Program: 162777
Project: 162777
Buggy source:
@Test public void testRDFServingModel() throws Exception {
  Map<String,Object> overlayConfig=new HashMap<>();
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str",RDFServingModelManager.class.getName());
  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();
  startServer(config);
  startUpdateTopics(new MockRDFClassificationModelGenerator(),10);
  Thread.sleep(1000);
  RDFServingModelManager manager=(RDFServingModelManager)getServingLayer().getContext().getServletContext().getAttribute(AbstractOryxResource.MODEL_MANAGER_KEY);
  assertNotNull("String_Node_Str",manager);
  RDFServingModel model=manager.getModel();
  log.debug("String_Node_Str",model);
  CategoricalValueEncodings encodings=model.getEncodings();
  assertEquals(2,encodings.getValueCount(0));
  assertEquals(2,encodings.getValueCount(1));
  Map<Integer,String> encodingValuePredictor=encodings.getEncodingValueMap(0);
  assertEquals("String_Node_Str",encodingValuePredictor.get(0));
  assertEquals("String_Node_Str",encodingValuePredictor.get(1));
  Map<Integer,String> encodingValueTarget=encodings.getEncodingValueMap(1);
  assertEquals("String_Node_Str",encodingValueTarget.get(0));
  assertEquals("String_Node_Str",encodingValueTarget.get(1));
  DecisionForest forest=model.getForest();
  assertEquals(1,forest.getTrees().length);
  assertArrayEquals(new double[]{1.0},forest.getWeights());
  InputSchema inputSchema=model.getInputSchema();
  assertEquals(2,inputSchema.getNumFeatures());
}

Fixed version (ground truth):
@Test public void testRDFServingModel() throws Exception {
  Map<String,Object> overlayConfig=new HashMap<>();
  overlayConfig.put("String_Node_Str","String_Node_Str");
  overlayConfig.put("String_Node_Str",RDFServingModelManager.class.getName());
  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();
  startServer(config);
  startUpdateTopics(new MockRDFClassificationModelGenerator(),5);
  Thread.sleep(1000);
  RDFServingModelManager manager=(RDFServingModelManager)getServingLayer().getContext().getServletContext().getAttribute(AbstractOryxResource.MODEL_MANAGER_KEY);
  assertNotNull("String_Node_Str",manager);
  RDFServingModel model=manager.getModel();
  log.debug("String_Node_Str",model);
  CategoricalValueEncodings encodings=model.getEncodings();
  assertEquals(2,encodings.getValueCount(0));
  assertEquals(2,encodings.getValueCount(1));
  Map<Integer,String> encodingValuePredictor=encodings.getEncodingValueMap(0);
  assertEquals("String_Node_Str",encodingValuePredictor.get(0));
  assertEquals("String_Node_Str",encodingValuePredictor.get(1));
  Map<Integer,String> encodingValueTarget=encodings.getEncodingValueMap(1);
  assertEquals("String_Node_Str",encodingValueTarget.get(0));
  assertEquals("String_Node_Str",encodingValueTarget.get(1));
  DecisionForest forest=model.getForest();
  DecisionTree[] trees=forest.getTrees();
  assertEquals(1,trees.length);
  assertArrayEquals(new double[]{1.0},forest.getWeights());
  InputSchema inputSchema=model.getInputSchema();
  assertEquals(2,inputSchema.getNumFeatures());
  DecisionTree tree=trees[0];
  DecisionNode root=(DecisionNode)tree.findByID("String_Node_Str");
  TerminalNode left=(TerminalNode)tree.findByID("String_Node_Str");
  TerminalNode right=(TerminalNode)tree.findByID("String_Node_Str");
  assertSame(root.getLeft(),left);
  assertSame(root.getRight(),right);
  assertEquals(7,left.getCount());
  assertEquals(7,right.getCount());
  CategoricalPrediction leftPrediction=(CategoricalPrediction)left.getPrediction();
  CategoricalPrediction rightPrediction=(CategoricalPrediction)right.getPrediction();
  assertEquals(2,leftPrediction.getCategoryCounts()[0]);
  assertEquals(5,leftPrediction.getCategoryCounts()[1]);
  assertEquals(3,rightPrediction.getCategoryCounts()[0]);
  assertEquals(4,rightPrediction.getCategoryCounts()[1]);
}