From f1e3c0b8533f512327a478099855f8a756e9225c Mon Sep 17 00:00:00 2001 From: Elena Hardon Date: Mon, 19 Feb 2018 13:40:52 +0200 Subject: [PATCH] MNT-19114 - Made review changes --- .../model/rma/type/RmSiteType.java | 16 +--- .../{RM19114Test.java => MNT19114Test.java} | 86 +++++++------------ 2 files changed, 34 insertions(+), 68 deletions(-) rename rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/{RM19114Test.java => MNT19114Test.java} (50%) diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java index e8b3858218..0682bf28b1 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java @@ -27,20 +27,19 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.type; -import com.google.common.collect.Sets; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; + import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.node.integrity.IntegrityException; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.annotation.Behaviour; import org.alfresco.repo.policy.annotation.BehaviourBean; @@ -59,7 +58,6 @@ import org.alfresco.service.cmr.site.SiteVisibility; import org.alfresco.service.namespace.QName; import org.alfresco.util.ParameterCheck; import org.alfresco.util.PropertyMap; -import org.springframework.extensions.surf.util.I18NUtil; /** * Behaviour associated with the RM Site type @@ -342,18 +340,6 @@ public class RmSiteType extends BaseBehaviourBean }); } - /** - * Overridden this because in this case we need to have multiple cm:folder types. - * The two mentioned folders are created when rm site is created and those are Saved Searches and surf-config folder. - * - */ - @Override - protected void validateNewChildAssociation(NodeRef parent, NodeRef child, List acceptedUniqueChildType, - List acceptedMultipleChildType) throws IntegrityException - { - super.validateNewChildAssociation(parent, child, acceptedUniqueChildType, acceptedMultipleChildType); - } - @Behaviour(kind = BehaviourKind.CLASS, policy = "alf:onDeleteNode", notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT) diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM19114Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/MNT19114Test.java similarity index 50% rename from rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM19114Test.java rename to rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/MNT19114Test.java index c1f9745aaf..a502b01e82 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM19114Test.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/MNT19114Test.java @@ -35,9 +35,9 @@ import org.alfresco.service.cmr.site.SiteInfo; import org.alfresco.service.cmr.site.SiteVisibility; /** - * Test class for RM 19114, wiki page can not be created under RM site + * Test class for MNT 19114, wiki page can not be created under RM site */ -public class RM19114Test extends BaseRMTestCase +public class MNT19114Test extends BaseRMTestCase { public static final String PARENT_NODE = "RMSite"; public static final String DOCUMENT_LIBRARY_FOLDER_TYPE = "documentLibrary"; @@ -57,74 +57,54 @@ public class RM19114Test extends BaseRMTestCase */ public void testCreateWikiPageInRmSite() throws Exception { - doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) + doBehaviourDrivenTest(new BehaviourDrivenTest() { NodeRef wikiPage; public void given() { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - // Creating a Records Management site - SiteInfo rmSite= siteService.createSite("rmSite", PARENT_NODE, generate(), generate(), SiteVisibility.PUBLIC, TYPE_RM_SITE); + // Creating a Records Management site + siteService.createSite("rmSite", PARENT_NODE, generate(), generate(), SiteVisibility.PUBLIC, TYPE_RM_SITE); - // Adding two immediate folder type children - getSiteContainer( - PARENT_NODE, - DOCUMENT_LIBRARY_FOLDER_TYPE, - true, - siteService, - transactionService, - taggingService); - getSiteContainer( - PARENT_NODE, - SURF_CONFIG_FOLDER_TYPE, - true, - siteService, - transactionService, - taggingService); - } - }); + // Adding two immediate folder type children + getSiteContainer( + PARENT_NODE, + DOCUMENT_LIBRARY_FOLDER_TYPE, + true, + siteService, + transactionService, + taggingService); + getSiteContainer( + PARENT_NODE, + SURF_CONFIG_FOLDER_TYPE, + true, + siteService, + transactionService, + taggingService); } public void when() throws Exception { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - wikiPage = getSiteContainer( - PARENT_NODE, - WIKI_PAGE_FOLDER_TYPE, - true, - siteService, - transactionService, - taggingService); - } - }); + wikiPage = getSiteContainer( + PARENT_NODE, + WIKI_PAGE_FOLDER_TYPE, + true, + siteService, + transactionService, + taggingService); + } public void then() throws Exception { - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - assertEquals( true, nodeService.exists(wikiPage)); - } - }); - + // Check if the new folder type wiki page has been created + assertEquals(true, nodeService.exists(wikiPage)); } - public void after(){ - doTestInTransaction(new VoidTest() - { - public void runImpl() throws Exception - { - siteService.deleteSite(PARENT_NODE);}}); + public void after() + { + siteService.deleteSite(PARENT_NODE); } }); }