Program: 162800
Project: 162800
Buggy source:
@Test public void testALS() 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",ALSUpdate.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",false);
  overlayConfig.put("String_Node_Str",LAMBDA);
  overlayConfig.put("String_Node_Str",FEATURES);
  Config config=ConfigUtils.overlayOn(overlayConfig,getConfig());
  startMessaging();
  List<Pair<String,String>> updates=startServerProduceConsumeTopics(config,new RandomALSDataGenerator(NUM_USERS_ITEMS,NUM_USERS_ITEMS,1,5),DATA_TO_WRITE,WRITE_INTERVAL_MSEC);
  List<Path> modelInstanceDirs=IOUtils.listFiles(modelDir,"String_Node_Str");
  log.info("String_Node_Str",modelInstanceDirs);
  int generations=modelInstanceDirs.size();
  checkIntervals(generations,DATA_TO_WRITE,WRITE_INTERVAL_MSEC,GEN_INTERVAL_SEC);
  List<Collection<Integer>> userIDs=new ArrayList<>();
  userIDs.add(Collections.<Integer>emptySet());
  List<Collection<Integer>> productIDs=new ArrayList<>();
  productIDs.add(Collections.<Integer>emptySet());
  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);
    Path xDir=modelInstanceDir.resolve("String_Node_Str");
    assertTrue(Files.exists(xDir));
    userIDs.add(checkFeatures(xDir,userIDs.get(userIDs.size() - 1)));
    Path yDir=modelInstanceDir.resolve("String_Node_Str");
    assertTrue(Files.exists(yDir));
    productIDs.add(checkFeatures(yDir,productIDs.get(productIDs.size() - 1)));
  }
  userIDs.remove(0);
  productIDs.remove(0);
  Collection<Integer> expectedUsers=null;
  Collection<Integer> expectedProducts=null;
  Collection<Integer> seenUsers=null;
  Collection<Integer> seenProducts=null;
  Collection<Integer> lastModelUsers=null;
  Collection<Integer> lastModelProducts=null;
  int whichGeneration=-1;
  for (  Pair<String,String> km : updates) {
    String type=km.getFirst();
    String value=km.getSecond();
    log.debug("String_Node_Str",type,value);
    boolean isModel="String_Node_Str".equals(type);
    boolean isUpdate="String_Node_Str".equals(type);
    assertTrue(isModel || isUpdate);
    if (isUpdate) {
      assertNotNull(seenUsers);
      assertNotNull(seenProducts);
      List<?> update=MAPPER.readValue(value,List.class);
      String whichMatrixField=update.get(0).toString();
      boolean isUser="String_Node_Str".equals(whichMatrixField);
      boolean isProduct="String_Node_Str".equals(whichMatrixField);
      Integer id=Integer.valueOf(update.get(1).toString());
      assertTrue(isUser || isProduct);
      if (isUser) {
        seenUsers.add(id);
      }
 else {
        seenProducts.add(id);
      }
      for (      float f : MAPPER.convertValue(update.get(2),float[].class)) {
        assertTrue(!Float.isNaN(f) && !Float.isInfinite(f));
      }
      if (isUser) {
        @SuppressWarnings("String_Node_Str") Collection<String> knownUsersItems=(Collection<String>)update.get(3);
        assertFalse(knownUsersItems.isEmpty());
        for (        String known : knownUsersItems) {
          int i=Integer.parseInt(known);
          assertTrue(i >= 0 && i < NUM_USERS_ITEMS);
        }
      }
    }
 else {
      PMML pmml=PMMLUtils.fromString(value);
      checkHeader(pmml.getHeader());
      assertEquals(7,pmml.getExtensions().size());
      Map<String,Object> expected=new HashMap<>();
      expected.put("String_Node_Str",FEATURES);
      expected.put("String_Node_Str",LAMBDA);
      expected.put("String_Node_Str",false);
      checkExtensions(pmml,expected);
      assertEquals(expectedUsers,seenUsers);
      assertEquals(expectedProducts,seenProducts);
      assertEquals(expectedUsers,lastModelUsers);
      assertEquals(expectedProducts,lastModelProducts);
      whichGeneration++;
      expectedUsers=userIDs.get(whichGeneration);
      expectedProducts=productIDs.get(whichGeneration);
      seenUsers=new HashSet<>();
      seenProducts=new HashSet<>();
      lastModelUsers=parseIDsFromContent(AppPMMLUtils.getExtensionContent(pmml,"String_Node_Str"));
      lastModelProducts=parseIDsFromContent(AppPMMLUtils.getExtensionContent(pmml,"String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
@Test public void testALS() 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",ALSUpdate.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",false);
  overlayConfig.put("String_Node_Str",LAMBDA);
  overlayConfig.put("String_Node_Str",FEATURES);
  Config config=ConfigUtils.overlayOn(overlayConfig,getConfig());
  startMessaging();
  List<Pair<String,String>> updates=startServerProduceConsumeTopics(config,new RandomALSDataGenerator(NUM_USERS_ITEMS,NUM_USERS_ITEMS,1,5),DATA_TO_WRITE,WRITE_INTERVAL_MSEC);
  List<Path> modelInstanceDirs=IOUtils.listFiles(modelDir,"String_Node_Str");
  log.info("String_Node_Str",modelInstanceDirs);
  int generations=modelInstanceDirs.size();
  checkIntervals(generations,DATA_TO_WRITE,WRITE_INTERVAL_MSEC,GEN_INTERVAL_SEC);
  List<Collection<Integer>> userIDs=new ArrayList<>();
  userIDs.add(Collections.<Integer>emptySet());
  List<Collection<Integer>> productIDs=new ArrayList<>();
  productIDs.add(Collections.<Integer>emptySet());
  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);
    Path xDir=modelInstanceDir.resolve("String_Node_Str");
    assertTrue(Files.exists(xDir));
    userIDs.add(checkFeatures(xDir,userIDs.get(userIDs.size() - 1)));
    Path yDir=modelInstanceDir.resolve("String_Node_Str");
    assertTrue(Files.exists(yDir));
    productIDs.add(checkFeatures(yDir,productIDs.get(productIDs.size() - 1)));
  }
  userIDs.remove(0);
  productIDs.remove(0);
  Collection<Integer> expectedUsers=null;
  Collection<Integer> expectedProducts=null;
  Collection<Integer> seenUsers=null;
  Collection<Integer> seenProducts=null;
  Collection<Integer> lastModelUsers=null;
  Collection<Integer> lastModelProducts=null;
  int whichGeneration=-1;
  for (  Pair<String,String> km : updates) {
    String type=km.getFirst();
    String value=km.getSecond();
    log.debug("String_Node_Str",type,value);
    boolean isModel="String_Node_Str".equals(type);
    boolean isUpdate="String_Node_Str".equals(type);
    assertTrue(isModel || isUpdate);
    if (isUpdate) {
      assertNotNull(seenUsers);
      assertNotNull(seenProducts);
      List<?> update=MAPPER.readValue(value,List.class);
      String whichMatrixField=update.get(0).toString();
      boolean isUser="String_Node_Str".equals(whichMatrixField);
      boolean isProduct="String_Node_Str".equals(whichMatrixField);
      Integer id=Integer.valueOf(update.get(1).toString());
      assertTrue(isUser || isProduct);
      if (isUser) {
        seenUsers.add(id);
      }
 else {
        seenProducts.add(id);
      }
      for (      float f : MAPPER.convertValue(update.get(2),float[].class)) {
        assertTrue(!Float.isNaN(f) && !Float.isInfinite(f));
      }
      if (isUser) {
        @SuppressWarnings("String_Node_Str") Collection<String> knownUsersItems=(Collection<String>)update.get(3);
        assertFalse(knownUsersItems.isEmpty());
        for (        String known : knownUsersItems) {
          int i=Integer.parseInt(known);
          assertTrue(i >= 0 && i < NUM_USERS_ITEMS);
        }
      }
    }
 else {
      log.info("String_Node_Str",value);
      PMML pmml=PMMLUtils.fromString(value);
      checkHeader(pmml.getHeader());
      assertEquals(7,pmml.getExtensions().size());
      Map<String,Object> expected=new HashMap<>();
      expected.put("String_Node_Str",FEATURES);
      expected.put("String_Node_Str",LAMBDA);
      expected.put("String_Node_Str",false);
      checkExtensions(pmml,expected);
      assertEquals(expectedUsers,seenUsers);
      assertEquals(expectedProducts,seenProducts);
      assertEquals(expectedUsers,lastModelUsers);
      assertEquals(expectedProducts,lastModelProducts);
      whichGeneration++;
      expectedUsers=userIDs.get(whichGeneration);
      expectedProducts=productIDs.get(whichGeneration);
      seenUsers=new HashSet<>();
      seenProducts=new HashSet<>();
      lastModelUsers=parseIDsFromContent(AppPMMLUtils.getExtensionContent(pmml,"String_Node_Str"));
      lastModelProducts=parseIDsFromContent(AppPMMLUtils.getExtensionContent(pmml,"String_Node_Str"));
    }
  }
}