01: /*
02: * Copyright 2005-2007 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.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 edu.iu.uis.eden.actions;
18:
19: import java.util.List;
20:
21: import org.junit.Test;
22: import org.kuali.workflow.test.WorkflowTestCase;
23:
24: import edu.iu.uis.eden.EdenConstants;
25: import edu.iu.uis.eden.KEWServiceLocator;
26: import edu.iu.uis.eden.actionrequests.ActionRequestValue;
27: import edu.iu.uis.eden.actions.BlanketApproveTest.NotifySetup;
28: import edu.iu.uis.eden.clientapp.WorkflowDocument;
29: import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
30: import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
31: import edu.iu.uis.eden.user.AuthenticationUserId;
32: import edu.iu.uis.eden.user.WorkflowUser;
33:
34: /**
35: * Tests the super user actions available on the API.
36: */
37: public class SuperUserActionRequestApproveEventTest extends
38: WorkflowTestCase {
39:
40: protected void loadTestData() throws Exception {
41: loadXmlFile("ActionsConfig.xml");
42: }
43:
44: @Test
45: public void testSuperUserFyi() throws Exception {
46: WorkflowDocument document = new WorkflowDocument(
47: new NetworkIdVO("ewestfal"),
48: NotifySetup.DOCUMENT_TYPE_NAME);
49: document.appSpecificRouteDocumentToUser(
50: EdenConstants.ACTION_REQUEST_FYI_REQ, "",
51: new NetworkIdVO("rkirkend"), "", true);
52: document.appSpecificRouteDocumentToUser(
53: EdenConstants.ACTION_REQUEST_APPROVE_REQ, "",
54: new NetworkIdVO("jhopf"), "", true);
55: document.routeDocument("");
56:
57: document = new WorkflowDocument(new NetworkIdVO("rkirkend"),
58: document.getRouteHeaderId());
59: assertTrue("rkirkend should have an FYI request.", document
60: .isFYIRequested());
61: WorkflowUser ewestfal = KEWServiceLocator.getUserService()
62: .getWorkflowUser(new AuthenticationUserId("ewestfal"));
63: WorkflowUser rkirkend = KEWServiceLocator.getUserService()
64: .getWorkflowUser(new AuthenticationUserId("rkirkend"));
65: DocumentRouteHeaderValue documentBO = KEWServiceLocator
66: .getRouteHeaderService().getRouteHeader(
67: document.getRouteHeaderId());
68: List<ActionRequestValue> actionRequests = KEWServiceLocator
69: .getActionRequestService().findAllValidRequests(
70: rkirkend, document.getRouteHeaderId(),
71: EdenConstants.ACTION_REQUEST_FYI_REQ);
72: assertEquals("There should only be 1 fyi request to rkirkend.",
73: 1, actionRequests.size());
74: KEWServiceLocator.getWorkflowDocumentService()
75: .super UserActionRequestApproveAction(
76: ewestfal,
77: documentBO,
78: new Long(actionRequests.get(0)
79: .getActionRequestId()), "");
80:
81: // FYI should no longer be requested
82: document = new WorkflowDocument(new NetworkIdVO("rkirkend"),
83: document.getRouteHeaderId());
84: assertFalse("rkirkend should no longer have an FYI request.",
85: document.isFYIRequested());
86:
87: // doc should still be enroute
88: assertTrue("Document should still be ENROUTE", document
89: .stateIsEnroute());
90:
91: }
92:
93: }
|