cancel
Showing results for 
Search instead for 
Did you mean: 

Is DelegationState.PENDING effective?

jieyee
Champ in-the-making
Champ in-the-making
A method added to FinancialReportProcessTest.java in activiti-engine-examples.

    @Deployment(
     "org/activiti/examples/bpmn/usertask/FinancialReportProcess.bpmn20.xml"})   
    public void testDelegate() {
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("financialReport");
        List<Task> tasks = taskService.createTaskQuery().taskCandidateUser("fozzie").list();
        assertEquals(1, tasks.size());
        Task task = tasks.get(0);
        String taskId = taks.getId();
        task.setOwner("fozzie");
        //taskService.cliam(taskId, "fozzie");
        task.setAssignee("fozzie");
        task.delegate("kermit");
        assertEquals(DelegationState.PENDING, task.getDelegationState());
        //taskService.resolveTask(taskId);
        taskService.complete(taskId);
        fail();
    }
the method taskService.complete(taskId) return with no error.
1 REPLY 1

chaoyy
Champ in-the-making
Champ in-the-making
I also found the problem.
With the description of taskService.complete in Activiti JavaDocs, it claim that "Throws:
ActivitiException - when no task exists with the given id or when this task is DelegationState.PENDING delegation."

When the task's delegation state is PENDING, the complete method will throw a ActivitiException, But in the Jieyee's sample code, it not do that.


please focus that:
1,After the delegate method is executed, the task's delegation state is PENDING;
2,When execute the complete method, it don't throw the ActivitiException.