ClusterManager { public File writeClusterSpecFile(String targetName, File workDir, boolean needAllocIp) { String clusterName = targetName.split("-")[0]; String fileName = clusterName + ".json"; List<String> targets = new ArrayList<String>(1); targets.add(targetName); Map<String, Object> clusterConfig = getClusterConfigManifest(clusterName, targets, needAllocIp); File file = new File(workDir, fileName); writeJsonFile(clusterConfig, file); return file; }  JobManager getJobManager(); void setJobManager(JobManager jobManager); ClusterConfigManager getClusterConfigMgr(); void setClusterConfigMgr(ClusterConfigManager clusterConfigMgr); INetworkService getNetworkManager(); void setNetworkManager(INetworkService networkManager); IResourceService getResMgr(); @Autowired void setResMgr(IResourceService resMgr); IClusterEntityManager getClusterEntityMgr(); @Autowired void setClusterEntityMgr(IClusterEntityManager clusterEntityMgr); RackInfoManager getRackInfoMgr(); @Autowired void setRackInfoMgr(RackInfoManager rackInfoMgr); IClusteringService getClusteringService(); @Autowired void setClusteringService(IClusteringService clusteringService); IClusterHealService getClusterHealService(); @Autowired void setClusterHealService(IClusterHealService clusterHealService); IExecutionService getExecutionService(); @Autowired void setExecutionService(IExecutionService executionService); @Autowired void setSoftwareManagerCollector(SoftwareManagerCollector softwareManagerCollector); @Autowired void setShrinkManager(ShrinkManager shrinkManager); Map<String, Object> getClusterConfigManifest(String clusterName,
         List<String> targets, boolean needAllocIp); File writeClusterSpecFile(String targetName, File workDir,
         boolean needAllocIp); ClusterRead getClusterByName(String clusterName, boolean realTime); ClusterCreate getClusterSpec(String clusterName); List<ClusterRead> getClusters(Boolean realTime); @ClusterManagerPointcut Long createCluster(ClusterCreate createSpec, org.apache.commons.configuration.Configuration newParams); @ClusterManagerPointcut Long configCluster(String clusterName, ClusterCreate createSpec); long enableLdap(String clusterName); Long resumeClusterCreation(String clusterName, org.apache.commons.configuration.Configuration newParams); @ClusterManagerPointcut Long deleteClusterByName(String clusterName); @ClusterManagerPointcut Long upgradeClusterByName(String clusterName); Long startCluster(String clusterName, boolean force); @ClusterManagerPointcut Long stopCluster(String clusterName); @ClusterManagerPointcut Long resizeCluster(String clusterName, String nodeGroupName,
         int instanceNum, boolean force, org.apache.commons.configuration.Configuration newParams); @SuppressWarnings("unchecked") List<String> syncSetParam(String clusterName,
         Integer activeComputeNodeNum, Integer minComputeNodeNum, Integer maxComputeNodeNum,
         Boolean enableAuto, Priority ioPriority); @ClusterManagerPointcut Long asyncSetParam(String clusterName, Integer activeComputeNodeNum,
         Integer minComputeNodeNum, Integer maxComputeNodeNum, Boolean enableAuto,
         Priority ioPriority); @ClusterManagerPointcut @Transactional void updateCluster(ClusterCreate clusterUpdate, boolean ignoreWarning, boolean appendResource); void prioritizeCluster(String clusterName, Priority ioShares); @ClusterManagerPointcut Long fixDiskFailures(String clusterName, String groupName); Map<String, String> getRackTopology(String clusterName, String topology); HadoopStack filterDistroFromAppManager(
         SoftwareManager softwareManager, String distroName); @ClusterManagerPointcut Long expandCluster(String clusterName,
                          NodeGroupCreate[] nodeGroupsAdd); Long clusterExpandExecute(String clusterName, NodeGroupCreate[] nodeGroupsAdd, ClusterCreate clusterSpec); void recoverClusters(List<VcClusterMap> clstMaps);  }
@Test(groups = { "TestClusterManager" }) public void testWriteClusterSpecFileWithUTF8() throws Exception { final String dirPath = "src/test/resources"; final String filePath = dirPath + "/클러스터.json"; new MockUp<ClusterManager>() { @Mock public Map<String, Object> getClusterConfigManifest( String clusterName, List<String> targets, boolean needAllocIp) { Map<String, Object> attrs = new HashMap<String, Object>(); ClusterCreate cluster = new ClusterCreate(); NodeGroupCreate master = new NodeGroupCreate(); master.setName("마스터 노드"); NodeGroupCreate worker = new NodeGroupCreate(); worker.setName("协作节点"); NodeGroupCreate client = new NodeGroupCreate(); client.setName("クライアント"); cluster.setNodeGroups(new NodeGroupCreate[] { master, worker, client }); attrs.put("cluster_definition", cluster); return attrs; } }.getMockInstance(); ClusterManager clusterManager = new ClusterManager(); File dir = new File(dirPath); clusterManager.writeClusterSpecFile("클러스터-主节点-01", dir, false); File file = new File(filePath); assertTrue(file.exists()); String clusterJson = readJsonFromFile(filePath); assertTrue(clusterJson.indexOf("마스터 노드") != -1); assertTrue(clusterJson.indexOf("协作节点") != -1); assertTrue(clusterJson.indexOf("クライアント") != -1); file.delete(); }