use of com.github.ambry.config.NetworkConfig in project ambry by linkedin.
the class ConnectionTrackerTest method initialize.
@Before
public void initialize() {
Properties props = new Properties();
props.setProperty("router.hostname", "localhost");
props.setProperty("router.datacenter.name", "DC1");
props.setProperty("router.scaling.unit.max.connections.per.port.plain.text", "3");
props.setProperty("router.scaling.unit.max.connections.per.port.ssl", "2");
verifiableProperties = new VerifiableProperties((props));
routerConfig = new RouterConfig(verifiableProperties);
networkConfig = new NetworkConfig(verifiableProperties);
time = new MockTime();
plainTextPort = new Port(100, PortType.PLAINTEXT);
sslPort = new Port(200, PortType.SSL);
}
use of com.github.ambry.config.NetworkConfig in project ambry by linkedin.
the class SelectorTest method setup.
@Before
public void setup() throws Exception {
this.server = new EchoServer(18283);
this.server.start();
Properties props = new Properties();
props.setProperty("selector.executor.pool.size", Integer.toString(selectorExecutorPoolSize));
VerifiableProperties vprops = new VerifiableProperties(props);
NetworkConfig networkConfig = new NetworkConfig(vprops);
this.selector = new Selector(new NetworkMetrics(new MetricRegistry()), SystemTime.getInstance(), null, networkConfig);
}
use of com.github.ambry.config.NetworkConfig in project ambry by linkedin.
the class CloudRouterTest method setRouter.
/**
* Initialize and set the router with the given {@link Properties} and {@link MockServerLayout}
* @param props the {@link Properties}
* @param notificationSystem the {@link NotificationSystem} to use.
*/
@Override
protected void setRouter(Properties props, MockServerLayout mockServerLayout, NotificationSystem notificationSystem) throws Exception {
VerifiableProperties verifiableProperties = new VerifiableProperties((props));
RouterConfig routerConfig = new RouterConfig(verifiableProperties);
routerMetrics = new NonBlockingRouterMetrics(mockClusterMap, routerConfig);
CloudConfig cloudConfig = new CloudConfig(verifiableProperties);
CloudDestinationFactory cloudDestinationFactory = Utils.getObj(cloudConfig.cloudDestinationFactoryClass, verifiableProperties, mockClusterMap.getMetricRegistry(), mockClusterMap);
CloudDestination cloudDestination = cloudDestinationFactory.getCloudDestination();
AccountService accountService = new InMemAccountService(false, true);
CloudRouterFactory cloudRouterFactory = new CloudRouterFactory(verifiableProperties, mockClusterMap, new LoggingNotificationSystem(), null, accountService);
RequestHandlerPool requestHandlerPool = cloudRouterFactory.getRequestHandlerPool(verifiableProperties, mockClusterMap, cloudDestination, cloudConfig);
Map<ReplicaType, NetworkClientFactory> childFactories = new EnumMap<>(ReplicaType.class);
childFactories.put(ReplicaType.CLOUD_BACKED, new LocalNetworkClientFactory((LocalRequestResponseChannel) requestHandlerPool.getChannel(), new NetworkConfig(verifiableProperties), new NetworkMetrics(routerMetrics.getMetricRegistry()), mockTime));
childFactories.put(ReplicaType.DISK_BACKED, new MockNetworkClientFactory(verifiableProperties, mockSelectorState, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, mockServerLayout, mockTime));
NetworkClientFactory networkClientFactory = new CompositeNetworkClientFactory(childFactories);
router = new NonBlockingRouter(routerConfig, routerMetrics, networkClientFactory, notificationSystem, mockClusterMap, kms, cryptoService, cryptoJobHandler, accountService, mockTime, MockClusterMap.DEFAULT_PARTITION_CLASS);
router.addResourceToClose(requestHandlerPool);
}
Aggregations