From 1e51b9927929dd45277502414043bb7688afd122 Mon Sep 17 00:00:00 2001 From: Claudia Agache Date: Tue, 14 Jul 2020 12:29:39 +0300 Subject: [PATCH 01/10] APPS-269 Automate AC for Worm Lock Action --- .../fileplancomponents/FilePlanComponentAspects.java | 2 ++ .../rest/rm/community/model/rules/ActionsOnRule.java | 3 ++- .../requests/gscore/api/ActionsExecutionAPI.java | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java index 32faaa8667..01d0a21a5d 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java @@ -59,4 +59,6 @@ public class FilePlanComponentAspects //declare version as record aspect public static final String VERSION_AS_RECORD="rmv:versionRecord"; + + public static final String ASPECT_STORE_SELECTOR="cm:storeSelector"; } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java index 24ac6257d8..e7351aabbf 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java @@ -49,7 +49,8 @@ public enum ActionsOnRule SET_PROPERTY_VALUE_RM("setPropertyValue"), HIDE_RECORD("hide-record"), DECLARE_VERSION_AS_RECORD("declare-as-version-record"), - DECLARE_AS_RECORD("create-record"); + DECLARE_AS_RECORD("create-record"), + WORM_LOCK("worm"); private String actionValue; 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 fdf5b74f90..825a39cdc9 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 @@ -102,4 +102,16 @@ public class ActionsExecutionAPI extends RMModelRequest return getRmRestWrapper().withCoreAPI().usingActions() .executeAction(ActionsOnRule.DECLARE_VERSION_AS_RECORD.getActionValue(), targetNode); } + + /** + * Add WORM lock to a node using v1 actions api + * + * @param targetNode the node on which the action is executed + * @throws Exception + */ + public JSONObject addWORMLock(RepoTestModel targetNode) throws Exception + { + return getRmRestWrapper().withCoreAPI().usingActions() + .executeAction(ActionsOnRule.WORM_LOCK.getActionValue(), targetNode); + } } From 3399123da2cdc9aa06cb20a1f8cac04e7b3c4fd3 Mon Sep 17 00:00:00 2001 From: Claudia Agache Date: Tue, 14 Jul 2020 16:57:12 +0300 Subject: [PATCH 02/10] added a rejected record to the list of invalid objects for WORM --- .../model/fileplancomponents/FilePlanComponentAspects.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java index 01d0a21a5d..d05545d789 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java @@ -57,8 +57,9 @@ public class FilePlanComponentAspects // retention schedule cut off aspect public static final String CUT_OFF_ASPECT = "rma:cutOff"; - //declare version as record aspect + // declare version as record aspect public static final String VERSION_AS_RECORD="rmv:versionRecord"; + // WORM store selector aspect public static final String ASPECT_STORE_SELECTOR="cm:storeSelector"; } From 219f82ad7e18bf3e5ecad84b3ee0a86c2f786aec Mon Sep 17 00:00:00 2001 From: Claudia Agache Date: Wed, 15 Jul 2020 10:23:20 +0300 Subject: [PATCH 03/10] apply code style --- .../model/fileplancomponents/FilePlanComponentAspects.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java index d05545d789..a9deb86b1f 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/fileplancomponents/FilePlanComponentAspects.java @@ -58,8 +58,8 @@ public class FilePlanComponentAspects public static final String CUT_OFF_ASPECT = "rma:cutOff"; // declare version as record aspect - public static final String VERSION_AS_RECORD="rmv:versionRecord"; + public static final String VERSION_AS_RECORD = "rmv:versionRecord"; // WORM store selector aspect - public static final String ASPECT_STORE_SELECTOR="cm:storeSelector"; + public static final String ASPECT_STORE_SELECTOR = "cm:storeSelector"; } From a93f847ed37e72c7d32e9185b84c6b9466d369de Mon Sep 17 00:00:00 2001 From: Claudia Agache Date: Wed, 15 Jul 2020 11:54:01 +0300 Subject: [PATCH 04/10] create helper method to check if an exception is thrown in alfresco logs --- .../rest/rm/community/util/DockerHelper.java | 19 +++++++++++++++++++ .../DeclareAndFileDocumentAsRecordTests.java | 9 +-------- .../files/FileVersionAsRecordTests.java | 11 ++--------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java index a46cd44e5c..dd71e65075 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/DockerHelper.java @@ -27,6 +27,8 @@ package org.alfresco.rest.rm.community.util; +import static org.testng.Assert.assertTrue; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -42,6 +44,7 @@ import com.github.dockerjava.netty.NettyDockerCmdExecFactory; import lombok.Getter; import lombok.Setter; +import org.alfresco.utility.Utility; import org.apache.commons.lang.SystemUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -142,6 +145,22 @@ public class DockerHelper } } + /** + * Helper method to check if the specified exception is thrown in alfresco logs + * + * @param expectedException the expected exception to be thrown + * @throws Exception + */ + public void checkExceptionIsInAlfrescoLogs(String expectedException) throws Exception + { + //Retry the operation because sometimes it takes few seconds to throw the exception + Utility.sleep(6000, 30000, () -> + { + List alfrescoLogs = getAlfrescoLogs(); + assertTrue(alfrescoLogs.stream().anyMatch(logLine -> logLine.contains(expectedException))); + }); + } + /** * Method for finding docker containers after the image name * 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 a040a4d3d1..61e91f4517 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 @@ -50,8 +50,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; -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; @@ -266,12 +264,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest assertStatusCode(ACCEPTED); STEP("Check the exception thrown in alfresco logs"); - //Retry the operation because sometimes it takes few seconds to throw the exception - Utility.sleep(6000, 30000, () -> - { - List alfrescoLogs = dockerHelper.getAlfrescoLogs(); - assertTrue(alfrescoLogs.stream().anyMatch(logLine -> logLine.contains(expectedException))); - }); + dockerHelper.checkExceptionIsInAlfrescoLogs(expectedException); STEP("Check that the file is not a record"); assertFalse(hasRecordAspect(testFile), "File should not have record aspect"); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/FileVersionAsRecordTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/FileVersionAsRecordTests.java index 4e32cf4790..dd6d0e453c 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/FileVersionAsRecordTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/files/FileVersionAsRecordTests.java @@ -41,7 +41,6 @@ import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import java.io.File; -import java.util.List; import org.alfresco.dataprep.CMISUtil; import org.alfresco.rest.rm.community.base.BaseRMRestTest; @@ -127,7 +126,7 @@ public class FileVersionAsRecordTests extends BaseRMRestTest } @BeforeMethod (alwaysRun = true) - public void createDocument() + public void createDocument() throws Exception { STEP("Create a document in the collaboration site"); testFile = dataContent.usingSite(publicSite) @@ -215,13 +214,7 @@ public class FileVersionAsRecordTests extends BaseRMRestTest assertStatusCode(ACCEPTED); STEP("Check the exception thrown in alfresco logs"); - //Retry the operation because sometimes it takes few seconds to throw the exception - Utility.sleep(6000, 30000, () -> - { - List alfrescoLogs = dockerHelper.getAlfrescoLogs(); - assertTrue(alfrescoLogs.stream().anyMatch(logLine -> logLine.contains(expectedException))); - }); - + dockerHelper.checkExceptionIsInAlfrescoLogs(expectedException); } /** From e35171ee6fe0156352ef3a82a4e1680fc8f106c9 Mon Sep 17 00:00:00 2001 From: ehardon Date: Wed, 15 Jul 2020 13:36:00 +0300 Subject: [PATCH 05/10] APPS-270: - add worm action in rm rules page --- .../alfresco/module/org_alfresco_module_rm/rm-action-context.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml index c398851937..fa7e932b13 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml @@ -988,6 +988,7 @@ + From 55626d70e6aa1eb9717274196f8851c5af575043 Mon Sep 17 00:00:00 2001 From: Claudia Agache Date: Wed, 15 Jul 2020 22:00:12 +0300 Subject: [PATCH 06/10] update tests based on latest changes --- .../alfresco/rest/rm/community/model/rules/ActionsOnRule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java index e7351aabbf..415c4da270 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java @@ -50,7 +50,7 @@ public enum ActionsOnRule HIDE_RECORD("hide-record"), DECLARE_VERSION_AS_RECORD("declare-as-version-record"), DECLARE_AS_RECORD("create-record"), - WORM_LOCK("worm"); + WORM_LOCK("wormlock"); private String actionValue; From f2333515659dfb3a4de6c90adbac41601fd4ea11 Mon Sep 17 00:00:00 2001 From: Claudia Agache Date: Mon, 20 Jul 2020 10:39:41 +0000 Subject: [PATCH 07/10] code review comments --- .../alfresco/rest/rm/community/model/rules/ActionsOnRule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java index 415c4da270..da7ee69144 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java @@ -50,7 +50,7 @@ public enum ActionsOnRule HIDE_RECORD("hide-record"), DECLARE_VERSION_AS_RECORD("declare-as-version-record"), DECLARE_AS_RECORD("create-record"), - WORM_LOCK("wormlock"); + WORM_LOCK("wormLock"); private String actionValue; From 3c747ea7b9e829bed191f7a7ae6256104b12baa3 Mon Sep 17 00:00:00 2001 From: Raluca Munteanu Date: Tue, 21 Jul 2020 14:25:32 +0300 Subject: [PATCH 08/10] APPS-265: Added temporary property to check store --- .../org_alfresco_module_rm/model/RecordsManagementModel.java | 1 + 1 file changed, 1 insertion(+) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java index 8b04d566f8..14ac8863cf 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementModel.java @@ -116,6 +116,7 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel QName ASPECT_RECORD = QName.createQName(RM_URI, "record"); QName PROP_DATE_FILED = QName.createQName(RM_URI, "dateFiled"); QName PROP_ORIGIONAL_NAME = QName.createQName(RM_URI, "origionalName"); + QName PROP_WORM_STORE = QName.createQName(RM_URI, "wormStore"); // Common record details QName ASPECT_COMMON_RECORD_DETAILS = QName.createQName(RM_URI, "commonRecordDetails"); From 3f9c2f04338e47d9f331afad635425ad4dd008ab Mon Sep 17 00:00:00 2001 From: Raluca Munteanu Date: Wed, 22 Jul 2020 11:41:44 +0300 Subject: [PATCH 09/10] APPS-265: Updates on UI side --- .../alfresco/rest/rm/community/model/rules/ActionsOnRule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java index da7ee69144..415c4da270 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java @@ -50,7 +50,7 @@ public enum ActionsOnRule HIDE_RECORD("hide-record"), DECLARE_VERSION_AS_RECORD("declare-as-version-record"), DECLARE_AS_RECORD("create-record"), - WORM_LOCK("wormLock"); + WORM_LOCK("wormlock"); private String actionValue; From 53b2284e27bad8b583a06816f632d104351ec4ee Mon Sep 17 00:00:00 2001 From: rodicasutu Date: Wed, 22 Jul 2020 20:00:34 +0300 Subject: [PATCH 10/10] fixes after merging the changes from master --- .../alfresco/rest/rm/community/model/rules/ActionsOnRule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java index 415c4da270..da7ee69144 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/rules/ActionsOnRule.java @@ -50,7 +50,7 @@ public enum ActionsOnRule HIDE_RECORD("hide-record"), DECLARE_VERSION_AS_RECORD("declare-as-version-record"), DECLARE_AS_RECORD("create-record"), - WORM_LOCK("wormlock"); + WORM_LOCK("wormLock"); private String actionValue;