Program: 4794
Project: 4794
Buggy source:
@Test public void testWorkflowTokenPut() throws Exception {
  Assert.assertEquals(200,deploy(WorkflowTokenTestPutApp.class).getStatusLine().getStatusCode());
  Id.Application appId=Id.Application.from(Id.Namespace.DEFAULT,WorkflowTokenTestPutApp.NAME);
  Id.Workflow workflowId=Id.Workflow.from(appId,WorkflowTokenTestPutApp.WorkflowTokenTestPut.NAME);
  Id.Program mapReduceId=Id.Program.from(appId,ProgramType.MAPREDUCE,WorkflowTokenTestPutApp.RecordCounter.NAME);
  Id.Program sparkId=Id.Program.from(appId,ProgramType.SPARK,WorkflowTokenTestPutApp.SparkTestApp.NAME);
  String outputPath=new File(tmpFolder.newFolder(),"String_Node_Str").getAbsolutePath();
  startProgram(workflowId,ImmutableMap.of("String_Node_Str",createInputForRecordVerification("String_Node_Str"),"String_Node_Str",outputPath));
  waitState(workflowId,ProgramStatus.RUNNING.name());
  waitState(workflowId,ProgramStatus.STOPPED.name());
  verifyProgramRuns(workflowId,"String_Node_Str");
  List<RunRecord> runs=getProgramRuns(workflowId,"String_Node_Str");
  Assert.assertEquals(1,runs.size());
  String wfRunId=runs.get(0).getPid();
  WorkflowTokenDetail tokenDetail=getWorkflowToken(workflowId,wfRunId,null,null);
  List<WorkflowTokenDetail.NodeValueDetail> details=tokenDetail.getTokenData().get("String_Node_Str");
  Assert.assertEquals(1,details.size());
  Assert.assertEquals(wfRunId,details.get(0).getValue());
  for (  String key : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}) {
    Assert.assertFalse(tokenDetail.getTokenData().containsKey(key));
  }
  List<RunRecord> sparkProgramRuns=getProgramRuns(sparkId,ProgramRunStatus.COMPLETED.name());
  Assert.assertEquals(1,sparkProgramRuns.size());
}

Fixed version (ground truth):
@Test public void testWorkflowTokenPut() throws Exception {
  Assert.assertEquals(200,deploy(WorkflowTokenTestPutApp.class).getStatusLine().getStatusCode());
  Id.Application appId=Id.Application.from(Id.Namespace.DEFAULT,WorkflowTokenTestPutApp.NAME);
  Id.Workflow workflowId=Id.Workflow.from(appId,WorkflowTokenTestPutApp.WorkflowTokenTestPut.NAME);
  Id.Program mapReduceId=Id.Program.from(appId,ProgramType.MAPREDUCE,WorkflowTokenTestPutApp.RecordCounter.NAME);
  Id.Program sparkId=Id.Program.from(appId,ProgramType.SPARK,WorkflowTokenTestPutApp.SparkTestApp.NAME);
  String outputPath=new File(tmpFolder.newFolder(),"String_Node_Str").getAbsolutePath();
  startProgram(workflowId,ImmutableMap.of("String_Node_Str",createInputForRecordVerification("String_Node_Str"),"String_Node_Str",outputPath));
  waitState(workflowId,ProgramStatus.RUNNING.name());
  waitState(workflowId,ProgramStatus.STOPPED.name());
  verifyProgramRuns(workflowId,ProgramRunStatus.COMPLETED);
  List<RunRecord> runs=getProgramRuns(workflowId,ProgramRunStatus.COMPLETED);
  Assert.assertEquals(1,runs.size());
  String wfRunId=runs.get(0).getPid();
  WorkflowTokenDetail tokenDetail=getWorkflowToken(workflowId,wfRunId,null,null);
  List<WorkflowTokenDetail.NodeValueDetail> details=tokenDetail.getTokenData().get("String_Node_Str");
  Assert.assertEquals(1,details.size());
  Assert.assertEquals(wfRunId,details.get(0).getValue());
  for (  String key : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}) {
    Assert.assertFalse(tokenDetail.getTokenData().containsKey(key));
  }
  List<RunRecord> sparkProgramRuns=getProgramRuns(sparkId,ProgramRunStatus.COMPLETED);
  Assert.assertEquals(1,sparkProgramRuns.size());
}