Program: 7427
Project: 7427
Buggy source:
@Test public void test() throws TimeoutException, InterruptedException, IOException {
  ApplicationManager appManager=deployApplication(PurchaseApp.class);
  FlowManager flowManager=appManager.startFlow("String_Node_Str");
  StreamWriter streamWriter=appManager.getStreamWriter("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  try {
    RuntimeMetrics metrics=RuntimeStats.getFlowletMetrics("String_Node_Str","String_Node_Str","String_Node_Str");
    metrics.waitForProcessed(5,15,TimeUnit.SECONDS);
  }
  finally {
    flowManager.stop();
  }
  ServiceManager userProfileServiceManager=appManager.startService(UserProfileService.SERVICE_NAME);
  serviceStatusCheck(userProfileServiceManager,true);
  URL setUserProfileURL=new URL(userProfileServiceManager.getServiceURL(),UserProfileServiceHandler.USER_ENDPOINT);
  HttpURLConnection setUserProfileConnection=(HttpURLConnection)setUserProfileURL.openConnection();
  String userProfileJson="String_Node_Str";
  try {
    setUserProfileConnection.setDoOutput(true);
    setUserProfileConnection.setRequestMethod("String_Node_Str");
    setUserProfileConnection.getOutputStream().write(userProfileJson.getBytes(Charsets.UTF_8));
    Assert.assertEquals(HttpURLConnection.HTTP_OK,setUserProfileConnection.getResponseCode());
  }
  finally {
    setUserProfileConnection.disconnect();
  }
  URL getUserProfileURL=new URL(userProfileServiceManager.getServiceURL(),UserProfileServiceHandler.USER_ENDPOINT + "String_Node_Str");
  HttpURLConnection getUserProfileConnection=(HttpURLConnection)getUserProfileURL.openConnection();
  Assert.assertEquals(HttpURLConnection.HTTP_OK,getUserProfileConnection.getResponseCode());
  String customerJson;
  try {
    customerJson=new String(ByteStreams.toByteArray(getUserProfileConnection.getInputStream()),Charsets.UTF_8);
  }
  finally {
    getUserProfileConnection.disconnect();
  }
  UserProfile profileFromService=GSON.fromJson(customerJson,UserProfile.class);
  Assert.assertEquals(profileFromService.getFirstName(),"String_Node_Str");
  Assert.assertEquals(profileFromService.getLastName(),"String_Node_Str");
  MapReduceManager mapReduceManager=appManager.startMapReduce("String_Node_Str",ImmutableMap.<String,String>of());
  mapReduceManager.waitForFinish(3,TimeUnit.MINUTES);
  ServiceManager purchaseHistoryServiceManager=appManager.startService(PurchaseHistoryService.SERVICE_NAME);
  serviceStatusCheck(purchaseHistoryServiceManager,true);
  URL url=new URL(purchaseHistoryServiceManager.getServiceURL(),"String_Node_Str");
  HttpURLConnection conn=(HttpURLConnection)url.openConnection();
  Assert.assertEquals(HttpURLConnection.HTTP_OK,conn.getResponseCode());
  String historyJson;
  try {
    historyJson=new String(ByteStreams.toByteArray(conn.getInputStream()),Charsets.UTF_8);
  }
  finally {
    conn.disconnect();
  }
  PurchaseHistory history=GSON.fromJson(historyJson,PurchaseHistory.class);
  Assert.assertEquals("String_Node_Str",history.getCustomer());
  Assert.assertEquals(2,history.getPurchases().size());
  UserProfile profileFromPurchaseHistory=history.getUserProfile();
  Assert.assertEquals(profileFromPurchaseHistory.getFirstName(),"String_Node_Str");
  Assert.assertEquals(profileFromPurchaseHistory.getLastName(),"String_Node_Str");
  appManager.stopAll();
}

Fixed version (ground truth):
@Test public void test() throws TimeoutException, InterruptedException, IOException {
  ApplicationManager appManager=deployApplication(PurchaseApp.class);
  FlowManager flowManager=appManager.startFlow("String_Node_Str");
  StreamWriter streamWriter=appManager.getStreamWriter("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  streamWriter.send("String_Node_Str");
  try {
    RuntimeMetrics metrics=RuntimeStats.getFlowletMetrics("String_Node_Str","String_Node_Str","String_Node_Str");
    metrics.waitForProcessed(5,15,TimeUnit.SECONDS);
  }
  finally {
    flowManager.stop();
  }
  ServiceManager userProfileServiceManager=appManager.startService(UserProfileServiceHandler.SERVICE_NAME);
  serviceStatusCheck(userProfileServiceManager,true);
  URL setUserProfileURL=new URL(userProfileServiceManager.getServiceURL(),UserProfileServiceHandler.USER_ENDPOINT);
  HttpURLConnection setUserProfileConnection=(HttpURLConnection)setUserProfileURL.openConnection();
  String userProfileJson="String_Node_Str";
  try {
    setUserProfileConnection.setDoOutput(true);
    setUserProfileConnection.setRequestMethod("String_Node_Str");
    setUserProfileConnection.getOutputStream().write(userProfileJson.getBytes(Charsets.UTF_8));
    Assert.assertEquals(HttpURLConnection.HTTP_OK,setUserProfileConnection.getResponseCode());
  }
  finally {
    setUserProfileConnection.disconnect();
  }
  URL getUserProfileURL=new URL(userProfileServiceManager.getServiceURL(),UserProfileServiceHandler.USER_ENDPOINT + "String_Node_Str");
  HttpURLConnection getUserProfileConnection=(HttpURLConnection)getUserProfileURL.openConnection();
  Assert.assertEquals(HttpURLConnection.HTTP_OK,getUserProfileConnection.getResponseCode());
  String customerJson;
  try {
    customerJson=new String(ByteStreams.toByteArray(getUserProfileConnection.getInputStream()),Charsets.UTF_8);
  }
  finally {
    getUserProfileConnection.disconnect();
  }
  UserProfile profileFromService=GSON.fromJson(customerJson,UserProfile.class);
  Assert.assertEquals(profileFromService.getFirstName(),"String_Node_Str");
  Assert.assertEquals(profileFromService.getLastName(),"String_Node_Str");
  MapReduceManager mapReduceManager=appManager.startMapReduce("String_Node_Str",ImmutableMap.<String,String>of());
  mapReduceManager.waitForFinish(3,TimeUnit.MINUTES);
  ServiceManager purchaseHistoryServiceManager=appManager.startService(PurchaseHistoryService.SERVICE_NAME);
  serviceStatusCheck(purchaseHistoryServiceManager,true);
  URL url=new URL(purchaseHistoryServiceManager.getServiceURL(),"String_Node_Str");
  HttpURLConnection conn=(HttpURLConnection)url.openConnection();
  Assert.assertEquals(HttpURLConnection.HTTP_OK,conn.getResponseCode());
  String historyJson;
  try {
    historyJson=new String(ByteStreams.toByteArray(conn.getInputStream()),Charsets.UTF_8);
  }
  finally {
    conn.disconnect();
  }
  PurchaseHistory history=GSON.fromJson(historyJson,PurchaseHistory.class);
  Assert.assertEquals("String_Node_Str",history.getCustomer());
  Assert.assertEquals(2,history.getPurchases().size());
  UserProfile profileFromPurchaseHistory=history.getUserProfile();
  Assert.assertEquals(profileFromPurchaseHistory.getFirstName(),"String_Node_Str");
  Assert.assertEquals(profileFromPurchaseHistory.getLastName(),"String_Node_Str");
  appManager.stopAll();
}