View Javadoc

1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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   * Unit tests for the WorkflowEngineFactoryImpl class. 
27   * 
28   * @author Kuali Rice Team (rice.collab@kuali.org)
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  }