Program: 4801
Project: 4801
Buggy source:
@Test public void testWorkflowPauseResume() throws Exception {
  String pauseResumeWorkflowApp="String_Node_Str";
  String pauseResumeWorkflow="String_Node_Str";
  File firstSimpleActionFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File firstSimpleActionDoneFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File forkedSimpleActionFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File forkedSimpleActionDoneFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File anotherForkedSimpleActionFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File anotherForkedSimpleActionDoneFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File lastSimpleActionFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File lastSimpleActionDoneFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  HttpResponse response=deploy(PauseResumeWorklowApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  Id.Program programId=Id.Program.from(TEST_NAMESPACE2,pauseResumeWorkflowApp,ProgramType.WORKFLOW,pauseResumeWorkflow);
  Map<String,String> runtimeArguments=Maps.newHashMap();
  runtimeArguments.put("String_Node_Str",firstSimpleActionFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",firstSimpleActionDoneFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",forkedSimpleActionFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",forkedSimpleActionDoneFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",anotherForkedSimpleActionFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",anotherForkedSimpleActionDoneFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",lastSimpleActionFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",lastSimpleActionDoneFile.getAbsolutePath());
  setAndTestRuntimeArgs(programId,runtimeArguments);
  startProgram(programId,200);
  waitState(programId,ProgramStatus.RUNNING.name());
  String runId=getRunIdOfRunningProgram(programId);
  while (!firstSimpleActionFile.exists()) {
    TimeUnit.MILLISECONDS.sleep(50);
  }
  verifyRunningProgramCount(programId,runId,1);
  suspendWorkflow(programId,runId,200);
  waitState(programId,ProgramStatus.STOPPED.name());
  verifyProgramRuns(programId,"String_Node_Str");
  suspendWorkflow(programId,runId,409);
  Assert.assertTrue(firstSimpleActionDoneFile.createNewFile());
  verifyRunningProgramCount(programId,runId,0);
  verifyProgramRuns(programId,"String_Node_Str");
  resumeWorkflow(programId,runId,200);
  waitState(programId,ProgramStatus.RUNNING.name());
  verifyProgramRuns(programId,"String_Node_Str");
  resumeWorkflow(programId,runId,409);
  while (!(forkedSimpleActionFile.exists() && anotherForkedSimpleActionFile.exists())) {
    TimeUnit.MILLISECONDS.sleep(50);
  }
  verifyRunningProgramCount(programId,runId,2);
  suspendWorkflow(programId,runId,200);
  waitState(programId,ProgramStatus.STOPPED.name());
  verifyProgramRuns(programId,"String_Node_Str");
  Assert.assertTrue(forkedSimpleActionDoneFile.createNewFile());
  Assert.assertTrue(anotherForkedSimpleActionDoneFile.createNewFile());
  verifyRunningProgramCount(programId,runId,0);
  verifyProgramRuns(programId,"String_Node_Str");
  Assert.assertTrue(!lastSimpleActionFile.exists());
  resumeWorkflow(programId,runId,200);
  waitState(programId,ProgramStatus.RUNNING.name());
  while (!lastSimpleActionFile.exists()) {
    TimeUnit.SECONDS.sleep(1);
  }
  verifyRunningProgramCount(programId,runId,1);
  Assert.assertTrue(lastSimpleActionDoneFile.createNewFile());
  verifyProgramRuns(programId,"String_Node_Str");
  waitState(programId,ProgramStatus.STOPPED.name());
  suspendWorkflow(programId,runId,404);
  resumeWorkflow(programId,runId,404);
}

Fixed version (ground truth):
@Test public void testWorkflowPauseResume() throws Exception {
  String pauseResumeWorkflowApp="String_Node_Str";
  String pauseResumeWorkflow="String_Node_Str";
  File firstSimpleActionFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File firstSimpleActionDoneFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File forkedSimpleActionFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File forkedSimpleActionDoneFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File anotherForkedSimpleActionFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File anotherForkedSimpleActionDoneFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File lastSimpleActionFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  File lastSimpleActionDoneFile=new File(tmpFolder.newFolder() + "String_Node_Str");
  HttpResponse response=deploy(PauseResumeWorklowApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  Id.Program programId=Id.Program.from(TEST_NAMESPACE2,pauseResumeWorkflowApp,ProgramType.WORKFLOW,pauseResumeWorkflow);
  Map<String,String> runtimeArguments=Maps.newHashMap();
  runtimeArguments.put("String_Node_Str",firstSimpleActionFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",firstSimpleActionDoneFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",forkedSimpleActionFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",forkedSimpleActionDoneFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",anotherForkedSimpleActionFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",anotherForkedSimpleActionDoneFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",lastSimpleActionFile.getAbsolutePath());
  runtimeArguments.put("String_Node_Str",lastSimpleActionDoneFile.getAbsolutePath());
  setAndTestRuntimeArgs(programId,runtimeArguments);
  startProgram(programId,200);
  waitState(programId,ProgramStatus.RUNNING.name());
  String runId=getRunIdOfRunningProgram(programId);
  while (!firstSimpleActionFile.exists()) {
    TimeUnit.MILLISECONDS.sleep(50);
  }
  verifyRunningProgramCount(programId,runId,1);
  suspendWorkflow(programId,runId,200);
  waitState(programId,ProgramStatus.STOPPED.name());
  verifyProgramRuns(programId,ProgramRunStatus.SUSPENDED);
  suspendWorkflow(programId,runId,409);
  Assert.assertTrue(firstSimpleActionDoneFile.createNewFile());
  verifyRunningProgramCount(programId,runId,0);
  verifyProgramRuns(programId,ProgramRunStatus.SUSPENDED);
  resumeWorkflow(programId,runId,200);
  waitState(programId,ProgramStatus.RUNNING.name());
  resumeWorkflow(programId,runId,409);
  while (!(forkedSimpleActionFile.exists() && anotherForkedSimpleActionFile.exists())) {
    TimeUnit.MILLISECONDS.sleep(50);
  }
  verifyRunningProgramCount(programId,runId,2);
  suspendWorkflow(programId,runId,200);
  waitState(programId,ProgramStatus.STOPPED.name());
  verifyProgramRuns(programId,ProgramRunStatus.SUSPENDED);
  Assert.assertTrue(forkedSimpleActionDoneFile.createNewFile());
  Assert.assertTrue(anotherForkedSimpleActionDoneFile.createNewFile());
  verifyRunningProgramCount(programId,runId,0);
  verifyProgramRuns(programId,ProgramRunStatus.SUSPENDED);
  Assert.assertTrue(!lastSimpleActionFile.exists());
  resumeWorkflow(programId,runId,200);
  waitState(programId,ProgramStatus.RUNNING.name());
  while (!lastSimpleActionFile.exists()) {
    TimeUnit.SECONDS.sleep(1);
  }
  verifyRunningProgramCount(programId,runId,1);
  Assert.assertTrue(lastSimpleActionDoneFile.createNewFile());
  verifyProgramRuns(programId,ProgramRunStatus.COMPLETED);
  suspendWorkflow(programId,runId,404);
  resumeWorkflow(programId,runId,404);
}