ZooKeeperManager { public void setClusterInfo(ClusterInfo info) throws Exception { byte[] json = info.toJson(); LOG.info("Setting cluster info to \n" + new String(json)); zkClient.get().setData("/" + this.clusterName, json, -1); } 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 testSetClusterInfo() throws Exception { String hdfsNameNode = "namenode001"; int replicaFactor = 3; ClusterInfo clusterInfo = new ClusterInfo(hdfsNameNode, replicaFactor); when(zk.setData(eq("/" + CLUSTER_NAME), eq(clusterInfo.toJson()), anyInt())) .thenReturn(new Stat()); zkManager.setClusterInfo(clusterInfo); verify(zk).setData(eq("/" + CLUSTER_NAME), eq(clusterInfo.toJson()), anyInt()); }