ZooKeeperManager { public void lockFileSet(String fileSet, FileSetInfo fileSetInfo, CreateMode mode) throws Exception { try { zkClient.get().create(getFileSetLockPath(fileSet), fileSetInfo.toJson(), ZK_ACL_LIST, mode); } catch (KeeperException e) { if (e instanceof KeeperException.NodeExistsException) { LOG.error("File set " + fileSet + " is already locked."); } throw e; } } 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 testLockFileSet() throws Exception { when(zk.create(anyString(), any(byte[].class), anyListOf(ACL.class), any(CreateMode.class))) .thenReturn(""); CreateMode mode = CreateMode.EPHEMERAL; zkManager.lockFileSet(FILE_SET, FILE_SET_INFO, mode); verify(zk).create(eq(FILE_SET_LOCK_PATH), any(byte[].class), anyListOf(ACL.class), eq(mode)); }