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