Search in sources :

Example 1 with AdminEmailLogPageAction

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);
}
Also used : EmailLogEntry(teammates.common.util.EmailLogEntry) ShowPageResult(teammates.ui.controller.ShowPageResult) AdminEmailLogPageData(teammates.ui.pagedata.AdminEmailLogPageData) AdminEmailLogPageAction(teammates.ui.controller.AdminEmailLogPageAction)

Example 2 with AdminEmailLogPageAction

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);
}
Also used : AdminEmailLogPageAction(teammates.ui.controller.AdminEmailLogPageAction) Date(java.util.Date) Test(org.testng.annotations.Test)

Example 3 with AdminEmailLogPageAction

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()));
}
Also used : ShowPageResult(teammates.ui.controller.ShowPageResult) AdminEmailLogPageData(teammates.ui.pagedata.AdminEmailLogPageData) AdminEmailLogPageAction(teammates.ui.controller.AdminEmailLogPageAction)

Example 4 with AdminEmailLogPageAction

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());
}
Also used : ShowPageResult(teammates.ui.controller.ShowPageResult) AdminEmailLogPageAction(teammates.ui.controller.AdminEmailLogPageAction) Date(java.util.Date) Test(org.testng.annotations.Test)

Aggregations

AdminEmailLogPageAction (teammates.ui.controller.AdminEmailLogPageAction)4 ShowPageResult (teammates.ui.controller.ShowPageResult)3 Date (java.util.Date)2 Test (org.testng.annotations.Test)2 AdminEmailLogPageData (teammates.ui.pagedata.AdminEmailLogPageData)2 EmailLogEntry (teammates.common.util.EmailLogEntry)1