use of com.alibaba.graphscope.groot.coordinator.ZkMetaStore in project GraphScope by alibaba.
the class ZkMetaStoreTest method testMetaStore.
@Test
void testMetaStore() throws Exception {
try (TestingServer testingServer = new TestingServer(-1)) {
int zkPort = testingServer.getPort();
Configs configs = Configs.newBuilder().put(ZkConfig.ZK_CONNECT_STRING.getKey(), "localhost:" + zkPort).put(ZkConfig.ZK_BASE_PATH.getKey(), "test_meta_store").build();
CuratorFramework curator = CuratorUtils.makeCurator(configs);
curator.start();
MetaStore metaStore = new ZkMetaStore(configs, curator);
String path = "test_path";
String data = "test_data";
assertFalse(metaStore.exists(path));
metaStore.write(path, data.getBytes());
assertTrue(metaStore.exists(path));
assertEquals(new String(metaStore.read(path)), data);
metaStore.delete(path);
assertFalse(metaStore.exists(path));
curator.close();
}
}
Aggregations