Class 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 Detail

      • 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
    • Constructor Detail

      • WorkflowMockEnvironment

        public WorkflowMockEnvironment()
    • 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.PluginException
        org.imixs.workflow.exceptions.ModelException
        org.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
      • getDatabase

        public Map<String,​org.imixs.workflow.ItemCollection> getDatabase()
      • 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.AdapterException
        Mocks a processing life cycle
        Parameters:
        workitem -
        Returns:
        Throws:
        org.imixs.workflow.exceptions.ModelException
        org.imixs.workflow.exceptions.PluginException
        org.imixs.workflow.exceptions.ProcessingErrorException
        org.imixs.workflow.exceptions.AccessDeniedException
        org.imixs.workflow.exceptions.AdapterException