From d5278c4ec7709537afdb83d70e3ff5a580de962c Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Fri, 9 Aug 2019 10:06:30 +0100 Subject: [PATCH 1/8] RM-6873 adding code to allow for the removal of active content from a hold --- .../model/rma/aspect/FrozenAspect.java | 20 +- .../hold/RemoveActiveContentToHoldTest.java | 194 ++++++++++++++++++ .../rma/aspect/FrozenAspectUnitTest.java | 126 ++++++++++++ 3 files changed, 329 insertions(+), 11 deletions(-) create mode 100644 rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentToHoldTest.java create mode 100644 rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java index c3dcc1f4fb..909cf8bd23 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java @@ -190,35 +190,33 @@ public class FrozenAspect extends BaseBehaviourBean kind = BehaviourKind.CLASS, notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT ) - public void onRemoveAspect(final NodeRef record, QName aspectTypeQName) + public void onRemoveAspect(final NodeRef nodeRef, QName aspectTypeQName) { AuthenticationUtil.runAsSystem(new RunAsWork() { @Override public Void doWork() { - if (nodeService.exists(record) && - isRecord(record)) + if (nodeService.exists(nodeRef) && + (isRecord(nodeRef) || instanceOf(nodeRef, TYPE_CONTENT))) { - // get the owning record folder - NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef(); + // get the owning folder + NodeRef owningFolder = nodeService.getPrimaryParent(nodeRef).getParentRef(); // check that the aspect has been added - if (nodeService.hasAspect(recordFolder, ASPECT_HELD_CHILDREN)) + if (nodeService.hasAspect(owningFolder, ASPECT_HELD_CHILDREN)) { // decrement current count - int currentCount = (Integer)nodeService.getProperty(recordFolder, PROP_HELD_CHILDREN_COUNT); + int currentCount = (Integer)nodeService.getProperty(owningFolder, PROP_HELD_CHILDREN_COUNT); if (currentCount > 0) { - currentCount = currentCount - 1; - nodeService.setProperty(recordFolder, PROP_HELD_CHILDREN_COUNT, currentCount); + nodeService.setProperty(owningFolder, PROP_HELD_CHILDREN_COUNT, currentCount - 1 ); } } } return null; } - }); - + }); } } diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentToHoldTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentToHoldTest.java new file mode 100644 index 0000000000..e182af97da --- /dev/null +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentToHoldTest.java @@ -0,0 +1,194 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2019 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.test.integration.hold; + +import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.repo.site.SiteModel; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.webscripts.GUID; + +/** + * Remove Active Content To Hold Integration Tests + * + * @author Ross Gale + * @since 3.2 + */ +public class RemoveActiveContentToHoldTest extends BaseRMTestCase +{ + @Override + protected boolean isCollaborationSiteTest() + { + return true; + } + + @Override + protected boolean isUserTest() + { + return true; + } + + /** + * Given a piece of active content on hold + * When I try to remove the active content from the hold + * Then the active content is unfrozen + * And the active content is not contained within the hold + */ + public void testRemoveDocumentFromHold() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef hold; + Integer before; + + public void given() + { + hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + holdService.addToHold(hold, dmDocument); + } + + public void when() + { + before = (Integer) nodeService.getProperty(dmFolder, PROP_HELD_CHILDREN_COUNT); + holdService.removeFromHold(hold, dmDocument); + } + + public void then() + { + // active content is no longer frozen + assertFalse(freezeService.isFrozen(dmDocument)); + + // check the content is no longer held + assertFalse(holdService.getHeld(hold).contains(dmDocument)); + assertFalse(holdService.heldBy(dmDocument, true).contains(hold)); + + // check the held count on the folder has been reduced + assertTrue(before > (Integer) nodeService.getProperty(dmFolder, PROP_HELD_CHILDREN_COUNT)); + } + }); + } + + /** + * Given a piece of active content in multiple holds + * When I try to remove the active content from a single hold + * Then the active content is still frozen + * And the active content is not contained within the specified hold + * And is still added to any other holds + */ + public void testRemoveDocumentFromASingleHold() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef hold; + private NodeRef hold2; + Integer before; + + public void given() + { + hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + hold2 = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + holdService.addToHold(hold, dmDocument); + holdService.addToHold(hold2, dmDocument); + } + + public void when() + { + before = (Integer) nodeService.getProperty(dmFolder, PROP_HELD_CHILDREN_COUNT); + holdService.removeFromHold(hold, dmDocument); + } + + public void then() + { + assertTrue(freezeService.isFrozen(dmDocument)); + assertFalse(holdService.heldBy(dmDocument, true).contains(hold)); + assertTrue(holdService.heldBy(dmDocument, true).contains(hold2)); + } + }); + } + + /** + * Given a piece of active content on hold + * When I try to remove the active content to the hold without permission + * Then an access denied exception is thrown + */ + public void testRemoveDocumentFromHoldFailsWithoutPermission() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) + { + private NodeRef hold; + + public void given() + { + hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + holdService.addToHold(hold, dmDocument); + } + + public void when() + { + AuthenticationUtil.runAs( + (RunAsWork) () -> { + holdService.removeFromHold(hold, dmDocument); + return null; + }, recordsManagerName ); + } + }); + } + + /** + * Given a piece of active content on hold + * When I try to remove the active content to the hold without the remove hold capability + * Then an access denied exception is thrown + */ + public void testRemoveDocumentFromHoldFailsWithoutRemoveHoldPermission() + { + doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class, powerUserName, false) + { + private NodeRef hold; + + public void given() + { + //add powerUserPerson as manager in collaboration site to have write permissions on dmDocument + AuthenticationUtil.runAs( + (RunAsWork) () -> { + siteService.setMembership(collabSiteId, powerUserName, SiteModel.SITE_MANAGER); + hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); + holdService.addToHold(hold, dmDocument); + return null; + }, getAdminUserName()); + } + + public void when() + { + holdService.removeFromHold(hold, dmDocument); + } + }); + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java new file mode 100644 index 0000000000..6eb3bef240 --- /dev/null +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java @@ -0,0 +1,126 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2019 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.model.rma.aspect; + +import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_HELD_CHILDREN; +import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_RECORD; +import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_HELD_CHILDREN_COUNT; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.alfresco.model.ContentModel; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +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; +import org.springframework.context.ApplicationContext; + +/** + * Test class for frozen aspect + * @author Ross Gale + * @since 3.2 + */ +public class FrozenAspectUnitTest +{ + @Mock + private NodeService nodeService; + + @Mock + private ApplicationContext applicationContext; + + @Mock + private ChildAssociationRef childAssociationRef; + + @Mock + private DictionaryService dictionaryService; + + @InjectMocks + private FrozenAspect frozenAspect; + + private NodeRef record = new NodeRef("workspace://record/node"); + private NodeRef folder = new NodeRef("workspace://folder/node"); + private NodeRef content = new NodeRef("workspace://content/node"); + + @Before + public void setUp() + { + MockitoAnnotations.initMocks(this); + when(nodeService.exists(record)).thenReturn(true); + when(nodeService.exists(content)).thenReturn(true); + when(nodeService.hasAspect(folder, ASPECT_HELD_CHILDREN)).thenReturn(true); + when(nodeService.getProperty(folder, PROP_HELD_CHILDREN_COUNT)).thenReturn(1); + when(applicationContext.getBean("dbNodeService")).thenReturn(nodeService); + when(nodeService.hasAspect(folder, ASPECT_HELD_CHILDREN)).thenReturn(true); + when(nodeService.getProperty(folder, PROP_HELD_CHILDREN_COUNT)).thenReturn(1); + } + + /** + * Test that the held count is reduced on a record folder after the frozen aspect is removed from a record + */ + @Test + public void testRemoveAspectForRecords() + { + when(nodeService.hasAspect(record, ASPECT_RECORD)).thenReturn(true); + when(nodeService.getPrimaryParent(record)).thenReturn(childAssociationRef); + when(childAssociationRef.getParentRef()).thenReturn(folder); + frozenAspect.onRemoveAspect(record, null); + verify(nodeService, times(1)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); + } + + /** + * Test that the held count is reduced on a folder after the frozen aspect is removed from a piece of content + */ + @Test + public void testRemoveAspectForContent() + { + when(nodeService.hasAspect(content, ASPECT_RECORD)).thenReturn(false); + when(nodeService.getType(content)).thenReturn(ContentModel.TYPE_CONTENT); + when(nodeService.getPrimaryParent(content)).thenReturn(childAssociationRef); + when(childAssociationRef.getParentRef()).thenReturn(folder); + frozenAspect.onRemoveAspect(content, null); + verify(nodeService, times(1)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); + } + + /** + * Test that the remove code is only ran for records or active content + */ + @Test + public void testRemoveAspectForContentDoesntUpdateForOtherTypes() + { + when(nodeService.hasAspect(content, ASPECT_RECORD)).thenReturn(false); + when(nodeService.getType(content)).thenReturn(ContentModel.TYPE_FOLDER); + when(dictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_CONTENT)).thenReturn(false); + frozenAspect.onRemoveAspect(content, null); + verify(nodeService, times(0)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); + } +} From dff5b452d967fce84db273ac28a20ff2c041af29 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Wed, 14 Aug 2019 11:20:18 +0100 Subject: [PATCH 2/8] RM-6873 code review changes --- .../model/rma/aspect/FrozenAspect.java | 33 ++++++------- .../hold/RemoveActiveContentToHoldTest.java | 6 +-- .../rma/aspect/FrozenAspectUnitTest.java | 46 +++++++++---------- 3 files changed, 38 insertions(+), 47 deletions(-) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java index 909cf8bd23..f5f174c73a 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java @@ -192,30 +192,25 @@ public class FrozenAspect extends BaseBehaviourBean ) public void onRemoveAspect(final NodeRef nodeRef, QName aspectTypeQName) { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() + AuthenticationUtil.runAsSystem((RunAsWork) () -> { + if (nodeService.exists(nodeRef) && + (isRecord(nodeRef) || instanceOf(nodeRef, TYPE_CONTENT))) { - if (nodeService.exists(nodeRef) && - (isRecord(nodeRef) || instanceOf(nodeRef, TYPE_CONTENT))) + // get the owning folder + NodeRef owningFolder = nodeService.getPrimaryParent(nodeRef).getParentRef(); + + // check that the aspect has been added + if (nodeService.hasAspect(owningFolder, ASPECT_HELD_CHILDREN)) { - // get the owning folder - NodeRef owningFolder = nodeService.getPrimaryParent(nodeRef).getParentRef(); - - // check that the aspect has been added - if (nodeService.hasAspect(owningFolder, ASPECT_HELD_CHILDREN)) + // decrement current count + int currentCount = (Integer) nodeService.getProperty(owningFolder, PROP_HELD_CHILDREN_COUNT); + if (currentCount > 0) { - // decrement current count - int currentCount = (Integer)nodeService.getProperty(owningFolder, PROP_HELD_CHILDREN_COUNT); - if (currentCount > 0) - { - nodeService.setProperty(owningFolder, PROP_HELD_CHILDREN_COUNT, currentCount - 1 ); - } - } + nodeService.setProperty(owningFolder, PROP_HELD_CHILDREN_COUNT, currentCount - 1); + } } - return null; } + return null; }); } diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentToHoldTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentToHoldTest.java index e182af97da..6c597f15d4 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentToHoldTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentToHoldTest.java @@ -109,7 +109,6 @@ public class RemoveActiveContentToHoldTest extends BaseRMTestCase { private NodeRef hold; private NodeRef hold2; - Integer before; public void given() { @@ -121,7 +120,6 @@ public class RemoveActiveContentToHoldTest extends BaseRMTestCase public void when() { - before = (Integer) nodeService.getProperty(dmFolder, PROP_HELD_CHILDREN_COUNT); holdService.removeFromHold(hold, dmDocument); } @@ -139,7 +137,7 @@ public class RemoveActiveContentToHoldTest extends BaseRMTestCase * When I try to remove the active content to the hold without permission * Then an access denied exception is thrown */ - public void testRemoveDocumentFromHoldFailsWithoutPermission() + public void testRemoveDocumentFromHoldFailsWithoutFilingPermission() { doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) { @@ -157,7 +155,7 @@ public class RemoveActiveContentToHoldTest extends BaseRMTestCase (RunAsWork) () -> { holdService.removeFromHold(hold, dmDocument); return null; - }, recordsManagerName ); + }, recordsManagerName); } }); } diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java index 6eb3bef240..0820c896a9 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java @@ -53,16 +53,16 @@ import org.springframework.context.ApplicationContext; public class FrozenAspectUnitTest { @Mock - private NodeService nodeService; + private NodeService mockNodeService; @Mock - private ApplicationContext applicationContext; + private ApplicationContext mockApplicationContext; @Mock - private ChildAssociationRef childAssociationRef; + private ChildAssociationRef mockChildAssociationRef; @Mock - private DictionaryService dictionaryService; + private DictionaryService mockDictionaryService; @InjectMocks private FrozenAspect frozenAspect; @@ -75,13 +75,11 @@ public class FrozenAspectUnitTest public void setUp() { MockitoAnnotations.initMocks(this); - when(nodeService.exists(record)).thenReturn(true); - when(nodeService.exists(content)).thenReturn(true); - when(nodeService.hasAspect(folder, ASPECT_HELD_CHILDREN)).thenReturn(true); - when(nodeService.getProperty(folder, PROP_HELD_CHILDREN_COUNT)).thenReturn(1); - when(applicationContext.getBean("dbNodeService")).thenReturn(nodeService); - when(nodeService.hasAspect(folder, ASPECT_HELD_CHILDREN)).thenReturn(true); - when(nodeService.getProperty(folder, PROP_HELD_CHILDREN_COUNT)).thenReturn(1); + when(mockNodeService.exists(record)).thenReturn(true); + when(mockNodeService.exists(content)).thenReturn(true); + when(mockNodeService.hasAspect(folder, ASPECT_HELD_CHILDREN)).thenReturn(true); + when(mockNodeService.getProperty(folder, PROP_HELD_CHILDREN_COUNT)).thenReturn(1); + when(mockApplicationContext.getBean("dbNodeService")).thenReturn(mockNodeService); } /** @@ -90,11 +88,11 @@ public class FrozenAspectUnitTest @Test public void testRemoveAspectForRecords() { - when(nodeService.hasAspect(record, ASPECT_RECORD)).thenReturn(true); - when(nodeService.getPrimaryParent(record)).thenReturn(childAssociationRef); - when(childAssociationRef.getParentRef()).thenReturn(folder); + when(mockNodeService.hasAspect(record, ASPECT_RECORD)).thenReturn(true); + when(mockNodeService.getPrimaryParent(record)).thenReturn(mockChildAssociationRef); + when(mockChildAssociationRef.getParentRef()).thenReturn(folder); frozenAspect.onRemoveAspect(record, null); - verify(nodeService, times(1)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); + verify(mockNodeService, times(1)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); } /** @@ -103,12 +101,12 @@ public class FrozenAspectUnitTest @Test public void testRemoveAspectForContent() { - when(nodeService.hasAspect(content, ASPECT_RECORD)).thenReturn(false); - when(nodeService.getType(content)).thenReturn(ContentModel.TYPE_CONTENT); - when(nodeService.getPrimaryParent(content)).thenReturn(childAssociationRef); - when(childAssociationRef.getParentRef()).thenReturn(folder); + when(mockNodeService.hasAspect(content, ASPECT_RECORD)).thenReturn(false); + when(mockNodeService.getType(content)).thenReturn(ContentModel.TYPE_CONTENT); + when(mockNodeService.getPrimaryParent(content)).thenReturn(mockChildAssociationRef); + when(mockChildAssociationRef.getParentRef()).thenReturn(folder); frozenAspect.onRemoveAspect(content, null); - verify(nodeService, times(1)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); + verify(mockNodeService, times(1)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); } /** @@ -117,10 +115,10 @@ public class FrozenAspectUnitTest @Test public void testRemoveAspectForContentDoesntUpdateForOtherTypes() { - when(nodeService.hasAspect(content, ASPECT_RECORD)).thenReturn(false); - when(nodeService.getType(content)).thenReturn(ContentModel.TYPE_FOLDER); - when(dictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_CONTENT)).thenReturn(false); + when(mockNodeService.hasAspect(content, ASPECT_RECORD)).thenReturn(false); + when(mockNodeService.getType(content)).thenReturn(ContentModel.TYPE_FOLDER); + when(mockDictionaryService.isSubClass(ContentModel.TYPE_FOLDER, ContentModel.TYPE_CONTENT)).thenReturn(false); frozenAspect.onRemoveAspect(content, null); - verify(nodeService, times(0)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); + verify(mockNodeService, times(0)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); } } From 2af340c5d62b079b4228620cc8d7f68cb9c63829 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Wed, 14 Aug 2019 13:40:39 +0100 Subject: [PATCH 3/8] RM-6873 sonar update --- .../org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java | 4 ++-- ...ntToHoldTest.java => RemoveActiveContentFromHoldTest.java} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/{RemoveActiveContentToHoldTest.java => RemoveActiveContentFromHoldTest.java} (99%) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java index f5f174c73a..6864207560 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java @@ -197,13 +197,13 @@ public class FrozenAspect extends BaseBehaviourBean (isRecord(nodeRef) || instanceOf(nodeRef, TYPE_CONTENT))) { // get the owning folder - NodeRef owningFolder = nodeService.getPrimaryParent(nodeRef).getParentRef(); + final NodeRef owningFolder = nodeService.getPrimaryParent(nodeRef).getParentRef(); // check that the aspect has been added if (nodeService.hasAspect(owningFolder, ASPECT_HELD_CHILDREN)) { // decrement current count - int currentCount = (Integer) nodeService.getProperty(owningFolder, PROP_HELD_CHILDREN_COUNT); + final int currentCount = (Integer) nodeService.getProperty(owningFolder, PROP_HELD_CHILDREN_COUNT); if (currentCount > 0) { nodeService.setProperty(owningFolder, PROP_HELD_CHILDREN_COUNT, currentCount - 1); diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentToHoldTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java similarity index 99% rename from rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentToHoldTest.java rename to rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java index 6c597f15d4..8a4181116e 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentToHoldTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java @@ -42,7 +42,7 @@ import org.springframework.extensions.webscripts.GUID; * @author Ross Gale * @since 3.2 */ -public class RemoveActiveContentToHoldTest extends BaseRMTestCase +public class RemoveActiveContentFromHoldTest extends BaseRMTestCase { @Override protected boolean isCollaborationSiteTest() From 1d739008c2f17a1344c2a7ae7c36ff3547788775 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Fri, 16 Aug 2019 07:25:19 +0100 Subject: [PATCH 4/8] RM-6873 adding unit tests for edit --- .../rma/aspect/FrozenAspectUnitTest.java | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+) diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java index 0820c896a9..e94f2ad103 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java @@ -29,15 +29,25 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.aspect; import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_HELD_CHILDREN; import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_RECORD; import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_HELD_CHILDREN_COUNT; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyMap; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; +import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; +import org.alfresco.repo.security.permissions.AccessDeniedException; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.namespace.QName; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -64,12 +74,37 @@ public class FrozenAspectUnitTest @Mock private DictionaryService mockDictionaryService; + @Mock + private FreezeService mockFreezeService; + + @Mock + private TransactionalResourceHelper mockResourceHelper; + + @Mock + private ChildAssociationRef mockChildRef; + + @Mock + private ChildAssociationRef mockParentRef; + + @Mock + private ChildAssociationRef mockOldRef; + + @Mock + private ChildAssociationRef mockNewRef; + + @Mock + private Set mockSet; + @InjectMocks private FrozenAspect frozenAspect; + private final List children = new ArrayList<>(); + private NodeRef record = new NodeRef("workspace://record/node"); private NodeRef folder = new NodeRef("workspace://folder/node"); private NodeRef content = new NodeRef("workspace://content/node"); + private NodeRef child = new NodeRef("workspace://content/child"); + private NodeRef parent = new NodeRef("workspace://content/parent"); @Before public void setUp() @@ -80,6 +115,11 @@ public class FrozenAspectUnitTest when(mockNodeService.hasAspect(folder, ASPECT_HELD_CHILDREN)).thenReturn(true); when(mockNodeService.getProperty(folder, PROP_HELD_CHILDREN_COUNT)).thenReturn(1); when(mockApplicationContext.getBean("dbNodeService")).thenReturn(mockNodeService); + when(mockNodeService.exists(content)).thenReturn(true); + when(mockFreezeService.isFrozen(content)).thenReturn(false); + children.add(mockChildRef); + when(mockNodeService.getChildAssocs(content)).thenReturn(children); + when(mockChildRef.isPrimary()).thenReturn(true); } /** @@ -121,4 +161,111 @@ public class FrozenAspectUnitTest frozenAspect.onRemoveAspect(content, null); verify(mockNodeService, times(0)).setProperty(folder, PROP_HELD_CHILDREN_COUNT, 0); } + + /** + * Test before delete throws an error if a node is frozen + */ + @Test(expected = AccessDeniedException.class) + public void testBeforeDeleteNodeThrowsExceptionIfNodeFrozen() + { + when(mockFreezeService.isFrozen(content)).thenReturn(true); + frozenAspect.beforeDeleteNode(content); + } + + /** + * Test before delete is fine for non-frozen nodes + */ + @Test + public void testBeforeDeleteForNonFrozenNodes() + { + frozenAspect.beforeDeleteNode(content); + verify(mockNodeService, times(1)).getChildAssocs(content); + verify(mockChildRef, times(1)).getChildRef(); + } + + /** + * Test before delete throws an error for a node with frozen children + */ + @Test (expected = AccessDeniedException.class) + public void testBeforeDeleteThrowsExceptionForFrozenChild() + { + when(mockChildRef.getChildRef()).thenReturn(child); + when(mockFreezeService.isFrozen(child)).thenReturn(true); + frozenAspect.beforeDeleteNode(content); + } + + /** + * Test on add aspect for a record node + */ + @Test + public void testOnAddAspectForRecord() + { + when(mockNodeService.getType(record)).thenReturn(ContentModel.TYPE_CONTENT); + when(mockNodeService.getPrimaryParent(record)).thenReturn(mockParentRef); + when(mockParentRef.getParentRef()).thenReturn(parent); + when(mockNodeService.hasAspect(parent, ASPECT_HELD_CHILDREN)).thenReturn(true); + when(mockNodeService.getProperty(parent, PROP_HELD_CHILDREN_COUNT)).thenReturn(0); + frozenAspect.onAddAspect(record,null); + verify(mockNodeService, times(1)).setProperty(parent, PROP_HELD_CHILDREN_COUNT,1); + } + + /** + * Test on add for a content node + */ + @Test + public void testOnAddAspectForContent() + { + when(mockNodeService.getType(record)).thenReturn(ContentModel.TYPE_CONTENT); + when(mockNodeService.getPrimaryParent(record)).thenReturn(mockParentRef); + when(mockParentRef.getParentRef()).thenReturn(parent); + when(mockNodeService.hasAspect(parent, ASPECT_HELD_CHILDREN)).thenReturn(false); + when(mockNodeService.getType(parent)).thenReturn(ContentModel.TYPE_FOLDER); + frozenAspect.onAddAspect(record, null); + verify(mockNodeService, times(1)).addAspect(any(NodeRef.class), any(QName.class), anyMap()); + } + + /** + * Test on move throws an error for a frozen node + */ + @Test(expected = AccessDeniedException.class) + public void testOnMoveThrowsExceptionForFrozenNode() + { + when(mockNewRef.getParentRef()).thenReturn(parent); + when(mockNewRef.getChildRef()).thenReturn(child); + when(mockNodeService.exists(parent)).thenReturn(true); + when(mockNodeService.exists(child)).thenReturn(true); + frozenAspect.onMoveNode(mockOldRef, mockNewRef); + } + + /** + * Test update properties throws an error for frozen nodes + */ + @Test(expected = AccessDeniedException.class) + public void testUpdatePropertiesThrowsExceptionForFrozenNode() + { + when(mockFreezeService.isFrozen(content)).thenReturn(true); + when(mockResourceHelper.getSet(content)).thenReturn(mockSet); + when(mockSet.contains("frozen")).thenReturn(false); + frozenAspect.onUpdateProperties(content, null, null); + } + + /** + * Test on content update throws an error for frozen nodes + */ + @Test(expected = AccessDeniedException.class) + public void testOnContentUpdateThrowsExceptionForFrozenNode() + { + when(mockFreezeService.isFrozen(content)).thenReturn(true); + frozenAspect.onContentUpdate(content, false); + } + + /** + * Test before copy throws an error for frozen node + */ + @Test(expected = AccessDeniedException.class) + public void testBeforeCopyThrowsExceptionForFrozenNode() + { + when(mockFreezeService.isFrozen(content)).thenReturn(true); + frozenAspect.beforeCopy(null, content, null); + } } From ac4b8d4b9a10fba440ee75de5a8125a41b7408df Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Mon, 19 Aug 2019 15:56:10 +0100 Subject: [PATCH 5/8] RM-6873 adding changes from update branch and updating tests --- .../rma/aspect/FrozenAspectUnitTest.java | 41 +++++-------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java index e94f2ad103..8a323d794b 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java @@ -43,6 +43,7 @@ import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; @@ -165,7 +166,7 @@ public class FrozenAspectUnitTest /** * Test before delete throws an error if a node is frozen */ - @Test(expected = AccessDeniedException.class) + @Test(expected = PermissionDeniedException.class) public void testBeforeDeleteNodeThrowsExceptionIfNodeFrozen() { when(mockFreezeService.isFrozen(content)).thenReturn(true); @@ -186,7 +187,7 @@ public class FrozenAspectUnitTest /** * Test before delete throws an error for a node with frozen children */ - @Test (expected = AccessDeniedException.class) + @Test (expected = PermissionDeniedException.class) public void testBeforeDeleteThrowsExceptionForFrozenChild() { when(mockChildRef.getChildRef()).thenReturn(child); @@ -225,22 +226,22 @@ public class FrozenAspectUnitTest } /** - * Test on move throws an error for a frozen node + * Test before move throws an error for a frozen node */ - @Test(expected = AccessDeniedException.class) - public void testOnMoveThrowsExceptionForFrozenNode() + @Test(expected = PermissionDeniedException.class) + public void testBeforeMoveThrowsExceptionForFrozenNode() { - when(mockNewRef.getParentRef()).thenReturn(parent); - when(mockNewRef.getChildRef()).thenReturn(child); - when(mockNodeService.exists(parent)).thenReturn(true); + when(mockOldRef.getParentRef()).thenReturn(parent); + when(mockOldRef.getChildRef()).thenReturn(child); when(mockNodeService.exists(child)).thenReturn(true); - frozenAspect.onMoveNode(mockOldRef, mockNewRef); + when(mockFreezeService.isFrozen(child)).thenReturn(true); + frozenAspect.beforeMoveNode(mockOldRef, null); } /** * Test update properties throws an error for frozen nodes */ - @Test(expected = AccessDeniedException.class) + @Test(expected = PermissionDeniedException.class) public void testUpdatePropertiesThrowsExceptionForFrozenNode() { when(mockFreezeService.isFrozen(content)).thenReturn(true); @@ -248,24 +249,4 @@ public class FrozenAspectUnitTest when(mockSet.contains("frozen")).thenReturn(false); frozenAspect.onUpdateProperties(content, null, null); } - - /** - * Test on content update throws an error for frozen nodes - */ - @Test(expected = AccessDeniedException.class) - public void testOnContentUpdateThrowsExceptionForFrozenNode() - { - when(mockFreezeService.isFrozen(content)).thenReturn(true); - frozenAspect.onContentUpdate(content, false); - } - - /** - * Test before copy throws an error for frozen node - */ - @Test(expected = AccessDeniedException.class) - public void testBeforeCopyThrowsExceptionForFrozenNode() - { - when(mockFreezeService.isFrozen(content)).thenReturn(true); - frozenAspect.beforeCopy(null, content, null); - } } From 6437f31749a0cd116f4d4c4d2de0cb28c491727c Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Tue, 20 Aug 2019 13:56:14 +0100 Subject: [PATCH 6/8] RM-6873 adding code review changes --- .../hold/RemoveActiveContentFromHoldTest.java | 14 ++++++++------ .../model/rma/aspect/FrozenAspectUnitTest.java | 18 ++++++------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java index 8a4181116e..2a08fb6877 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java @@ -28,11 +28,13 @@ package org.alfresco.module.org_alfresco_module_rm.test.integration.hold; import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; +import java.util.ArrayList; +import java.util.List; + import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.repo.site.SiteModel; import org.alfresco.service.cmr.repository.NodeRef; import org.springframework.extensions.webscripts.GUID; @@ -114,8 +116,10 @@ public class RemoveActiveContentFromHoldTest extends BaseRMTestCase { hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); hold2 = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - holdService.addToHold(hold, dmDocument); - holdService.addToHold(hold2, dmDocument); + final List holds = new ArrayList<>(2); + holds.add(hold); + holds.add(hold2); + holdService.addToHolds(holds, dmDocument); } public void when() @@ -162,7 +166,7 @@ public class RemoveActiveContentFromHoldTest extends BaseRMTestCase /** * Given a piece of active content on hold - * When I try to remove the active content to the hold without the remove hold capability + * When I try to remove the active content from the hold without the remove hold capability * Then an access denied exception is thrown */ public void testRemoveDocumentFromHoldFailsWithoutRemoveHoldPermission() @@ -173,10 +177,8 @@ public class RemoveActiveContentFromHoldTest extends BaseRMTestCase public void given() { - //add powerUserPerson as manager in collaboration site to have write permissions on dmDocument AuthenticationUtil.runAs( (RunAsWork) () -> { - siteService.setMembership(collabSiteId, powerUserName, SiteModel.SITE_MANAGER); hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); holdService.addToHold(hold, dmDocument); return null; diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java index 8a323d794b..8cddad40a2 100644 --- a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspectUnitTest.java @@ -42,7 +42,6 @@ import java.util.Set; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; -import org.alfresco.repo.security.permissions.AccessDeniedException; import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.ChildAssociationRef; @@ -90,9 +89,6 @@ public class FrozenAspectUnitTest @Mock private ChildAssociationRef mockOldRef; - @Mock - private ChildAssociationRef mockNewRef; - @Mock private Set mockSet; @@ -116,11 +112,11 @@ public class FrozenAspectUnitTest when(mockNodeService.hasAspect(folder, ASPECT_HELD_CHILDREN)).thenReturn(true); when(mockNodeService.getProperty(folder, PROP_HELD_CHILDREN_COUNT)).thenReturn(1); when(mockApplicationContext.getBean("dbNodeService")).thenReturn(mockNodeService); - when(mockNodeService.exists(content)).thenReturn(true); when(mockFreezeService.isFrozen(content)).thenReturn(false); children.add(mockChildRef); when(mockNodeService.getChildAssocs(content)).thenReturn(children); when(mockChildRef.isPrimary()).thenReturn(true); + when(mockNodeService.hasAspect(record, ASPECT_RECORD)).thenReturn(true); } /** @@ -129,7 +125,6 @@ public class FrozenAspectUnitTest @Test public void testRemoveAspectForRecords() { - when(mockNodeService.hasAspect(record, ASPECT_RECORD)).thenReturn(true); when(mockNodeService.getPrimaryParent(record)).thenReturn(mockChildAssociationRef); when(mockChildAssociationRef.getParentRef()).thenReturn(folder); frozenAspect.onRemoveAspect(record, null); @@ -151,7 +146,7 @@ public class FrozenAspectUnitTest } /** - * Test that the remove code is only ran for records or active content + * Test that the remove code is only run for records or active content */ @Test public void testRemoveAspectForContentDoesntUpdateForOtherTypes() @@ -201,7 +196,6 @@ public class FrozenAspectUnitTest @Test public void testOnAddAspectForRecord() { - when(mockNodeService.getType(record)).thenReturn(ContentModel.TYPE_CONTENT); when(mockNodeService.getPrimaryParent(record)).thenReturn(mockParentRef); when(mockParentRef.getParentRef()).thenReturn(parent); when(mockNodeService.hasAspect(parent, ASPECT_HELD_CHILDREN)).thenReturn(true); @@ -211,17 +205,17 @@ public class FrozenAspectUnitTest } /** - * Test on add for a content node + * Test on add aspect for a content node */ @Test public void testOnAddAspectForContent() { - when(mockNodeService.getType(record)).thenReturn(ContentModel.TYPE_CONTENT); - when(mockNodeService.getPrimaryParent(record)).thenReturn(mockParentRef); + when(mockNodeService.getType(content)).thenReturn(ContentModel.TYPE_CONTENT); + when(mockNodeService.getPrimaryParent(content)).thenReturn(mockParentRef); when(mockParentRef.getParentRef()).thenReturn(parent); when(mockNodeService.hasAspect(parent, ASPECT_HELD_CHILDREN)).thenReturn(false); when(mockNodeService.getType(parent)).thenReturn(ContentModel.TYPE_FOLDER); - frozenAspect.onAddAspect(record, null); + frozenAspect.onAddAspect(content, null); verify(mockNodeService, times(1)).addAspect(any(NodeRef.class), any(QName.class), anyMap()); } From 3e5b1bad95be9abf44d4fe55590d6d744f469ef6 Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Tue, 20 Aug 2019 13:57:42 +0100 Subject: [PATCH 7/8] RM-6873 adding code review changes --- .../test/integration/hold/RemoveActiveContentFromHoldTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java index 2a08fb6877..7f940ef310 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java @@ -39,7 +39,7 @@ import org.alfresco.service.cmr.repository.NodeRef; import org.springframework.extensions.webscripts.GUID; /** - * Remove Active Content To Hold Integration Tests + * Remove active content from hold integration tests * * @author Ross Gale * @since 3.2 From 40767c1b5937c4845fc9b3bc8699ee3e458ceb4f Mon Sep 17 00:00:00 2001 From: Ross Gale Date: Tue, 20 Aug 2019 13:58:26 +0100 Subject: [PATCH 8/8] RM-6873 adding code review changes --- .../test/integration/hold/RemoveActiveContentFromHoldTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java index 7f940ef310..170bec08ab 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/RemoveActiveContentFromHoldTest.java @@ -138,7 +138,7 @@ public class RemoveActiveContentFromHoldTest extends BaseRMTestCase /** * Given a piece of active content on hold - * When I try to remove the active content to the hold without permission + * When I try to remove the active content from the hold without permission * Then an access denied exception is thrown */ public void testRemoveDocumentFromHoldFailsWithoutFilingPermission()