From 1c6e95efe88cdb09d84080475a0d9845f7e1e98b Mon Sep 17 00:00:00 2001 From: Roy Wetherall Date: Tue, 15 Mar 2016 11:20:53 +1100 Subject: [PATCH] Extend integration test to show rule inheritance on record categories working as expected (RM-3148) --- .../rule/FilePlanRuleInheritanceTest.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/rule/FilePlanRuleInheritanceTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/rule/FilePlanRuleInheritanceTest.java index 55caa28ecf..ab97dc4ecd 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/rule/FilePlanRuleInheritanceTest.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/rule/FilePlanRuleInheritanceTest.java @@ -35,6 +35,7 @@ import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.rule.Rule; import org.alfresco.service.cmr.rule.RuleService; +import org.springframework.extensions.webscripts.GUID; /** * File plan rule inheritance test @@ -236,4 +237,48 @@ public class FilePlanRuleInheritanceTest extends BaseRMTestCase } }); } + + /** + * Given that a single rule is set on the file plan root + * And that it is configured to apply to children + * When we ask for the rules on a record category including those inherited + * Then it will include those defined on the file plan root + */ + public void testFilePlanRulesInheritedOnRecordCategory() + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef filePlan = null; + private NodeRef recordCategory = null; + private List rules = null; + + public void given() + { + filePlan = createFilePlan(); + recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + + // create a rule that applies to childre + Action completeRecordAction = actionService.createAction(DeclareRecordAction.NAME); + Rule rule = new Rule(); + rule.setRuleType("inbound"); + rule.setAction(completeRecordAction); + rule.applyToChildren(true); + + // save rule on file plan root + ruleService.saveRule(filePlan, rule); + } + + public void when() + { + // get rules, including those inherited + rules = ruleService.getRules(recordCategory, true); + } + + public void then() + { + // rules aren't inhreited from file plan root + assertEquals(1, rules.size()); + } + }); + } }