1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.routing;
17
18 import static org.junit.Assert.assertTrue;
19 import static org.junit.Assert.fail;
20
21 import org.junit.Test;
22 import org.kuali.rice.kew.api.WorkflowDocument;
23 import org.kuali.rice.kew.api.WorkflowDocumentFactory;
24 import org.kuali.rice.kew.api.action.InvalidActionTakenException;
25 import org.kuali.rice.kew.test.KEWTestCase;
26 import org.kuali.rice.kew.test.TestUtilities;
27 import org.kuali.rice.test.BaselineTestCase.BaselineMode;
28 import org.kuali.rice.test.BaselineTestCase.Mode;
29
30 @BaselineMode(Mode.CLEAR_DB)
31 public class RoutingToInactiveWorkgroupTest extends KEWTestCase {
32
33 protected void loadTestData() throws Exception {
34 loadXmlFile("RoutingConfig.xml");
35 }
36
37 @Test public void testRoutingToInactiveWorkgroup() throws Exception {
38 WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "InactiveWorkgroupDocType");
39 try {
40 doc.route("");
41 fail("document should have thrown routing exception");
42 } catch (Exception e) {
43 e.printStackTrace();
44 }
45 TestUtilities.getExceptionThreader().join();
46 doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), doc.getDocumentId());
47 assertTrue("Document should be in exception routing because workgroup is inactive", doc.isException());
48
49 try {
50 doc.route("routing a document that is in exception routing");
51 fail("Succeeded in routing document that is in exception routing");
52 } catch (InvalidActionTakenException iate) {
53 log.info("Expected exception occurred: " + iate);
54 }
55 }
56 }