Thanks Sabastian
It looks like its only reproducible when using lanes ( or lanesets ) - I struggled to find much documentation around Lanes and the Model API - so may be using them incorrectly ? ( I just reverse engineered from the generated eclipse model )...
Failing Testcase:
@Test
public void buildModel() {
// Create Model
BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
definitions.setId("definition");
definitions.setTargetNamespace("
http://camunda.com");
// Create Process
Process process = modelInstance.newInstance(Process.class);
process.setName("Process Name");
process.setId("id12345");
process.setExecutable(true);
// Create laneset ( to hold lane )
LaneSet laneset = modelInstance.newInstance(LaneSet.class);
// Create lane
Lane lane = modelInstance.newInstance(Lane.class);
lane.setName("Swimlane Name");
// Create start event
StartEvent startEvent = modelInstance.newInstance(StartEvent.class);
startEvent.setName("Start Event");
startEvent.setId("id23456");
startEvent.setCamundaAsync(true);
process.addChildElement(startEvent);
// Add reference to lane
FlowNodeRef flowNodeRef = modelInstance.newInstance(FlowNodeRef.class);
flowNodeRef.setTextContent(startEvent.getName());
lane.addChildElement(flowNodeRef);
// Create empty task
Task task = modelInstance.newInstance(Task.class);
task.setName("Task");
task.setId("id34567");
process.addChildElement(task);
// Add reference to lane
flowNodeRef = modelInstance.newInstance(FlowNodeRef.class);
flowNodeRef.setTextContent(task.getName());
lane.addChildElement(flowNodeRef);
// Create end event
EndEvent endEvent = modelInstance.newInstance(EndEvent.class);
endEvent.setName("End Event");
endEvent.setId("id45678");
process.addChildElement(endEvent);
// Add reference to lane
flowNodeRef = modelInstance.newInstance(FlowNodeRef.class);
flowNodeRef.setTextContent(endEvent.getName());
lane.addChildElement(flowNodeRef);
// Add lane to laneset
laneset.addChildElement(lane);
// Add laneset to process
process.addChildElement(laneset);
// Add process to definition
definitions.addChildElement(process);
modelInstance.setDefinitions(definitions);
try {
DeploymentBuilder deploymentBuilder = repositoryService().createDeployment();
deploymentBuilder.addModelInstance("test.bpmn", modelInstance);
} catch (ModelValidationException modelValidationException) {
System.out.println("Exception:" + modelValidationException);
modelValidationException.printStackTrace();
}
Bpmn.writeModelToFile(new File("target/test.bpmn"), modelInstance);