use of teammates.ui.controller.AdminActivityLogPageAction in project teammates by TEAMMATES.
the class AdminActivityLogPageActionTest method verifyActionResult.
private void verifyActionResult(int[][] expectedLogs, String... params) {
AdminActivityLogPageAction action = getAction(params);
ShowPageResult result = getShowPageResult(action);
AdminActivityLogPageData pageData = (AdminActivityLogPageData) result.data;
List<ActivityLogEntry> actualLogs = getLogsFromLogTemplateRows(pageData.getLogs());
verifyLogs(expectedLogs, actualLogs);
}
use of teammates.ui.controller.AdminActivityLogPageAction in project teammates by TEAMMATES.
the class AdminActivityLogPageActionTest method statusMessage_validQuery_generatedCorrectly.
@Test(groups = "typicalActivityLogs")
public void statusMessage_validQuery_generatedCorrectly() {
// test statusMessage for default search
AdminActivityLogPageAction action = getAction();
String statusMessage = getShowPageResult(action).getStatusMessage();
verifyStatusMessage(statusMessage, 11, 5, YESTERDAY);
verifyLocalTimeInStatusMessage(statusMessage, YESTERDAY, Const.SystemParams.ADMIN_TIME_ZONE_ID);
// test statusMessage with filterQuery
String query = "person:idOfInstructor1OfCourse1";
action = getAction("filterQuery", query);
statusMessage = getShowPageResult(action).getStatusMessage();
verifyStatusMessage(statusMessage, 11, 1, YESTERDAY);
// test statusMessage with `to`
query = "to:" + formatAdminDate(YESTERDAY);
action = getAction("filterQuery", query);
Instant toDate = getEndOfTheDayOffsetNowInAdminTimeZone(-2);
statusMessage = getShowPageResult(action).getStatusMessage();
verifyStatusMessage(statusMessage, 6, 3, toDate);
verifyLocalTimeInStatusMessage(statusMessage, toDate, Const.SystemParams.ADMIN_TIME_ZONE_ID);
// test statusMessage with `from`
query = "from:" + formatAdminDate(YESTERDAY);
action = getAction("filterQuery", query);
Instant fromDate = getBeginOfTheDayOffsetNowInAdminTimeZone(-1);
statusMessage = getShowPageResult(action).getStatusMessage();
verifyStatusMessage(statusMessage, 17, 8, fromDate);
verifyLocalTimeInStatusMessage(statusMessage, fromDate, Const.SystemParams.ADMIN_TIME_ZONE_ID);
}
use of teammates.ui.controller.AdminActivityLogPageAction in project teammates by TEAMMATES.
the class AdminActivityLogPageActionTest method verifyContinueSearch.
private void verifyContinueSearch(String[] params, int[][] expected, int totalLogs, int filteredLogs, Instant earliestDateInUtc) {
AdminActivityLogPageAction action = getAction(params);
ShowPageResult result = getShowPageResult(action);
AdminActivityLogPageData pageData = (AdminActivityLogPageData) result.data;
verifyStatusMessage(result.getStatusMessage(), totalLogs, filteredLogs, earliestDateInUtc);
verifyLogs(expected, getLogsFromLogTemplateRows(pageData.getLogs()));
}
use of teammates.ui.controller.AdminActivityLogPageAction in project teammates by TEAMMATES.
the class AdminActivityLogPageActionTest method verifyLoadingLocalTimeAjaxResult.
private void verifyLoadingLocalTimeAjaxResult(String expected, String role, String googleId, long timeInMillis) {
String[] params = new String[] { "logRole", role, "logGoogleId", googleId, "logUnixTimeMillis", String.valueOf(timeInMillis) };
AdminActivityLogPageAction action = getAction(params);
AjaxResult result = getAjaxResult(action);
AdminActivityLogPageData pageData = (AdminActivityLogPageData) result.data;
assertEquals(expected, pageData.getLogLocalTime());
}
use of teammates.ui.controller.AdminActivityLogPageAction in project teammates by TEAMMATES.
the class AdminActivityLogPageActionTest 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 = "manyActivityLogs", priority = 2)
public void statusMessageAndContinueSearch_withManyLogs_searchCorrectly() {
Instant now = Instant.now();
// default search will stop at #logs around 50
AdminActivityLogPageAction action = getAction();
ShowPageResult result = getShowPageResult(action);
Instant earliestDateInUtc = now.minusMillis(54 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000);
verifyManyLogs(55, 0, 54, result.data, result.getStatusMessage(), earliestDateInUtc);
// continue search will get next #logs around 50
long nextSearch = now.toEpochMilli() - 56 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000;
action = getAction("searchTimeOffset", String.valueOf(nextSearch));
result = getShowPageResult(action);
earliestDateInUtc = now.minusMillis(110 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000);
verifyManyLogs(56, 55, 110, result.data, result.getStatusMessage(), earliestDateInUtc);
// continue search will get logs until no logs
nextSearch = now.toEpochMilli() - 112 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000;
action = getAction("searchTimeOffset", String.valueOf(nextSearch));
result = getShowPageResult(action);
earliestDateInUtc = Instant.ofEpochMilli(nextSearch - 24 * 60 * 60 * 1000);
verifyManyLogs(39, 111, 149, result.data, result.getStatusMessage(), earliestDateInUtc);
// default search with filter stop at #logs around 50
action = getAction("filterQuery", "request:testdata1");
result = getShowPageResult(action);
earliestDateInUtc = now.minusMillis(54 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000);
verifyManyLogs(55, 0, 54, result.data, result.getStatusMessage(), earliestDateInUtc);
// continue search with filter will get logs until no logs
nextSearch = now.toEpochMilli() - 56 * LOG_MESSAGE_INTERVAL_MANY_LOGS * 1000;
action = getAction("filterQuery", "request:testdata1", "searchTimeOffset", String.valueOf(nextSearch));
result = getShowPageResult(action);
earliestDateInUtc = Instant.ofEpochMilli(nextSearch - 24 * 60 * 60 * 1000);
verifyManyLogs(95, 55, 60, result.data, result.getStatusMessage(), earliestDateInUtc);
}
Aggregations