Program: 6689
Project: 6689
Buggy source:
@Test public void testAllProgramsLineage() throws Exception {
  String namespace="String_Node_Str";
  Id.Application app=Id.Application.from(namespace,AllProgramsApp.NAME);
  Id.Flow flow=Id.Flow.from(app,AllProgramsApp.NoOpFlow.NAME);
  Id.Program mapreduce=Id.Program.from(app,ProgramType.MAPREDUCE,AllProgramsApp.NoOpMR.NAME);
  Id.Program spark=Id.Program.from(app,ProgramType.SPARK,AllProgramsApp.NoOpSpark.NAME);
  Id.Program service=Id.Program.from(app,ProgramType.SERVICE,AllProgramsApp.NoOpService.NAME);
  Id.Program worker=Id.Program.from(app,ProgramType.WORKER,AllProgramsApp.NoOpWorker.NAME);
  Id.Program workflow=Id.Program.from(app,ProgramType.WORKFLOW,AllProgramsApp.NoOpWorkflow.NAME);
  Id.DatasetInstance dataset=Id.DatasetInstance.from(namespace,AllProgramsApp.DATASET_NAME);
  Id.Stream stream=Id.Stream.from(namespace,AllProgramsApp.STREAM_NAME);
  Assert.assertEquals(200,status(createNamespace(namespace)));
  try {
    Assert.assertEquals(200,status(deploy(AllProgramsApp.class,Constants.Gateway.API_VERSION_3_TOKEN,namespace)));
    ImmutableSet<String> sparkTags=ImmutableSet.of("String_Node_Str","String_Node_Str");
    addTags(spark,sparkTags);
    Assert.assertEquals(sparkTags,getTags(spark));
    ImmutableSet<String> workerTags=ImmutableSet.of("String_Node_Str");
    addTags(worker,workerTags);
    Assert.assertEquals(workerTags,getTags(worker));
    ImmutableMap<String,String> datasetProperties=ImmutableMap.of("String_Node_Str","String_Node_Str");
    addProperties(dataset,datasetProperties);
    Assert.assertEquals(datasetProperties,getProperties(dataset));
    RunId flowRunId=runAndWait(flow);
    RunId mrRunId=runAndWait(mapreduce);
    RunId sparkRunId=runAndWait(spark);
    runAndWait(workflow);
    RunId workflowMrRunId=getRunId(mapreduce,mrRunId);
    RunId serviceRunId=runAndWait(service);
    RunId workerRunId=runAndWait(worker);
    waitForStop(flow,true);
    waitForStop(mapreduce,false);
    waitForStop(spark,false);
    waitForStop(workflow,false);
    waitForStop(worker,false);
    waitForStop(service,true);
    long now=System.currentTimeMillis();
    long oneHourMillis=TimeUnit.HOURS.toMillis(1);
    HttpResponse httpResponse=fetchLineage(dataset,now - oneHourMillis,now + oneHourMillis,10);
    Assert.assertEquals(200,httpResponse.getResponseCode());
    LineageRecord lineage=GSON.fromJson(httpResponse.getResponseBodyAsString(),LineageRecord.class);
    LineageRecord expected=new LineageRecord(now - oneHourMillis,now + oneHourMillis,ImmutableSet.of(new Relation(dataset,flow,AccessType.UNKNOWN,ImmutableSet.of(flowRunId),ImmutableSet.of(Id.Flow.Flowlet.from(flow,AllProgramsApp.A.NAME))),new Relation(dataset,mapreduce,AccessType.UNKNOWN,ImmutableSet.of(mrRunId)),new Relation(dataset,spark,AccessType.UNKNOWN,ImmutableSet.of(sparkRunId)),new Relation(dataset,mapreduce,AccessType.UNKNOWN,ImmutableSet.of(workflowMrRunId)),new Relation(dataset,service,AccessType.UNKNOWN,ImmutableSet.of(serviceRunId)),new Relation(dataset,worker,AccessType.UNKNOWN,ImmutableSet.of(workerRunId)),new Relation(stream,flow,AccessType.READ,ImmutableSet.of(flowRunId),ImmutableSet.of(Id.Flow.Flowlet.from(flow,AllProgramsApp.A.NAME))),new Relation(stream,mapreduce,AccessType.READ,ImmutableSet.of(mrRunId)),new Relation(stream,spark,AccessType.READ,ImmutableSet.of(sparkRunId)),new Relation(stream,mapreduce,AccessType.READ,ImmutableSet.of(workflowMrRunId)),new Relation(stream,worker,AccessType.WRITE,ImmutableSet.of(workerRunId))));
    Assert.assertEquals(expected,lineage);
    httpResponse=fetchLineage(stream,now - oneHourMillis,now + oneHourMillis,10);
    Assert.assertEquals(200,httpResponse.getResponseCode());
    lineage=GSON.fromJson(httpResponse.getResponseBodyAsString(),LineageRecord.class);
    Assert.assertEquals(expected,lineage);
    Id.Program programForFlow=Id.Program.from(flow.getApplication(),flow.getType(),flow.getId());
    Assert.assertEquals(toSet(new MetadataRecord(app,emptyMap(),emptySet()),new MetadataRecord(programForFlow,emptyMap(),emptySet()),new MetadataRecord(dataset,datasetProperties,emptySet()),new MetadataRecord(stream,emptyMap(),emptySet())),fetchAccesses(new Id.Run(flow,flowRunId.getId())));
    Id.Program programForWorker=Id.Program.from(worker.getApplication(),worker.getType(),worker.getId());
    Assert.assertEquals(toSet(new MetadataRecord(app,emptyMap(),emptySet()),new MetadataRecord(programForWorker,emptyMap(),workerTags),new MetadataRecord(dataset,datasetProperties,emptySet()),new MetadataRecord(stream,emptyMap(),emptySet())),fetchAccesses(new Id.Run(worker,workerRunId.getId())));
    Id.Program programForSpark=Id.Program.from(spark.getApplication(),spark.getType(),spark.getId());
    Assert.assertEquals(toSet(new MetadataRecord(app,emptyMap(),emptySet()),new MetadataRecord(programForSpark,emptyMap(),sparkTags),new MetadataRecord(dataset,datasetProperties,emptySet()),new MetadataRecord(stream,emptyMap(),emptySet())),fetchAccesses(new Id.Run(spark,sparkRunId.getId())));
  }
  finally {
    try {
      deleteNamespace(namespace);
    }
 catch (    Throwable e) {
      LOG.error("String_Node_Str",namespace,e);
    }
  }
}

Fixed version (ground truth):
@Test public void testAllProgramsLineage() throws Exception {
  String namespace="String_Node_Str";
  Id.Application app=Id.Application.from(namespace,AllProgramsApp.NAME);
  Id.Flow flow=Id.Flow.from(app,AllProgramsApp.NoOpFlow.NAME);
  Id.Program mapreduce=Id.Program.from(app,ProgramType.MAPREDUCE,AllProgramsApp.NoOpMR.NAME);
  Id.Program spark=Id.Program.from(app,ProgramType.SPARK,AllProgramsApp.NoOpSpark.NAME);
  Id.Program service=Id.Program.from(app,ProgramType.SERVICE,AllProgramsApp.NoOpService.NAME);
  Id.Program worker=Id.Program.from(app,ProgramType.WORKER,AllProgramsApp.NoOpWorker.NAME);
  Id.Program workflow=Id.Program.from(app,ProgramType.WORKFLOW,AllProgramsApp.NoOpWorkflow.NAME);
  Id.DatasetInstance dataset=Id.DatasetInstance.from(namespace,AllProgramsApp.DATASET_NAME);
  Id.Stream stream=Id.Stream.from(namespace,AllProgramsApp.STREAM_NAME);
  Assert.assertEquals(200,status(createNamespace(namespace)));
  try {
    Assert.assertEquals(200,status(deploy(AllProgramsApp.class,Constants.Gateway.API_VERSION_3_TOKEN,namespace)));
    ImmutableSet<String> sparkTags=ImmutableSet.of("String_Node_Str","String_Node_Str");
    addTags(spark,sparkTags);
    Assert.assertEquals(sparkTags,getTags(spark));
    ImmutableSet<String> workerTags=ImmutableSet.of("String_Node_Str");
    addTags(worker,workerTags);
    Assert.assertEquals(workerTags,getTags(worker));
    ImmutableMap<String,String> datasetProperties=ImmutableMap.of("String_Node_Str","String_Node_Str");
    addProperties(dataset,datasetProperties);
    Assert.assertEquals(datasetProperties,getProperties(dataset));
    RunId flowRunId=runAndWait(flow);
    RunId mrRunId=runAndWait(mapreduce);
    RunId sparkRunId=runAndWait(spark);
    runAndWait(workflow);
    RunId workflowMrRunId=getRunId(mapreduce,mrRunId);
    RunId serviceRunId=runAndWait(service);
    RunId workerRunId=runAndWait(worker);
    waitForStop(flow,true);
    waitForStop(mapreduce,false);
    waitForStop(spark,false);
    waitForStop(workflow,false);
    waitForStop(worker,false);
    waitForStop(service,true);
    long now=System.currentTimeMillis();
    long oneHourMillis=TimeUnit.HOURS.toMillis(1);
    HttpResponse httpResponse=fetchLineage(dataset,now - oneHourMillis,now + oneHourMillis,10);
    Assert.assertEquals(200,httpResponse.getResponseCode());
    LineageRecord lineage=GSON.fromJson(httpResponse.getResponseBodyAsString(),LineageRecord.class);
    LineageRecord expected=new LineageRecord(now - oneHourMillis,now + oneHourMillis,ImmutableSet.of(new Relation(dataset,flow,AccessType.UNKNOWN,ImmutableSet.of(flowRunId),ImmutableSet.of(Id.Flow.Flowlet.from(flow,AllProgramsApp.A.NAME))),new Relation(dataset,mapreduce,AccessType.UNKNOWN,ImmutableSet.of(mrRunId)),new Relation(dataset,spark,AccessType.UNKNOWN,ImmutableSet.of(sparkRunId)),new Relation(dataset,mapreduce,AccessType.UNKNOWN,ImmutableSet.of(workflowMrRunId)),new Relation(dataset,service,AccessType.UNKNOWN,ImmutableSet.of(serviceRunId)),new Relation(dataset,worker,AccessType.UNKNOWN,ImmutableSet.of(workerRunId)),new Relation(stream,flow,AccessType.READ,ImmutableSet.of(flowRunId),ImmutableSet.of(Id.Flow.Flowlet.from(flow,AllProgramsApp.A.NAME))),new Relation(stream,mapreduce,AccessType.READ,ImmutableSet.of(mrRunId)),new Relation(stream,spark,AccessType.READ,ImmutableSet.of(sparkRunId)),new Relation(stream,mapreduce,AccessType.READ,ImmutableSet.of(workflowMrRunId)),new Relation(stream,worker,AccessType.WRITE,ImmutableSet.of(workerRunId))));
    Assert.assertEquals(expected,lineage);
    httpResponse=fetchLineage(stream,now - oneHourMillis,now + oneHourMillis,10);
    Assert.assertEquals(200,httpResponse.getResponseCode());
    lineage=GSON.fromJson(httpResponse.getResponseBodyAsString(),LineageRecord.class);
    Assert.assertEquals(expected,lineage);
    Id.Program programForFlow=Id.Program.from(flow.getApplication(),flow.getType(),flow.getId());
    Assert.assertEquals(toSet(new MetadataRecord(app,emptyMap(),emptySet()),new MetadataRecord(programForFlow,emptyMap(),emptySet()),new MetadataRecord(dataset,datasetProperties,emptySet()),new MetadataRecord(stream,emptyMap(),emptySet())),fetchRunMetadata(new Id.Run(flow,flowRunId.getId())));
    Id.Program programForWorker=Id.Program.from(worker.getApplication(),worker.getType(),worker.getId());
    Assert.assertEquals(toSet(new MetadataRecord(app,emptyMap(),emptySet()),new MetadataRecord(programForWorker,emptyMap(),workerTags),new MetadataRecord(dataset,datasetProperties,emptySet()),new MetadataRecord(stream,emptyMap(),emptySet())),fetchRunMetadata(new Id.Run(worker,workerRunId.getId())));
    Id.Program programForSpark=Id.Program.from(spark.getApplication(),spark.getType(),spark.getId());
    Assert.assertEquals(toSet(new MetadataRecord(app,emptyMap(),emptySet()),new MetadataRecord(programForSpark,emptyMap(),sparkTags),new MetadataRecord(dataset,datasetProperties,emptySet()),new MetadataRecord(stream,emptyMap(),emptySet())),fetchRunMetadata(new Id.Run(spark,sparkRunId.getId())));
  }
  finally {
    try {
      deleteNamespace(namespace);
    }
 catch (    Throwable e) {
      LOG.error("String_Node_Str",namespace,e);
    }
  }
}