From 491923ef380666f16100af5d6f325cbd4d872040 Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Thu, 24 Mar 2016 12:24:07 +1100 Subject: [PATCH 1/5] Adjust POM's so plugin execution errors are masked in Eclipse --- rm-automation/pom.xml | 19 +++++++++++++++++++ rm-community/rm-community-repo/pom.xml | 15 +++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/rm-automation/pom.xml b/rm-automation/pom.xml index b21356e74d..119c9a23b7 100644 --- a/rm-automation/pom.xml +++ b/rm-automation/pom.xml @@ -111,6 +111,25 @@ + + + + org.codehaus.mojo + + + build-helper-maven-plugin + + + [1.9.1,) + + + regex-properties + + + + + + diff --git a/rm-community/rm-community-repo/pom.xml b/rm-community/rm-community-repo/pom.xml index 50205782c5..b373b7bdb5 100644 --- a/rm-community/rm-community-repo/pom.xml +++ b/rm-community/rm-community-repo/pom.xml @@ -268,6 +268,21 @@ + + + org.codehaus.mojo + + build-helper-maven-plugin + + [1.9.1,) + + regex-properties + + + + + + From 2a6b2f07516bf62a6521c03e8ccacef6ddbedc92 Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Thu, 24 Mar 2016 13:07:56 +1100 Subject: [PATCH 2/5] RM-3148 - File Plan containers rule inheritance patch implementation --- .../patch/rm-patch-context.xml | 7 +- .../patch/rm-patch-v24-context.xml | 18 ++++ ...FilePlanContainerRuleInheritancePatch.java | 91 +++++++++++++++++++ 3 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v24-context.xml create mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatch.java diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml index 5ae2a94653..03373b1ef4 100755 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml @@ -9,7 +9,7 @@ - + @@ -28,10 +28,7 @@ - - - - + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v24-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v24-context.xml new file mode 100644 index 0000000000..a67ec59f6b --- /dev/null +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v24-context.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatch.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatch.java new file mode 100644 index 0000000000..2b5de0dffa --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatch.java @@ -0,0 +1,91 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ + +package org.alfresco.module.org_alfresco_module_rm.patch.v24; + +import java.util.Set; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; +import org.alfresco.repo.rule.RuleModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; + +/** + * RM v2.4 patch that ensures that file plan root containers do not inherited rules, because this is no longer enforced + * in the service code anymore. + * + * See https://issues.alfresco.com/jira/browse/RM-3154 + * + * @author Roy Wetherall + * @since 2.4 + */ +public class RMv24FilePlanContainerRuleInheritancePatch extends AbstractModulePatch +{ + /** file plan service */ + private FilePlanService filePlanService; + + /** node service */ + private NodeService nodeService; + + /** + * @param filePlanService file plan service + */ + public void setFilePlanService(FilePlanService filePlanService) + { + this.filePlanService = filePlanService; + } + + /** + * @param nodeService node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() + * + * Note that we do not break rule inheritance for the root file since this wasn't previously + * the behaviour and we don't want to prevent this from happening if the current installation + * has been setup to allow it. + */ + @Override + public void applyInternal() + { + // get all the file plans + Set filePlans = filePlanService.getFilePlans(); + for (NodeRef filePlan : filePlans) + { + // set rule inheritance for all root file plan containers + nodeService.addAspect(filePlanService.getUnfiledContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + nodeService.addAspect(filePlanService.getHoldContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + nodeService.addAspect(filePlanService.getTransferContainer(filePlan), RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + } + } +} From 49d91d9f79478e33fa335abbf0422f5f1952e78c Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Thu, 24 Mar 2016 13:35:23 +1100 Subject: [PATCH 3/5] RM-3148: Patch unit test --- ...ContainerRuleInheritancePatchUnitTest.java | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatchUnitTest.java diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatchUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatchUnitTest.java new file mode 100644 index 0000000000..8d98cbb90f --- /dev/null +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v24/RMv24FilePlanContainerRuleInheritancePatchUnitTest.java @@ -0,0 +1,118 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ + +package org.alfresco.module.org_alfresco_module_rm.patch.v24; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock.generateNodeRef; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import java.util.Collections; + +import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.rule.RuleModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.junit.Before; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +/** + * RM V2.4 File Plan container rule inheritance patch unit test. + * + * @author Roy Wetherall + * @since 2.4 + */ +public class RMv24FilePlanContainerRuleInheritancePatchUnitTest +{ + private @Mock NodeService mockedNodeService; + private @Mock FilePlanService mockedFilePlanService; + + private @InjectMocks RMv24FilePlanContainerRuleInheritancePatch patch; + + @Before + public void before() + { + MockitoAnnotations.initMocks(this); + } + + /** + * Given there are not file plans, + * When the patch is executed, + * Then nothing happens + */ + @SuppressWarnings("unchecked") + @Test + public void noFilePlans() + { + // given + when(mockedFilePlanService.getFilePlans()) + .thenReturn(Collections.EMPTY_SET); + + // when + patch.applyInternal(); + + // then + verifyZeroInteractions(mockedNodeService); + } + + /** + * Given there is a file plan, + * When the patch is executed, + * Then the file plan containers are updated + */ + @Test + public void atLeastOneFilePlan() + { + NodeRef filePlan = generateNodeRef(mockedNodeService, RecordsManagementModel.TYPE_FILE_PLAN); + NodeRef holdsContainer = generateNodeRef(mockedNodeService); + NodeRef transferContainer = generateNodeRef(mockedNodeService); + NodeRef unfiledRecordsContainer = generateNodeRef(mockedNodeService); + + // given + when(mockedFilePlanService.getFilePlans()) + .thenReturn(Collections.singleton(filePlan)); + when(mockedFilePlanService.getHoldContainer(filePlan)) + .thenReturn(holdsContainer); + when(mockedFilePlanService.getTransferContainer(filePlan)) + .thenReturn(transferContainer); + when(mockedFilePlanService.getUnfiledContainer(filePlan)) + .thenReturn(unfiledRecordsContainer); + + // when + patch.applyInternal(); + + // then + verify(mockedNodeService).addAspect(holdsContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + verify(mockedNodeService).addAspect(transferContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + verify(mockedNodeService).addAspect(unfiledRecordsContainer, RuleModel.ASPECT_IGNORE_INHERITED_RULES, null); + } +} From 645d80edcbbdce65939656b446f9ce465f24151d Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Wed, 30 Mar 2016 09:57:54 +1100 Subject: [PATCH 4/5] Consolidate pluginExecution sections in root POM --- pom.xml | 19 +++++++++++++++++++ rm-automation/pom.xml | 21 +-------------------- rm-community/rm-community-repo/pom.xml | 17 +---------------- 3 files changed, 21 insertions(+), 36 deletions(-) diff --git a/pom.xml b/pom.xml index 191867fe7e..4ed1b31892 100644 --- a/pom.xml +++ b/pom.xml @@ -214,6 +214,25 @@ + + + + org.codehaus.mojo + + + build-helper-maven-plugin + + + [1.9.1,) + + + regex-properties + + + + + + diff --git a/rm-automation/pom.xml b/rm-automation/pom.xml index 119c9a23b7..c766803616 100644 --- a/rm-automation/pom.xml +++ b/rm-automation/pom.xml @@ -110,26 +110,7 @@ - - - - - org.codehaus.mojo - - - build-helper-maven-plugin - - - [1.9.1,) - - - regex-properties - - - - - - + diff --git a/rm-community/rm-community-repo/pom.xml b/rm-community/rm-community-repo/pom.xml index b373b7bdb5..77aa61d749 100644 --- a/rm-community/rm-community-repo/pom.xml +++ b/rm-community/rm-community-repo/pom.xml @@ -267,22 +267,7 @@ - - - - org.codehaus.mojo - - build-helper-maven-plugin - - [1.9.1,) - - regex-properties - - - - - - + From 1aecba721e4c56d73bad6bfa1eb0e04e19a5322e Mon Sep 17 00:00:00 2001 From: Tuna Aksoy Date: Wed, 30 Mar 2016 20:12:39 +0100 Subject: [PATCH 5/5] RM-3229 (Repo AMP contains unwanted libraries) --- rm-community/rm-community-repo/pom.xml | 46 +++++++++++++++++++------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/rm-community/rm-community-repo/pom.xml b/rm-community/rm-community-repo/pom.xml index 77aa61d749..af9825bcb5 100644 --- a/rm-community/rm-community-repo/pom.xml +++ b/rm-community/rm-community-repo/pom.xml @@ -24,7 +24,7 @@ 5.1.31 alfresco-rm-community-repo true - ${project.build.directory}/solr/home + ${project.build.directory}/solr/home @@ -213,12 +213,12 @@ - + org.codehaus.mojo - license-maven-plugin - + license-maven-plugin + alfresco_community source/java @@ -229,8 +229,8 @@ test/resources - - + + @@ -267,7 +267,7 @@ - + @@ -277,11 +277,6 @@ - - com.google.code.gson - gson - 2.3.1 - ${alfresco.groupId} alfresco-remote-api @@ -332,10 +327,12 @@ postgresql postgresql ${alfresco.postgres.version} + test mysql mysql-connector-java + test ${alfresco.groupId} @@ -348,6 +345,7 @@ * + test @@ -540,6 +538,30 @@ + + + postgresql + postgresql + ${alfresco.postgres.version} + + + mysql + mysql-connector-java + ${alfresco.mysql.version} + + + ${alfresco.groupId} + alfresco-repository + ${alfresco.version} + h2scripts + + + * + * + + + +