@Test public void testShowEmailStatistics() throws Exception { result = ninjaTestBrowser.makeRequest(ninjaTestServer.getBaseUrl() + "/admin/emailStatistics"); assertTrue(result.contains("Todays (last 24 hours) sender domains")); assertTrue(result.contains("Last 7 days sender domains")); assertFalse(result.contains("FreeMarker template error")); assertFalse(result.contains("<title>404 - not found</title>")); result = ninjaTestBrowser.makeJsonRequest(ninjaTestServer.getBaseUrl() + "/admin/emailSenderPage?scope=day&offset=0&limit=10"); assertTrue("{\"total\":0,\"rows\":[]}".equals(result)); assertFalse(result.contains("FreeMarker template error")); assertFalse(result.contains("<title>404 - not found</title>")); result = ninjaTestBrowser.makeJsonRequest(ninjaTestServer.getBaseUrl() + "/admin/emailSenderPage?scope=week&offset=0&limit=10"); assertTrue("{\"total\":0,\"rows\":[]}".equals(result)); assertFalse(result.contains("FreeMarker template error")); assertFalse(result.contains("<title>404 - not found</title>")); result = ninjaTestBrowser.makeJsonRequest(ninjaTestServer.getBaseUrl() + "/admin/emailSenderPage?scope=week&offset=10&limit=10"); assertTrue("{\"total\":0,\"rows\":[]}".equals(result)); assertFalse(result.contains("FreeMarker template error")); assertFalse(result.contains("<title>404 - not found</title>")); result = ninjaTestBrowser.makeJsonRequest(ninjaTestServer.getBaseUrl() + "/admin/emailSenderPage?scope=month&offset=0&limit=10"); assertTrue("null".equals(result)); MailStatistics mailStatistics = new MailStatistics(); MailStatisticsKey mailStatisticsKey = new MailStatisticsKey(new Date(System.currentTimeMillis()), 0, "fromDomain.com", "targetDomain.com"); assertEquals("fromdomain.com", mailStatisticsKey.getFromDomain()); assertEquals("targetdomain.com", mailStatisticsKey.getTargetDomain()); mailStatistics.setKey(mailStatisticsKey); mailStatistics.setDropCount(13); mailStatistics.setForwardCount(5); Ebean.save(mailStatistics); result = ninjaTestBrowser.makeJsonRequest(ninjaTestServer.getBaseUrl() + "/admin/emailSenderPage?scope=day&offset=0&limit=10"); assertTrue("{\"total\":1,\"rows\":[{\"id\":0,\"fromDomain\":\"fromdomain.com\",\"droppedCount\":13,\"forwardedCount\":5}]}".equals(result)); assertFalse(result.contains("FreeMarker template error")); assertFalse(result.contains("<title>404 - not found</title>")); }
public Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage, @Param("sortDailyList") String sortDailyList, @Param("sortWeeklyList") String sortWeeklyList) { Result html = Results.html(); List<Long> dailyDroppedMails = new LinkedList<>(); List<Long> dailyForwardedMails = new LinkedList<>(); List<Long> dailyTimestamps = new LinkedList<>(); reduceStatisticsData(4, getStatistics(0, true), dailyDroppedMails, dailyForwardedMails, dailyTimestamps); html.render("lastDayTimestamps", dailyTimestamps); html.render("lastDayDroppedData", dailyDroppedMails); html.render("lastDayForwardedData", dailyForwardedMails); List<Long> weeklyDroppedMails = new LinkedList<>(); List<Long> weeklyForwardedMails = new LinkedList<>(); List<Long> weeklyTimestamps = new LinkedList<>(); reduceStatisticsData(4, getStatistics(6, false), weeklyDroppedMails, weeklyForwardedMails, weeklyTimestamps); html.render("lastWeekTimestamps", weeklyTimestamps); html.render("lastWeekDroppedData", weeklyDroppedMails); html.render("lastWeekForwardedData", weeklyForwardedMails); return html; }
AdminHandler { public Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage, @Param("sortDailyList") String sortDailyList, @Param("sortWeeklyList") String sortWeeklyList) { Result html = Results.html(); List<Long> dailyDroppedMails = new LinkedList<>(); List<Long> dailyForwardedMails = new LinkedList<>(); List<Long> dailyTimestamps = new LinkedList<>(); reduceStatisticsData(4, getStatistics(0, true), dailyDroppedMails, dailyForwardedMails, dailyTimestamps); html.render("lastDayTimestamps", dailyTimestamps); html.render("lastDayDroppedData", dailyDroppedMails); html.render("lastDayForwardedData", dailyForwardedMails); List<Long> weeklyDroppedMails = new LinkedList<>(); List<Long> weeklyForwardedMails = new LinkedList<>(); List<Long> weeklyTimestamps = new LinkedList<>(); reduceStatisticsData(4, getStatistics(6, false), weeklyDroppedMails, weeklyForwardedMails, weeklyTimestamps); html.render("lastWeekTimestamps", weeklyTimestamps); html.render("lastWeekDroppedData", weeklyDroppedMails); html.render("lastWeekForwardedData", weeklyForwardedMails); return html; } }
AdminHandler { public Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage, @Param("sortDailyList") String sortDailyList, @Param("sortWeeklyList") String sortWeeklyList) { Result html = Results.html(); List<Long> dailyDroppedMails = new LinkedList<>(); List<Long> dailyForwardedMails = new LinkedList<>(); List<Long> dailyTimestamps = new LinkedList<>(); reduceStatisticsData(4, getStatistics(0, true), dailyDroppedMails, dailyForwardedMails, dailyTimestamps); html.render("lastDayTimestamps", dailyTimestamps); html.render("lastDayDroppedData", dailyDroppedMails); html.render("lastDayForwardedData", dailyForwardedMails); List<Long> weeklyDroppedMails = new LinkedList<>(); List<Long> weeklyForwardedMails = new LinkedList<>(); List<Long> weeklyTimestamps = new LinkedList<>(); reduceStatisticsData(4, getStatistics(6, false), weeklyDroppedMails, weeklyForwardedMails, weeklyTimestamps); html.render("lastWeekTimestamps", weeklyTimestamps); html.render("lastWeekDroppedData", weeklyDroppedMails); html.render("lastWeekForwardedData", weeklyForwardedMails); return html; }  }
AdminHandler { public Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage, @Param("sortDailyList") String sortDailyList, @Param("sortWeeklyList") String sortWeeklyList) { Result html = Results.html(); List<Long> dailyDroppedMails = new LinkedList<>(); List<Long> dailyForwardedMails = new LinkedList<>(); List<Long> dailyTimestamps = new LinkedList<>(); reduceStatisticsData(4, getStatistics(0, true), dailyDroppedMails, dailyForwardedMails, dailyTimestamps); html.render("lastDayTimestamps", dailyTimestamps); html.render("lastDayDroppedData", dailyDroppedMails); html.render("lastDayForwardedData", dailyForwardedMails); List<Long> weeklyDroppedMails = new LinkedList<>(); List<Long> weeklyForwardedMails = new LinkedList<>(); List<Long> weeklyTimestamps = new LinkedList<>(); reduceStatisticsData(4, getStatistics(6, false), weeklyDroppedMails, weeklyForwardedMails, weeklyTimestamps); html.render("lastWeekTimestamps", weeklyTimestamps); html.render("lastWeekDroppedData", weeklyDroppedMails); html.render("lastWeekForwardedData", weeklyForwardedMails); return html; }  Result showAdmin(Context context); Result showUsers(Context context); Result showSummedTransactions(Context context); Result pagedMTX(Context context, @Param("p") int page); Result deleteMTXProcess(@PathParam("time") Integer time, Context context); Result activateUserProcess(@PathParam("id") Long userId, Context context); Result promoteUserProcess(@PathParam("id") Long userId, Context context); Result deleteUserProcess(@PathParam("id") Long deleteUserId, Context context); Result jsonUserSearch(Context context); @FilterWith(WhitelistFilter.class) Result showDomainWhitelist(Context context); @FilterWith(WhitelistFilter.class) Result callRemoveDomain(Context context, @Param("removeDomainsSelection") Long remDomainId); @FilterWith(WhitelistFilter.class) Result handleRemoveDomain(Context context, @Param("action") String action, @Param("domainId") long domainId); @FilterWith(WhitelistFilter.class) Result addDomain(Context context, @Param("domainName") String domainName); Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage,
                                      @Param("sortDailyList") String sortDailyList,
                                      @Param("sortWeeklyList") String sortWeeklyList); Result getEmailSenderTablePage(Context context, @Param("scope") String scope, @Param("page") int page,
                                          @Param("offset") int offset, @Param("limit") int limit,
                                          @Param("sort") String sort, @Param("order") String order); }
AdminHandler { public Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage, @Param("sortDailyList") String sortDailyList, @Param("sortWeeklyList") String sortWeeklyList) { Result html = Results.html(); List<Long> dailyDroppedMails = new LinkedList<>(); List<Long> dailyForwardedMails = new LinkedList<>(); List<Long> dailyTimestamps = new LinkedList<>(); reduceStatisticsData(4, getStatistics(0, true), dailyDroppedMails, dailyForwardedMails, dailyTimestamps); html.render("lastDayTimestamps", dailyTimestamps); html.render("lastDayDroppedData", dailyDroppedMails); html.render("lastDayForwardedData", dailyForwardedMails); List<Long> weeklyDroppedMails = new LinkedList<>(); List<Long> weeklyForwardedMails = new LinkedList<>(); List<Long> weeklyTimestamps = new LinkedList<>(); reduceStatisticsData(4, getStatistics(6, false), weeklyDroppedMails, weeklyForwardedMails, weeklyTimestamps); html.render("lastWeekTimestamps", weeklyTimestamps); html.render("lastWeekDroppedData", weeklyDroppedMails); html.render("lastWeekForwardedData", weeklyForwardedMails); return html; }  Result showAdmin(Context context); Result showUsers(Context context); Result showSummedTransactions(Context context); Result pagedMTX(Context context, @Param("p") int page); Result deleteMTXProcess(@PathParam("time") Integer time, Context context); Result activateUserProcess(@PathParam("id") Long userId, Context context); Result promoteUserProcess(@PathParam("id") Long userId, Context context); Result deleteUserProcess(@PathParam("id") Long deleteUserId, Context context); Result jsonUserSearch(Context context); @FilterWith(WhitelistFilter.class) Result showDomainWhitelist(Context context); @FilterWith(WhitelistFilter.class) Result callRemoveDomain(Context context, @Param("removeDomainsSelection") Long remDomainId); @FilterWith(WhitelistFilter.class) Result handleRemoveDomain(Context context, @Param("action") String action, @Param("domainId") long domainId); @FilterWith(WhitelistFilter.class) Result addDomain(Context context, @Param("domainName") String domainName); Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage,
                                      @Param("sortDailyList") String sortDailyList,
                                      @Param("sortWeeklyList") String sortWeeklyList); Result getEmailSenderTablePage(Context context, @Param("scope") String scope, @Param("page") int page,
                                          @Param("offset") int offset, @Param("limit") int limit,
                                          @Param("sort") String sort, @Param("order") String order);  }