Program: 8133
Project: 8133
Buggy source:
/** 
 * FIXME: Not sure why this test is failing.
 * @throws Exception
 */
public void end2endTest() throws Exception {
  final Injector injector=Guice.createInjector(new MetricsModules().getDistributedModules());
  final MetricsCollectionServerInterface serverInterface=injector.getInstance(MetricsCollectionServerInterface.class);
  Assert.assertNotNull(serverInterface);
  final int port=PortDetector.findFreePort();
  configuration.setInt(Constants.CFG_METRICS_COLLECTOR_SERVER_PORT,port);
  try {
    new Thread(new Runnable(){
      @Override public void run(){
        try {
          serverInterface.start(new String[]{},configuration);
        }
 catch (        ServerException e) {
          Assert.assertTrue(false);
        }
      }
    }
).start();
    Thread.sleep(10000);
    OverlordMetricsReporter.enable(1L,TimeUnit.SECONDS,configuration);
    CMetrics cmetrics=new CMetrics(MetricType.FlowUser,"String_Node_Str");
    for (int i=0; i < 10; ++i) {
      cmetrics.counter("String_Node_Str",1);
      cmetrics.counter("String_Node_Str",2);
      cmetrics.counter("String_Node_Str",3);
      cmetrics.meter("String_Node_Str",i);
      Thread.sleep(1000);
    }
    Thread.sleep(2000);
    List<Counter> counters=getMetric(new FlowArgument("String_Node_Str","String_Node_Str","String_Node_Str"),null);
    Assert.assertTrue(counters.size() > 0);
    for (    Counter counter : counters) {
      if (counter.getQualifier().equals("String_Node_Str")) {
        Assert.assertTrue(counter.getValue() >= 10.0f);
      }
 else       if (counter.getQualifier().equals("String_Node_Str") && counter.getName().equals("String_Node_Str")) {
        Assert.assertTrue(counter.getValue() >= 20.0f);
      }
 else       if (counter.getQualifier().equals("String_Node_Str")) {
        Assert.assertTrue(counter.getValue() >= 30.0f);
      }
 else       if (counter.getQualifier().equals("String_Node_Str") && counter.getName().equals("String_Node_Str")) {
        Assert.assertTrue(counter.getValue() > 2.79103);
      }
    }
  }
  finally {
    serverInterface.stop(true);
  }
}

Fixed version (ground truth):
/** 
 * FIXME: Not sure why this test is failing.
 * @throws Exception
 */
public void end2endTest() throws Exception {
  final Injector injector=Guice.createInjector(new MetricsModules().getDistributedModules());
  final MetricsCollectionServerInterface serverInterface=injector.getInstance(MetricsCollectionServerInterface.class);
  Assert.assertNotNull(serverInterface);
  final int port=PortDetector.findFreePort();
  configuration.setInt(Constants.CFG_METRICS_COLLECTOR_SERVER_PORT,port);
  try {
    new Thread(new Runnable(){
      @Override public void run(){
        try {
          serverInterface.start(new String[]{},configuration);
        }
 catch (        ServerException e) {
          Assert.assertTrue(false);
        }
      }
    }
).start();
    Thread.sleep(10000);
    OverlordMetricsReporter.enable(1L,TimeUnit.SECONDS,configuration);
    CMetrics cmetrics=new CMetrics(MetricType.FlowSystem,"String_Node_Str");
    for (int i=0; i < 10; ++i) {
      cmetrics.counter("String_Node_Str",1);
      cmetrics.counter("String_Node_Str",2);
      cmetrics.counter("String_Node_Str",3);
      cmetrics.meter("String_Node_Str",i);
      Thread.sleep(1000);
    }
    Thread.sleep(2000);
    List<Counter> counters=getMetric(new FlowArgument("String_Node_Str","String_Node_Str","String_Node_Str"),null);
    Assert.assertTrue(counters.size() > 0);
    for (    Counter counter : counters) {
      if (counter.getQualifier().equals("String_Node_Str")) {
        Assert.assertTrue(counter.getValue() >= 10.0f);
      }
 else       if (counter.getQualifier().equals("String_Node_Str") && counter.getName().equals("String_Node_Str")) {
        Assert.assertTrue(counter.getValue() >= 20.0f);
      }
 else       if (counter.getQualifier().equals("String_Node_Str")) {
        Assert.assertTrue(counter.getValue() >= 30.0f);
      }
 else       if (counter.getQualifier().equals("String_Node_Str") && counter.getName().equals("String_Node_Str")) {
        Assert.assertTrue(counter.getValue() > 2.79103);
      }
    }
  }
  finally {
    serverInterface.stop(true);
  }
}