cancel
Showing results for 
Search instead for 
Did you mean: 

Can not See Task in Activiti Explorer

tulipneo
Champ in-the-making
Champ in-the-making
Hi List,
I m very new to Activiti.
I am trying to learn this through the manning book and i was going through the sample programs.
I executed successfully BookOrderTest.java in chapter 1.
My code are as bellow.

public class BookOrderTest {   
   @Test
   public void startBookOrder() {
      ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()   
          .buildProcessEngine();       
      RepositoryService repositoryService = processEngine.getRepositoryService();
      RuntimeService runtimeService = processEngine.getRuntimeService();
      IdentityService identityService = processEngine.getIdentityService();
      TaskService taskService = processEngine.getTaskService();
      repositoryService.createDeployment().addClasspathResource("chapter1/bookorder.bpmn20.xml").deploy();
      
      // remove tasks already present
            List<Task> availableTaskList = taskService.createTaskQuery().taskName("Work on order").list();
            for (Task task : availableTaskList) {
             taskService.complete(task.getId());
          }   
      
            Map<String, Object> variableMap = new HashMap<String, Object>();
            variableMap.put("isbn", "123456");
            identityService.setAuthenticatedUserId("kermit");
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(
                  "bookorder", variableMap);            
            assertNotNull(processInstance.getId());
            System.out.println("id " + processInstance.getId() + " " + processInstance.getProcessDefinitionId());            
            List<Task> taskList = taskService.createTaskQuery().taskName("Work on order").list();
            System.out.println("size"+ taskList.size());
            assertEquals(1, taskList.size());
            System.out.println("found task " + taskList.get(0).getName());
   }
}

The output in Console are as bellowSmiley SadAs expected):
validating order for isbn 123456
id 4 bookorder:1:3
size1
found task Work on order

My xml file bookorder.bpmn20.xml structure is as bellow:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
      targetNamespace="http://www.bpmnwithactiviti.org">
      
   <process id="bookorder" name="Order book">
      <startEvent id="startevent1" name="Start"/>
      <sequenceFlow id="sequenceflow1" name="Validate order" sourceRef="startevent1" targetRef="scripttask1"/>
      <scriptTask id="scripttask1" name="Validate order" scriptFormat="groovy">
         <script>
            outSmiley Tonguerintln "validating order for isbn " + isbn;
         </script>
      </scriptTask>
      <sequenceFlow id="sequenceflow2" name="Sending to sales" sourceRef="scripttask1" targetRef="usertask1"/>
      <userTask id="usertask1" name="Work on order">
         <documentation>book order user task</documentation>
         <potentialOwner>
            <resourceAssignmentExpression>
               <formalExpression>sales</formalExpression>
            </resourceAssignmentExpression>
         </potentialOwner>
      </userTask>
      <sequenceFlow id="sequenceflow3" name="Ending process" sourceRef="usertask1" targetRef="endevent1"/>
      <endEvent id="endevent1" name="End"/>
   </process>
</definitions>


From eclipse console i see the task is created but i dont see the task in Activiti Explorere.

Any help or advice is welcome
Thanks n Regards
Tulip
1 REPLY 1

trademak
Star Contributor
Star Contributor
That's because the task is created in an in-memory database. So if you change it to for example a standalone H2 database for both the unit test as well as the Activiti Explorer it should work.

Best regards,
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.