use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap in project coprhd-controller by CoprHD.
the class ProtocolSocketFactoryTest method setup.
@Before
public void setup() throws Exception {
ApplicationContextUtil.initContext(System.getProperty("buildType"), ApplicationContextUtil.SECURITY_CONTEXTS);
List<URI> uri = new ArrayList<URI>();
uri.add(URI.create(coordinatorServer));
ZkConnection connection = new ZkConnection();
connection.setServer(uri);
connection.build();
coordinatorClient.setZkConnection(connection);
CoordinatorClientInetAddressMap map = new CoordinatorClientInetAddressMap();
map.setNodeId("standalone");
DualInetAddress localAddress = DualInetAddress.fromAddresses("127.0.0.1", "::1");
map.setDualInetAddress(localAddress);
Map<String, DualInetAddress> controllerNodeIPLookupMap = new HashMap<String, DualInetAddress>();
controllerNodeIPLookupMap.put("localhost", localAddress);
map.setControllerNodeIPLookupMap(controllerNodeIPLookupMap);
coordinatorClient.setInetAddessLookupMap(map);
coordinatorClient.start();
FileInputStream is = new FileInputStream(defaultOvfPropsLocation);
Properties defaultProp = new Properties();
defaultProp.load(is);
is.close();
is = new FileInputStream(ovfPropsLocation);
Properties ovfProps = new Properties();
ovfProps.load(is);
is.close();
CoordinatorClientImpl.setDefaultProperties(defaultProp);
CoordinatorClientImpl.setOvfProperties(ovfProps);
ks = KeyStoreUtil.getViPRKeystore(coordinatorClient);
KeyCertificatePairGenerator gen = new KeyCertificatePairGenerator();
gen.setKeyCertificateAlgorithmValuesHolder(new KeyCertificateAlgorithmValuesHolder(coordinatorClient));
entry = gen.generateKeyCertificatePair();
hostName = System.getenv(KeyCertificatePairGeneratorTest.LOCALHOST_IP);
if (StringUtils.isBlank(hostName)) {
hostName = "localhost";
}
webServer = new TestWebServer(entry);
webServer.start();
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap in project coprhd-controller by CoprHD.
the class SSLSocketFactoryTest method setup.
@Before
public void setup() throws Exception {
ApplicationContextUtil.initContext(System.getProperty("buildType"), ApplicationContextUtil.SECURITY_CONTEXTS);
List<URI> uri = new ArrayList<URI>();
uri.add(URI.create(coordinatorServer));
ZkConnection connection = new ZkConnection();
connection.setServer(uri);
connection.build();
coordinatorClient.setZkConnection(connection);
CoordinatorClientInetAddressMap map = new CoordinatorClientInetAddressMap();
map.setNodeId("standalone");
DualInetAddress localAddress = DualInetAddress.fromAddresses("127.0.0.1", "::1");
map.setDualInetAddress(localAddress);
Map<String, DualInetAddress> controllerNodeIPLookupMap = new HashMap<String, DualInetAddress>();
controllerNodeIPLookupMap.put("localhost", localAddress);
map.setControllerNodeIPLookupMap(controllerNodeIPLookupMap);
coordinatorClient.setInetAddessLookupMap(map);
coordinatorClient.start();
FileInputStream is = new FileInputStream(defaultOvfPropsLocation);
Properties defaultProp = new Properties();
defaultProp.load(is);
is.close();
is = new FileInputStream(ovfPropsLocation);
Properties ovfProps = new Properties();
ovfProps.load(is);
is.close();
CoordinatorClientImpl.setDefaultProperties(defaultProp);
CoordinatorClientImpl.setOvfProperties(ovfProps);
ks = KeyStoreUtil.getViPRKeystore(coordinatorClient);
KeyCertificateAlgorithmValuesHolder values = new KeyCertificateAlgorithmValuesHolder(coordinatorClient);
gen = new KeyCertificatePairGenerator();
gen.setKeyCertificateAlgorithmValuesHolder(values);
entry = gen.generateKeyCertificatePair();
hostName = System.getenv(KeyCertificatePairGeneratorTest.LOCALHOST_IP);
if (StringUtils.isBlank(hostName)) {
hostName = "localhost";
}
webServer = new TestWebServer(entry);
webServer.start();
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap in project coprhd-controller by CoprHD.
the class TrustManagerTest method setup.
@Before
public void setup() throws IOException, URISyntaxException {
ApplicationContextUtil.initContext(System.getProperty("buildType"), ApplicationContextUtil.SECURITY_CONTEXTS);
List<URI> uri = new ArrayList<URI>();
uri.add(URI.create(coordinatorServer));
ZkConnection connection = new ZkConnection();
connection.setServer(uri);
connection.build();
coordinatorClient.setZkConnection(connection);
CoordinatorClientInetAddressMap map = new CoordinatorClientInetAddressMap();
map.setNodeId("standalone");
DualInetAddress localAddress = DualInetAddress.fromAddresses("127.0.0.1", "::1");
map.setDualInetAddress(localAddress);
Map<String, DualInetAddress> controllerNodeIPLookupMap = new HashMap<String, DualInetAddress>();
controllerNodeIPLookupMap.put("localhost", localAddress);
map.setControllerNodeIPLookupMap(controllerNodeIPLookupMap);
coordinatorClient.setInetAddessLookupMap(map);
coordinatorClient.start();
FileInputStream is = new FileInputStream(defaultOvfPropsLocation);
Properties defaultProp = new Properties();
defaultProp.load(is);
is.close();
is = new FileInputStream(ovfPropsLocation);
Properties ovfProps = new Properties();
ovfProps.load(is);
is.close();
CoordinatorClientImpl.setDefaultProperties(defaultProp);
CoordinatorClientImpl.setOvfProperties(ovfProps);
loadStoreParam = new DistributedLoadKeyStoreParam();
loadStoreParam.setCoordinator(coordinatorClient);
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap in project coprhd-controller by CoprHD.
the class GeoSeedProviderImpl method initCoordinatorClient.
/**
* Construct coordinator client from argument. Seed provider instance is created by cassandra
* on demand. Not from spring context.
*
* @param args
*/
private void initCoordinatorClient(Map<String, String> args) throws IOException {
// endpoints for coordinator in local site
String coordinatorArg = args.get(COORDINATORS);
if (coordinatorArg == null || coordinatorArg.trim().isEmpty()) {
throw new IllegalArgumentException(COORDINATORS);
}
String[] coordinators = coordinatorArg.split(",", -1);
List<URI> uri = new ArrayList<URI>(coordinators.length);
for (String coord : coordinators) {
if (!coord.trim().isEmpty()) {
uri.add(URI.create(coord.trim()));
}
}
ZkConnection connection = new ZkConnection();
connection.setServer(uri);
String siteIdFile = args.get(Constants.SITE_ID_FILE);
connection.setSiteIdFile(siteIdFile);
connection.build();
CoordinatorClientImpl client = new CoordinatorClientImpl();
client.setZkConnection(connection);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/nodeaddrmap-var.xml");
CoordinatorClientInetAddressMap inetAddressMap = (CoordinatorClientInetAddressMap) ctx.getBean("inetAddessLookupMap");
if (inetAddressMap == null) {
log.error("CoordinatorClientInetAddressMap is not initialized. Node address lookup will fail.");
}
// HARCODE FOR NOW
client.setInetAddessLookupMap(inetAddressMap);
client.start();
coordinator = client;
}
use of com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap in project coprhd-controller by CoprHD.
the class DbSvcRunner method getCoordinator.
/**
* Get CoordinatorClient instance
*
* @return
* @throws URISyntaxException
* @throws IOException
*/
public CoordinatorClient getCoordinator() throws URISyntaxException, IOException {
if (coordinator == null) {
ZkConnection zkConn = new ZkConnection();
List<URI> uris = new ArrayList<URI>();
uris.add(new URI("coordinator://localhost:2181"));
zkConn.setServer(uris);
zkConn.setTimeoutMs(10000);
zkConn.build();
// Suppress Sonar violation of Lazy initialization of static fields should be synchronized
// Junit test will be called in single thread by default, it's safe to ignore this violation
// NOSONAR ("squid:S2444")
coordinator = new CoordinatorClientImpl();
coordinator.setZkConnection(zkConn);
coordinator.setSysSvcName("syssvc");
coordinator.setSysSvcVersion("1");
coordinator.setNodeCount(1);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("nodeaddrmap-var.xml");
CoordinatorClientInetAddressMap inetAddressMap = (CoordinatorClientInetAddressMap) ctx.getBean("inetAddessLookupMap");
if (inetAddressMap == null) {
log.error("CoordinatorClientInetAddressMap is not initialized. Node address lookup will fail.");
}
Map<String, DualInetAddress> controlNodes = inetAddressMap.getControllerNodeIPLookupMap();
// HARCODE FOR NOW
coordinator.setInetAddessLookupMap(inetAddressMap);
DbVersionInfo dbVersionInfo = new DbVersionInfo();
dbVersionInfo.setSchemaVersion(SVC_VERSION);
coordinator.setDbVersionInfo(dbVersionInfo);
coordinator.start();
}
return coordinator;
}
Aggregations