Program: 6645
Project: 6645
Buggy source:
@Category(XSlowTests.class) @Test public void testWorkflowScopedArguments() throws Exception {
  String workflowAppWithScopedParameters="String_Node_Str";
  String workflowAppWithScopedParameterWorkflow="String_Node_Str";
  HttpResponse response=deploy(WorkflowAppWithScopedParameters.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  Id.Program programId=Id.Program.from(TEST_NAMESPACE2,workflowAppWithScopedParameters,ProgramType.WORKFLOW,workflowAppWithScopedParameterWorkflow);
  Map<String,String> runtimeArguments=Maps.newHashMap();
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str",createInput("String_Node_Str"));
  runtimeArguments.put("String_Node_Str",createInput("String_Node_Str"));
  runtimeArguments.put("String_Node_Str",createInput("String_Node_Str"));
  runtimeArguments.put("String_Node_Str",createInput("String_Node_Str"));
  runtimeArguments.put("String_Node_Str",new File(tmpFolder.newFolder(),"String_Node_Str").getAbsolutePath());
  runtimeArguments.put("String_Node_Str",new File(tmpFolder.newFolder(),"String_Node_Str").getAbsolutePath());
  runtimeArguments.put("String_Node_Str",new File(tmpFolder.newFolder(),"String_Node_Str").getAbsolutePath());
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  setAndTestRuntimeArgs(programId,runtimeArguments);
  startProgram(programId);
  verifyProgramRuns(programId,"String_Node_Str");
  List<RunRecord> workflowHistoryRuns=getProgramRuns(programId,"String_Node_Str");
  Id.Program mr1ProgramId=Id.Program.from(TEST_NAMESPACE2,workflowAppWithScopedParameters,ProgramType.MAPREDUCE,"String_Node_Str");
  List<RunRecord> oneMRHistoryRuns=getProgramRuns(mr1ProgramId,"String_Node_Str");
  Id.Program mr2ProgramId=Id.Program.from(TEST_NAMESPACE2,workflowAppWithScopedParameters,ProgramType.MAPREDUCE,"String_Node_Str");
  List<RunRecord> anotherMRHistoryRuns=getProgramRuns(mr2ProgramId,"String_Node_Str");
  Id.Program spark1ProgramId=Id.Program.from(TEST_NAMESPACE2,workflowAppWithScopedParameters,ProgramType.SPARK,"String_Node_Str");
  List<RunRecord> oneSparkHistoryRuns=getProgramRuns(spark1ProgramId,"String_Node_Str");
  Id.Program spark2ProgramId=Id.Program.from(TEST_NAMESPACE2,workflowAppWithScopedParameters,ProgramType.SPARK,"String_Node_Str");
  List<RunRecord> anotherSparkHistoryRuns=getProgramRuns(spark2ProgramId,"String_Node_Str");
  Assert.assertEquals(1,workflowHistoryRuns.size());
  Assert.assertEquals(1,oneMRHistoryRuns.size());
  Assert.assertEquals(1,anotherMRHistoryRuns.size());
  Assert.assertEquals(1,oneSparkHistoryRuns.size());
  Assert.assertEquals(1,anotherSparkHistoryRuns.size());
  Map<String,String> workflowRunRecordProperties=workflowHistoryRuns.get(0).getProperties();
  Map<String,String> oneMRRunRecordProperties=oneMRHistoryRuns.get(0).getProperties();
  Map<String,String> anotherMRRunRecordProperties=anotherMRHistoryRuns.get(0).getProperties();
  Map<String,String> oneSparkRunRecordProperties=oneSparkHistoryRuns.get(0).getProperties();
  Map<String,String> anotherSparkRunRecordProperties=anotherSparkHistoryRuns.get(0).getProperties();
  Assert.assertNotNull(oneMRRunRecordProperties.get("String_Node_Str"));
  Assert.assertEquals(workflowHistoryRuns.get(0).getPid(),oneMRRunRecordProperties.get("String_Node_Str"));
  Assert.assertNotNull(anotherMRRunRecordProperties.get("String_Node_Str"));
  Assert.assertEquals(workflowHistoryRuns.get(0).getPid(),anotherMRRunRecordProperties.get("String_Node_Str"));
  Assert.assertNotNull(oneSparkRunRecordProperties.get("String_Node_Str"));
  Assert.assertEquals(workflowHistoryRuns.get(0).getPid(),oneSparkRunRecordProperties.get("String_Node_Str"));
  Assert.assertNotNull(anotherSparkRunRecordProperties.get("String_Node_Str"));
  Assert.assertEquals(workflowHistoryRuns.get(0).getPid(),anotherSparkRunRecordProperties.get("String_Node_Str"));
  Assert.assertEquals(workflowRunRecordProperties.get("String_Node_Str"),oneMRHistoryRuns.get(0).getPid());
  Assert.assertEquals(workflowRunRecordProperties.get("String_Node_Str"),oneSparkHistoryRuns.get(0).getPid());
  Assert.assertEquals(workflowRunRecordProperties.get("String_Node_Str"),anotherMRHistoryRuns.get(0).getPid());
  Assert.assertEquals(workflowRunRecordProperties.get("String_Node_Str"),anotherSparkHistoryRuns.get(0).getPid());
}

Fixed version (ground truth):
@Category(XSlowTests.class) @Test public void testWorkflowScopedArguments() throws Exception {
  String workflowAppWithScopedParameters="String_Node_Str";
  String workflowAppWithScopedParameterWorkflow="String_Node_Str";
  HttpResponse response=deploy(WorkflowAppWithScopedParameters.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  Id.Program programId=Id.Program.from(TEST_NAMESPACE2,workflowAppWithScopedParameters,ProgramType.WORKFLOW,workflowAppWithScopedParameterWorkflow);
  Map<String,String> runtimeArguments=Maps.newHashMap();
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str",createInput("String_Node_Str"));
  runtimeArguments.put("String_Node_Str",createInput("String_Node_Str"));
  runtimeArguments.put("String_Node_Str",createInput("String_Node_Str"));
  runtimeArguments.put("String_Node_Str",createInput("String_Node_Str"));
  runtimeArguments.put("String_Node_Str",new File(tmpFolder.newFolder(),"String_Node_Str").getAbsolutePath());
  runtimeArguments.put("String_Node_Str",new File(tmpFolder.newFolder(),"String_Node_Str").getAbsolutePath());
  runtimeArguments.put("String_Node_Str",new File(tmpFolder.newFolder(),"String_Node_Str").getAbsolutePath());
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  runtimeArguments.put("String_Node_Str","String_Node_Str");
  setAndTestRuntimeArgs(programId,runtimeArguments);
  startProgram(programId);
  waitState(programId,"String_Node_Str");
  List<RunRecord> workflowHistoryRuns=getProgramRuns(programId,"String_Node_Str");
  String workflowRunId=workflowHistoryRuns.get(0).getPid();
  Id.Program mr1ProgramId=Id.Program.from(TEST_NAMESPACE2,workflowAppWithScopedParameters,ProgramType.MAPREDUCE,"String_Node_Str");
  waitState(mr1ProgramId,"String_Node_Str");
  List<RunRecord> oneMRHistoryRuns=getProgramRuns(mr1ProgramId,"String_Node_Str");
  String expectedMessage=String.format("String_Node_Str" + "String_Node_Str",new Id.Run(mr1ProgramId,oneMRHistoryRuns.get(0).getPid()),workflowRunId);
  stopProgram(mr1ProgramId,oneMRHistoryRuns.get(0).getPid(),400,expectedMessage);
  verifyProgramRuns(programId,"String_Node_Str");
  workflowHistoryRuns=getProgramRuns(programId,"String_Node_Str");
  oneMRHistoryRuns=getProgramRuns(mr1ProgramId,"String_Node_Str");
  Id.Program mr2ProgramId=Id.Program.from(TEST_NAMESPACE2,workflowAppWithScopedParameters,ProgramType.MAPREDUCE,"String_Node_Str");
  List<RunRecord> anotherMRHistoryRuns=getProgramRuns(mr2ProgramId,"String_Node_Str");
  Id.Program spark1ProgramId=Id.Program.from(TEST_NAMESPACE2,workflowAppWithScopedParameters,ProgramType.SPARK,"String_Node_Str");
  List<RunRecord> oneSparkHistoryRuns=getProgramRuns(spark1ProgramId,"String_Node_Str");
  Id.Program spark2ProgramId=Id.Program.from(TEST_NAMESPACE2,workflowAppWithScopedParameters,ProgramType.SPARK,"String_Node_Str");
  List<RunRecord> anotherSparkHistoryRuns=getProgramRuns(spark2ProgramId,"String_Node_Str");
  Assert.assertEquals(1,workflowHistoryRuns.size());
  Assert.assertEquals(1,oneMRHistoryRuns.size());
  Assert.assertEquals(1,anotherMRHistoryRuns.size());
  Assert.assertEquals(1,oneSparkHistoryRuns.size());
  Assert.assertEquals(1,anotherSparkHistoryRuns.size());
  Map<String,String> workflowRunRecordProperties=workflowHistoryRuns.get(0).getProperties();
  Map<String,String> oneMRRunRecordProperties=oneMRHistoryRuns.get(0).getProperties();
  Map<String,String> anotherMRRunRecordProperties=anotherMRHistoryRuns.get(0).getProperties();
  Map<String,String> oneSparkRunRecordProperties=oneSparkHistoryRuns.get(0).getProperties();
  Map<String,String> anotherSparkRunRecordProperties=anotherSparkHistoryRuns.get(0).getProperties();
  Assert.assertNotNull(oneMRRunRecordProperties.get("String_Node_Str"));
  Assert.assertEquals(workflowHistoryRuns.get(0).getPid(),oneMRRunRecordProperties.get("String_Node_Str"));
  Assert.assertNotNull(anotherMRRunRecordProperties.get("String_Node_Str"));
  Assert.assertEquals(workflowHistoryRuns.get(0).getPid(),anotherMRRunRecordProperties.get("String_Node_Str"));
  Assert.assertNotNull(oneSparkRunRecordProperties.get("String_Node_Str"));
  Assert.assertEquals(workflowHistoryRuns.get(0).getPid(),oneSparkRunRecordProperties.get("String_Node_Str"));
  Assert.assertNotNull(anotherSparkRunRecordProperties.get("String_Node_Str"));
  Assert.assertEquals(workflowHistoryRuns.get(0).getPid(),anotherSparkRunRecordProperties.get("String_Node_Str"));
  Assert.assertEquals(workflowRunRecordProperties.get("String_Node_Str"),oneMRHistoryRuns.get(0).getPid());
  Assert.assertEquals(workflowRunRecordProperties.get("String_Node_Str"),oneSparkHistoryRuns.get(0).getPid());
  Assert.assertEquals(workflowRunRecordProperties.get("String_Node_Str"),anotherMRHistoryRuns.get(0).getPid());
  Assert.assertEquals(workflowRunRecordProperties.get("String_Node_Str"),anotherSparkHistoryRuns.get(0).getPid());
}