@Test
    public void testGetUsage() throws Exception {
        EsMetricsAccessor metrics = new EsMetricsAccessor(client);

        UsageHistogramBean usage = metrics.getUsage("JBossOverlord", "s-ramp-api", "1.0", HistogramIntervalType.day,
                parseDate("2015-01-01"), new DateTime().withZone(DateTimeZone.UTC));
        List<UsageDataPoint> data = usage.getData();
        Assert.assertTrue(!data.isEmpty());
        Assert.assertTrue(data.size() > 1);
        Assert.assertEquals("2015-06-19T00:00:00.000Z", usage.getData().get(169).getLabel());
        Assert.assertEquals(46L, usage.getData().get(169).getCount());


        usage = metrics.getUsage("JBossOverlord", "s-ramp-api", "1.0", HistogramIntervalType.hour,
                parseDate("2015-06-15"), parseDate("2015-06-22"));
        data = usage.getData();
        Assert.assertEquals(168, data.size());
        Assert.assertEquals("2015-06-19T15:00:00.000Z", usage.getData().get(111).getLabel());
        Assert.assertEquals(46L, usage.getData().get(111).getCount());


        usage = metrics.getUsage("JBossOverlord", "s-ramp-api", "1.0", HistogramIntervalType.minute,
                parseDate("2015-06-19"), parseDate("2015-06-20"));
        data = usage.getData();
        Assert.assertEquals(1440, data.size());
        Assert.assertEquals("2015-06-19T15:13:00.000Z", usage.getData().get(913).getLabel());
        Assert.assertEquals("2015-06-19T15:14:00.000Z", usage.getData().get(914).getLabel());
        Assert.assertEquals("2015-06-19T15:15:00.000Z", usage.getData().get(915).getLabel());
        Assert.assertEquals(14L, usage.getData().get(913).getCount());
        Assert.assertEquals(15L, usage.getData().get(914).getCount());
        Assert.assertEquals(17L, usage.getData().get(915).getCount());
    }
Test method for {@link EsMetricsAccessor#getUsage(java.lang.String, java.lang.String, java.lang.String, io.apiman.manager.api.beans.metrics.HistogramIntervalType, java.util.Date, java.util.Date)}.
manager/test/api/src/test/java/io/apiman/manager/test/es/EsMetricsAccessorTest.java