1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.rule.service.impl;
18
19 import org.junit.Test;
20 import org.kuali.rice.kew.rule.RuleDelegationBo;
21 import org.kuali.rice.kew.service.KEWServiceLocator;
22 import org.kuali.rice.kew.test.KEWTestCase;
23 import org.kuali.rice.test.BaselineTestCase;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28 import static org.junit.Assert.assertNotNull;
29 import static org.junit.Assert.assertNull;
30 import static org.junit.Assert.assertTrue;
31
32 @BaselineTestCase.BaselineMode(BaselineTestCase.Mode.NONE)
33 public class DelegationRuleServiceTest extends KEWTestCase {
34
35
36 @Test
37 public void testRetrievalOfDelegationRules() throws Exception {
38 loadXmlFile("org/kuali/rice/kew/rule/RouteTemplateConfig.xml");
39 loadXmlFile("org/kuali/rice/kew/rule/RulesWithoutResponsibilities.xml");
40
41 loadXmlFile("org/kuali/rice/kew/rule/DelegationRules.xml");
42 List<RuleDelegationBo> delegationRuleList;
43
44
45 delegationRuleList = KEWServiceLocator.getRuleDelegationService().search(null, null, null, null, null, null, null, null, null,Boolean.TRUE ,null,null);
46 assertNotNull("The returned delegation rule list should not be null", delegationRuleList);
47
48
49 delegationRuleList = KEWServiceLocator.getRuleDelegationService().search(null,null,"RiceDocument.child1",null,null,null,null,null,null,Boolean.TRUE,null,null);
50 assertTrue(delegationRuleList.size() == 1);
51
52
53 delegationRuleList = KEWServiceLocator.getRuleDelegationService().search(null,null,null,null,null,"A rule with a group responsibility",null,null,null,Boolean.TRUE,null,null);
54 assertTrue(delegationRuleList.size() == 1);
55
56
57 delegationRuleList = KEWServiceLocator.getRuleDelegationService().search(null,null,null,null,null,null,null,null,null,Boolean.FALSE,null,null);
58 assertTrue(delegationRuleList.isEmpty());
59 }
60
61 }