use of com.kixeye.chassis.bootstrap.configuration.zookeeper.CuratorFrameworkBuilder in project chassis by Kixeye.
the class CuratorFrameworkBuilderTest method buildWithConfiguration.
@Test
public void buildWithConfiguration() {
HashMap<String, Object> map = new HashMap<>();
map.put(BootstrapConfigKeys.ZOOKEEPER_MAX_RETRIES.getPropertyName(), 1);
MapConfiguration configuration = new MapConfiguration(map);
try (CuratorFramework curatorFramework = new CuratorFrameworkBuilder(false).withZookeeper("localhost:2181").withConfiguration(configuration).build()) {
}
}
use of com.kixeye.chassis.bootstrap.configuration.zookeeper.CuratorFrameworkBuilder in project chassis by Kixeye.
the class CuratorFrameworkBuilderTest method zookeeperStarted.
@Test
public void zookeeperStarted() throws Exception {
testingServer = new TestingServer(SocketUtils.findAvailableTcpPort());
try (CuratorFramework curatorFramework = new CuratorFrameworkBuilder(true).withZookeeper(testingServer.getConnectString()).build()) {
Assert.assertEquals(CuratorFrameworkState.STARTED, curatorFramework.getState());
Assert.assertNull(curatorFramework.checkExists().forPath("/test"));
curatorFramework.create().forPath("/test");
Assert.assertNotNull(curatorFramework.checkExists().forPath("/test"));
}
}
Aggregations