Program: 7227
Project: 7227
Buggy source:
@Test public void testPartitionedCounting() throws Exception {
  ApplicationManager appManager=getTestManager().deployApplication(SportResults.class);
  ServiceManager serviceManager=appManager.startService("String_Node_Str");
  serviceManager.waitForStatus(true);
  URL url=serviceManager.getServiceURL();
  uploadResults(url,"String_Node_Str",2014,FANTASY_2014);
  uploadResults(url,"String_Node_Str",2015,FANTASY_2015);
  uploadResults(url,"String_Node_Str",2014,CRITTERS_2014);
  MapReduceManager mrManager=appManager.startMapReduce("String_Node_Str",ImmutableMap.of("String_Node_Str","String_Node_Str"));
  mrManager.waitForFinish(5,TimeUnit.MINUTES);
  DataSetManager<PartitionedFileSet> dataSetManager=getTestManager().getDataset("String_Node_Str");
  PartitionedFileSet totals=dataSetManager.get();
  String path=totals.getPartition(PartitionKey.builder().addStringField("String_Node_Str","String_Node_Str").build());
  Assert.assertNotNull(path);
  Location location=totals.getEmbeddedFileSet().getLocation(path);
  Assert.assertTrue(location.isDirectory());
  for (  Location file : location.list()) {
    if (file.getName().startsWith("String_Node_Str")) {
      location=file;
    }
  }
  BufferedReader reader=new BufferedReader(new InputStreamReader(location.getInputStream()));
  Map<String,String[]> expected=ImmutableMap.of("String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  while (true) {
    String line=reader.readLine();
    if (line == null) {
      break;
    }
    String[] fields=line.split("String_Node_Str");
    Assert.assertArrayEquals(expected.get(fields[0]),fields);
  }
  Connection connection=getTestManager().getQueryClient();
  ResultSet results=connection.prepareStatement("String_Node_Str" + "String_Node_Str").executeQuery();
  Assert.assertTrue(results.next());
  Assert.assertEquals(2,results.getInt(1));
  Assert.assertEquals(0,results.getInt(2));
  Assert.assertEquals(1,results.getInt(3));
  Assert.assertEquals(53,results.getInt(4));
  Assert.assertEquals(65,results.getInt(5));
  Assert.assertFalse(results.next());
}

Fixed version (ground truth):
@Test public void testPartitionedCounting() throws Exception {
  ApplicationManager appManager=deployApplication(SportResults.class);
  ServiceManager serviceManager=appManager.startService("String_Node_Str");
  serviceManager.waitForStatus(true);
  URL url=serviceManager.getServiceURL();
  uploadResults(url,"String_Node_Str",2014,FANTASY_2014);
  uploadResults(url,"String_Node_Str",2015,FANTASY_2015);
  uploadResults(url,"String_Node_Str",2014,CRITTERS_2014);
  MapReduceManager mrManager=appManager.startMapReduce("String_Node_Str",ImmutableMap.of("String_Node_Str","String_Node_Str"));
  mrManager.waitForFinish(5,TimeUnit.MINUTES);
  DataSetManager<PartitionedFileSet> dataSetManager=getDataset("String_Node_Str");
  PartitionedFileSet totals=dataSetManager.get();
  String path=totals.getPartition(PartitionKey.builder().addStringField("String_Node_Str","String_Node_Str").build());
  Assert.assertNotNull(path);
  Location location=totals.getEmbeddedFileSet().getLocation(path);
  Assert.assertTrue(location.isDirectory());
  for (  Location file : location.list()) {
    if (file.getName().startsWith("String_Node_Str")) {
      location=file;
    }
  }
  BufferedReader reader=new BufferedReader(new InputStreamReader(location.getInputStream()));
  Map<String,String[]> expected=ImmutableMap.of("String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"},"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  while (true) {
    String line=reader.readLine();
    if (line == null) {
      break;
    }
    String[] fields=line.split("String_Node_Str");
    Assert.assertArrayEquals(expected.get(fields[0]),fields);
  }
  Connection connection=getQueryClient();
  ResultSet results=connection.prepareStatement("String_Node_Str" + "String_Node_Str").executeQuery();
  Assert.assertTrue(results.next());
  Assert.assertEquals(2,results.getInt(1));
  Assert.assertEquals(0,results.getInt(2));
  Assert.assertEquals(1,results.getInt(3));
  Assert.assertEquals(53,results.getInt(4));
  Assert.assertEquals(65,results.getInt(5));
  Assert.assertFalse(results.next());
}