Program: 7228
Project: 7228
Buggy source:
@Test public void testStreamConversion() throws Exception {
  ApplicationManager appManager=getTestManager().deployApplication(StreamConversionApp.class);
  WorkflowManager workflowManager=appManager.startWorkflow("String_Node_Str",RuntimeArguments.NO_ARGUMENTS);
  workflowManager.getSchedule("String_Node_Str").suspend();
  StreamWriter streamWriter=appManager.getStreamWriter("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  long startTime=System.currentTimeMillis();
  MapReduceManager mapReduceManager=appManager.startMapReduce("String_Node_Str",RuntimeArguments.NO_ARGUMENTS);
  mapReduceManager.waitForFinish(5,TimeUnit.MINUTES);
  DataSetManager<TimePartitionedFileSet> fileSetManager=getTestManager().getDataset("String_Node_Str");
  TimePartitionedFileSet converted=fileSetManager.get();
  Map<Long,String> partitions=converted.getPartitions(startTime,System.currentTimeMillis());
  Assert.assertEquals(1,partitions.size());
  long partitionTime=partitions.keySet().iterator().next();
  Calendar calendar=Calendar.getInstance();
  calendar.setTimeInMillis(startTime);
  calendar.set(Calendar.SECOND,0);
  calendar.set(Calendar.MILLISECOND,0);
  long startMinute=calendar.getTimeInMillis();
  Assert.assertTrue(partitionTime >= startMinute);
  Assert.assertTrue(partitionTime <= System.currentTimeMillis());
  calendar.setTimeInMillis(partitionTime);
  int year=calendar.get(Calendar.YEAR);
  int month=calendar.get(Calendar.MONTH) + 1;
  int day=calendar.get(Calendar.DAY_OF_MONTH);
  int hour=calendar.get(Calendar.HOUR_OF_DAY);
  int minute=calendar.get(Calendar.MINUTE);
  Connection connection=getTestManager().getQueryClient();
  ResultSet results=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str").executeQuery();
  Assert.assertTrue(results.next());
  Assert.assertEquals(year,results.getInt(1));
  Assert.assertEquals(month,results.getInt(2));
  Assert.assertEquals(day,results.getInt(3));
  Assert.assertEquals(hour,results.getInt(4));
  Assert.assertEquals(minute,results.getInt(5));
  Assert.assertFalse(results.next());
}

Fixed version (ground truth):
@Test public void testStreamConversion() throws Exception {
  ApplicationManager appManager=deployApplication(StreamConversionApp.class);
  WorkflowManager workflowManager=appManager.startWorkflow("String_Node_Str",RuntimeArguments.NO_ARGUMENTS);
  workflowManager.getSchedule("String_Node_Str").suspend();
  StreamWriter streamWriter=appManager.getStreamWriter("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  long startTime=System.currentTimeMillis();
  MapReduceManager mapReduceManager=appManager.startMapReduce("String_Node_Str",RuntimeArguments.NO_ARGUMENTS);
  mapReduceManager.waitForFinish(5,TimeUnit.MINUTES);
  DataSetManager<TimePartitionedFileSet> fileSetManager=getDataset("String_Node_Str");
  TimePartitionedFileSet converted=fileSetManager.get();
  Map<Long,String> partitions=converted.getPartitions(startTime,System.currentTimeMillis());
  Assert.assertEquals(1,partitions.size());
  long partitionTime=partitions.keySet().iterator().next();
  Calendar calendar=Calendar.getInstance();
  calendar.setTimeInMillis(startTime);
  calendar.set(Calendar.SECOND,0);
  calendar.set(Calendar.MILLISECOND,0);
  long startMinute=calendar.getTimeInMillis();
  Assert.assertTrue(partitionTime >= startMinute);
  Assert.assertTrue(partitionTime <= System.currentTimeMillis());
  calendar.setTimeInMillis(partitionTime);
  int year=calendar.get(Calendar.YEAR);
  int month=calendar.get(Calendar.MONTH) + 1;
  int day=calendar.get(Calendar.DAY_OF_MONTH);
  int hour=calendar.get(Calendar.HOUR_OF_DAY);
  int minute=calendar.get(Calendar.MINUTE);
  Connection connection=getQueryClient();
  ResultSet results=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str").executeQuery();
  Assert.assertTrue(results.next());
  Assert.assertEquals(year,results.getInt(1));
  Assert.assertEquals(month,results.getInt(2));
  Assert.assertEquals(day,results.getInt(3));
  Assert.assertEquals(hour,results.getInt(4));
  Assert.assertEquals(minute,results.getInt(5));
  Assert.assertFalse(results.next());
}