There is a process model of the shape startEvent - userTask - exclusiveGateway - 3 userTasks - endEventThe problem is, when the first userTask has been completed, the process does not have active tasks.(In contrast, the process works as expected when the first userTask is removed.)XorTest.testXorFunctionality.bpmn20.xml:<?xml version="1.0" encoding="UTF-8"?>
<definitions id="propertyTest" xmlns="http://schema.omg.org/spec/BPMN/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn-extensions"
typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id="xorTest">
<startEvent id="startEvent" />
<sequenceFlow targetRef="chooseRecipeTask" sourceRef="startEvent" />
<userTask id="chooseRecipeTask" name="Choose Recipe" />
<exclusiveGateway id="recipeChosenXorGateway" />
<sequenceFlow sourceRef="recipeChosenXorGateway"
targetRef="cookPastaTask">
<conditionExpression xsi:type="tFormalExpression">${recipe == 0}</conditionExpression>
</sequenceFlow>
<sequenceFlow sourceRef="recipeChosenXorGateway"
targetRef="roastSteakTask">
<conditionExpression xsi:type="tFormalExpression">${recipe == 1}</conditionExpression>
</sequenceFlow>
<sequenceFlow sourceRef="recipeChosenXorGateway"
targetRef="prepareSaladTask">
<conditionExpression xsi:type="tFormalExpression">${recipe == 2}</conditionExpression>
</sequenceFlow>
<userTask id="cookPastaTask" name="Cook Pasta" />
<userTask id="roastSteakTask" name="Roast Steak" />
<userTask id="prepareSaladTask" name="Prepare Salad" />
<sequenceFlow targetRef="endEvent" sourceRef="cookPastaTask" />
<sequenceFlow targetRef="endEvent" sourceRef="roastSteakTask" />
<sequenceFlow targetRef="endEvent" sourceRef="prepareSaladTask" />
<endEvent id="endEvent" />
</process>
</definitions>XorTest.java:public class XorTest extends ActivitiTestCase {
public void testXorFunctionality() {
deployProcessForThisTestMethod();
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("recipe", 2);
ProcessInstance processInstance = processService
.startProcessInstanceById("xorTest:1", variables);
Task task = taskService.createTaskQuery().processInstance(
processInstance.getId()).singleResult();
assertEquals("Choose Recipe", task.getName());
taskService.complete(task.getId());
task = taskService.createTaskQuery().processInstance(
processInstance.getId()).singleResult();
// task is null at this place (but shouldn't be)
assertEquals("Prepare Salad", task.getName());
}
}—BTW, the variable named "result" in ExpressionCondition#evaluate(..) should be trimmed in order to remove potential XML whitespace.Thanks