use of org.apache.helix.controller.HierarchicalDataHolder in project helix by apache.
the class TestHierarchicalDataStore method testHierarchicalDataStore.
@Test(groups = { "unitTest" })
public void testHierarchicalDataStore() {
_zkClientString = new ZkClient(ZK_ADDR, 1000, 3000);
String path = "/tmp/testHierarchicalDataStore";
FileFilter filter = null;
// _zkClient.setZkSerializer(new ZNRecordSerializer());
_zkClientString.deleteRecursively(path);
HierarchicalDataHolder<ZNRecord> dataHolder = new HierarchicalDataHolder<ZNRecord>(_zkClientString, path, filter);
dataHolder.print();
AssertJUnit.assertFalse(dataHolder.refreshData());
// write data
add(path, "root data");
AssertJUnit.assertTrue(dataHolder.refreshData());
dataHolder.print();
// add some children
add(path + "/child1", "child 1 data");
add(path + "/child2", "child 2 data");
AssertJUnit.assertTrue(dataHolder.refreshData());
dataHolder.print();
// add some grandchildren
add(path + "/child1" + "/grandchild1", "grand child 1 data");
add(path + "/child1" + "/grandchild2", "grand child 2 data");
AssertJUnit.assertTrue(dataHolder.refreshData());
dataHolder.print();
AssertJUnit.assertFalse(dataHolder.refreshData());
set(path + "/child1", "new child 1 data");
AssertJUnit.assertTrue(dataHolder.refreshData());
dataHolder.print();
}
Aggregations