Program: 162756
Project: 162756
Buggy source:
@Test public void testRDFSpeedRegression() throws Exception {
  Map<String,Object> overlayConfig=new HashMap<>();
  overlayConfig.put("String_Node_Str",RDFSpeedModelManager.class.getName());
  overlayConfig.put("String_Node_Str",5);
  overlayConfig.put("String_Node_Str",1);
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str","String_Node_Str");
  Config config=ConfigUtils.overlayOn(overlayConfig,getConfig());
  startMessaging();
  List<Pair<String,String>> updates=startServerProduceConsumeTopics(config,new MockRDFRegressionInputGenerator(),new MockRDFRegressionModelGenerator(),NUM_INPUT,1);
  if (log.isDebugEnabled()) {
    for (    Pair<String,String> update : updates) {
      log.debug("String_Node_Str",update);
    }
  }
  int numUpdates=updates.size();
  assertTrue(numUpdates >= 3 && numUpdates % 2 != 0);
  assertEquals("String_Node_Str",updates.get(0).getFirst());
  for (int i=1; i < numUpdates; i++) {
    Pair<String,String> update=updates.get(i);
    assertEquals("String_Node_Str",update.getFirst());
    List<?> fields=MAPPER.readValue(update.getSecond(),List.class);
    int treeID=(Integer)fields.get(0);
    String nodeID=fields.get(1).toString();
    double mean=(Double)fields.get(2);
    assertEquals(0,treeID);
    assertTrue("String_Node_Str".equals(nodeID) || "String_Node_Str".equals(nodeID));
    if ("String_Node_Str".equals(nodeID)) {
      assertEquals(5.0,mean,0.5);
    }
 else {
      assertEquals(-4.0,mean,0.5);
    }
  }
  for (int i=1; i < numUpdates; i+=2) {
    Pair<String,String> update1=updates.get(i);
    Pair<String,String> update2=updates.get(i + 1);
    List<?> fields1=MAPPER.readValue(update1.getSecond(),List.class);
    List<?> fields2=MAPPER.readValue(update2.getSecond(),List.class);
    int count1=(Integer)fields1.get(3);
    int count2=(Integer)fields2.get(3);
    assertTrue(Math.abs(count1 - count2) <= 1);
    String nodeID1=fields1.get(1).toString();
    String nodeID2=fields2.get(1).toString();
    if ("String_Node_Str".equals(nodeID1)) {
      assertEquals("String_Node_Str",nodeID2);
    }
 else {
      assertEquals("String_Node_Str",nodeID2);
    }
  }
}

Fixed version (ground truth):
@Test public void testRDFSpeedRegression() throws Exception {
  Map<String,Object> overlayConfig=new HashMap<>();
  overlayConfig.put("String_Node_Str",RDFSpeedModelManager.class.getName());
  overlayConfig.put("String_Node_Str",10);
  overlayConfig.put("String_Node_Str",1);
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str","String_Node_Str");
  Config config=ConfigUtils.overlayOn(overlayConfig,getConfig());
  startMessaging();
  List<Pair<String,String>> updates=startServerProduceConsumeTopics(config,new MockRDFRegressionInputGenerator(),new MockRDFRegressionModelGenerator(),NUM_INPUT,1);
  if (log.isDebugEnabled()) {
    for (    Pair<String,String> update : updates) {
      log.debug("String_Node_Str",update);
    }
  }
  int numUpdates=updates.size();
  assertTrue(numUpdates >= 3 && numUpdates % 2 != 0);
  assertEquals("String_Node_Str",updates.get(0).getFirst());
  for (int i=1; i < numUpdates; i++) {
    Pair<String,String> update=updates.get(i);
    assertEquals("String_Node_Str",update.getFirst());
    List<?> fields=MAPPER.readValue(update.getSecond(),List.class);
    int treeID=(Integer)fields.get(0);
    String nodeID=fields.get(1).toString();
    double mean=(Double)fields.get(2);
    assertEquals(0,treeID);
    assertTrue("String_Node_Str".equals(nodeID) || "String_Node_Str".equals(nodeID));
    if ("String_Node_Str".equals(nodeID)) {
      assertEquals(5.0,mean,0.5);
    }
 else {
      assertEquals(-4.0,mean,0.5);
    }
  }
  for (int i=1; i < numUpdates; i+=2) {
    Pair<String,String> update1=updates.get(i);
    Pair<String,String> update2=updates.get(i + 1);
    List<?> fields1=MAPPER.readValue(update1.getSecond(),List.class);
    List<?> fields2=MAPPER.readValue(update2.getSecond(),List.class);
    int count1=(Integer)fields1.get(3);
    int count2=(Integer)fields2.get(3);
    assertTrue(Math.abs(count1 - count2) <= 1);
    String nodeID1=fields1.get(1).toString();
    String nodeID2=fields2.get(1).toString();
    if ("String_Node_Str".equals(nodeID1)) {
      assertEquals("String_Node_Str",nodeID2);
    }
 else {
      assertEquals("String_Node_Str",nodeID2);
    }
  }
}