@Test
	public void testDayCounts() throws Exception {
		final DateTime start = new DateTime(2013, 11, 28, 23, 0);
		final DateTime end   = start.plusDays(66);

		DateTime now = start;
		int val = 1;
		while (!now.isAfter(end.plusDays(1))) {
			aggregateCounterRepository.increment(counterName, val++, now);
			now = now.plus(Duration.standardDays(1));
		}
		long[] counts = aggregateCounterRepository.getCounts(counterName, new Interval(start, end), AggregateCountResolution.day).getCounts();
		assertEquals(67, counts.length);

		for (int i=0; i < counts.length; i++) {
			assertEquals("count at index " + i + " should be " + (i+1), i+1, counts[i]);
		}

		counts = aggregateCounterRepository.getCounts(counterName, new Interval(end.minusDays(30), end), AggregateCountResolution.day).getCounts();
		assertEquals(31, counts.length);

		counts = aggregateCounterRepository.getCounts(counterName, 60, end, AggregateCountResolution.day).getCounts();
		assertEquals(60, counts.length);
		assertEquals(8, counts[0]);
		assertEquals(67, counts[59]);
	}
@author Luke Taylor
@author Gary Russell
@author Ilayaperumal Gopinathan
spring-xd-analytics/src/test/java/org/springframework/xd/analytics/metrics/AbstractAggregateCounterTests.java