Program: 6643
Project: 6643
Buggy source:
@Category(XSlowTests.class) @Test public void testProgramStartStopStatusErrors() throws Exception {
  HttpResponse response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  startProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,"String_Node_Str"),404);
  startProgram(Id.Program.from(TEST_NAMESPACE1,"String_Node_Str",ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  startProgram(Id.Program.from("String_Node_Str",WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  debugProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,"String_Node_Str"),404);
  debugProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.MAPREDUCE,WORDCOUNT_MAPREDUCE_NAME),501);
  programStatus(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,"String_Node_Str"),404);
  programStatus(Id.Program.from(TEST_NAMESPACE1,"String_Node_Str",ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  programStatus(Id.Program.from("String_Node_Str",WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  stopProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,"String_Node_Str"),404);
  stopProgram(Id.Program.from(TEST_NAMESPACE1,"String_Node_Str",ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  stopProgram(Id.Program.from("String_Node_Str",WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  stopProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),400);
  stopProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),400,"String_Node_Str");
  startProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME));
  waitState(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),"String_Node_Str");
  startProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),409);
  List<RunRecord> runs=getProgramRuns(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),"String_Node_Str");
  Assert.assertEquals(1,runs.size());
  String runId=runs.get(0).getPid();
  stopProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),200);
  waitState(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),"String_Node_Str");
  runs=getProgramRuns(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),"String_Node_Str");
  Assert.assertTrue(runs.isEmpty());
  stopProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404,runId);
  response=doDelete(getVersionedAPIPath("String_Node_Str",Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1));
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
}

Fixed version (ground truth):
@Category(XSlowTests.class) @Test public void testProgramStartStopStatusErrors() throws Exception {
  HttpResponse response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  startProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,"String_Node_Str"),404);
  startProgram(Id.Program.from(TEST_NAMESPACE1,"String_Node_Str",ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  startProgram(Id.Program.from("String_Node_Str",WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  debugProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,"String_Node_Str"),404);
  debugProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.MAPREDUCE,WORDCOUNT_MAPREDUCE_NAME),501);
  programStatus(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,"String_Node_Str"),404);
  programStatus(Id.Program.from(TEST_NAMESPACE1,"String_Node_Str",ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  programStatus(Id.Program.from("String_Node_Str",WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  stopProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,"String_Node_Str"),404);
  stopProgram(Id.Program.from(TEST_NAMESPACE1,"String_Node_Str",ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  stopProgram(Id.Program.from("String_Node_Str",WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),404);
  stopProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),400);
  stopProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),"String_Node_Str",400);
  startProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME));
  waitState(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),"String_Node_Str");
  startProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),409);
  List<RunRecord> runs=getProgramRuns(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),"String_Node_Str");
  Assert.assertEquals(1,runs.size());
  String runId=runs.get(0).getPid();
  stopProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),200);
  waitState(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),"String_Node_Str");
  runs=getProgramRuns(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),"String_Node_Str");
  Assert.assertTrue(runs.isEmpty());
  stopProgram(Id.Program.from(TEST_NAMESPACE1,WORDCOUNT_APP_NAME,ProgramType.FLOW,WORDCOUNT_FLOW_NAME),runId,404);
  response=doDelete(getVersionedAPIPath("String_Node_Str",Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE1));
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
}