Community

Manual reroute in Jbpm 4.3

reply from Martin Pradny in jBPM - View the full discussion

Hi,

 

still no luck. moveTo calls setActivity, so it probably not the issue. I think, I'm missing something in general here. The methods are called fine, but the state is not persisted. Here is my current test code - it looks to simple to work :) (Based on TaskCandidates test, because once the rerouting is working I want to make sure tasks are also correctly updated)

 

public void testReroute() {

    ProcessInstance processInstance = executionService.startProcessInstanceByKey("TaskReroute");

    String pid = processInstance.getId();

 

    // both johndoe and joesmoe will see the task in their *group* task list

    List<Task> taskList = taskService.findGroupTasks("johndoe");

    assertEquals("Expected a single task in johndoe's task list", 1, taskList.size());

    Task task = taskList.get(0);

    assertEquals("review", task.getName());

    taskService.completeTask(task.getId());

 

    // verify that process moved to the next state

    processInstance = executionService.findProcessInstanceById(pid);

    assertTrue(processInstance.isActive("approve"));

 

    //reroute back to review

    ExecutionImpl execution=(ExecutionImpl) processInstance.findActiveExecutionIn("approve");

    ProcessDefinitionQuery pdquery = repositoryService.createProcessDefinitionQuery();

    pdquery.processDefinitionId(execution.getProcessDefinitionId());

    ProcessDefinitionImpl pd=(ProcessDefinitionImpl) pdquery.list().get(0);

       ActivityImpl endActivity=pd.getActivity("review");

    execution.setActivity(endActivity);

 

    processInstance = executionService.findProcessInstanceById(pid);

    assertTrue(processInstance.isActive("review"));

 

  }

Reply to this message by going to Community

Start a new discussion in jBPM at Community