Program: 6417
Project: 6417
Buggy source:
@Test public void testAppWithPlugin() throws Exception {
  Id.Artifact artifactId=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  addAppArtifact(artifactId,AppWithPlugin.class);
  Id.Artifact pluginArtifactId=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  addPluginArtifact(pluginArtifactId,artifactId,ToStringPlugin.class);
  Id.Application appId=Id.Application.from(Id.Namespace.DEFAULT,"String_Node_Str");
  AppRequest createRequest=new AppRequest(new ArtifactSummary(artifactId.getName(),artifactId.getVersion().getVersion()));
  ApplicationManager appManager=deployApplication(appId,createRequest);
  WorkerManager workerManager=appManager.getWorkerManager(AppWithPlugin.WORKER);
  workerManager.start();
  workerManager.waitForStatus(false,5,1);
  List<RunRecord> workerRun=workerManager.getHistory(ProgramRunStatus.COMPLETED);
  Assert.assertFalse(workerRun.isEmpty());
  ServiceManager serviceManager=appManager.getServiceManager(AppWithPlugin.SERVICE);
  serviceManager.start();
  serviceManager.waitForStatus(true,1,10);
  URL serviceURL=serviceManager.getServiceURL(5,TimeUnit.SECONDS);
  callServiceGet(serviceURL,"String_Node_Str");
  serviceManager.stop();
  serviceManager.waitForStatus(false,1,10);
  List<RunRecord> serviceRun=serviceManager.getHistory(ProgramRunStatus.KILLED);
  Assert.assertFalse(serviceRun.isEmpty());
  MapReduceManager mrManager=appManager.getMapReduceManager(AppWithPlugin.MAPREDUCE);
  mrManager.start();
  mrManager.waitForFinish(10,TimeUnit.MINUTES);
  List<RunRecord> runRecords=mrManager.getHistory();
  Assert.assertNotEquals(ProgramRunStatus.FAILED,runRecords.get(0).getStatus());
  StreamManager streamManager=getStreamManager(AppWithPlugin.SPARK_STREAM);
  for (int i=0; i < 5; i++) {
    streamManager.send("String_Node_Str" + i);
  }
  SparkManager sparkManager=appManager.getSparkManager(AppWithPlugin.SPARK).start();
  sparkManager.waitForFinish(2,TimeUnit.MINUTES);
  DataSetManager<Table> dataSetManager=getDataset(AppWithPlugin.SPARK_TABLE);
  Table table=dataSetManager.get();
  Scanner scanner=table.scan(null,null);
  try {
    for (int i=0; i < 5; i++) {
      Row row=scanner.next();
      Assert.assertNotNull(row);
      String expected="String_Node_Str" + i + "String_Node_Str"+ AppWithPlugin.TEST;
      Assert.assertEquals(expected,Bytes.toString(row.getRow()));
      Assert.assertEquals(expected,Bytes.toString(row.get(expected)));
    }
    Assert.assertNull(scanner.next());
  }
  finally {
    scanner.close();
  }
}

Fixed version (ground truth):
@Test public void testAppWithPlugin() throws Exception {
  Id.Artifact artifactId=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  addAppArtifact(artifactId,AppWithPlugin.class);
  Id.Artifact pluginArtifactId=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  addPluginArtifact(pluginArtifactId,artifactId,ToStringPlugin.class);
  Id.Application appId=Id.Application.from(Id.Namespace.DEFAULT,"String_Node_Str");
  AppRequest createRequest=new AppRequest(new ArtifactSummary(artifactId.getName(),artifactId.getVersion().getVersion()));
  ApplicationManager appManager=deployApplication(appId,createRequest);
  final WorkerManager workerManager=appManager.getWorkerManager(AppWithPlugin.WORKER);
  workerManager.start();
  workerManager.waitForStatus(false,5,1);
  Tasks.waitFor(false,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      return workerManager.getHistory(ProgramRunStatus.COMPLETED).isEmpty();
    }
  }
,5,TimeUnit.SECONDS,10,TimeUnit.MILLISECONDS);
  final ServiceManager serviceManager=appManager.getServiceManager(AppWithPlugin.SERVICE);
  serviceManager.start();
  serviceManager.waitForStatus(true,1,10);
  URL serviceURL=serviceManager.getServiceURL(5,TimeUnit.SECONDS);
  callServiceGet(serviceURL,"String_Node_Str");
  serviceManager.stop();
  serviceManager.waitForStatus(false,1,10);
  Tasks.waitFor(false,new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      return serviceManager.getHistory(ProgramRunStatus.KILLED).isEmpty();
    }
  }
,5,TimeUnit.SECONDS,10,TimeUnit.MILLISECONDS);
  MapReduceManager mrManager=appManager.getMapReduceManager(AppWithPlugin.MAPREDUCE);
  mrManager.start();
  mrManager.waitForFinish(10,TimeUnit.MINUTES);
  List<RunRecord> runRecords=mrManager.getHistory();
  Assert.assertNotEquals(ProgramRunStatus.FAILED,runRecords.get(0).getStatus());
  StreamManager streamManager=getStreamManager(AppWithPlugin.SPARK_STREAM);
  for (int i=0; i < 5; i++) {
    streamManager.send("String_Node_Str" + i);
  }
  SparkManager sparkManager=appManager.getSparkManager(AppWithPlugin.SPARK).start();
  sparkManager.waitForFinish(2,TimeUnit.MINUTES);
  DataSetManager<Table> dataSetManager=getDataset(AppWithPlugin.SPARK_TABLE);
  Table table=dataSetManager.get();
  Scanner scanner=table.scan(null,null);
  try {
    for (int i=0; i < 5; i++) {
      Row row=scanner.next();
      Assert.assertNotNull(row);
      String expected="String_Node_Str" + i + "String_Node_Str"+ AppWithPlugin.TEST;
      Assert.assertEquals(expected,Bytes.toString(row.getRow()));
      Assert.assertEquals(expected,Bytes.toString(row.get(expected)));
    }
    Assert.assertNull(scanner.next());
  }
  finally {
    scanner.close();
  }
}