Package org.imixs.workflow.engine
Class WorkflowMockEnvironment
- java.lang.Object
-
- org.imixs.workflow.engine.WorkflowMockEnvironment
-
public class WorkflowMockEnvironment extends Object
The WorkflowMockEnvironment provides a mocked database environment for jUnit tests. The WorkflowMockEnvironment can be used to test the WorkflowService. This test class mocks a complete workflow environment without the class WorkflowService The test class generates a test database with process entities and activity entities which can be accessed from a plug-in or the workflowKernel. A JUnit Test can save, load and process workitems. JUnit tests can also manipulate the model by changing entities through calling the methods: getActivityEntity,setActivityEntity,getProcessEntity,setProcessEntity- Version:
- 2.0
- Author:
- rsoika
-
-
Field Summary
Fields Modifier and Type Field Description protected jakarta.ejb.SessionContextctxstatic StringDEFAULT_MODEL_VERSIONprotected org.imixs.workflow.engine.DocumentServicedocumentServiceprotected org.imixs.workflow.engine.ModelServicemodelServiceprotected org.imixs.workflow.WorkflowContextworkflowContextprotected org.imixs.workflow.engine.WorkflowServiceworkflowService
-
Constructor Summary
Constructors Constructor Description WorkflowMockEnvironment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcreateTestDatabase()Create a test database with some workItems and a simple modelMap<String,org.imixs.workflow.ItemCollection>getDatabase()org.imixs.workflow.engine.DocumentServicegetDocumentService()org.imixs.workflow.ModelgetModel()StringgetModelPath()org.imixs.workflow.engine.ModelServicegetModelService()org.imixs.workflow.WorkflowContextgetWorkflowContext()org.imixs.workflow.engine.WorkflowServicegetWorkflowService()voidloadModel()loads the current modelvoidloadModel(String modelPath)loads a model from the given pathorg.imixs.workflow.ItemCollectionprocessWorkItem(org.imixs.workflow.ItemCollection workitem)Mocks a processing life cyclevoidsetModelPath(String modelPath)voidsetup()
-
-
-
Field Detail
-
DEFAULT_MODEL_VERSION
public static final String DEFAULT_MODEL_VERSION
- See Also:
- Constant Field Values
-
documentService
@Spy protected org.imixs.workflow.engine.DocumentService documentService
-
workflowService
@Spy protected org.imixs.workflow.engine.WorkflowService workflowService
-
modelService
@Spy protected org.imixs.workflow.engine.ModelService modelService
-
ctx
protected jakarta.ejb.SessionContext ctx
-
workflowContext
protected org.imixs.workflow.WorkflowContext workflowContext
-
-
Method Detail
-
getModelPath
public String getModelPath()
-
setModelPath
public void setModelPath(String modelPath)
-
getWorkflowContext
public org.imixs.workflow.WorkflowContext getWorkflowContext()
-
getWorkflowService
public org.imixs.workflow.engine.WorkflowService getWorkflowService()
-
getModelService
public org.imixs.workflow.engine.ModelService getModelService()
-
getDocumentService
public org.imixs.workflow.engine.DocumentService getDocumentService()
-
setup
public void setup() throws org.imixs.workflow.exceptions.PluginException, org.imixs.workflow.exceptions.ModelException, org.imixs.workflow.exceptions.AdapterException- Throws:
org.imixs.workflow.exceptions.PluginExceptionorg.imixs.workflow.exceptions.ModelExceptionorg.imixs.workflow.exceptions.AdapterException
-
createTestDatabase
protected void createTestDatabase()
Create a test database with some workItems and a simple model
-
getModel
public org.imixs.workflow.Model getModel()
-
loadModel
public void loadModel(String modelPath)
loads a model from the given path- Parameters:
modelPath-
-
loadModel
public void loadModel()
loads the current model
-
processWorkItem
public org.imixs.workflow.ItemCollection processWorkItem(org.imixs.workflow.ItemCollection workitem) throws org.imixs.workflow.exceptions.AccessDeniedException, org.imixs.workflow.exceptions.ProcessingErrorException, org.imixs.workflow.exceptions.PluginException, org.imixs.workflow.exceptions.ModelException, org.imixs.workflow.exceptions.AdapterExceptionMocks a processing life cycle- Parameters:
workitem-- Returns:
- Throws:
org.imixs.workflow.exceptions.ModelExceptionorg.imixs.workflow.exceptions.PluginExceptionorg.imixs.workflow.exceptions.ProcessingErrorExceptionorg.imixs.workflow.exceptions.AccessDeniedExceptionorg.imixs.workflow.exceptions.AdapterException
-
-