@Test
public void testMetricsProcessor() {

    // This test just drives coverage
    
    
    // Add as a listener to drive real data throuh
    Javametrics.getInstance().addListener(mp);
    int id = mp.addContext();
   // Sleep for 3 seconds to allow some data to arrive via the listener
    try {
        Thread.sleep(3000);
    } catch (InterruptedException e) {
    }
    
    // Add some HTTP data
    List<String> jsonData = new ArrayList<String>();
    jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis()
            + ",\"duration\":150,\"url\":\"http://localhost:9080/testy/v1/example1\",\"method\":\"GET\",\"status\":200,\"contentType\":\"null\",\"header\":{},\"requestHeader\":{}}}");
    jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis()
            + ",\"duration\":150,\"url\":\"http://localhost:9080/testy/v1/example\",\"method\":\"GET\",\"status\":200,\"contentType\":\"null\",\"header\":{},\"requestHeader\":{}}}");
    jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis()
            + ",\"duration\":600,\"url\":\"http://localhost:9080/testy/v1/example2\",\"method\":\"GET\",\"status\":200,\"contentType\":\"null\",\"header\":{},\"requestHeader\":{}}}");
    mp.processData(jsonData);
    jsonData.clear();
    try {
        Thread.sleep(3000);
    } catch (InterruptedException e) {
    }
    int id2 = mp.addContext();
    jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis()
            + ",\"duration\":150,\"url\":\"http://localhost:9080/testy/v1/example2\",\"method\":\"GET\",\"status\":200,\"contentType\":\"null\",\"header\":{},\"requestHeader\":{}}}");
    jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis()
            + ",\"duration\":0,\"url\":\"http://localhost:9080/testy/v1/example\",\"method\":\"GET\",\"status\":200,\"contentType\":\"null\",\"header\":{},\"requestHeader\":{}}}");
    printSummary(id);
    jsonData.add("{\"topic\":\"http\",\"payload\":{\"time\":" + System.currentTimeMillis()
            + ",\"duration\":150,\"url\":\"http://localhost:9080/testy/v1/example\",\"method\":\"GET\",\"status\":200,\"contentType\":\"null\",\"header\":{},\"requestHeader\":{}}}");
    mp.processData(jsonData);
    try {
        Thread.sleep(3000);
    } catch (InterruptedException e) {
    }
    
    System.gc();
    
    try {
        Thread.sleep(3000);
    } catch (InterruptedException e) {
    }
    printSummary(id);
    printSummary(id2);
}