mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
update the java docs for the changes added
This commit is contained in:
@@ -34,13 +34,17 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.alfresco.utility.model.TestModel;
|
||||
|
||||
/**
|
||||
* POJO for audit entry
|
||||
*
|
||||
* @author Rodica Sutu
|
||||
* @since 2.7
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
@EqualsAndHashCode (callSuper = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonIgnoreProperties (ignoreUnknown = true)
|
||||
|
@@ -28,6 +28,7 @@ package org.alfresco.rest.rm.community.model.audit;
|
||||
|
||||
/**
|
||||
* Enumerates the list of events audited
|
||||
*
|
||||
* @author Rodica Sutu
|
||||
* @since 2.7
|
||||
*
|
||||
@@ -36,6 +37,7 @@ public enum AuditEvents
|
||||
{
|
||||
CREATE_PERSON("Create Person","Create User"),
|
||||
DELETE_PERSON("Delete Person","Delete User");
|
||||
|
||||
/** event audited */
|
||||
public final String event;
|
||||
|
||||
|
@@ -101,10 +101,10 @@ public class PojoUtility
|
||||
}
|
||||
|
||||
/**
|
||||
* Converting json to object
|
||||
* Converting json to java object
|
||||
*
|
||||
* @param json The json object to convert
|
||||
* @param classz Class (or interface) whose annotations to effectively override
|
||||
* @param json The json object to convert
|
||||
* @param classz Class for the java object
|
||||
* @return The converted java object
|
||||
* @throws JsonProcessingException Throws exceptions if the given object doesn't match to the POJO class model
|
||||
*/
|
||||
@@ -126,6 +126,14 @@ public class PojoUtility
|
||||
return (T) obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converting json array into a list of java objects
|
||||
*
|
||||
* @param json The json array to convert
|
||||
* @param classz Class for the java object
|
||||
* @return The list of converted java objects
|
||||
* @throws JsonProcessingException Throws exceptions if the given object doesn't match to the POJO class model
|
||||
*/
|
||||
public static <T> List<T> jsonToObject(JSONArray json, Class<T> classz)
|
||||
{
|
||||
|
||||
|
@@ -43,20 +43,18 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* The v0 REST API for copy-to (which supports multi-item copy).
|
||||
* The v0 REST API for rm audit logs
|
||||
*
|
||||
* @author Tom Page
|
||||
* @since 2.6
|
||||
* @author Rodica Sutu
|
||||
* @since 2.7
|
||||
*/
|
||||
@Component
|
||||
public class RMAuditAPI extends BaseAPI
|
||||
{
|
||||
/** Logger for the class. */
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RMAuditAPI.class);
|
||||
|
||||
/** The URI for the audit API. */
|
||||
/**
|
||||
* The URI for the copy-to API.
|
||||
*/
|
||||
private static final String RM_AUDIT_API = "{0}rma/admin/rmauditlog";
|
||||
private static final String RM_AUDIT_LOG_API = RM_AUDIT_API + "?{1}";
|
||||
|
||||
@@ -66,8 +64,8 @@ public class RMAuditAPI extends BaseAPI
|
||||
* @param user The username of the user to use.
|
||||
* @param password The password of the user.
|
||||
* @param size Maximum number of log entries to return
|
||||
* @param event Only return log entries matching this event
|
||||
* @return return the A
|
||||
* @param event The name of audit event to be retrieved
|
||||
* @return return Only return log entries matching this event
|
||||
*/
|
||||
public List<AuditEntry> getRMAuditLog(String user, String password, final int size, final String event)
|
||||
{
|
||||
@@ -89,9 +87,9 @@ public class RMAuditAPI extends BaseAPI
|
||||
/**
|
||||
* Clear the list of audit entries audit of Records Management events. .
|
||||
*
|
||||
* @param username The username of the user to use.
|
||||
* @param username The username of the user to use.
|
||||
* @param password The password of the user.
|
||||
* @throws AssertionError If the API call didn't return a 200 response.
|
||||
* @throws AssertionError If the API call didn't clear the audit log.
|
||||
*/
|
||||
public void clearAuditLog(String username, String password)
|
||||
{
|
||||
|
@@ -28,6 +28,7 @@ package org.alfresco.rest.rm.community.audit;
|
||||
|
||||
import static org.alfresco.rest.rm.community.model.audit.AuditEvents.CREATE_PERSON;
|
||||
import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
|
||||
import static org.alfresco.utility.report.log.Step.STEP;
|
||||
import static org.testng.AssertJUnit.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
@@ -67,12 +68,15 @@ public class AuditUserEventsTests extends BaseRMRestTest
|
||||
@AlfrescoTest(jira = "RM-6223")
|
||||
public void createUserEventIsAudited() throws Exception
|
||||
{
|
||||
STEP("Create a new user.");
|
||||
String userName = "auditCreateUser" + PREFIX;
|
||||
|
||||
createUser = getDataUser().createUser(userName);
|
||||
|
||||
STEP("Get the list of audit entries for the create person event.");
|
||||
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getPassword(),
|
||||
getAdminUser().getPassword(), 100, CREATE_PERSON.event);
|
||||
|
||||
STEP("Check the audit log contains only the entries for the created user.");
|
||||
assertTrue("The list of events is not filtered by " + CREATE_PERSON.event,
|
||||
auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(CREATE_PERSON.eventDisplayName)));
|
||||
|
||||
|
Reference in New Issue
Block a user