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: import edu.iu.uis.eden.exception.WorkflowException;
25:
26: public class CreateDocumentTest extends WorkflowTestCase {
27:
28: @Override
29: protected void loadTestData() throws Exception {
30: loadXmlFile("ActionsConfig.xml");
31: }
32:
33: /**
34: * Tests the attempt to create a document from a non-existent document type.
35: */
36: @Test
37: public void testCreateNonExistentDocumentType() throws Exception {
38: WorkflowDocument document = new WorkflowDocument(
39: new NetworkIdVO("ewestfal"), "flim-flam-flooey");
40: try {
41: document.getRouteHeaderId();
42: fail("A workflow exception should have been thrown.");
43: } catch (WorkflowException e) {
44: e.printStackTrace();
45: }
46: }
47:
48: /**
49: * Tests the attempt to create a document from a document type with no routing path.
50: */
51: @Test
52: public void testCreateNonRoutableDocumentType() throws Exception {
53: // the BlanketApproveTest is a parent document type that has no routing path defined. Attempts to
54: // create documents of this type should throw a WorkflowException
55: WorkflowDocument document = new WorkflowDocument(
56: new NetworkIdVO("ewestfal"), "BlanketApproveTest");
57: try {
58: document.getRouteHeaderId();
59: fail("A workflow exception should have been thrown.");
60: } catch (WorkflowException e) {
61: e.printStackTrace();
62: }
63: }
64:
65: /**
66: * Tests the attempt to create a document from a document type with no routing path.
67: */
68: @Test
69: public void testCreateInactiveDocumentType() throws Exception {
70: // the CreatedDocumentInactive document type is inactive and should not be able to
71: // be initiated for a new document
72: WorkflowDocument document = new WorkflowDocument(
73: new NetworkIdVO("ewestfal"), "CreatedDocumentInactive");
74: try {
75: document.getRouteHeaderId();
76: fail("A workflow exception should have been thrown.");
77: } catch (WorkflowException e) {
78: e.printStackTrace();
79: }
80: }
81: }
|