MNT-19114 - Made review changes

This commit is contained in:
Elena Hardon
2018-02-19 13:40:52 +02:00
parent b581d58726
commit f1e3c0b853
2 changed files with 34 additions and 68 deletions

View File

@@ -27,20 +27,19 @@
package org.alfresco.module.org_alfresco_module_rm.model.rma.type; package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
import com.google.common.collect.Sets;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; 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.model.BaseBehaviourBean;
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
import org.alfresco.repo.node.NodeServicePolicies; 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.Behaviour.NotificationFrequency;
import org.alfresco.repo.policy.annotation.Behaviour; import org.alfresco.repo.policy.annotation.Behaviour;
import org.alfresco.repo.policy.annotation.BehaviourBean; 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.service.namespace.QName;
import org.alfresco.util.ParameterCheck; import org.alfresco.util.ParameterCheck;
import org.alfresco.util.PropertyMap; import org.alfresco.util.PropertyMap;
import org.springframework.extensions.surf.util.I18NUtil;
/** /**
* Behaviour associated with the RM Site type * 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<QName> acceptedUniqueChildType,
List<QName> acceptedMultipleChildType) throws IntegrityException
{
super.validateNewChildAssociation(parent, child, acceptedUniqueChildType, acceptedMultipleChildType);
}
@Behaviour(kind = BehaviourKind.CLASS, @Behaviour(kind = BehaviourKind.CLASS,
policy = "alf:onDeleteNode", policy = "alf:onDeleteNode",
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT) notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT)

View File

@@ -35,9 +35,9 @@ import org.alfresco.service.cmr.site.SiteInfo;
import org.alfresco.service.cmr.site.SiteVisibility; 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 PARENT_NODE = "RMSite";
public static final String DOCUMENT_LIBRARY_FOLDER_TYPE = "documentLibrary"; public static final String DOCUMENT_LIBRARY_FOLDER_TYPE = "documentLibrary";
@@ -57,18 +57,14 @@ public class RM19114Test extends BaseRMTestCase
*/ */
public void testCreateWikiPageInRmSite() throws Exception public void testCreateWikiPageInRmSite() throws Exception
{ {
doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) doBehaviourDrivenTest(new BehaviourDrivenTest()
{ {
NodeRef wikiPage; NodeRef wikiPage;
public void given() public void given()
{
doTestInTransaction(new VoidTest()
{
public void runImpl() throws Exception
{ {
// Creating a Records Management site // Creating a Records Management site
SiteInfo rmSite= siteService.createSite("rmSite", PARENT_NODE, generate(), generate(), SiteVisibility.PUBLIC, TYPE_RM_SITE); siteService.createSite("rmSite", PARENT_NODE, generate(), generate(), SiteVisibility.PUBLIC, TYPE_RM_SITE);
// Adding two immediate folder type children // Adding two immediate folder type children
getSiteContainer( getSiteContainer(
@@ -86,15 +82,10 @@ public class RM19114Test extends BaseRMTestCase
transactionService, transactionService,
taggingService); taggingService);
} }
});
}
public void when() throws Exception public void when() throws Exception
{ {
doTestInTransaction(new VoidTest()
{
public void runImpl() throws Exception
{
wikiPage = getSiteContainer( wikiPage = getSiteContainer(
PARENT_NODE, PARENT_NODE,
WIKI_PAGE_FOLDER_TYPE, WIKI_PAGE_FOLDER_TYPE,
@@ -102,29 +93,18 @@ public class RM19114Test extends BaseRMTestCase
siteService, siteService,
transactionService, transactionService,
taggingService); taggingService);
}
});
} }
public void then() throws Exception public void then() throws Exception
{ {
doTestInTransaction(new VoidTest() // Check if the new folder type wiki page has been created
{ assertEquals(true, nodeService.exists(wikiPage));
public void runImpl() throws Exception
{
assertEquals( true, nodeService.exists(wikiPage));
}
});
} }
public void after(){ public void after()
doTestInTransaction(new VoidTest()
{ {
public void runImpl() throws Exception siteService.deleteSite(PARENT_NODE);
{
siteService.deleteSite(PARENT_NODE);}});
} }
}); });
} }