Program: 162746
Project: 162746
Buggy source:
@Test public void testKMeans() throws Exception {
  Path tempDir=getTempDir();
  Path dataDir=tempDir.resolve("String_Node_Str");
  Path modelDir=tempDir.resolve("String_Node_Str");
  Map<String,Object> overlayConfig=new HashMap<>();
  overlayConfig.put("String_Node_Str",KMeansUpdate.class.getName());
  ConfigUtils.set(overlayConfig,"String_Node_Str",dataDir);
  ConfigUtils.set(overlayConfig,"String_Node_Str",modelDir);
  overlayConfig.put("String_Node_Str",GEN_INTERVAL_SEC);
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str",20);
  overlayConfig.put("String_Node_Str",20);
  overlayConfig.put("String_Node_Str",NUM_FEATURES);
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str",3);
  overlayConfig.put("String_Node_Str",2);
  overlayConfig.put("String_Node_Str",EVALUATION_STRATEGY);
  Config config=ConfigUtils.overlayOn(overlayConfig,getConfig());
  startMessaging();
  startServerProduceConsumeTopics(config,new RandomKMeansDataGenerator(NUM_FEATURES),DATA_TO_WRITE,WRITE_INTERVAL_MSEC);
  List<Path> modelInstanceDirs=IOUtils.listFiles(modelDir,"String_Node_Str");
  checkIntervals(modelInstanceDirs.size(),DATA_TO_WRITE,WRITE_INTERVAL_MSEC,GEN_INTERVAL_SEC);
  Path latestModelDir=modelInstanceDirs.get(modelInstanceDirs.size() - 1);
  Path modelFile=latestModelDir.resolve(MLUpdate.MODEL_FILE_NAME);
  assertTrue("String_Node_Str" + modelFile,Files.exists(modelFile));
  PMML pmml=PMMLUtils.read(modelFile);
  Model rootModel=pmml.getModels().get(0);
  ClusteringModel clusteringModel=(ClusteringModel)rootModel;
  assertEquals(100,clusteringModel.getNumberOfClusters().intValue());
}

Fixed version (ground truth):
@Test public void testKMeans() throws Exception {
  Path tempDir=getTempDir();
  Path dataDir=tempDir.resolve("String_Node_Str");
  Path modelDir=tempDir.resolve("String_Node_Str");
  Map<String,Object> overlayConfig=new HashMap<>();
  overlayConfig.put("String_Node_Str",KMeansUpdate.class.getName());
  ConfigUtils.set(overlayConfig,"String_Node_Str",dataDir);
  ConfigUtils.set(overlayConfig,"String_Node_Str",modelDir);
  overlayConfig.put("String_Node_Str",GEN_INTERVAL_SEC);
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str",20);
  overlayConfig.put("String_Node_Str",20);
  overlayConfig.put("String_Node_Str",NUM_FEATURES);
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str",3);
  overlayConfig.put("String_Node_Str",2);
  overlayConfig.put("String_Node_Str",EVALUATION_STRATEGY);
  Config config=ConfigUtils.overlayOn(overlayConfig,getConfig());
  startMessaging();
  startServerProduceConsumeTopics(config,new RandomKMeansDataGenerator(NUM_FEATURES),DATA_TO_WRITE,WRITE_INTERVAL_MSEC);
  List<Path> modelInstanceDirs=IOUtils.listFiles(modelDir,"String_Node_Str");
  checkIntervals(modelInstanceDirs.size(),DATA_TO_WRITE,WRITE_INTERVAL_MSEC,GEN_INTERVAL_SEC);
  Path latestModelDir=modelInstanceDirs.get(modelInstanceDirs.size() - 1);
  Path modelFile=latestModelDir.resolve(MLUpdate.MODEL_FILE_NAME);
  assertTrue("String_Node_Str" + modelFile,Files.exists(modelFile));
  PMML pmml=PMMLUtils.read(modelFile);
  Model rootModel=pmml.getModels().get(0);
  ClusteringModel clusteringModel=(ClusteringModel)rootModel;
  assertEquals(100,clusteringModel.getNumberOfClusters());
}