1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.actions;
17
18 import static org.junit.Assert.assertFalse;
19 import static org.junit.Assert.assertTrue;
20
21 import org.junit.Test;
22 import org.kuali.rice.edl.framework.util.EDLFunctions;
23 import org.kuali.rice.kew.api.WorkflowDocument;
24 import org.kuali.rice.kew.api.WorkflowDocumentFactory;
25 import org.kuali.rice.kew.test.KEWTestCase;
26 import org.kuali.rice.krad.UserSession;
27 import org.kuali.rice.krad.util.GlobalVariables;
28
29 public class RouteLogAuthenticationTest extends KEWTestCase {
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
39
40 @Test public void testUserRouteLogAuthenticated() throws Exception {
41 String user1PrincipalId = getPrincipalIdForName("user1");
42
43 WorkflowDocument document = WorkflowDocumentFactory.createDocument(user1PrincipalId, DOCUMENT_TYPE_NAME);
44 document.route("");
45
46
47 GlobalVariables.setUserSession(null);
48
49
50 assertFalse(EDLFunctions.isUserRouteLogAuthenticated(document.getDocumentId() + ""));
51
52
53 GlobalVariables.setUserSession(new UserSession("user1"));
54 assertTrue(EDLFunctions.isUserRouteLogAuthenticated(document.getDocumentId() + ""));
55 GlobalVariables.setUserSession(new UserSession("bmcgough"));
56 assertTrue(EDLFunctions.isUserRouteLogAuthenticated(document.getDocumentId() + ""));
57
58
59 GlobalVariables.setUserSession(new UserSession("user2"));
60 assertFalse(EDLFunctions.isUserRouteLogAuthenticated(document.getDocumentId() + ""));
61 }
62
63 }