1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.kuali.rice.kew.actions; |
18 |
|
|
19 |
|
|
20 |
|
import org.junit.Test; |
21 |
|
import org.kuali.rice.kew.actionitem.ActionItem; |
22 |
|
import org.kuali.rice.kew.actionlist.service.ActionListService; |
23 |
|
|
24 |
|
import org.kuali.rice.kew.service.KEWServiceLocator; |
25 |
|
import org.kuali.rice.kew.service.WorkflowDocument; |
26 |
|
import org.kuali.rice.kew.test.KEWTestCase; |
27 |
|
import org.kuali.rice.kim.util.KimConstants; |
28 |
|
|
29 |
|
import java.util.Collection; |
30 |
|
import java.util.Iterator; |
31 |
|
|
32 |
|
import static org.junit.Assert.assertEquals; |
33 |
|
import static org.junit.Assert.assertTrue; |
34 |
|
|
35 |
|
|
36 |
|
@author |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 3 |
Complexity Density: 0.16 |
|
38 |
|
public class ReleaseWorkgroupAuthorityTest extends KEWTestCase { |
39 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
40 |
0
|
protected void loadTestData() throws Exception {... |
41 |
0
|
loadXmlFile("ActionsConfig.xml"); |
42 |
|
} |
43 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 2 |
Complexity Density: 0.11 |
4
-
|
|
44 |
0
|
@Test public void testReleaseWorkgroupAuthority() throws Exception {... |
45 |
0
|
WorkflowDocument doc = new WorkflowDocument(getPrincipalIdForName("user1"), TakeWorkgroupAuthorityTest.DOC_TYPE); |
46 |
0
|
doc.routeDocument(""); |
47 |
|
|
48 |
0
|
String groupId = getGroupIdForName(KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "TestWorkgroup"); |
49 |
|
|
50 |
0
|
doc = new WorkflowDocument(getPrincipalIdForName("rkirkend"), doc.getRouteHeaderId()); |
51 |
0
|
doc.takeGroupAuthority("", groupId); |
52 |
|
|
53 |
|
|
54 |
0
|
ActionListService aiService = KEWServiceLocator.getActionListService(); |
55 |
0
|
Collection actionItems = aiService.findByRouteHeaderId(doc.getRouteHeaderId()); |
56 |
0
|
assertEquals("There should be only one action item", 1, actionItems.size()); |
57 |
0
|
ActionItem ai = (ActionItem)actionItems.iterator().next(); |
58 |
0
|
assertEquals("action item should be to rkirkend", getPrincipalIdForName("rkirkend"), ai.getPrincipalId()); |
59 |
0
|
assertEquals("action item should be to group", groupId, ai.getGroupId()); |
60 |
|
|
61 |
|
|
62 |
0
|
doc = new WorkflowDocument(getPrincipalIdForName("rkirkend"), doc.getRouteHeaderId()); |
63 |
|
|
64 |
0
|
doc.releaseGroupAuthority("", groupId); |
65 |
|
|
66 |
|
|
67 |
0
|
actionItems = aiService.findByRouteHeaderId(doc.getRouteHeaderId()); |
68 |
0
|
assertTrue("There should be more than one action item", actionItems.size() > 1); |
69 |
0
|
for (Iterator iter = actionItems.iterator(); iter.hasNext();) { |
70 |
0
|
ActionItem actionItem = (ActionItem) iter.next(); |
71 |
0
|
assertTrue("Action Item not to workgroup member", TakeWorkgroupAuthorityTest.WORKGROUP_MEMBERS.contains(actionItem.getPerson().getPrincipalName())); |
72 |
|
} |
73 |
|
} |
74 |
|
} |