ZooKeeperManager { public void createClusterPaths() throws Exception { if (zkClient.get().exists(clusterPath, false) == null) { zkClient.get().create(clusterPath, null, ZK_ACL_LIST, CreateMode.PERSISTENT); } if (zkClient.get().exists(clusterLocksPath, false) == null) { zkClient.get().create(clusterLocksPath, null, ZK_ACL_LIST, CreateMode.PERSISTENT); } if (zkClient.get().exists(clusterViewsPath, false) == null) { zkClient.get().create(clusterViewsPath, null, ZK_ACL_LIST, CreateMode.PERSISTENT); } } ZooKeeperManager(ZooKeeperClient zkClient, String clusterName); void createClusterPaths(); void registerWatchAllFileSets(); void lockFileSet(String fileSet,
                          FileSetInfo fileSetInfo,
                          CreateMode mode); void lockFileSet(String fileSet,
                          FileSetInfo fileSetInfo); void unlockFileSet(String fileSet); void setFileSetInfo(String fileSet,
                             FileSetInfo fileSetInfo); void deleteFileSetInfo(String fileSet); FileSetInfo getFileSetInfo(String fileSet); ViewInfo getViewInfo(String resource); void setViewInfo(ViewInfo viewInfo); void deleteViewInfo(String resource); FileSetInfo getFileSetInfoForced(String fileSet); FileSetInfo getLockedFileSetInfo(String fileSet); Map<String, Pair<FileSetInfo, FileSetInfo>> getCandidateHdfsDirMap(); InetSocketAddress getControllerLeader(); ClusterInfo getClusterInfo(); void setClusterInfo(ClusterInfo info); Map<String, FileSetInfo> getFileSetInfoMap(); List<String> getLockedFileSets(); List<String> getLiveInstances();  }
@Test public void testCreateClusterPaths() throws Exception { when(zk.create(anyString(), any(byte[].class), anyListOf(ACL.class), any(CreateMode.class))) .thenReturn(""); ArgumentCaptor<String> pathCaptor = ArgumentCaptor.forClass(String.class); zkManager.createClusterPaths(); verify(zk, times(3)).create(pathCaptor.capture(), any(byte[].class), anyListOf(ACL.class), any(CreateMode.class)); Set<String> allPaths = Sets.newHashSet(pathCaptor.getAllValues()); assertTrue(allPaths.contains(FILE_SET_DIR)); assertTrue(allPaths.contains(VIEWS_DIR)); assertTrue(allPaths.contains(LOCKS_DIR)); }