Extend integration test to show rule inheritance on record categories working as expected (RM-3148)

This commit is contained in:
Roy Wetherall
2016-03-15 11:20:53 +11:00
parent e0cef2c6e1
commit 1c6e95efe8

View File

@@ -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<Rule> 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());
}
});
}
}