diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/audit/AuditEvents.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/audit/AuditEvents.java index b844ad6dab..7b9381040f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/audit/AuditEvents.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/audit/AuditEvents.java @@ -42,6 +42,7 @@ public enum AuditEvents ADD_TO_USER_GROUP("Add To User Group", "Add To User Group"), REMOVE_FROM_USER_GROUP("Remove From User Group", "Remove From User Group"), LOGIN_UNSUCCESSFUL("Login.Failure", "Login Unsuccessful"), + LOGIN_SUCCESSFUL("Login.Success", "Login Successful"), CREATE_HOLD("Create Hold", "Create Hold"), DELETE_HOLD("Delete Hold", "Delete Hold"), ADD_TO_HOLD("Add To Hold", "Add To Hold"), diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditLoginEventsTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditLoginEventsTests.java index 25a32e52d5..02f40b5c2e 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditLoginEventsTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/audit/AuditLoginEventsTests.java @@ -26,6 +26,7 @@ */ package org.alfresco.rest.rm.community.audit; +import static org.alfresco.rest.rm.community.model.audit.AuditEvents.LOGIN_SUCCESSFUL; import static org.alfresco.rest.rm.community.model.audit.AuditEvents.LOGIN_UNSUCCESSFUL; import static org.alfresco.utility.report.log.Step.STEP; import static org.testng.AssertJUnit.assertTrue; @@ -72,4 +73,24 @@ public class AuditLoginEventsTests extends BaseRMRestTest assertTrue("The list of events is not filtered by " + LOGIN_UNSUCCESSFUL.event, auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(LOGIN_UNSUCCESSFUL.eventDisplayName))); } + + /** + * Given I have tried to login using valid credentials + * When I view the RM audit filtered by Login successful event + * Then the audit log contains only the entries for the Login successful event + */ + @Test + public void filterByLoginSuccessful() throws Exception + { + restClient.authenticateUser(getAdminUser()); + restClient.withCoreAPI().getSites(); + + STEP("Get the list of audit entries for the login successful event."); + List auditEntries = rmAuditService.getAuditEntriesFilteredByEvent(getAdminUser(), + LOGIN_SUCCESSFUL); + + STEP("Check the audit log contains only the entries for the login successful event."); + assertTrue("The list of events is not filtered by " + LOGIN_SUCCESSFUL.event, + auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(LOGIN_SUCCESSFUL.eventDisplayName))); + } }