getEntityManager().flush();
// put in two records, one with 100 for values, one with 200
for (int i = 1; i <= 2; i++)
{
DailyUsageSummary foo = new DailyUsageSummary();
foo.setMessageCount(count * i);
foo.setPageViewCount(count * i);
foo.setStreamContributorCount(count * i);
foo.setStreamViewCount(count * i);
foo.setStreamViewerCount(count * i);
foo.setUniqueVisitorCount(count * i);
foo.setUsageDate(new Date(nowInMs - (8 * 2 + i) * msInDay));
foo.setAvgActivityResponseTime(count * i);
foo.setStreamViewStreamScopeId(streamViewScopeId);
foo.setUsageDateTimeStampInMs(1308238511000L);
getEntityManager().persist(foo);
getEntityManager().flush();
assertTrue(foo.getId() > 0);
}
// throw in some stats that don't pertain to this stream that will be ignored
getEntityManager().persist(
new DailyUsageSummary(1, 2, 3, 4, 5, 6, 7, new Date(nowInMs - 6 * msInDay), 1308238511000L,
streamViewScopeId + 1, 1L, 2L, 5L));
getEntityManager().persist(
new DailyUsageSummary(1, 2, 3, 4, 5, 6, 7, new Date(nowInMs - 7 * msInDay), 1308238511000L,
streamViewScopeId + 1, 1L, 2L, 5L));
getEntityManager().persist(
new DailyUsageSummary(1, 2, 3, 4, 5, 6, 7, new Date(nowInMs - 8 * msInDay), 1308238511000L, null, 1L,
2L, 5L));
getEntityManager().flush();
getEntityManager().clear();