matchingRecord = getRestAPIFactory().getRecordFolderAPI()
- .getRecordFolderChildren(recFolder.getId())
- .getEntries()
- .stream()
- .filter(e -> e.getEntry().getId()
- .equals(testFile.getNodeRefWithoutVersion()))
- .findAny();
- assertTrue(matchingRecord.isPresent());
- });
- return true;
- }
- catch (AssertionError | Exception e)
- {
- return false;
- }
- }
-
- /**
- * Helper method to create a test user with rm role and permissions over the recordCategory and collaborator role
- * in collaboration site
- *
- * @param userRole the rm role
- * @param userPermission the permissions over the recordCategory
- * @return the created user model
- * @throws Exception
- */
- private UserModel createCollaboratorWithRMRoleAndPermission(UserRoles userRole, UserPermissions userPermission)
- {
- UserModel rmUser = createUserWithRMRoleAndCategoryPermission(userRole.roleId, recordCategory, userPermission);
- getDataUser().addUserToSite(rmUser, publicSite, UserRole.SiteCollaborator);
- return rmUser;
- }
-
- /**
- * Checks if the given file has record aspect
- *
- * @param testFile the file to be checked
- * @return true if the file has the aspect, false otherwise
- */
- private boolean hasRecordAspect(FileModel testFile) throws Exception
- {
- return getRestAPIFactory().getNodeAPI(testFile).getNode()
- .getAspectNames().contains(RECORD_TYPE);
- }
@AfterClass(alwaysRun = true)
public void declareAndFileDocumentAsRecordCleanup()
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java
index 387e263460..bc88c6a6d6 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/DeleteRecordTests.java
@@ -49,7 +49,6 @@ import static org.springframework.http.HttpStatus.NO_CONTENT;
import static org.springframework.http.HttpStatus.OK;
import org.alfresco.dataprep.CMISUtil;
-import org.alfresco.rest.core.JsonBodyGenerator;
import org.alfresco.rest.core.RestResponse;
import org.alfresco.rest.core.v0.BaseAPI.RM_ACTIONS;
import org.alfresco.rest.model.RestNodeBodyMoveCopyModel;
@@ -66,6 +65,7 @@ import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
import org.alfresco.rest.v0.RMRolesAndActionsAPI;
import org.alfresco.rest.v0.service.DispositionScheduleService;
+import org.alfresco.rest.v0.service.RoleService;
import org.alfresco.test.AlfrescoTest;
import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.FileModel;
@@ -90,6 +90,8 @@ public class DeleteRecordTests extends BaseRMRestTest
private RMRolesAndActionsAPI rmRolesAndActionsAPI;
@Autowired
private org.alfresco.rest.v0.RecordsAPI recordsAPI;
+ @Autowired
+ private RoleService roleService;
/**
*
@@ -237,7 +239,7 @@ public class DeleteRecordTests extends BaseRMRestTest
{
// Create test user and add it with collaboration privileges
// Add RM role to user, RM Power User doesn't have the "Delete Record" capabilities
- UserModel deleteUser = createUserWithRMRole(ROLE_RM_POWER_USER.roleId);
+ UserModel deleteUser = roleService.createUserWithRMRole(ROLE_RM_POWER_USER.roleId);
getDataUser().addUserToSite(deleteUser, new SiteModel(getRestAPIFactory().getRMSiteAPI().getSite().getId()), SiteCollaborator);
String username = deleteUser.getUsername();
logger.info("Test user: " + username);
diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java
index c433c99dc6..35c2eee056 100644
--- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java
+++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/records/UpdateRecordsTests.java
@@ -66,10 +66,12 @@ import org.alfresco.rest.rm.community.requests.gscore.api.RecordFolderAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.RecordsAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI;
import org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI;
+import org.alfresco.rest.v0.service.RoleService;
import org.alfresco.test.AlfrescoTest;
import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.UserModel;
+import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.AfterClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -87,6 +89,9 @@ public class UpdateRecordsTests extends BaseRMRestTest
/* to be used to append to modifications */
private final String MODIFIED_PREFIX = "modified_";
+ @Autowired
+ private RoleService roleService;
+
/** Incomplete electronic and non electronic records created in one record folder, unfiled records container and one unfiled record folder */
@DataProvider(name = "incompleteRecords")
public Object[][] getIncompleteRecords() throws Exception
@@ -236,7 +241,7 @@ public class UpdateRecordsTests extends BaseRMRestTest
RMUserAPI rmUserAPI = getRestAPIFactory().getRMUserAPI();
// Create test user and add it with collab. privileges.
// RM Security Officer is the lowest role with Edit Record Metadata capabilities
- UserModel updateUser = createUserWithRMRole(ROLE_RM_SECURITY_OFFICER.roleId);
+ UserModel updateUser = roleService.createUserWithRMRole(ROLE_RM_SECURITY_OFFICER.roleId);
updateUser.setUserRole(UserRole.SiteCollaborator);
getDataUser().addUserToSite(updateUser, new SiteModel(getRestAPIFactory().getRMSiteAPI().getSite().getId()), UserRole.SiteCollaborator);