private void loadData(final Instant startDate,
                          final int statNameCount,
                          final int timesCount,
                          final StatisticType statisticType) throws SQLException {

        LOGGER.info("Filling STAT_VAL_SRC");

        // initial load of data just before now
        Instant newStartDate = startDate;
        LOGGER.info("Adding stats working back from: " + newStartDate);
        fillStatValSrc(newStartDate, statNameCount, timesCount, statisticType);
        int iteration = 0;
        assertThat(getRowCount(SQLStatisticNames.SQL_STATISTIC_VALUE_SOURCE_TABLE_NAME))
                .isEqualTo(statNameCount * timesCount * ++iteration);

        // Value stats doesn't do hour granularity
        if (statisticType.equals(StatisticType.COUNT)) {
            // load of data two hours old
            newStartDate = startDate.minus(2, ChronoUnit.HOURS);
            LOGGER.info("Adding stats working back from: " + newStartDate);
            fillStatValSrc(newStartDate, statNameCount, timesCount, statisticType);
            assertThat(getRowCount(SQLStatisticNames.SQL_STATISTIC_VALUE_SOURCE_TABLE_NAME))
                    .isEqualTo(statNameCount * timesCount * ++iteration);
        }

        // load of data 2 days old
        newStartDate = startDate.minus(2, ChronoUnit.DAYS);
        LOGGER.info("Adding stats working back from: " + newStartDate);
        fillStatValSrc(newStartDate, statNameCount, timesCount, statisticType);
        assertThat(getRowCount(SQLStatisticNames.SQL_STATISTIC_VALUE_SOURCE_TABLE_NAME))
                .isEqualTo(statNameCount * timesCount * ++iteration);

        // load of data 65 days old
        newStartDate = startDate.minus(65, ChronoUnit.DAYS);
        LOGGER.info("Adding stats working back from: " + newStartDate);
        fillStatValSrc(newStartDate, statNameCount, timesCount, statisticType);
        assertThat(getRowCount(SQLStatisticNames.SQL_STATISTIC_VALUE_SOURCE_TABLE_NAME))
                .isEqualTo(statNameCount * timesCount * ++iteration);
    }
Test loads data into stat val src, with stats aged so that there are
equal numbers falling into each precision. It then does runs the
aggregation process and checks the right data is in stat_val. Following
this it does further iterations of loading more data and running
aggregation to verify the new data is being merged in and the old data is
rolled up. It uses a future 'current time' to replicate aggregation
running against stats that have been in stat_val for a while.
stroom-app/src/test/java/stroom/statistics/impl/sql/TestSQLStatisticAggregationManager.java