From e9bff5190a55382ee4ebbbb4f1fbf0ba95278bd0 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Fri, 14 Jun 2019 13:44:44 +0100 Subject: [PATCH 1/9] RM-6865 adding extra param for declare to --- .../action/dm/CreateRecordAction.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java index f668e41e28..3d51e9552a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java @@ -71,6 +71,8 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase public static final String PARAM_FILE_PLAN = "file-plan"; public static final String PARAM_HIDE_RECORD = "hide-record"; public static final String PARAM_PATH = "path"; + public static final String PARAM_ENCODED = "encoded"; + /** Node service */ private NodeService nodeService; @@ -127,10 +129,6 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase // resolve destination record folder if path supplied NodeRef destinationRecordFolder = null; String pathParameter = (String) action.getParameterValue(PARAM_PATH); - if (pathParameter != null && !pathParameter.isEmpty()) - { - destinationRecordFolder = resolvePath(filePlan, pathParameter); - } // indicate whether the record should be hidden or not (default not) boolean hideRecord = false; @@ -140,6 +138,18 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase hideRecord = hideRecordValue.booleanValue(); } + if (pathParameter != null && !pathParameter.isEmpty()) + { + if ((Boolean) action.getParameterValue(PARAM_ENCODED)) + { + destinationRecordFolder = resolvePath(filePlan, decode(pathParameter)); + } + else + { + destinationRecordFolder = resolvePath(filePlan, pathParameter); + } + } + synchronized (this) { // create record from existing document @@ -162,19 +172,18 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase //params.add(new ParameterDefinitionImpl(PARAM_FILE_PLAN, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_FILE_PLAN))); params.add(new ParameterDefinitionImpl(PARAM_PATH, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_PATH))); params.add(new ParameterDefinitionImpl(PARAM_HIDE_RECORD, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_HIDE_RECORD))); + params.add(new ParameterDefinitionImpl(PARAM_ENCODED, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_ENCODED))); } /** * Helper method to get the target record folder node reference from the action path parameter * - * @param filePlan The filePlan containing the path + * @param filePlan The filePlan containing the path * @param pathParameter The path * @return The NodeRef of the resolved path */ private NodeRef resolvePath(NodeRef filePlan, final String pathParameter) { - String decodedPathParameter = decode(pathParameter); - NodeRef destinationFolder; if (filePlan == null) @@ -182,7 +191,7 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase filePlan = getDefaultFilePlan(); } - final String[] pathElementsArray = StringUtils.tokenizeToStringArray(decodedPathParameter, "/", false, true); + final String[] pathElementsArray = StringUtils.tokenizeToStringArray(pathParameter, "/", false, true); if ((pathElementsArray != null) && (pathElementsArray.length > 0)) { destinationFolder = resolvePath(filePlan, Arrays.asList(pathElementsArray)); From 6eba79b77ace22917d3e0885940ca7a157b83efb Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Mon, 17 Jun 2019 08:01:15 +0100 Subject: [PATCH 2/9] RM-6865 adding test --- .../legacy/action/CreateRecordActionTest.java | 31 +++++++++++++++++++ .../test/util/BaseRMTestCase.java | 8 +++++ 2 files changed, 39 insertions(+) diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java index 9bb0a18d0d..aec46757d2 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java @@ -117,4 +117,35 @@ public class CreateRecordActionTest extends BaseRMTestCase }, ADMIN_USER); } + + public void testCreateRecordActionWithLocationWithSpaces() + { + doTestInTransaction(new Test() + { + public Void run() + { + assertFalse(recordService.isRecord(dmDocument1)); + + Action action = actionService.createAction(CreateRecordAction.NAME); + action.setParameterValue(CreateRecordAction.PARAM_HIDE_RECORD, false); + action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); + action.setParameterValue(CreateRecordAction.PARAM_PATH, "rm Container/rm Folder"); + action.setParameterValue(CreateRecordAction.PARAM_ENCODED, true); + actionService.executeAction(action, dmDocument1); + + return null; + } + + public void test(Void result) throws Exception + { + assertTrue(recordService.isRecord(dmDocument1)); + assertTrue(recordService.isFiled(dmDocument1)); + + // is the record folder the primary parent of the filed record + NodeRef parent = nodeService.getPrimaryParent(dmDocument1).getParentRef(); + assertEquals(rm_Folder, parent); + } + }, + ADMIN_USER); + } } diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java index 09667ed0f9..e0320dfc0c 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java @@ -186,8 +186,10 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase protected NodeRef folder; protected NodeRef filePlan; protected NodeRef rmContainer; + protected NodeRef rm_Container; protected DispositionSchedule dispositionSchedule; protected NodeRef rmFolder; + protected NodeRef rm_Folder; protected NodeRef unfiledContainer; protected String collabSiteId; protected NodeRef holdsContainer; @@ -586,12 +588,18 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase rmContainer = filePlanService.createRecordCategory(filePlan, "rmContainer"); assertNotNull("Could not create rm container", rmContainer); + rm_Container = filePlanService.createRecordCategory(filePlan, "rm Container"); + assertNotNull("Could not create rm container", rm_Container); + // Create disposition schedule dispositionSchedule = utils.createBasicDispositionSchedule(rmContainer); // Create RM folder rmFolder = recordFolderService.createRecordFolder(rmContainer, "rmFolder"); assertNotNull("Could not create rm folder", rmFolder); + + rm_Folder = recordFolderService.createRecordFolder(rm_Container, "rm Folder"); + assertNotNull("Could not create rm folder", rm_Folder); } } From a736112f0d3058790edbcce8df3b1ec380d29724 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Mon, 17 Jun 2019 14:43:39 +0100 Subject: [PATCH 3/9] RM-6865 adding null check --- .../org_alfresco_module_rm/action/dm/CreateRecordAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java index 3d51e9552a..4f6aee0895 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java @@ -140,7 +140,7 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase if (pathParameter != null && !pathParameter.isEmpty()) { - if ((Boolean) action.getParameterValue(PARAM_ENCODED)) + if (action.getParameterValue(PARAM_ENCODED) != null && (Boolean) action.getParameterValue(PARAM_ENCODED)) { destinationRecordFolder = resolvePath(filePlan, decode(pathParameter)); } From 3819bbac8820b40ec540eb20c4c09622cec8375d Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Tue, 18 Jun 2019 08:57:46 +0100 Subject: [PATCH 4/9] RM-6865 adding param to test --- .../requests/gscore/api/ActionsExecutionAPI.java | 15 +++++++++++++++ .../DeclareAndFileDocumentAsRecordTests.java | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java index a977db9ad6..f15c336b9c 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java @@ -64,6 +64,21 @@ public class ActionsExecutionAPI extends RMModelRequest ImmutableMap.of("path", destinationPath)); } + /** + * Declares and files a document as record to a record folder using v1 actions api + * + * @param targetNode the node on which the action is executed + * @param destinationPath the path to the record folder + * @param encoded value to indicate if the path has been encoded + * @throws Exception + */ + public JSONObject declareAndFile(RepoTestModel targetNode, String destinationPath, boolean encoded) throws Exception + { + return getRmRestWrapper().withCoreAPI().usingActions() + .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode, + ImmutableMap.of("path", destinationPath, "encoded", String.valueOf(encoded))); + } + /** * Declares a document as record using v1 actions api * diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java index db798cf113..f16ad991db 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java @@ -237,7 +237,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest { STEP("Declare document as record with an encoded location parameter value"); getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFile(testFile, - Utility.buildPath(recordCategory.getName(), RECORD_FOLDER_NAME_ENCODED)); + Utility.buildPath(recordCategory.getName(), RECORD_FOLDER_NAME_ENCODED), true); STEP("Verify the declared record is placed in the record folder"); assertTrue(isMatchingRecordInRecordFolder(testFile, recordFolderWithSpacesInName), "Record should be filed to record folder"); From 6100987ea232ba9efa72eba0af9fb1a0785bba85 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Tue, 18 Jun 2019 17:45:46 +0100 Subject: [PATCH 5/9] RM-6865 removing encoding of path in action body --- .../gscore/api/ActionsExecutionAPI.java | 15 --------- .../DeclareAndFileDocumentAsRecordTests.java | 11 +++---- .../action/dm/CreateRecordAction.java | 32 +------------------ 3 files changed, 6 insertions(+), 52 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java index f15c336b9c..a977db9ad6 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/ActionsExecutionAPI.java @@ -64,21 +64,6 @@ public class ActionsExecutionAPI extends RMModelRequest ImmutableMap.of("path", destinationPath)); } - /** - * Declares and files a document as record to a record folder using v1 actions api - * - * @param targetNode the node on which the action is executed - * @param destinationPath the path to the record folder - * @param encoded value to indicate if the path has been encoded - * @throws Exception - */ - public JSONObject declareAndFile(RepoTestModel targetNode, String destinationPath, boolean encoded) throws Exception - { - return getRmRestWrapper().withCoreAPI().usingActions() - .executeAction(ActionsOnRule.DECLARE_AS_RECORD.getActionValue(), targetNode, - ImmutableMap.of("path", destinationPath, "encoded", String.valueOf(encoded))); - } - /** * Declares a document as record using v1 actions api * diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java index f16ad991db..244132d031 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java @@ -87,8 +87,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest private final static String DESTINATION_PATH_NOT_RECORD_FOLDER_EXC = "Unable to execute create-record action, because the destination path is not a record folder."; private final static String CLOSED_RECORD_FOLDER_EXC = "You can't add new items to a closed record folder."; private final static String HOLD_NAME = "holdName"; - private final static String RECORD_FOLDER_NAME_ENCODED = "Folder%20With%20Spaces%20In%20Name"; - private final static String RECORD_FOLDER_NAME_DECODED = "Folder With Spaces In Name"; + private final static String RECORD_FOLDER_NAME_WITH_SPACE = "Folder With Spaces In Name"; private UserModel userFillingPermission, userReadOnlyPermission; private SiteModel publicSite; @@ -167,7 +166,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest "Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE); closedRecordFolder = createFolder(recordCategory.getId(), getRandomName("closedRecordFolder")); closeFolder(closedRecordFolder.getId()); - recordFolderWithSpacesInName = createFolder(recordCategory.getId(), RECORD_FOLDER_NAME_DECODED); + recordFolderWithSpacesInName = createFolder(recordCategory.getId(), RECORD_FOLDER_NAME_WITH_SPACE); STEP("Create rm users with different permissions on the record category"); userFillingPermission = roleService.createCollaboratorWithRMRoleAndPermission(publicSite, recordCategory, ROLE_RM_POWER_USER, PERMISSION_FILING); @@ -227,17 +226,17 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest /** * Given I am calling the "declare as record" action - * And I provide a valid encoded record folder name in the location parameter + * And I provide a valid record folder name in the location parameter * When I execute the action * Then the document is declared as a record * And is filed to the record folder specified */ @Test - public void declareAndFileToValidEncodedLocationUsingActionsAPI() throws Exception + public void declareAndFileToValidLocationWithSpacesUsingActionsAPI() throws Exception { STEP("Declare document as record with an encoded location parameter value"); getRestAPIFactory().getActionsAPI(userFillingPermission).declareAndFile(testFile, - Utility.buildPath(recordCategory.getName(), RECORD_FOLDER_NAME_ENCODED), true); + Utility.buildPath(recordCategory.getName(), RECORD_FOLDER_NAME_WITH_SPACE)); STEP("Verify the declared record is placed in the record folder"); assertTrue(isMatchingRecordInRecordFolder(testFile, recordFolderWithSpacesInName), "Record should be filed to record folder"); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java index 4f6aee0895..0700df1524 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java @@ -27,8 +27,6 @@ package org.alfresco.module.org_alfresco_module_rm.action.dm; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; import java.util.Arrays; import java.util.List; @@ -140,14 +138,7 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase if (pathParameter != null && !pathParameter.isEmpty()) { - if (action.getParameterValue(PARAM_ENCODED) != null && (Boolean) action.getParameterValue(PARAM_ENCODED)) - { - destinationRecordFolder = resolvePath(filePlan, decode(pathParameter)); - } - else - { - destinationRecordFolder = resolvePath(filePlan, pathParameter); - } + destinationRecordFolder = resolvePath(filePlan, pathParameter); } synchronized (this) @@ -172,7 +163,6 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase //params.add(new ParameterDefinitionImpl(PARAM_FILE_PLAN, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_FILE_PLAN))); params.add(new ParameterDefinitionImpl(PARAM_PATH, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_PATH))); params.add(new ParameterDefinitionImpl(PARAM_HIDE_RECORD, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_HIDE_RECORD))); - params.add(new ParameterDefinitionImpl(PARAM_ENCODED, DataTypeDefinition.BOOLEAN, false, getParamDisplayLabel(PARAM_ENCODED))); } /** @@ -272,24 +262,4 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase } return filePlan; } - - /** - * Helper method to decode path string - * - * @param pathParameter The path string to be decoded - * @return The decoded path string - */ - private String decode(String pathParameter) - { - String decodedPathParameter; - try - { - decodedPathParameter = URLDecoder.decode(pathParameter, "UTF-8"); - } - catch (UnsupportedEncodingException ex) - { - throw new AlfrescoRuntimeException("Unable to execute " + NAME + " action, because the destination path could not be decoded."); - } - return decodedPathParameter; - } } From 2833d3cabad5b613c5be035a8eb9d6f210ef0f38 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Tue, 18 Jun 2019 17:47:39 +0100 Subject: [PATCH 6/9] RM-6865 removing encoding of path in action body --- .../org_alfresco_module_rm/action/dm/CreateRecordAction.java | 1 - 1 file changed, 1 deletion(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java index 0700df1524..e4a28b14b3 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java @@ -69,7 +69,6 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase public static final String PARAM_FILE_PLAN = "file-plan"; public static final String PARAM_HIDE_RECORD = "hide-record"; public static final String PARAM_PATH = "path"; - public static final String PARAM_ENCODED = "encoded"; /** Node service */ From 12f9907b064cd7a48cece72e90cc3d4d8db7a07e Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Wed, 19 Jun 2019 08:20:55 +0100 Subject: [PATCH 7/9] RM-6865 code review changes --- .../org_alfresco_module_rm/action/dm/CreateRecordAction.java | 1 - .../test/legacy/action/CreateRecordActionTest.java | 1 - .../module/org_alfresco_module_rm/test/util/BaseRMTestCase.java | 2 -- 3 files changed, 4 deletions(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java index e4a28b14b3..5e2a86ab73 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java @@ -70,7 +70,6 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase public static final String PARAM_HIDE_RECORD = "hide-record"; public static final String PARAM_PATH = "path"; - /** Node service */ private NodeService nodeService; diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java index aec46757d2..64df34a536 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/CreateRecordActionTest.java @@ -130,7 +130,6 @@ public class CreateRecordActionTest extends BaseRMTestCase action.setParameterValue(CreateRecordAction.PARAM_HIDE_RECORD, false); action.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); action.setParameterValue(CreateRecordAction.PARAM_PATH, "rm Container/rm Folder"); - action.setParameterValue(CreateRecordAction.PARAM_ENCODED, true); actionService.executeAction(action, dmDocument1); return null; diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java index e0320dfc0c..21e69a773a 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java @@ -54,7 +54,6 @@ import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderServi import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; import org.alfresco.module.org_alfresco_module_rm.report.ReportService; import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.role.Role; import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; import org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService; @@ -62,7 +61,6 @@ import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService; import org.alfresco.repo.policy.BehaviourFilter; import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authority.AuthorityDAO; import org.alfresco.repo.site.SiteModel; import org.alfresco.repo.site.SiteServiceImpl; import org.alfresco.repo.transaction.RetryingTransactionHelper; From 47b78b9cd6cf88bcfeeb20db2d014e8ecee1a9ec Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Wed, 19 Jun 2019 10:16:25 +0100 Subject: [PATCH 8/9] RM-6865 code review changes --- .../files/DeclareAndFileDocumentAsRecordTests.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java index 244132d031..72eafb3c97 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java @@ -44,7 +44,6 @@ import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.FORBIDDEN; import static org.springframework.http.HttpStatus.NOT_FOUND; import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; -import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; @@ -52,7 +51,6 @@ import java.util.List; import org.alfresco.dataprep.CMISUtil; import org.alfresco.rest.rm.community.base.BaseRMRestTest; -import org.alfresco.rest.rm.community.model.record.Record; import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; @@ -280,13 +278,13 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest public void declareAndFileToValidLocationUsingFilesAPI() throws Exception { STEP("Declare document as record with a location parameter value"); - Record record = getRestAPIFactory().getFilesAPI(userFillingPermission) + getRestAPIFactory().getFilesAPI(userFillingPermission) .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) .declareAsRecord(testFile.getNodeRefWithoutVersion()); assertStatusCode(CREATED); STEP("Verify the declared record is placed in the record folder"); - assertEquals(record.getParentId(), recordFolder.getId(), "Record should be filed to record folder"); + assertTrue(isMatchingRecordInRecordFolder(testFile, recordFolder), "Record should be filed to record folder"); STEP("Verify the document in collaboration site is now a record"); assertTrue(hasRecordAspect(testFile), "File should have record aspect"); From 628a3527b9b74182061119bc7f908f54adfe6049 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Wed, 19 Jun 2019 10:57:08 +0100 Subject: [PATCH 9/9] Revert "RM-6865 code review changes" This reverts commit 47b78b9c --- .../files/DeclareAndFileDocumentAsRecordTests.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java index 72eafb3c97..244132d031 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/DeclareAndFileDocumentAsRecordTests.java @@ -44,6 +44,7 @@ import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.FORBIDDEN; import static org.springframework.http.HttpStatus.NOT_FOUND; import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY; +import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; @@ -51,6 +52,7 @@ import java.util.List; import org.alfresco.dataprep.CMISUtil; import org.alfresco.rest.rm.community.base.BaseRMRestTest; +import org.alfresco.rest.rm.community.model.record.Record; import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory; import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild; import org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild; @@ -278,13 +280,13 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest public void declareAndFileToValidLocationUsingFilesAPI() throws Exception { STEP("Declare document as record with a location parameter value"); - getRestAPIFactory().getFilesAPI(userFillingPermission) + Record record = getRestAPIFactory().getFilesAPI(userFillingPermission) .usingParams(String.format("%s=%s", PARENT_ID_PARAM, recordFolder.getId())) .declareAsRecord(testFile.getNodeRefWithoutVersion()); assertStatusCode(CREATED); STEP("Verify the declared record is placed in the record folder"); - assertTrue(isMatchingRecordInRecordFolder(testFile, recordFolder), "Record should be filed to record folder"); + assertEquals(record.getParentId(), recordFolder.getId(), "Record should be filed to record folder"); STEP("Verify the document in collaboration site is now a record"); assertTrue(hasRecordAspect(testFile), "File should have record aspect");