Program: 162801
Project: 162801
Buggy source:
@Ignore @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",BLOCK_INTERVAL_SEC);
  overlayConfig.put("String_Node_Str",CLUSTERS);
  overlayConfig.put("String_Node_Str",2);
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str",5);
  Config config=ConfigUtils.overlayOn(overlayConfig,getConfig());
  startMessaging();
  List<Pair<String,String>> updates=startServerProduceConsumeTopics(config,new RandomKMeansDataGenerator(2),DATA_TO_WRITE,WRITE_INTERVAL_MSEC);
  List<Path> modelInstanceDirs=IOUtils.listFiles(modelDir,"String_Node_Str");
  log.info("String_Node_Str",modelInstanceDirs);
  assertFalse("String_Node_Str",modelInstanceDirs.isEmpty());
  int generations=modelInstanceDirs.size();
  checkIntervals(generations,DATA_TO_WRITE,WRITE_INTERVAL_MSEC,GEN_INTERVAL_SEC);
  for (  Path modelInstanceDir : modelInstanceDirs) {
    log.info("String_Node_Str",modelInstanceDir);
    Path modelFile=modelInstanceDir.resolve(MLUpdate.MODEL_FILE_NAME);
    assertTrue("String_Node_Str" + modelFile,Files.exists(modelFile));
    assertTrue("String_Node_Str" + modelFile,Files.size(modelFile) > 0);
  }
  for (  Pair<String,String> km : updates) {
    String type=km.getFirst();
    String value=km.getSecond();
    log.debug("String_Node_Str",type,value);
    assertEquals("String_Node_Str",type);
    PMML pmml=PMMLUtils.fromString(value);
    checkHeader(pmml.getHeader());
    Model rootModel=pmml.getModels().get(0);
    assertTrue(rootModel instanceof ClusteringModel);
    ClusteringModel clusteringModel=((ClusteringModel)rootModel);
    assertEquals(Integer.valueOf(CLUSTERS),clusteringModel.getNumberOfClusters());
    assertEquals(ComparisonMeasure.Kind.DISTANCE,clusteringModel.getComparisonMeasure().getKind());
    assertEquals(2,clusteringModel.getClusters().get(0).getArray().getN().intValue());
  }
}

Fixed version (ground truth):
@Ignore @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",BLOCK_INTERVAL_SEC);
  overlayConfig.put("String_Node_Str",CLUSTERS);
  overlayConfig.put("String_Node_Str",2);
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str",5);
  Config config=ConfigUtils.overlayOn(overlayConfig,getConfig());
  startMessaging();
  List<Pair<String,String>> updates=startServerProduceConsumeTopics(config,new RandomKMeansDataGenerator(2),DATA_TO_WRITE,WRITE_INTERVAL_MSEC);
  List<Path> modelInstanceDirs=IOUtils.listFiles(modelDir,"String_Node_Str");
  log.info("String_Node_Str",modelInstanceDirs);
  assertFalse("String_Node_Str",modelInstanceDirs.isEmpty());
  int generations=modelInstanceDirs.size();
  checkIntervals(generations,DATA_TO_WRITE,WRITE_INTERVAL_MSEC,GEN_INTERVAL_SEC);
  for (  Path modelInstanceDir : modelInstanceDirs) {
    log.info("String_Node_Str",modelInstanceDir);
    Path modelFile=modelInstanceDir.resolve(MLUpdate.MODEL_FILE_NAME);
    assertTrue("String_Node_Str" + modelFile,Files.exists(modelFile));
    assertTrue("String_Node_Str" + modelFile,Files.size(modelFile) > 0);
    PMMLUtils.read(modelFile);
  }
  for (  Pair<String,String> km : updates) {
    String type=km.getFirst();
    String value=km.getSecond();
    assertEquals("String_Node_Str",type);
    log.info("String_Node_Str",value);
    PMML pmml=PMMLUtils.fromString(value);
    checkHeader(pmml.getHeader());
    Model rootModel=pmml.getModels().get(0);
    assertTrue(rootModel instanceof ClusteringModel);
    ClusteringModel clusteringModel=((ClusteringModel)rootModel);
    assertEquals(Integer.valueOf(CLUSTERS),clusteringModel.getNumberOfClusters());
    assertEquals(ComparisonMeasure.Kind.DISTANCE,clusteringModel.getComparisonMeasure().getKind());
    assertEquals(2,clusteringModel.getClusters().get(0).getArray().getN().intValue());
  }
}