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.Before;
19 import org.junit.Test;
20 import org.kuali.rice.kew.engine.OrchestrationConfig.EngineCapability;
21 import org.kuali.rice.kew.engine.simulation.SimulationEngine;
22
23 import static org.junit.Assert.*;
24
25
26
27
28
29
30 public class WorkflowEngineFactoryImplTest {
31
32 private WorkflowEngineFactory factory;
33
34 @Before
35 public void setup() {
36 factory = new WorkflowEngineFactoryImpl();
37 }
38
39 @Test
40 public void standardEngineCreate() {
41 OrchestrationConfig config = new OrchestrationConfig(EngineCapability.STANDARD);
42 WorkflowEngine workflowEngine = factory.newEngine(config);
43
44 assertNotNull(workflowEngine);
45 assertFalse(workflowEngine instanceof BlanketApproveEngine);
46 assertFalse(workflowEngine instanceof SimulationEngine);
47 assertTrue(workflowEngine instanceof StandardWorkflowEngine);
48 }
49
50 @Test
51 public void blanketApproveEngineCreate() {
52 OrchestrationConfig config = new OrchestrationConfig(EngineCapability.BLANKET_APPROVAL);
53 WorkflowEngine workflowEngine = factory.newEngine(config);
54
55 assertNotNull(workflowEngine);
56 assertTrue(workflowEngine instanceof BlanketApproveEngine);
57 assertFalse(workflowEngine instanceof SimulationEngine);
58 }
59
60 @Test
61 public void simulationEngineCreate() {
62 OrchestrationConfig config = new OrchestrationConfig(EngineCapability.SIMULATION);
63 WorkflowEngine workflowEngine = factory.newEngine(config);
64
65 assertNotNull(workflowEngine);
66 assertFalse(workflowEngine instanceof BlanketApproveEngine);
67 assertTrue(workflowEngine instanceof SimulationEngine);
68 }
69
70 @Test
71 public void standardEngineRunPostProcessLogic() {
72 OrchestrationConfig config = new OrchestrationConfig(EngineCapability.STANDARD, true);
73 WorkflowEngine workflowEngine = factory.newEngine(config);
74 assertTrue(((StandardWorkflowEngine)workflowEngine).isRunPostProcessorLogic());
75 }
76
77 @Test
78 public void standardEngineDoNotRunPostProcessLogic() {
79 OrchestrationConfig config = new OrchestrationConfig(EngineCapability.STANDARD, false);
80 WorkflowEngine workflowEngine = factory.newEngine(config);
81 assertFalse(((StandardWorkflowEngine)workflowEngine).isRunPostProcessorLogic());
82 }
83
84 }