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.actions.BlanketApproveTest.NotifySetup;
23: import edu.iu.uis.eden.clientapp.WorkflowDocument;
24: import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
25:
26: /**
27: * Test SuperUserCancel through WorkflowDocument
28: */
29: public class SuperUserCancelTest extends WorkflowTestCase {
30:
31: protected void loadTestData() throws Exception {
32: loadXmlFile("ActionsConfig.xml");
33: }
34:
35: @Test
36: public void testSuperUserCancel() throws Exception {
37: WorkflowDocument document = new WorkflowDocument(
38: new NetworkIdVO("ewestfal"),
39: NotifySetup.DOCUMENT_TYPE_NAME);
40: document.routeDocument("");
41:
42: document = new WorkflowDocument(new NetworkIdVO("jhopf"),
43: document.getRouteHeaderId());
44: assertTrue(
45: "WorkflowDocument should indicate jhopf as SuperUser",
46: document.isSuperUser());
47: document.super UserCancel("");
48: assertTrue(
49: "Document should be final after Super User Disapprove",
50: document.stateIsCanceled());
51: }
52:
53: @Test
54: public void testSuperUserInitiatorCancel() throws Exception {
55: WorkflowDocument document = new WorkflowDocument(
56: new NetworkIdVO("ewestfal"),
57: NotifySetup.DOCUMENT_TYPE_NAME);
58: assertTrue(
59: "WorkflowDocument should indicate ewestfal as SuperUser",
60: document.isSuperUser());
61: document.super UserCancel("");
62: assertTrue(
63: "Document should be final after Super User Disapprove",
64: document.stateIsCanceled());
65: }
66:
67: @Test
68: public void testSuperUserCancelInvalidUser() throws Exception {
69: WorkflowDocument document = new WorkflowDocument(
70: new NetworkIdVO("ewestfal"),
71: NotifySetup.DOCUMENT_TYPE_NAME);
72: document.routeDocument("");
73:
74: document = new WorkflowDocument(new NetworkIdVO("quickstart"),
75: document.getRouteHeaderId());
76: try {
77: assertFalse(
78: "WorkflowDocument should not indicate quickstart as SuperUser",
79: document.isSuperUser());
80: document.super UserCancel("");
81: fail("invalid user attempted to SuperUserApprove");
82: } catch (Exception e) {
83: }
84:
85: }
86:
87: }
|