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 org.junit.Test;
20: import org.kuali.workflow.test.WorkflowTestCase;
21:
22: import edu.iu.uis.eden.KEWServiceLocator;
23: import edu.iu.uis.eden.clientapp.WorkflowDocument;
24: import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
25: import edu.iu.uis.eden.edl.WorkflowFunctions;
26: import edu.iu.uis.eden.user.AuthenticationUserId;
27: import edu.iu.uis.eden.web.session.UserSession;
28:
29: public class RouteLogAuthenticationTest extends WorkflowTestCase {
30:
31: public static final String DOCUMENT_TYPE_NAME = "BlanketApproveSequentialTest";
32:
33: protected void loadTestData() throws Exception {
34: loadXmlFile("ActionsConfig.xml");
35: }
36:
37: /**
38: * Tests WorkflowFunctions.isUserRouteLogAuthenticated
39: */
40: @Test
41: public void testUserRouteLogAuthenticated() throws Exception {
42: WorkflowDocument document = new WorkflowDocument(
43: new NetworkIdVO("user1"), DOCUMENT_TYPE_NAME);
44: document.routeDocument("");
45:
46: // false because we didn't set up the user session properly
47: assertFalse(WorkflowFunctions
48: .isUserRouteLogAuthenticated(document
49: .getRouteHeaderId()
50: + ""));
51:
52: // these two should be in the route log
53: UserSession.setAuthenticatedUser(new UserSession(
54: KEWServiceLocator.getUserService().getWorkflowUser(
55: new AuthenticationUserId("user1"))));
56: assertTrue(WorkflowFunctions
57: .isUserRouteLogAuthenticated(document
58: .getRouteHeaderId()
59: + ""));
60: UserSession.setAuthenticatedUser(new UserSession(
61: KEWServiceLocator.getUserService().getWorkflowUser(
62: new AuthenticationUserId("bmcgough"))));
63: assertTrue(WorkflowFunctions
64: .isUserRouteLogAuthenticated(document
65: .getRouteHeaderId()
66: + ""));
67:
68: // user2 should NOT be in the route log
69: UserSession.setAuthenticatedUser(new UserSession(
70: KEWServiceLocator.getUserService().getWorkflowUser(
71: new AuthenticationUserId("user2"))));
72: assertFalse(WorkflowFunctions
73: .isUserRouteLogAuthenticated(document
74: .getRouteHeaderId()
75: + ""));
76: }
77:
78: }
|