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.routing;
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: import edu.iu.uis.eden.exception.InvalidActionTakenException;
25: import edu.iu.uis.eden.exception.WorkflowException;
26: import edu.iu.uis.eden.test.TestUtilities;
27:
28: public class RoutingToInactiveWorkgroupTest extends WorkflowTestCase {
29:
30: protected void loadTestData() throws Exception {
31: loadXmlFile("RoutingConfig.xml");
32: }
33:
34: @Test
35: public void testRoutingToInactiveWorkgroup() throws Exception {
36: WorkflowDocument doc = new WorkflowDocument(new NetworkIdVO(
37: "rkirkend"), "InactiveWorkgroupDocType");
38: try {
39: doc.routeDocument("");
40: fail("document should have thrown routing exception");
41: } catch (Exception e) {
42:
43: }
44: TestUtilities.getExceptionThreader().join();//wait for doc to go into exception routing
45: doc = new WorkflowDocument(new NetworkIdVO("rkirkend"), doc
46: .getRouteHeaderId());
47: assertTrue(
48: "Document should be in exception routing because workgroup is inactive",
49: doc.stateIsException());
50:
51: try {
52: doc
53: .routeDocument("routing a document that is in exception routing");
54: fail("Succeeded in routing document that is in exception routing");
55: } catch (InvalidActionTakenException iate) {
56: log.info("Expected exception occurred: " + iate);
57: } catch (WorkflowException we) {
58: fail("Attempt at routing document in exception routing succeeded, when it should have been an InvalidActionTakenException");
59: }
60: }
61: }
|