use of com.continuuity.weave.internal.zookeeper.InMemoryZKServer in project weave by continuuity.
the class ZKOperationsTest method recursiveDelete.
@Test
public void recursiveDelete() throws ExecutionException, InterruptedException, TimeoutException {
InMemoryZKServer zkServer = InMemoryZKServer.builder().setTickTime(1000).build();
zkServer.startAndWait();
try {
ZKClientService client = ZKClientService.Builder.of(zkServer.getConnectionStr()).build();
client.startAndWait();
try {
client.create("/test1/test10/test101", null, CreateMode.PERSISTENT).get();
client.create("/test1/test10/test102", null, CreateMode.PERSISTENT).get();
client.create("/test1/test10/test103", null, CreateMode.PERSISTENT).get();
client.create("/test1/test11/test111", null, CreateMode.PERSISTENT).get();
client.create("/test1/test11/test112", null, CreateMode.PERSISTENT).get();
client.create("/test1/test11/test113", null, CreateMode.PERSISTENT).get();
ZKOperations.recursiveDelete(client, "/test1").get(2, TimeUnit.SECONDS);
Assert.assertNull(client.exists("/test1").get(2, TimeUnit.SECONDS));
} finally {
client.stopAndWait();
}
} finally {
zkServer.stopAndWait();
}
}
Aggregations