ZkConfiguration extends KattaConfiguration { public static String getZkParent(String path) { if (path.length() == 1) { return null; } String name = getZKName(path); String parent = path.substring(0, path.length() - name.length() - 1); if (parent.equals("")) { return String.valueOf(ZK_PATH_SEPARATOR); } return parent; } ZkConfiguration();  ZkConfiguration(final String path);  ZkConfiguration(final File file);  ZkConfiguration(Properties properties, String filePath); boolean isEmbedded(); void setEmbedded(boolean embeddedZk); String getZKServers(); void setZKServers(String servers); int getZKTimeOut(); int getZKTickTime(); int getZKInitLimit(); int getZKSyncLimit(); String getZKDataDir(); String getZKDataLogDir(); String getZKNodeQueuePath(String node); String getZkPath(PathDef pathDef, String... names); String getZkRootPath(); void setZKRootPath(String rootPath); static String getZKName(String path); static String getZkParent(String path); static String buildZkPath(String... folders); static final String KATTA_PROPERTY_NAME; static final String ZOOKEEPER_EMBEDDED; static final String ZOOKEEPER_SERVERS; static final String ZOOKEEPER_TIMEOUT; static final String ZOOKEEPER_TICK_TIME; static final String ZOOKEEPER_INIT_LIMIT; static final String ZOOKEEPER_SYNC_LIMIT; static final String ZOOKEEPER_DATA_DIR; static final String ZOOKEEPER_LOG_DATA_DIR; static final String ZOOKEEPER_ROOT_PATH; static Character ZK_PATH_SEPARATOR; static final String DEFAULT_ROOT_PATH; }
@Test public void testZkParent() { assertEquals("/katta", ZkConfiguration.getZkParent("/katta/abc")); assertEquals("/", ZkConfiguration.getZkParent("/katta")); assertEquals(null, ZkConfiguration.getZkParent("/")); }