AnsweredAssumed Answered

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

Question asked by aduarte on Sep 27, 2013
Latest reply on Oct 14, 2013 by aduarte
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

Outcomes