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.clientapp.WorkflowDocument;
23: import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
24:
25: public class ApproveActionTest extends WorkflowTestCase {
26:
27: protected void loadTestData() throws Exception {
28: loadXmlFile("ActionsConfig.xml");
29: }
30:
31: @Test
32: public void testPreapprovals() throws Exception {
33: WorkflowDocument doc = new WorkflowDocument(new NetworkIdVO(
34: "rkirkend"), "PreApprovalTest");
35: doc.routeDocument("");
36:
37: //rock some preapprovals and other actions...
38: doc = new WorkflowDocument(new NetworkIdVO("ewestfal"), doc
39: .getRouteHeaderId());
40: doc.approve("");
41:
42: doc = new WorkflowDocument(new NetworkIdVO("user2"), doc
43: .getRouteHeaderId());
44: doc.acknowledge("");
45:
46: doc = new WorkflowDocument(new NetworkIdVO("user3"), doc
47: .getRouteHeaderId());
48: doc.complete("");
49:
50: //approve as the person the doc is routed to so we can move the documen on and hopefully to final
51: doc = new WorkflowDocument(new NetworkIdVO("user1"), doc
52: .getRouteHeaderId());
53: doc.approve("");
54:
55: doc = new WorkflowDocument(new NetworkIdVO("user1"), doc
56: .getRouteHeaderId());
57: assertTrue("the document should be final", doc.stateIsFinal());
58: }
59:
60: @Test
61: public void testInitiatorRole() throws Exception {
62: WorkflowDocument doc = new WorkflowDocument(new NetworkIdVO(
63: "rkirkend"), "InitiatorRoleApprovalTest");
64: doc.routeDocument("");
65: //rock some preapprovals and other actions...
66: doc = new WorkflowDocument(new NetworkIdVO("ewestfal"), doc
67: .getRouteHeaderId());
68: doc.approve("");
69:
70: doc = new WorkflowDocument(new NetworkIdVO("user2"), doc
71: .getRouteHeaderId());
72: doc.acknowledge("");
73:
74: doc = new WorkflowDocument(new NetworkIdVO("user3"), doc
75: .getRouteHeaderId());
76: doc.complete("");
77:
78: assertFalse("the document should NOT be final", doc
79: .stateIsFinal());
80:
81: //approve as the person the doc is routed (initiator) to so we can move the document on and hopefully to final
82: doc = new WorkflowDocument(new NetworkIdVO("rkirkend"), doc
83: .getRouteHeaderId());
84: doc.approve("");
85:
86: assertTrue("the document should be final", doc.stateIsFinal());
87: }
88: }
|