use of com.github.ambry.server.RouterServerTestFramework in project ambry by linkedin.
the class RouterServerSSLTest method initializeTests.
@BeforeClass
public static void initializeTests() throws Exception {
File trustStoreFile = File.createTempFile("truststore", ".jks");
String sslEnabledDataCentersStr = "DC1,DC2,DC3";
Properties serverSSLProps = new Properties();
TestSSLUtils.addSSLProperties(serverSSLProps, sslEnabledDataCentersStr, SSLFactory.Mode.SERVER, trustStoreFile, "server");
TestSSLUtils.addHttp2Properties(serverSSLProps, SSLFactory.Mode.SERVER, true);
Properties routerProps = getRouterProperties("DC1");
TestSSLUtils.addSSLProperties(routerProps, sslEnabledDataCentersStr, SSLFactory.Mode.CLIENT, trustStoreFile, "router-client");
sslCluster = new MockCluster(serverSSLProps, false, SystemTime.getInstance());
MockNotificationSystem notificationSystem = new MockNotificationSystem(sslCluster.getClusterMap());
sslCluster.initializeServers(notificationSystem);
sslCluster.startServers();
MockClusterMap routerClusterMap = sslCluster.getClusterMap();
// MockClusterMap returns a new registry by default. This is to ensure that each node (server, router and so on,
// get a different registry. But at this point all server nodes have been initialized, and we want the router and
// its components, which are going to be created, to use the same registry.
routerClusterMap.createAndSetPermanentMetricRegistry();
testFramework = new RouterServerTestFramework(routerProps, routerClusterMap, notificationSystem);
routerMetricRegistry = routerClusterMap.getMetricRegistry();
}
use of com.github.ambry.server.RouterServerTestFramework in project ambry by linkedin.
the class RouterServerPlaintextTest method initializeTests.
@BeforeClass
public static void initializeTests() throws Exception {
Properties properties = getRouterProperties("DC1");
Properties serverProperties = new Properties();
TestSSLUtils.addHttp2Properties(serverProperties, SSLFactory.Mode.SERVER, true);
plaintextCluster = new MockCluster(serverProperties, false, SystemTime.getInstance());
MockNotificationSystem notificationSystem = new MockNotificationSystem(plaintextCluster.getClusterMap());
plaintextCluster.initializeServers(notificationSystem);
plaintextCluster.startServers();
MockClusterMap routerClusterMap = plaintextCluster.getClusterMap();
// MockClusterMap returns a new registry by default. This is to ensure that each node (server, router and so on,
// get a different registry. But at this point all server nodes have been initialized, and we want the router and
// its components, which are going to be created, to use the same registry.
routerClusterMap.createAndSetPermanentMetricRegistry();
testFramework = new RouterServerTestFramework(properties, routerClusterMap, notificationSystem);
routerMetricRegistry = routerClusterMap.getMetricRegistry();
refAccount = testFramework.accountService.createAndAddRandomAccount();
Iterator<Container> allContainers = refAccount.getAllContainers().iterator();
// container with null replication policy
Container container = allContainers.next();
container = testFramework.accountService.addReplicationPolicyToContainer(container, null);
refContainers.add(container);
// container with configured default replication policy
container = allContainers.next();
container = testFramework.accountService.addReplicationPolicyToContainer(container, MockClusterMap.DEFAULT_PARTITION_CLASS);
refContainers.add(container);
// container with a special replication policy
container = allContainers.next();
container = testFramework.accountService.addReplicationPolicyToContainer(container, MockClusterMap.SPECIAL_PARTITION_CLASS);
refContainers.add(container);
}
use of com.github.ambry.server.RouterServerTestFramework in project ambry by linkedin.
the class RouterServerHttp2Test method initializeTests.
@BeforeClass
public static void initializeTests() throws Exception {
File trustStoreFile = File.createTempFile("truststore", ".jks");
// Set up router properties
Properties routerProps = getRouterProperties("DC1");
TestSSLUtils.addSSLProperties(routerProps, "DC1,DC2,DC3", SSLFactory.Mode.CLIENT, trustStoreFile, "http2-router");
TestSSLUtils.addHttp2Properties(routerProps, SSLFactory.Mode.CLIENT, false);
routerProps.setProperty(RouterConfig.ROUTER_ENABLE_HTTP2_NETWORK_CLIENT, "true");
// Set up server properties
Properties serverSSLProps = new Properties();
TestSSLUtils.addSSLProperties(serverSSLProps, "DC1,DC2,DC3", SSLFactory.Mode.SERVER, trustStoreFile, "http2-server");
TestSSLUtils.addHttp2Properties(serverSSLProps, SSLFactory.Mode.SERVER, false);
serverSSLProps.setProperty("server.enable.store.data.prefetch", "true");
http2Cluster = new MockCluster(serverSSLProps, false, SystemTime.getInstance());
MockNotificationSystem notificationSystem = new MockNotificationSystem(http2Cluster.getClusterMap());
http2Cluster.initializeServers(notificationSystem);
http2Cluster.startServers();
MockClusterMap routerClusterMap = http2Cluster.getClusterMap();
// MockClusterMap returns a new registry by default. This is to ensure that each node (server, router and so on,
// get a different registry. But at this point all server nodes have been initialized, and we want the router and
// its components, which are going to be created, to use the same registry.
routerClusterMap.createAndSetPermanentMetricRegistry();
testFramework = new RouterServerTestFramework(routerProps, routerClusterMap, notificationSystem);
}
Aggregations