use of teammates.ui.controller.AdminEmailLogPageAction in project teammates by TEAMMATES.
the class AdminEmailLogPageActionTest method verifyActionResult.
private void verifyActionResult(int[][] expectedLogs, String... params) {
AdminEmailLogPageAction action = getAction(params);
ShowPageResult result = getShowPageResult(action);
AdminEmailLogPageData pageData = (AdminEmailLogPageData) result.data;
List<EmailLogEntry> actualLogs = getLogsFromLogTemplateRows(pageData.getLogs());
verifyLogs(expectedLogs, actualLogs);
}
use of teammates.ui.controller.AdminEmailLogPageAction in project teammates by TEAMMATES.
the class AdminEmailLogPageActionTest method statusMessage_validQuery_generatedCorrectly.
@Test(groups = "typicalEmailLogs")
public void statusMessage_validQuery_generatedCorrectly() {
Date twoDaysAgo = TimeHelper.getDateOffsetToCurrentTime(-2);
// test statusMessage for default search
AdminEmailLogPageAction action = getAction();
String statusMessage = getShowPageResult(action).getStatusMessage();
verifyStatusMessage(statusMessage, 8);
// test statusMessage with `after` filter
String query = "after:" + formatterAdminTime.format(twoDaysAgo);
action = getAction("filterQuery", query);
statusMessage = getShowPageResult(action).getStatusMessage();
verifyStatusMessage(statusMessage, 16);
}
use of teammates.ui.controller.AdminEmailLogPageAction in project teammates by TEAMMATES.
the class AdminEmailLogPageActionTest method verifyContinueSearch.
private void verifyContinueSearch(String[] params, int[][] expected, int totalLogs) {
AdminEmailLogPageAction action = getAction(params);
ShowPageResult result = getShowPageResult(action);
AdminEmailLogPageData pageData = (AdminEmailLogPageData) result.data;
verifyStatusMessage(result.getStatusMessage(), totalLogs);
verifyLogs(expected, getLogsFromLogTemplateRows(pageData.getLogs()));
}
use of teammates.ui.controller.AdminEmailLogPageAction in project teammates by TEAMMATES.
the class AdminEmailLogPageActionTest method statusMessageAndContinueSearch_withManyLogs_searchCorrectly.
// The two test groups should have different 'priority' so that they can run separately
// as they depend on different sets of log messages
@Test(groups = "manyEmailLogs", priority = 2)
public void statusMessageAndContinueSearch_withManyLogs_searchCorrectly() {
Date today = TimeHelper.getDateOffsetToCurrentTime(0);
// default search will stop at #logs around 50
AdminEmailLogPageAction action = getAction();
ShowPageResult result = getShowPageResult(action);
verifyManyLogs(55, 0, 54, result.data, result.getStatusMessage());
// continue search will get next #logs around 50
long nextSearch = today.getTime() - 56 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000;
action = getAction("offset", String.valueOf(nextSearch));
result = getShowPageResult(action);
verifyManyLogs(56, 55, 110, result.data, result.getStatusMessage());
// continue search will get logs until no logs
nextSearch = today.getTime() - 112 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000;
action = getAction("offset", String.valueOf(nextSearch));
result = getShowPageResult(action);
verifyManyLogs(39, 111, 149, result.data, result.getStatusMessage());
// default search with filter stop at #logs around 50
action = getAction("filterQuery", "receiver:email1@email.com");
result = getShowPageResult(action);
verifyManyLogs(55, 0, 54, result.data, result.getStatusMessage());
// continue search with filter will get logs until no logs
nextSearch = today.getTime() - 56 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000;
action = getAction("filterQuery", "receiver:email1@email.com", "offset", String.valueOf(nextSearch));
result = getShowPageResult(action);
verifyManyLogs(95, 55, 69, result.data, result.getStatusMessage());
}
Aggregations