cancel
Showing results for 
Search instead for 
Did you mean: 

Error 'this activity doesn't accept signals' when testing

aduarte
Champ in-the-making
Champ in-the-making
Hello everyone,

I integrated Activiti 5.13 inside my java web application (based on hibernate/spring/vaadin) to manage the business processes via the API (For example, when a user click on a button, it starts a process, and the user can see his tasks and complete them).
I got some problems when I try to simulate a process in order to test it :

<process id="myProcess" name="My process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="checkObjectValue" name="Check object value" activiti:async="true" activiti:expression="#{myWorkflow.checkObjectValue(objectId, execution)}" activiti:resultVariableName="objectValue"></serviceTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="checkObjectValue"></sequenceFlow>
    <userTask id="takeDecisionTask" name="Take decision task"></userTask>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <serviceTask id="doA" name="Do A" activiti:async="true" activiti:expression="#{myWorkflow.doA(objectId)}"></serviceTask>
    <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow2" sourceRef="checkObjectValue" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow3" sourceRef="exclusivegateway1" targetRef="takeDecisionTask">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${objectValue == true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow4" sourceRef="takeDecisionTask" targetRef="exclusivegateway2"></sequenceFlow>
    <sequenceFlow id="flow5" sourceRef="exclusivegateway2" targetRef="doA">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${decision == true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow6" sourceRef="exclusivegateway1" targetRef="doA">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${objectValue == false}]]></conditionExpression>
    </sequenceFlow>
    <serviceTask id="doB" name="Do B" activiti:async="true" activiti:expression="#{myWorkflow.doA(objectId)}"></serviceTask>
    <sequenceFlow id="flow7" sourceRef="exclusivegateway2" targetRef="doB">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${decision == false}]]></conditionExpression>
    </sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow8" sourceRef="doA" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow9" sourceRef="doB" targetRef="endevent1"></sequenceFlow>
  </process>


All the service tasks are done in java and are asynchronous and exclusive because I want everything to be flushed in database at the end of each task.

When I use my web application to execute the process, everything is ok but I wrote some tests to execute automatically the process and verify the result.
For the process in the example I wrote (simplified version) :

// Start process
activitiService.startProcess("myWorkflow", variables);
// Check if a user task has been created
Task task = getActivitiTaskService().createTaskQuery().processVariableValueEquals(variableName, variableValue);
// Complete it
getActivitiTaskService().complete(taskId);
// Check the final result
assertTrue(something);


But when I call the completeTask method, I got this error :

org.activiti.engine.ActivitiException: this activity doesn't accept signals
   at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.signal(FlowNodeActivityBehavior.java:53)
   at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.signal(AbstractBpmnActivityBehavior.java:90)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.signal(ExecutionEntity.java:350)
   at org.activiti.engine.impl.persistence.entity.TaskEntity.complete(TaskEntity.java:160)
   at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:39)
   at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:24)
   at org.activiti.engine.impl.cmd.NeedsActiveTaskCmd.execute(NeedsActiveTaskCmd.java:61)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:61)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
   at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:163)


I don't understand why it happens only in test case (the same methods are called by the buttons in my web app).

Thank you for helping
6 REPLIES 6

trademak
Star Contributor
Star Contributor
You don't show where you got the taskId from. Could you create a unit test showing the issue?

Best regards,

aduarte
Champ in-the-making
Champ in-the-making
Sorry, I forgot that point.
I got the id of the task from the list returned by the taskQuery I wrote in my post :
<code>
// Check if a user task has been created
TaskQuery taskQuery = getActivitiTaskService().createTaskQuery().processVariableValueEquals(variableName, variableValue);
for (Task task : taskQuery.list()) {
     // Complete it
     getActivitiTaskService().complete(task.getId());
}
</code>

And I inject processEngine to get the task service :
<code>
private org.activiti.engine.TaskService getActivitiTaskService() {
return processEngine.getTaskService();
}
</code>

frederikherema1
Star Contributor
Star Contributor
Are all the tasks part of the process-definition you mention above? Or is it possible that completing one task has impact on the availability of another task? Also, from where in the code do you call the "complete" code? I hope not from within the process itself?

aduarte
Champ in-the-making
Champ in-the-making
Hi Frederik,

The complete task method is not called from the process itself, it is called from the test that I wrote to execute the process from the beginning to the end.

The task completion add a variable to the process to decide to do A or B using an exclusive gateway (which tests the variable value).

trademak
Star Contributor
Star Contributor
Can you create a JIRA issue and attach the unit test to it so we can reproduce it?

Thanks,

aduarte
Champ in-the-making
Champ in-the-making
I created a unit test case to reproduce it and posted it as a JIRA issue : http://jira.codehaus.org/browse/ACT-1811