Program: 6224
Project: 6224
Buggy source:
@Test public void testGetPlugins() throws Exception {
  Id.Artifact wordCount1Id=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),addAppArtifact(wordCount1Id,WordCountApp.class).getStatusLine().getStatusCode());
  Id.Artifact wordCount2Id=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),addAppArtifact(wordCount2Id,WordCountApp.class).getStatusLine().getStatusCode());
  Manifest manifest=new Manifest();
  manifest.getMainAttributes().put(ManifestFields.EXPORT_PACKAGE,Plugin1.class.getPackage().getName());
  Id.Artifact pluginsId1=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  Set<ArtifactRange> plugins1Parents=Sets.newHashSet(new ArtifactRange(Id.Namespace.DEFAULT,"String_Node_Str",new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str")));
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),addPluginArtifact(pluginsId1,Plugin1.class,manifest,plugins1Parents).getStatusLine().getStatusCode());
  Id.Artifact pluginsId2=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  Set<ArtifactRange> plugins2Parents=Sets.newHashSet(new ArtifactRange(Id.Namespace.DEFAULT,"String_Node_Str",new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str")));
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),addPluginArtifact(pluginsId2,Plugin1.class,manifest,plugins2Parents).getStatusLine().getStatusCode());
  ArtifactSummary plugins1Artifact=new ArtifactSummary("String_Node_Str","String_Node_Str");
  ArtifactSummary plugins2Artifact=new ArtifactSummary("String_Node_Str","String_Node_Str");
  Set<String> expectedTypes=Sets.newHashSet("String_Node_Str","String_Node_Str");
  Set<String> actualTypes=getPluginTypes(wordCount1Id);
  Assert.assertEquals(expectedTypes,actualTypes);
  actualTypes=getPluginTypes(wordCount2Id);
  Assert.assertEquals(expectedTypes,actualTypes);
  Set<PluginSummary> expectedSummaries=Sets.newHashSet(new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins1Artifact),new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins2Artifact));
  Set<PluginSummary> actualSummaries=getPluginSummaries(wordCount1Id,"String_Node_Str");
  Assert.assertEquals(expectedSummaries,actualSummaries);
  expectedSummaries=Sets.newHashSet(new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins1Artifact),new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins2Artifact));
  actualSummaries=getPluginSummaries(wordCount1Id,"String_Node_Str");
  Assert.assertEquals(expectedSummaries,actualSummaries);
  expectedSummaries=Sets.newHashSet(new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins2Artifact));
  actualSummaries=getPluginSummaries(wordCount2Id,"String_Node_Str");
  Assert.assertEquals(expectedSummaries,actualSummaries);
  expectedSummaries=Sets.newHashSet(new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins2Artifact));
  actualSummaries=getPluginSummaries(wordCount2Id,"String_Node_Str");
  Assert.assertEquals(expectedSummaries,actualSummaries);
  Map<String,PluginPropertyField> p1Properties=ImmutableMap.of("String_Node_Str",new PluginPropertyField("String_Node_Str","String_Node_Str","String_Node_Str",true),"String_Node_Str",new PluginPropertyField("String_Node_Str","String_Node_Str","String_Node_Str",true));
  Map<String,PluginPropertyField> p2Properties=ImmutableMap.of("String_Node_Str",new PluginPropertyField("String_Node_Str","String_Node_Str","String_Node_Str",true));
  Set<PluginInfo> expectedInfos=Sets.newHashSet(new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins1Artifact,p1Properties),new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins2Artifact,p1Properties));
  Assert.assertEquals(expectedInfos,getPluginInfos(wordCount1Id,"String_Node_Str","String_Node_Str"));
  expectedInfos=Sets.newHashSet(new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins1Artifact,p2Properties),new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins2Artifact,p2Properties));
  Assert.assertEquals(expectedInfos,getPluginInfos(wordCount1Id,"String_Node_Str","String_Node_Str"));
  expectedInfos=Sets.newHashSet(new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins2Artifact,p1Properties));
  Assert.assertEquals(expectedInfos,getPluginInfos(wordCount2Id,"String_Node_Str","String_Node_Str"));
  expectedInfos=Sets.newHashSet(new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins2Artifact,p2Properties));
  Assert.assertEquals(expectedInfos,getPluginInfos(wordCount2Id,"String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testGetPlugins() throws Exception {
  Id.Artifact wordCount1Id=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),addAppArtifact(wordCount1Id,WordCountApp.class).getStatusLine().getStatusCode());
  Id.Artifact wordCount2Id=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),addAppArtifact(wordCount2Id,WordCountApp.class).getStatusLine().getStatusCode());
  Manifest manifest=new Manifest();
  manifest.getMainAttributes().put(ManifestFields.EXPORT_PACKAGE,Plugin1.class.getPackage().getName());
  Id.Artifact pluginsId1=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  Set<ArtifactRange> plugins1Parents=Sets.newHashSet(new ArtifactRange(Id.Namespace.DEFAULT,"String_Node_Str",new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str")));
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),addPluginArtifact(pluginsId1,Plugin1.class,manifest,plugins1Parents).getStatusLine().getStatusCode());
  Id.Artifact pluginsId2=Id.Artifact.from(Id.Namespace.DEFAULT,"String_Node_Str","String_Node_Str");
  Set<ArtifactRange> plugins2Parents=Sets.newHashSet(new ArtifactRange(Id.Namespace.DEFAULT,"String_Node_Str",new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str")));
  Assert.assertEquals(HttpResponseStatus.OK.getCode(),addPluginArtifact(pluginsId2,Plugin1.class,manifest,plugins2Parents).getStatusLine().getStatusCode());
  ArtifactSummary plugins1Artifact=new ArtifactSummary("String_Node_Str","String_Node_Str");
  ArtifactSummary plugins2Artifact=new ArtifactSummary("String_Node_Str","String_Node_Str");
  Set<String> expectedTypes=Sets.newHashSet("String_Node_Str","String_Node_Str");
  Set<String> actualTypes=getPluginTypes(wordCount1Id);
  Assert.assertEquals(expectedTypes,actualTypes);
  actualTypes=getPluginTypes(wordCount2Id);
  Assert.assertEquals(expectedTypes,actualTypes);
  Set<PluginSummary> expectedSummaries=Sets.newHashSet(new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins1Artifact),new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins2Artifact));
  Set<PluginSummary> actualSummaries=getPluginSummaries(wordCount1Id,"String_Node_Str");
  Assert.assertEquals(expectedSummaries,actualSummaries);
  expectedSummaries=Sets.newHashSet(new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins1Artifact),new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins2Artifact));
  actualSummaries=getPluginSummaries(wordCount1Id,"String_Node_Str");
  Assert.assertEquals(expectedSummaries,actualSummaries);
  expectedSummaries=Sets.newHashSet(new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins2Artifact));
  actualSummaries=getPluginSummaries(wordCount2Id,"String_Node_Str");
  Assert.assertEquals(expectedSummaries,actualSummaries);
  expectedSummaries=Sets.newHashSet(new PluginSummary("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins2Artifact));
  actualSummaries=getPluginSummaries(wordCount2Id,"String_Node_Str");
  Assert.assertEquals(expectedSummaries,actualSummaries);
  Map<String,PluginPropertyField> p1Properties=ImmutableMap.of("String_Node_Str",new PluginPropertyField("String_Node_Str","String_Node_Str","String_Node_Str",true),"String_Node_Str",new PluginPropertyField("String_Node_Str","String_Node_Str","String_Node_Str",true));
  Map<String,PluginPropertyField> p2Properties=ImmutableMap.of("String_Node_Str",new PluginPropertyField("String_Node_Str","String_Node_Str","String_Node_Str",true));
  Set<PluginInfo> expectedInfos=Sets.newHashSet(new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins1Artifact,p1Properties,new HashSet<String>()),new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins2Artifact,p1Properties,new HashSet<String>()));
  Assert.assertEquals(expectedInfos,getPluginInfos(wordCount1Id,"String_Node_Str","String_Node_Str"));
  expectedInfos=Sets.newHashSet(new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins1Artifact,p2Properties,new HashSet<String>()),new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins2Artifact,p2Properties,new HashSet<String>()));
  Assert.assertEquals(expectedInfos,getPluginInfos(wordCount1Id,"String_Node_Str","String_Node_Str"));
  expectedInfos=Sets.newHashSet(new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin1.class.getName(),plugins2Artifact,p1Properties,new HashSet<String>()));
  Assert.assertEquals(expectedInfos,getPluginInfos(wordCount2Id,"String_Node_Str","String_Node_Str"));
  expectedInfos=Sets.newHashSet(new PluginInfo("String_Node_Str","String_Node_Str","String_Node_Str",Plugin2.class.getName(),plugins2Artifact,p2Properties,new HashSet<String>()));
  Assert.assertEquals(expectedInfos,getPluginInfos(wordCount2Id,"String_Node_Str","String_Node_Str"));
}