ZkclientZookeeperClient extends AbstractZookeeperClient<IZkChildListener> { @Override public List<String> getChildren(String path) { try { return client.getChildren(path); } catch (ZkNoNodeException e) { return null; } } ZkclientZookeeperClient(String serverAddr); @Override void createPersistent(String path); @Override void createEphemeral(String path); @Override void delete(String path); @Override List<String> getChildren(String path); @Override boolean checkExists(String path); @Override boolean isConnected(); @Override void doClose(); @Override IZkChildListener createTargetChildListener(String path, final ChildListener listener); @Override List<String> addTargetChildListener(String path, final IZkChildListener listener); @Override void removeTargetChildListener(String path, IZkChildListener listener);  }
@Test public void testGetChildren() throws IOException { String path = "/dubbo/org.apache.dubbo.demo.DemoService/parentProviders"; zkclientZookeeperClient.create(path, false); for (int i = 0; i < 5; i++) { zkclientZookeeperClient.createEphemeral(path + "/server" + i); } List<String> zookeeperClientChildren = zkclientZookeeperClient.getChildren(path); assertThat(zookeeperClientChildren, hasSize(5)); }