Program: 4797
Project: 4797
Buggy source:
@Test public void testStreamSizeSchedules() throws Exception {
  String appName="String_Node_Str";
  String sampleSchedule1="String_Node_Str";
  String sampleSchedule2="String_Node_Str";
  String workflowName="String_Node_Str";
  String streamName="String_Node_Str";
  Id.Program programId=Id.Program.from(TEST_NAMESPACE2,appName,ProgramType.WORKFLOW,workflowName);
  StringBuilder longStringBuilder=new StringBuilder();
  for (int i=0; i < 10000; i++) {
    longStringBuilder.append("String_Node_Str");
  }
  String longString=longStringBuilder.toString();
  HttpResponse response=deploy(AppWithStreamSizeSchedule.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  Assert.assertEquals(200,resumeSchedule(TEST_NAMESPACE2,appName,sampleSchedule1));
  Assert.assertEquals(200,resumeSchedule(TEST_NAMESPACE2,appName,sampleSchedule2));
  List<ScheduleDetail> schedules=getSchedules(TEST_NAMESPACE2,appName,workflowName);
  Assert.assertEquals(2,schedules.size());
  String scheduleName1=schedules.get(0).getName();
  String scheduleName2=schedules.get(1).getName();
  Assert.assertNotNull(scheduleName1);
  Assert.assertFalse(scheduleName1.isEmpty());
  response=doPut(String.format("String_Node_Str",TEST_NAMESPACE2,streamName),"String_Node_Str");
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  response=doGet(String.format("String_Node_Str",TEST_NAMESPACE2,streamName));
  String json=EntityUtils.toString(response.getEntity());
  StreamProperties properties=new Gson().fromJson(json,StreamProperties.class);
  Assert.assertEquals(1,properties.getNotificationThresholdMB().intValue());
  for (int i=0; i < 12; ++i) {
    response=doPost(String.format("String_Node_Str",TEST_NAMESPACE2,streamName),longString);
    Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  }
  verifyProgramRuns(programId,"String_Node_Str");
  assertSchedule(programId,scheduleName1,true,30,TimeUnit.SECONDS);
  assertSchedule(programId,scheduleName2,true,30,TimeUnit.SECONDS);
  Assert.assertEquals(200,suspendSchedule(TEST_NAMESPACE2,appName,scheduleName1));
  Assert.assertEquals(200,suspendSchedule(TEST_NAMESPACE2,appName,scheduleName2));
  assertSchedule(programId,scheduleName1,false,30,TimeUnit.SECONDS);
  assertSchedule(programId,scheduleName2,false,30,TimeUnit.SECONDS);
  int workflowRuns=getProgramRuns(programId,"String_Node_Str").size();
  Assert.assertEquals(1,workflowRuns);
  for (int i=0; i < 12; ++i) {
    response=doPost(String.format("String_Node_Str",TEST_NAMESPACE2,streamName),longString);
    Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  }
  TimeUnit.SECONDS.sleep(5);
  int workflowRunsAfterSuspend=getProgramRuns(programId,"String_Node_Str").size();
  Assert.assertEquals(workflowRuns,workflowRunsAfterSuspend);
  Assert.assertEquals(200,resumeSchedule(TEST_NAMESPACE2,appName,scheduleName1));
  assertSchedule(programId,scheduleName1,true,30,TimeUnit.SECONDS);
  assertRunHistory(programId,"String_Node_Str",1 + workflowRunsAfterSuspend,60,TimeUnit.SECONDS);
  try {
    assertSchedule(programId,"String_Node_Str",true,2,TimeUnit.SECONDS);
    Assert.fail();
  }
 catch (  Exception e) {
  }
  Assert.assertEquals(200,suspendSchedule(TEST_NAMESPACE2,appName,scheduleName1));
  assertSchedule(programId,scheduleName1,false,30,TimeUnit.SECONDS);
  try {
    assertSchedule(Id.Program.from(TEST_NAMESPACE1,appName,ProgramType.WORKFLOW,workflowName),scheduleName1,true,2,TimeUnit.SECONDS);
    Assert.fail();
  }
 catch (  Exception e) {
  }
  Assert.assertEquals(404,suspendSchedule(TEST_NAMESPACE1,appName,scheduleName1));
  Assert.assertEquals(404,resumeSchedule(TEST_NAMESPACE1,appName,scheduleName1));
  TimeUnit.SECONDS.sleep(2);
}

Fixed version (ground truth):
@Test public void testStreamSizeSchedules() throws Exception {
  String appName="String_Node_Str";
  String sampleSchedule1="String_Node_Str";
  String sampleSchedule2="String_Node_Str";
  String workflowName="String_Node_Str";
  String streamName="String_Node_Str";
  Id.Program programId=Id.Program.from(TEST_NAMESPACE2,appName,ProgramType.WORKFLOW,workflowName);
  StringBuilder longStringBuilder=new StringBuilder();
  for (int i=0; i < 10000; i++) {
    longStringBuilder.append("String_Node_Str");
  }
  String longString=longStringBuilder.toString();
  HttpResponse response=deploy(AppWithStreamSizeSchedule.class,Constants.Gateway.API_VERSION_3_TOKEN,TEST_NAMESPACE2);
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  Assert.assertEquals(200,resumeSchedule(TEST_NAMESPACE2,appName,sampleSchedule1));
  Assert.assertEquals(200,resumeSchedule(TEST_NAMESPACE2,appName,sampleSchedule2));
  List<ScheduleDetail> schedules=getSchedules(TEST_NAMESPACE2,appName,workflowName);
  Assert.assertEquals(2,schedules.size());
  String scheduleName1=schedules.get(0).getName();
  String scheduleName2=schedules.get(1).getName();
  Assert.assertNotNull(scheduleName1);
  Assert.assertFalse(scheduleName1.isEmpty());
  response=doPut(String.format("String_Node_Str",TEST_NAMESPACE2,streamName),"String_Node_Str");
  Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  response=doGet(String.format("String_Node_Str",TEST_NAMESPACE2,streamName));
  String json=EntityUtils.toString(response.getEntity());
  StreamProperties properties=new Gson().fromJson(json,StreamProperties.class);
  Assert.assertEquals(1,properties.getNotificationThresholdMB().intValue());
  for (int i=0; i < 12; ++i) {
    response=doPost(String.format("String_Node_Str",TEST_NAMESPACE2,streamName),longString);
    Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  }
  verifyProgramRuns(programId,ProgramRunStatus.COMPLETED);
  assertSchedule(programId,scheduleName1,true,30,TimeUnit.SECONDS);
  assertSchedule(programId,scheduleName2,true,30,TimeUnit.SECONDS);
  Assert.assertEquals(200,suspendSchedule(TEST_NAMESPACE2,appName,scheduleName1));
  Assert.assertEquals(200,suspendSchedule(TEST_NAMESPACE2,appName,scheduleName2));
  assertSchedule(programId,scheduleName1,false,30,TimeUnit.SECONDS);
  assertSchedule(programId,scheduleName2,false,30,TimeUnit.SECONDS);
  int workflowRuns=getProgramRuns(programId,ProgramRunStatus.COMPLETED).size();
  Assert.assertEquals(1,workflowRuns);
  for (int i=0; i < 12; ++i) {
    response=doPost(String.format("String_Node_Str",TEST_NAMESPACE2,streamName),longString);
    Assert.assertEquals(200,response.getStatusLine().getStatusCode());
  }
  TimeUnit.SECONDS.sleep(5);
  int workflowRunsAfterSuspend=getProgramRuns(programId,ProgramRunStatus.COMPLETED).size();
  Assert.assertEquals(workflowRuns,workflowRunsAfterSuspend);
  Assert.assertEquals(200,resumeSchedule(TEST_NAMESPACE2,appName,scheduleName1));
  assertSchedule(programId,scheduleName1,true,30,TimeUnit.SECONDS);
  assertRunHistory(programId,ProgramRunStatus.COMPLETED,1 + workflowRunsAfterSuspend,60,TimeUnit.SECONDS);
  try {
    assertSchedule(programId,"String_Node_Str",true,2,TimeUnit.SECONDS);
    Assert.fail();
  }
 catch (  Exception e) {
  }
  Assert.assertEquals(200,suspendSchedule(TEST_NAMESPACE2,appName,scheduleName1));
  assertSchedule(programId,scheduleName1,false,30,TimeUnit.SECONDS);
  try {
    assertSchedule(Id.Program.from(TEST_NAMESPACE1,appName,ProgramType.WORKFLOW,workflowName),scheduleName1,true,2,TimeUnit.SECONDS);
    Assert.fail();
  }
 catch (  Exception e) {
  }
  Assert.assertEquals(404,suspendSchedule(TEST_NAMESPACE1,appName,scheduleName1));
  Assert.assertEquals(404,resumeSchedule(TEST_NAMESPACE1,appName,scheduleName1));
  TimeUnit.SECONDS.sleep(2);
}