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