AnsweredAssumed Answered

Deployment in ActivitiTestCase does not work?

Question asked by mhw on Aug 10, 2011
Latest reply on Aug 10, 2011 by mhw
Hi,

as absolute beginner I am trying to implement unit tests for our requirements with a standalone workflow engine. I thought adapting the example unit tests is the best way, but now I am struggeling with the deployment.
I wrote this test:
public class Tests extends PluggableActivitiTestCase {

   @Deployment(resources = {"com/example/wfe/test/res/Example_Spec_1_StartEnd.bpmn2"})
   public void testMinimalProcess() throws Exception {
      
       // After starting the process, a task should be assigned to the 'initiator' (normally set by GUI)
       Map<String, Object> variables = new HashMap<String, Object>();
       variables.put("initiator", "micha");
      
       ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
       query.deploymentId(deploymentId);
       List<ProcessDefinition> defs = query.list();
       for(Iterator<ProcessDefinition> i = defs.iterator();i.hasNext();){
          ProcessDefinition def = i.next();
          System.out.println(def.getKey());
       }
      
       String procId = runtimeService.startProcessInstanceByKey("Minimal").getId();
       Task task = taskService.createTaskQuery().taskAssignee("micha").singleResult();
       assertEquals("Minimal Process", task.getName());
   }
}
I get a deploymentId here(AbstractActivitiTestCase):

      deploymentId = TestHelper.annotationDeploymentSetUp(processEngine, getClass(), getName());
So my resource is found and I would expect to find it within the defs-list. But that remains empty.
The test is failing at this line:
String procId = runtimeService.startProcessInstanceByKey("Minimal").getId();
With the message:
org.activiti.engine.ActivitiException: no processes deployed with key 'Minimal'
In the xml the id is given:
<process processType="Private" isExecutable="true" id="Minimal" name="Minimal Process" >
Please give me a hint what I do wrong.

Michael

Outcomes