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