Program: 5068
Project: 5068
Buggy source:
@Test public void testVersionedProgramStartStopStatus() throws Exception {
  Id.Artifact wordCountArtifactId=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str",VERSION1);
  addAppArtifact(wordCountArtifactId,WordCountApp.class);
  AppRequest<? extends Config> wordCountRequest=new AppRequest<>(new ArtifactSummary(wordCountArtifactId.getName(),wordCountArtifactId.getVersion().getVersion()));
  ApplicationId wordCountApp1=NamespaceId.DEFAULT.app("String_Node_Str",VERSION1);
  ProgramId wordcountFlow1=wordCountApp1.program(ProgramType.FLOW,"String_Node_Str");
  Id.Application wordCountAppDefault=wordCountApp1.toId();
  Id.Program wordcountFlowDefault=wordcountFlow1.toId();
  ApplicationId wordCountApp2=NamespaceId.DEFAULT.app("String_Node_Str",VERSION2);
  ProgramId wordcountFlow2=wordCountApp2.program(ProgramType.FLOW,"String_Node_Str");
  Assert.assertEquals(200,deploy(wordCountApp1,wordCountRequest).getStatusLine().getStatusCode());
  Assert.assertEquals(200,deploy(wordCountAppDefault,wordCountRequest).getStatusLine().getStatusCode());
  Assert.assertEquals(STOPPED,getProgramStatus(wordcountFlow1));
  startProgram(wordcountFlow1,200);
  waitState(wordcountFlow1,RUNNING);
  startProgram(wordcountFlow1,409);
  startProgram(new NamespaceId(TEST_NAMESPACE1).app(wordcountFlow1.getApplication(),wordcountFlow1.getVersion()).program(wordcountFlow1.getType(),wordcountFlow1.getProgram()),404);
  Assert.assertEquals(200,deploy(wordCountApp2,wordCountRequest).getStatusLine().getStatusCode());
  startProgram(wordcountFlow2,409);
  startProgram(wordcountFlowDefault,409);
  stopProgram(wordcountFlow1,null,200,null);
  waitState(wordcountFlow1,"String_Node_Str");
  startProgram(wordcountFlow2,200);
  stopProgram(wordcountFlow2,null,200,null);
  ProgramId wordFrequencyService1=wordCountApp1.program(ProgramType.SERVICE,"String_Node_Str");
  ProgramId wordFrequencyService2=wordCountApp2.program(ProgramType.SERVICE,"String_Node_Str");
  Id.Program wordFrequencyServiceDefault=wordFrequencyService1.toId();
  Assert.assertEquals(STOPPED,getProgramStatus(wordFrequencyService1));
  startProgram(wordFrequencyService1,200);
  waitState(wordFrequencyService1,RUNNING);
  Assert.assertEquals(STOPPED,getProgramStatus(wordFrequencyService2));
  startProgram(wordFrequencyService2,200);
  waitState(wordFrequencyService2,RUNNING);
  Assert.assertEquals(STOPPED,getProgramStatus(wordFrequencyServiceDefault));
  startProgram(wordFrequencyServiceDefault,200);
  waitState(wordFrequencyServiceDefault,RUNNING);
  startProgram(wordFrequencyService1,409);
  stopProgram(wordFrequencyService1,null,200,null);
  Assert.assertEquals(STOPPED,getProgramStatus(wordFrequencyService1));
  startProgram(wordFrequencyService1,200);
  stopProgram(wordFrequencyService1,null,200,null);
  stopProgram(wordFrequencyService2,null,200,null);
  stopProgram(wordFrequencyServiceDefault,null,200,null);
  Id.Artifact sleepWorkflowArtifactId=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str",VERSION1);
  addAppArtifact(sleepWorkflowArtifactId,SleepingWorkflowApp.class);
  AppRequest<? extends Config> sleepWorkflowRequest=new AppRequest<>(new ArtifactSummary(sleepWorkflowArtifactId.getName(),sleepWorkflowArtifactId.getVersion().getVersion()));
  ApplicationId sleepWorkflowApp1=new ApplicationId(Id.Namespace.DEFAULT.getId(),"String_Node_Str",VERSION1);
  ProgramId sleepWorkflow1=sleepWorkflowApp1.program(ProgramType.WORKFLOW,"String_Node_Str");
  ApplicationId sleepWorkflowApp2=new ApplicationId(Id.Namespace.DEFAULT.getId(),"String_Node_Str",VERSION2);
  ProgramId sleepWorkflow2=sleepWorkflowApp2.program(ProgramType.WORKFLOW,"String_Node_Str");
  Assert.assertEquals(200,deploy(sleepWorkflowApp1,sleepWorkflowRequest).getStatusLine().getStatusCode());
  Assert.assertEquals(STOPPED,getProgramStatus(sleepWorkflow1));
  startProgram(sleepWorkflow2,404);
  Assert.assertEquals(200,deploy(sleepWorkflowApp2,sleepWorkflowRequest).getStatusLine().getStatusCode());
  startProgram(sleepWorkflow1,200);
  startProgram(sleepWorkflow2,200);
  startProgram(sleepWorkflow1,200);
  startProgram(sleepWorkflow2,200);
  stopProgram(sleepWorkflow1,null,200,null);
  stopProgram(sleepWorkflow2,null,200,null);
  Assert.assertEquals(STOPPED,getProgramStatus(sleepWorkflow1));
  Assert.assertEquals(STOPPED,getProgramStatus(sleepWorkflow2));
  deleteApp(wordCountApp1,200);
  deleteApp(wordCountApp2,200);
  deleteApp(wordCountAppDefault,200);
  deleteApp(sleepWorkflowApp1,200);
  deleteApp(sleepWorkflowApp2,200);
}

Fixed version (ground truth):
@Test public void testVersionedProgramStartStopStatus() throws Exception {
  Id.Artifact wordCountArtifactId=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str",VERSION1);
  addAppArtifact(wordCountArtifactId,WordCountApp.class);
  AppRequest<? extends Config> wordCountRequest=new AppRequest<>(new ArtifactSummary(wordCountArtifactId.getName(),wordCountArtifactId.getVersion().getVersion()));
  ApplicationId wordCountApp1=NamespaceId.DEFAULT.app("String_Node_Str",VERSION1);
  ProgramId wordcountFlow1=wordCountApp1.program(ProgramType.FLOW,"String_Node_Str");
  Id.Application wordCountAppDefault=wordCountApp1.toId();
  Id.Program wordcountFlowDefault=wordcountFlow1.toId();
  ApplicationId wordCountApp2=NamespaceId.DEFAULT.app("String_Node_Str",VERSION2);
  ProgramId wordcountFlow2=wordCountApp2.program(ProgramType.FLOW,"String_Node_Str");
  Assert.assertEquals(200,deploy(wordCountApp1,wordCountRequest).getStatusLine().getStatusCode());
  Assert.assertEquals(200,deploy(wordCountAppDefault,wordCountRequest).getStatusLine().getStatusCode());
  Assert.assertEquals(STOPPED,getProgramStatus(wordcountFlow1));
  startProgram(wordcountFlow1,200);
  waitState(wordcountFlow1,RUNNING);
  startProgram(wordcountFlow1,409);
  startProgram(new NamespaceId(TEST_NAMESPACE1).app(wordcountFlow1.getApplication(),wordcountFlow1.getVersion()).program(wordcountFlow1.getType(),wordcountFlow1.getProgram()),404);
  Assert.assertEquals(200,deploy(wordCountApp2,wordCountRequest).getStatusLine().getStatusCode());
  startProgram(wordcountFlow2,409);
  startProgram(wordcountFlowDefault,409);
  stopProgram(wordcountFlow1,null,200,null);
  waitState(wordcountFlow1,"String_Node_Str");
  startProgram(wordcountFlow2,200);
  stopProgram(wordcountFlow2,null,200,null);
  ProgramId wordFrequencyService1=wordCountApp1.program(ProgramType.SERVICE,"String_Node_Str");
  ProgramId wordFrequencyService2=wordCountApp2.program(ProgramType.SERVICE,"String_Node_Str");
  Id.Program wordFrequencyServiceDefault=wordFrequencyService1.toId();
  Assert.assertEquals(STOPPED,getProgramStatus(wordFrequencyService1));
  startProgram(wordFrequencyService1,200);
  waitState(wordFrequencyService1,RUNNING);
  Assert.assertEquals(STOPPED,getProgramStatus(wordFrequencyService2));
  startProgram(wordFrequencyService2,200);
  waitState(wordFrequencyService2,RUNNING);
  Assert.assertEquals(STOPPED,getProgramStatus(wordFrequencyServiceDefault));
  startProgram(wordFrequencyServiceDefault,200);
  waitState(wordFrequencyServiceDefault,RUNNING);
  startProgram(wordFrequencyService1,409);
  stopProgram(wordFrequencyService1,null,200,null);
  Assert.assertEquals(STOPPED,getProgramStatus(wordFrequencyService1));
  startProgram(wordFrequencyService1,200);
  stopProgram(wordFrequencyService1,null,200,null);
  stopProgram(wordFrequencyService2,null,200,null);
  stopProgram(wordFrequencyServiceDefault,null,200,null);
  Id.Artifact sleepWorkflowArtifactId=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str",VERSION1);
  addAppArtifact(sleepWorkflowArtifactId,SleepingWorkflowApp.class);
  AppRequest<? extends Config> sleepWorkflowRequest=new AppRequest<>(new ArtifactSummary(sleepWorkflowArtifactId.getName(),sleepWorkflowArtifactId.getVersion().getVersion()));
  ApplicationId sleepWorkflowApp1=new ApplicationId(Id.Namespace.DEFAULT.getId(),"String_Node_Str",VERSION1);
  ProgramId sleepWorkflow1=sleepWorkflowApp1.program(ProgramType.WORKFLOW,"String_Node_Str");
  ApplicationId sleepWorkflowApp2=new ApplicationId(Id.Namespace.DEFAULT.getId(),"String_Node_Str",VERSION2);
  ProgramId sleepWorkflow2=sleepWorkflowApp2.program(ProgramType.WORKFLOW,"String_Node_Str");
  Assert.assertEquals(200,deploy(sleepWorkflowApp1,sleepWorkflowRequest).getStatusLine().getStatusCode());
  Assert.assertEquals(STOPPED,getProgramStatus(sleepWorkflow1));
  startProgram(sleepWorkflow2,404);
  Assert.assertEquals(200,deploy(sleepWorkflowApp2,sleepWorkflowRequest).getStatusLine().getStatusCode());
  startProgram(sleepWorkflow1,200);
  startProgram(sleepWorkflow2,200);
  startProgram(sleepWorkflow1,200);
  startProgram(sleepWorkflow2,200);
  stopProgram(sleepWorkflow1,null,200,null);
  stopProgram(sleepWorkflow2,null,200,null);
  Assert.assertEquals(STOPPED,getProgramStatus(sleepWorkflow1));
  Assert.assertEquals(STOPPED,getProgramStatus(sleepWorkflow2));
  testVersionedProgramRuntimeArgs(sleepWorkflow1);
  deleteApp(wordCountApp1,200);
  deleteApp(wordCountApp2,200);
  deleteApp(wordCountAppDefault,200);
  deleteApp(sleepWorkflowApp1,200);
  deleteApp(sleepWorkflowApp2,200);
}