Program: 48848
Project: 48848
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Test(groups={"String_Node_Str"}) public void testClusterConfigWithExternalHDFS() throws Exception {
  String[] hdfsArray=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  ClusterCreate spec=new ClusterCreate();
  spec.setName("String_Node_Str");
  List<String> rps=new ArrayList<String>();
  rps.add("String_Node_Str");
  spec.setRpNames(rps);
  spec.setNetworkConfig(createNetConfigs());
  spec.setDistro("String_Node_Str");
  spec.setDistroVendor(Constants.DEFAULT_VENDOR);
  spec.setExternalHDFS(hdfsArray[0]);
  String clusterConfigJson="String_Node_Str" + hdfsArray[1] + "String_Node_Str";
  Map clusterConfig=(new Gson()).fromJson(clusterConfigJson,Map.class);
  spec.setConfiguration((Map<String,Object>)(clusterConfig.get("String_Node_Str")));
  NodeGroupCreate ng0=new NodeGroupCreate();
  List<String> jobtrackerRole=new ArrayList<String>();
  jobtrackerRole.add("String_Node_Str");
  ng0.setRoles(jobtrackerRole);
  ng0.setName("String_Node_Str");
  ng0.setInstanceNum(1);
  ng0.setCpuNum(2);
  ng0.setMemCapacityMB(7500);
  ng0.setInstanceType(InstanceType.LARGE);
  String ng0ConfigJson="String_Node_Str" + hdfsArray[2] + "String_Node_Str";
  Map ng0Config=(new Gson()).fromJson(ng0ConfigJson,Map.class);
  ng0.setConfiguration((Map<String,Object>)(ng0Config.get("String_Node_Str")));
  NodeGroupCreate ng1=new NodeGroupCreate();
  List<String> computeRoles=new ArrayList<String>();
  computeRoles.add("String_Node_Str");
  ng1.setRoles(computeRoles);
  ng1.setName("String_Node_Str");
  ng1.setInstanceNum(4);
  ng1.setCpuNum(2);
  ng1.setMemCapacityMB(7500);
  ng1.setInstanceType(InstanceType.MEDIUM);
  StorageRead storage=new StorageRead();
  storage.setType("String_Node_Str");
  storage.setSizeGB(10);
  ng1.setStorage(storage);
  String ng1ConfigJson="String_Node_Str" + hdfsArray[3] + "String_Node_Str";
  Map ng1Config=(new Gson()).fromJson(ng1ConfigJson,Map.class);
  ng1.setConfiguration((Map<String,Object>)(ng1Config.get("String_Node_Str")));
  NodeGroupCreate ng2=new NodeGroupCreate();
  ng2.setRoles(computeRoles);
  ng2.setName("String_Node_Str");
  ng2.setInstanceNum(2);
  ng2.setCpuNum(2);
  ng2.setMemCapacityMB(7500);
  ng2.setInstanceType(InstanceType.MEDIUM);
  StorageRead storageCompute=new StorageRead();
  storageCompute.setType("String_Node_Str");
  storageCompute.setSizeGB(10);
  ng2.setStorage(storageCompute);
  NodeGroupCreate[] ngs=new NodeGroupCreate[]{ng0,ng1,ng2};
  spec.setNodeGroups(ngs);
  spec=ClusterSpecFactory.getCustomizedSpec(spec);
  clusterConfigMgr.createClusterConfig(spec);
  ClusterEntity cluster=clusterEntityMgr.findClusterById(1l);
  List<ClusterEntity> cs=clusterEntityMgr.findAllClusters();
  for (  ClusterEntity c : cs) {
    System.out.println(c.getId());
  }
  cluster=clusterEntityMgr.findByName("String_Node_Str");
  Assert.assertTrue(cluster != null);
  ClusterCreate attrs=clusterConfigMgr.getClusterConfig("String_Node_Str");
  String manifest=gson.toJson(attrs);
  System.out.println(manifest);
  Assert.assertTrue(Pattern.compile("String_Node_Str" + hdfsArray[0] + "String_Node_Str").matcher(manifest).matches(),"String_Node_Str");
  Assert.assertTrue(manifest.indexOf(hdfsArray[1]) == -1,"String_Node_Str");
  Assert.assertTrue(manifest.indexOf(hdfsArray[2]) == -1,"String_Node_Str");
  Assert.assertTrue(manifest.indexOf(hdfsArray[3]) == -1,"String_Node_Str");
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Test(groups={"String_Node_Str"}) public void testClusterConfigWithExternalHDFS() throws Exception {
  String[] hdfsArray=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  ClusterCreate spec=new ClusterCreate();
  spec.setName("String_Node_Str");
  List<String> rps=new ArrayList<String>();
  rps.add("String_Node_Str");
  spec.setRpNames(rps);
  spec.setNetworkConfig(createNetConfigs());
  spec.setDistro("String_Node_Str");
  spec.setDistroVendor(Constants.DEFAULT_VENDOR);
  spec.setExternalHDFS(hdfsArray[0]);
  String clusterConfigJson="String_Node_Str" + hdfsArray[1] + "String_Node_Str";
  Map clusterConfig=(new Gson()).fromJson(clusterConfigJson,Map.class);
  spec.setConfiguration((Map<String,Object>)(clusterConfig.get("String_Node_Str")));
  NodeGroupCreate ng0=new NodeGroupCreate();
  List<String> jobtrackerRole=new ArrayList<String>();
  jobtrackerRole.add("String_Node_Str");
  ng0.setRoles(jobtrackerRole);
  ng0.setName("String_Node_Str");
  ng0.setInstanceNum(1);
  ng0.setInstanceType(InstanceType.LARGE);
  String ng0ConfigJson="String_Node_Str" + hdfsArray[2] + "String_Node_Str";
  Map ng0Config=(new Gson()).fromJson(ng0ConfigJson,Map.class);
  ng0.setConfiguration((Map<String,Object>)(ng0Config.get("String_Node_Str")));
  NodeGroupCreate ng1=new NodeGroupCreate();
  List<String> computeRoles=new ArrayList<String>();
  computeRoles.add("String_Node_Str");
  ng1.setRoles(computeRoles);
  ng1.setName("String_Node_Str");
  ng1.setInstanceNum(4);
  ng1.setInstanceType(InstanceType.MEDIUM);
  StorageRead storage=new StorageRead();
  storage.setType("String_Node_Str");
  storage.setSizeGB(10);
  ng1.setStorage(storage);
  String ng1ConfigJson="String_Node_Str" + hdfsArray[3] + "String_Node_Str";
  Map ng1Config=(new Gson()).fromJson(ng1ConfigJson,Map.class);
  ng1.setConfiguration((Map<String,Object>)(ng1Config.get("String_Node_Str")));
  NodeGroupCreate ng2=new NodeGroupCreate();
  ng2.setRoles(computeRoles);
  ng2.setName("String_Node_Str");
  ng2.setInstanceNum(2);
  ng2.setInstanceType(InstanceType.MEDIUM);
  StorageRead storageCompute=new StorageRead();
  storageCompute.setType("String_Node_Str");
  storageCompute.setSizeGB(10);
  ng2.setStorage(storageCompute);
  NodeGroupCreate[] ngs=new NodeGroupCreate[]{ng0,ng1,ng2};
  spec.setNodeGroups(ngs);
  spec=ClusterSpecFactory.getCustomizedSpec(spec);
  clusterConfigMgr.createClusterConfig(spec);
  ClusterEntity cluster=clusterEntityMgr.findClusterById(1l);
  List<ClusterEntity> cs=clusterEntityMgr.findAllClusters();
  for (  ClusterEntity c : cs) {
    System.out.println(c.getId());
  }
  cluster=clusterEntityMgr.findByName("String_Node_Str");
  Assert.assertTrue(cluster != null);
  ClusterCreate attrs=clusterConfigMgr.getClusterConfig("String_Node_Str");
  String manifest=gson.toJson(attrs);
  System.out.println(manifest);
  Assert.assertTrue(Pattern.compile("String_Node_Str" + hdfsArray[0] + "String_Node_Str").matcher(manifest).matches(),"String_Node_Str");
  Assert.assertTrue(manifest.indexOf(hdfsArray[1]) == -1,"String_Node_Str");
  Assert.assertTrue(manifest.indexOf(hdfsArray[2]) == -1,"String_Node_Str");
  Assert.assertTrue(manifest.indexOf(hdfsArray[3]) == -1,"String_Node_Str");
}