ServiceTimeAggregator extends RequestDataAggregator { public Map<String,long[]> getData() { Map<String,long[]> result = new HashMap(); for (Map.Entry e : data.entrySet()) { result.put((String)e.getKey(), ((TimeAggregator)e.getValue()).getData()); } return result; } ServiceTimeAggregator(Query query, View view);  ServiceTimeAggregator(Query query, View view, Set<String> services); Query getQuery(); void visit(RequestData req, Object... aggregates); long[] getTotalFailed(); Map<String,long[]> getData(); long[][] getRawData();  }
@Test public void testHour() throws Exception { Date from = testData.toDate("2010-08-23T15:00:00"); Date to = testData.toDate("2010-08-23T16:57:00"); ServiceTimeAggregator agg = new ServiceTimeAggregator(new Query().between(from, to), View.HOURLY); Query q = new Query().between(from, to); monitor.query(q, agg); Map<String,long[]> map = agg.getData(); assertEquals(4, map.size()); long[] data = map.get("foo"); assertEquals(1, data[26]); assertEquals(1, data[66]); assertEquals(0, data[67]); assertEquals(1, data[76]); assertEquals(1, data[116]); assertEquals(0, data[117]); data = map.get("bar"); assertEquals(1, data[36]); assertEquals(1, data[86]); assertEquals(0, data[87]); data = map.get("baz"); assertEquals(1, data[46]); assertEquals(0, data[86]); data = map.get("bam"); assertEquals(1, data[56]); assertEquals(1, data[96]); assertEquals(1, data[106]); assertEquals(0, data[86]); }