Program: 29099
Project: 29099
Buggy source:
@Test public void testToJSONFunctionExtension2() throws InterruptedException {
  log.info("String_Node_Str");
  SiddhiManager siddhiManager=new SiddhiManager();
  siddhiManager.setExtension("String_Node_Str",ConcatFunctionExtension.class);
  String inStreamDefinition="String_Node_Str";
  String query=("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  ExecutionPlanRuntime executionPlanRuntime=siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query);
  executionPlanRuntime.addCallback("String_Node_Str",new StreamCallback(){
    @Override public void receive(    Event[] inEvents){
      EventPrinter.print(inEvents);
      for (      Event event : inEvents) {
        count.incrementAndGet();
        if (count.get() == 1) {
          JSONAssert.assertEquals(new JSONObject("String_Node_Str"),new JSONObject(event.getData(0)),false);
          eventArrived=true;
        }
        if (count.get() == 2) {
          JSONAssert.assertEquals(new JSONObject("String_Node_Str"),new JSONObject(event.getData(0)),false);
          eventArrived=true;
        }
        if (count.get() == 3) {
          JSONAssert.assertEquals(new JSONObject("String_Node_Str"),new JSONObject(event.getData(0)),false);
          eventArrived=true;
        }
      }
    }
  }
);
  InputHandler inputHandler=executionPlanRuntime.getInputHandler("String_Node_Str");
  executionPlanRuntime.start();
  inputHandler.send(new Object[]{"String_Node_Str",100,100l});
  inputHandler.send(new Object[]{"String_Node_Str",200,200l});
  inputHandler.send(new Object[]{"String_Node_Str",300,200l});
  SiddhiTestHelper.waitForEvents(100,3,count,60000);
  Assert.assertEquals(3,count.get());
  Assert.assertTrue(eventArrived);
  executionPlanRuntime.shutdown();
}

Fixed version (ground truth):
@Test public void testToJSONFunctionExtension2() throws InterruptedException {
  log.info("String_Node_Str");
  SiddhiManager siddhiManager=new SiddhiManager();
  siddhiManager.setExtension("String_Node_Str",ConcatFunctionExtension.class);
  String inStreamDefinition="String_Node_Str";
  String query=("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  ExecutionPlanRuntime executionPlanRuntime=siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query);
  executionPlanRuntime.addCallback("String_Node_Str",new StreamCallback(){
    @Override public void receive(    Event[] inEvents){
      EventPrinter.print(inEvents);
      for (      Event event : inEvents) {
        count.incrementAndGet();
        if (count.get() == 1) {
          Assert.assertEquals(event.getData(0) instanceof String,true);
          JSONAssert.assertEquals(new JSONObject("String_Node_Str"),new JSONObject((String)event.getData(0)),false);
          eventArrived=true;
        }
        if (count.get() == 2) {
          Assert.assertEquals(event.getData(0) instanceof String,true);
          JSONAssert.assertEquals(new JSONObject("String_Node_Str"),new JSONObject((String)event.getData(0)),false);
          eventArrived=true;
        }
        if (count.get() == 3) {
          Assert.assertEquals(event.getData(0) instanceof String,true);
          JSONAssert.assertEquals(new JSONObject("String_Node_Str"),new JSONObject((String)event.getData(0)),false);
          eventArrived=true;
        }
      }
    }
  }
);
  InputHandler inputHandler=executionPlanRuntime.getInputHandler("String_Node_Str");
  executionPlanRuntime.start();
  inputHandler.send(new Object[]{"String_Node_Str",100,100l});
  inputHandler.send(new Object[]{"String_Node_Str",200,200l});
  inputHandler.send(new Object[]{"String_Node_Str",300,200l});
  SiddhiTestHelper.waitForEvents(100,3,count,60000);
  Assert.assertEquals(3,count.get());
  Assert.assertTrue(eventArrived);
  executionPlanRuntime.shutdown();
}