Clover Coverage Report - kew-test 2.0.0-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
17   67   3   8.5
2   33   0.18   2
2     1.5  
1    
 
  RoutingWithEmptyWorkGroupTest       Line # 28 17 0% 3 21 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2005-2007 The Kuali Foundation
3    *
4    *
5    * Licensed under the Educational Community License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    * http://www.opensource.org/licenses/ecl2.php
10    *
11    * Unless required by applicable law or agreed to in writing, software
12    * distributed under the License is distributed on an "AS IS" BASIS,
13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    * See the License for the specific language governing permissions and
15    * limitations under the License.
16    */
17    package org.kuali.rice.kew.routing;
18   
19    import org.junit.Test;
20    import org.kuali.rice.kew.dto.ActionRequestDTO;
21    import org.kuali.rice.kew.service.WorkflowDocument;
22    import org.kuali.rice.kew.test.KEWTestCase;
23    import org.kuali.rice.kew.test.TestUtilities;
24    import org.kuali.rice.kim.service.KIMServiceLocator;
25   
26    import static org.junit.Assert.assertTrue;
27   
 
28    public class RoutingWithEmptyWorkGroupTest extends KEWTestCase {
29   
 
30  0 toggle protected void loadTestData() throws Exception {
31  0 loadXmlFile("RoutingWithEmptyGroupConfig.xml");
32    }
33   
 
34  0 toggle @Test public void testRoutingToEmptyWorkgroup() throws Exception {
35   
36  0 String user1PrincipalId = getPrincipalIdForName("user1");
37  0 String user2PrincipalId = getPrincipalIdForName("user2");
38  0 String user3PrincipalId = getPrincipalIdForName("user3");
39   
40  0 WorkflowDocument doc = new WorkflowDocument(user1PrincipalId, "EmptyWorkgroupDocType");
41   
42  0 doc = new WorkflowDocument("user1", doc.getRouteHeaderId());
43   
44  0 doc.routeDocument("");
45   
46    // the document should skip node 1 because it is routing to user1, it should
47    // skip node 2 (effectively) because that node is using a group with no members,
48    // and then it should land on node 3 being in user 2's action list
49   
50  0 doc = new WorkflowDocument(user2PrincipalId, doc.getRouteHeaderId());
51   
52  0 assertTrue("Document should be enroute", doc.stateIsEnroute());
53  0 TestUtilities.assertAtNode(doc, "Node3");
54   
55  0 TestUtilities.assertInActionList(user2PrincipalId, doc.getRouteHeaderId());
56   
57    // verify that an action request was generated at Node 2 to the "EmptyWorkgroup" but was immediately deactivated
58  0 ActionRequestDTO[] actionRequests = doc.getActionRequests();
59  0 for (ActionRequestDTO actionRequest : actionRequests) {
60  0 if ("Node2".equals(actionRequest.getNodeName())) {
61  0 assertTrue("action request should be for a group", actionRequest.isGroupRequest());
62  0 assertTrue("action request should be marked as \"done\"", actionRequest.isDone());
63  0 assertTrue("Group should have no members.", KIMServiceLocator.getIdentityManagementService().getGroupMemberPrincipalIds(actionRequest.getGroupId()).isEmpty());
64    }
65    }
66    }
67    }