use of io.pravega.controller.store.client.ZKClientConfig in project pravega by pravega.
the class ZKBackedControllerServiceStarterTest method setup.
@Override
public void setup() throws Exception {
zkServer = new TestingServerStarter().start();
ZKClientConfig zkClientConfig = ZKClientConfigImpl.builder().connectionString(zkServer.getConnectString()).initialSleepInterval(500).maxRetries(10).namespace("pravega/" + UUID.randomUUID()).sessionTimeoutMs(10 * 1000).build();
storeClientConfig = getStoreConfig(zkClientConfig);
storeClient = StoreClientFactory.createStoreClient(storeClientConfig);
executor = ExecutorServiceHelpers.newScheduledThreadPool(5, "test");
segments = new ConcurrentHashMap<>();
segmentEvent = new ConcurrentHashMap<>();
writers = new ConcurrentHashMap<>();
writerEventNumber = new ConcurrentHashMap<>();
}
use of io.pravega.controller.store.client.ZKClientConfig in project pravega by pravega.
the class ZKClientConfigImplTests method testToStringIsSuccessfulWithAllConfigSpecified.
// region Tests that verify the toString() method.
// Note: It might seem odd that we are unit testing the toString() method of the code under test. The reason we are
// doing that is that the method is hand-rolled and there is a bit of logic there that isn't entirely unlikely to fail.
@Test
public void testToStringIsSuccessfulWithAllConfigSpecified() {
ZKClientConfig config = new ZKClientConfigImpl("connectString", "namespace", 5, 2, 60000, true, "/zk.truststore.jks", "zk.truststore.password");
assertNotNull(config.toString());
}
use of io.pravega.controller.store.client.ZKClientConfig in project pravega by pravega.
the class ZKClientConfigImplTests method testToStringIsSuccessfulWithTlsDisabled.
@Test
public void testToStringIsSuccessfulWithTlsDisabled() {
ZKClientConfig config = new ZKClientConfigImpl("connectString", "namespace", 5, 2, 60000, false, null, null);
assertNotNull(config.toString());
}
use of io.pravega.controller.store.client.ZKClientConfig in project pravega by pravega.
the class InProcPravegaCluster method startLocalController.
private ControllerServiceMain startLocalController(int controllerId) {
ZKClientConfig zkClientConfig = ZKClientConfigImpl.builder().connectionString(zkUrl).namespace("pravega/" + clusterName).initialSleepInterval(2000).maxRetries(1).sessionTimeoutMs(10 * 1000).secureConnectionToZooKeeper(this.secureZK).trustStorePath(jksTrustFile).trustStorePasswordPath(keyPasswordFile).build();
StoreClientConfig storeClientConfig = StoreClientConfigImpl.withPravegaTablesClient(zkClientConfig);
HostMonitorConfig hostMonitorConfig = HostMonitorConfigImpl.builder().hostMonitorEnabled(true).containerCount(containerCount).hostMonitorMinRebalanceInterval(1).build();
TimeoutServiceConfig timeoutServiceConfig = TimeoutServiceConfig.builder().maxLeaseValue(Config.MAX_LEASE_VALUE).build();
ControllerEventProcessorConfig eventProcessorConfig = ControllerEventProcessorConfigImpl.withDefaultBuilder().shutdownTimeout(Duration.ofMillis(100)).build();
GRPCServerConfig grpcServerConfig = GRPCServerConfigImpl.builder().port(this.controllerPorts[controllerId]).publishedRPCHost("localhost").publishedRPCPort(this.controllerPorts[controllerId]).authorizationEnabled(this.enableAuth).tlsEnabled(this.enableTls).tlsProtocolVersion(this.tlsProtocolVersion).tlsTrustStore(this.certFile).tlsCertFile(this.certFile).tlsKeyFile(this.keyFile).userPasswordFile(this.passwdFile).tokenSigningKey("secret").accessTokenTTLInSeconds(600).replyWithStackTraceOnError(false).requestTracingEnabled(true).build();
RESTServerConfig restServerConfig = null;
if (this.enableRestServer) {
restServerConfig = RESTServerConfigImpl.builder().host("0.0.0.0").port(this.restServerPort).tlsEnabled(this.enableTls).tlsProtocolVersion(this.tlsProtocolVersion).keyFilePath(this.jksKeyFile).keyFilePasswordPath(this.keyPasswordFile).build();
}
ControllerServiceConfig serviceConfig = ControllerServiceConfigImpl.builder().threadPoolSize(Runtime.getRuntime().availableProcessors()).storeClientConfig(storeClientConfig).hostMonitorConfig(hostMonitorConfig).controllerClusterListenerEnabled(false).timeoutServiceConfig(timeoutServiceConfig).eventProcessorConfig(Optional.of(eventProcessorConfig)).grpcServerConfig(Optional.of(grpcServerConfig)).restServerConfig(Optional.ofNullable(restServerConfig)).shutdownTimeout(Duration.ofMillis(100)).build();
ControllerServiceMain controllerService = new ControllerServiceMain(serviceConfig);
try {
controllerService.startAsync().awaitRunning();
return controllerService;
} catch (Throwable ex) {
Callbacks.invokeSafely(controllerService::close, ex2 -> log.error("Unable to clean up controller startup.", ex2));
throw ex;
}
}
Aggregations