1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.engine;
17
18 import org.junit.Test;
19 import org.kuali.rice.kew.api.KewApiServiceLocator;
20 import org.kuali.rice.kew.api.WorkflowDocument;
21 import org.kuali.rice.kew.api.WorkflowDocumentFactory;
22 import org.kuali.rice.kew.api.doctype.ProcessDefinition;
23 import org.kuali.rice.kew.api.doctype.RoutePath;
24 import org.kuali.rice.kew.test.KEWTestCase;
25
26 import static org.junit.Assert.assertNotNull;
27 import static org.junit.Assert.assertNull;
28 import static org.junit.Assert.assertTrue;
29
30
31
32
33 public class EmptyProcessTest extends KEWTestCase {
34
35 private static final String DOCUMENT_TYPE_NAME = "EmptyProcessDocType";
36
37 protected void loadTestData() throws Exception {
38 loadXmlFile("EngineConfig.xml");
39 }
40
41
42
43
44
45 @Test public void testEmptyProcess() throws Exception {
46 WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), DOCUMENT_TYPE_NAME);
47 document.route("test");
48 assertNotNull(document.getDocumentId());
49 assertTrue(document.isFinal());
50 }
51
52
53
54
55
56
57 @Test public void testGetRoutePathForDocumentTypeName() throws Exception {
58 RoutePath routePath =
59 KewApiServiceLocator.getDocumentTypeService().getRoutePathForDocumentTypeName(DOCUMENT_TYPE_NAME);
60 assertNotNull(routePath);
61 ProcessDefinition processDefinition = routePath.getPrimaryProcess();
62 assertNotNull(processDefinition);
63 assertNull("The initial route node *should* be null since this is an empty process", processDefinition.getInitialRouteNode());
64 }
65
66 }