feat(import): import collaboration + artifacts + message flows

This commit adds support for collaborations, message flows and
artifacts.

Related to #1
This commit is contained in:
Nico Rehwaldt 2014-03-13 20:21:42 +01:00
parent 5a4d0b566a
commit f3f95154fd
11 changed files with 717 additions and 71 deletions

View File

@ -2,9 +2,20 @@
<head>
<title>bpmn-js demo</title>
<link rel="stylesheet" href="style.css" />
<style>
#drop-zone {
width: 200px;
line-height: 100px;
background: fuchsia;
color: #FFF;
font-size: 20px;
text-align: center;
}
</style>
</head>
<body>
<div id="drop-zone">Drop files here</div>
<div id="drop-zone">Drop BPMN here</div>
<output id="list"></output>
<div id="canvas"></div>
@ -17,8 +28,9 @@
var Diagram = require('bpmn/Diagram');
</script>
<script>
var diagram = new Diagram(document.getElementById('canvas'));
function handleFileSelect(evt) {
evt.stopPropagation();
evt.preventDefault();
@ -38,12 +50,9 @@
if (err) {
console.error(err);
} else {
var diagram = new Diagram(document.getElementById('canvas'));
diagram.importDefinitions(definitions, function() {
console.log("import done!!");
});
console.log(definitions);
}
});

View File

@ -28,6 +28,15 @@ function BpmnTraverser(visitor) {
return gfx;
}
function visitIfDi(element, ctx) {
var di = getDi(element);
if (di) {
return visit(element, di, ctx);
}
}
////// DI handling ////////////////////////////
function buildDiMap(definitions) {
@ -88,35 +97,139 @@ function BpmnTraverser(visitor) {
}
}
function handleDataAssociation(association, context) {
visitIfDi(association, context);
}
function handleDataInput(dataInput, context) {
visitIfDi(dataInput, context);
}
function handleDataOutput(dataOutput, context) {
visitIfDi(dataOutput, context);
}
function handleArtifact(artifact, context) {
// bpmn:TextAnnotation
// bpmn:Group
// bpmn:Association
visitIfDi(artifact, context);
}
function handleArtifacts(artifacts, context) {
_.forEach(artifacts, contextual(handleArtifact, context));
}
function handleIoSpecification(ioSpecification, context) {
if (!ioSpecification) {
return;
}
_.forEach(ioSpecification.dataInputs, contextual(handleDataInput, context));
_.forEach(ioSpecification.dataOutputs, contextual(handleDataOutput, context));
}
function handleSubProcess(subProcess, context) {
handleFlowElementsContainer(subProcess, context);
handleArtifacts(subProcess.artifacts, context);
}
function handleFlowNode(flowNode, context) {
var di = getDi(flowNode);
var childCtx = visitIfDi(flowNode, context);
var childCtx = visit(flowNode, di, context);
if (is(flowNode, 'bpmn:SubProcess')) {
handleSubProcess(flowNode, childCtx || context);
}
if (is(flowNode, 'bpmn:FlowElementsContainer')) {
handleFlowElementsContainer(flowNode, childCtx);
if (is(flowNode, 'bpmn:Activity')) {
_.forEach(flowNode.dataInputAssociations, contextual(handleDataAssociation, null));
_.forEach(flowNode.dataOutputAssociations, contextual(handleDataAssociation, null));
handleIoSpecification(flowNode.ioSpecification, context);
}
}
function handleSequenceFlow(sequenceFlow, context) {
var di = getDi(sequenceFlow);
visitIfDi(sequenceFlow, context);
}
visit(sequenceFlow, di, context);
function handleDataElement(dataObject, context) {
visitIfDi(dataObject, context);
}
function handleLane(lane, context) {
var newContext = visitIfDi(lane, context);
if (lane.childLaneSet) {
handleLaneSet(lane.childLaneSet, newContext || context);
} else {
handleFlowElements(lane.flowNodeRef, newContext || context);
}
}
function handleLaneSet(laneSet, context) {
_.forEach(laneSet.lanes, contextual(handleLane, context));
}
function handleLaneSets(laneSets, context) {
_.forEach(laneSets, contextual(handleLaneSet, context));
}
function handleFlowElementsContainer(container, context) {
if (container.laneSets) {
handleLaneSets(container.laneSets, context);
handleNonFlowNodes(container.flowElements);
} else {
handleFlowElements(container.flowElements, context);
}
}
function handleNonFlowNodes(flowElements, context) {
var sequenceFlows = [];
// handle FlowNode(s)
_.forEach(container.flowElements, function(e) {
_.forEach(flowElements, function(e) {
if (is(e, 'bpmn:SequenceFlow')) {
sequenceFlows.push(e);
} else
if (is(e, 'bpmn:DataObject')) {
// SKIP (assume correct referencing via DataObjectReference)
} else
if (is(e, 'bpmn:DataStoreReference')) {
handleDataElement(e, context);
} else
if (is(e, 'bpmn:DataObjectReference')) {
handleDataElement(e, context);
}
});
// handle SequenceFlows
_.forEach(sequenceFlows, contextual(handleSequenceFlow, context));
}
function handleFlowElements(flowElements, context) {
var sequenceFlows = [];
_.forEach(flowElements, function(e) {
if (is(e, 'bpmn:SequenceFlow')) {
sequenceFlows.push(e);
} else
if (is(e, 'bpmn:FlowNode')) {
handleFlowNode(e, context);
} else
if (is(e, 'bpmn:DataObject')) {
// SKIP (assume correct referencing via DataObjectReference)
} else
if (is(e, 'bpmn:DataStoreReference')) {
handleDataElement(e, context);
} else
if (is(e, 'bpmn:DataObjectReference')) {
handleDataElement(e, context);
} else {
throw new Error('unrecognized element: ' + e);
throw new Error('unrecognized element <' + e.$type + '> in context ' + (context ? context.id : null));
}
});
@ -125,25 +238,38 @@ function BpmnTraverser(visitor) {
}
function handleParticipant(participant, context) {
var di = getDi(participant);
var newCtx = visit(participant, di, context);
var newCtx = visitIfDi(participant, context);
var process = participant.processRef;
if (process) {
handleProcess(process, newCtx);
handleProcess(process, newCtx || context);
}
}
function handleProcess(process, context) {
handleFlowElementsContainer(process, context);
handleIoSpecification(process.ioSpecification, context);
handleArtifacts(process.artifacts, context);
}
function handleMessageFlow(messageFlow, context) {
visitIfDi(messageFlow, context);
}
function handleMessageFlows(messageFlows, context) {
if (messageFlows) {
_.forEach(messageFlows, contextual(handleMessageFlow, context));
}
}
function handleCollaboration(collaboration) {
_.forEach(collaboration.participants, contextual(handleParticipant));
// TODO: handle message flows
handleArtifacts(collaboration.artifacts);
handleMessageFlows(collaboration.messageFlows);
}

View File

@ -7,9 +7,17 @@ function Diagram(container) {
Diagram.prototype.importDefinitions = function(definitions, done) {
if (this.diagram) {
this.clear();
}
this.diagram = new DiagramJS({ canvas: { container: this.container }});
Importer.importBpmnDiagram(this.diagram, definitions, done);
};
Diagram.prototype.clear = function() {
this.container.innerHTML = '';
};
module.exports = Diagram;

View File

@ -1,3 +1,5 @@
var _ = require('lodash');
var BpmnTreeWalker = require('./BpmnTreeWalker');
function importBpmnDiagram(diagram, definitions, done) {
@ -10,6 +12,13 @@ function importBpmnDiagram(diagram, definitions, done) {
var bounds = di.bounds;
canvas.addShape({ id: element.id, type: element.$type, x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height });
} else {
var waypoints = _.collect(di.waypoint, function(p) {
return { x: p.x, y: p.y };
});
canvas.addConnection({ id: element.id, waypoints: waypoints });
}
};

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_pHDz0KojEeOJhIBv1RySdg" targetNamespace="http://activiti.org/bpmn">
<bpmn2:collaboration id="_Collaboration_2">
<bpmn2:participant id="Participant_2" name="Pool" processRef="Process_1"/>
<bpmn2:participant id="Participant_1" name="Pool" processRef="Process_2"/>
</bpmn2:collaboration>
<bpmn2:process id="Process_1" isExecutable="false">
<bpmn2:laneSet id="LaneSet_1" name="Lane Set 1">
<bpmn2:lane id="Lane_1" name="Lane 1">
<bpmn2:childLaneSet xsi:type="bpmn2:tLaneSet" id="LaneSet_2">
<bpmn2:lane id="Lane_2" name="Lane 2">
<bpmn2:flowNodeRef>SubProcess_1</bpmn2:flowNodeRef>
</bpmn2:lane>
<bpmn2:lane id="Lane_3" name="Lane 3"/>
</bpmn2:childLaneSet>
</bpmn2:lane>
</bpmn2:laneSet>
<bpmn2:dataStoreReference id="DataStoreReference_5" name="Data Store 1" dataStoreRef="DataStore_1"/>
<bpmn2:subProcess id="SubProcess_1">
<bpmn2:dataObject id="DataObject_1" name="Data Object 1"/>
<bpmn2:dataObjectReference id="DataObjectReference_1" name="Data Object 1" dataObjectRef="DataObject_1"/>
</bpmn2:subProcess>
<bpmn2:dataStoreReference id="DataStoreReference_6" name="Data Store 2" dataStoreRef="DataStore_2"/>
</bpmn2:process>
<bpmn2:process id="Process_2" isExecutable="false">
<bpmn2:ioSpecification id="InputOutputSpecification_1">
<bpmn2:dataInput id="DataInput_1"/>
<bpmn2:dataOutput id="DataOutput_1"/>
</bpmn2:ioSpecification>
</bpmn2:process>
<bpmn2:dataStore id="DataStore_1" name="Data Store 1"/>
<bpmn2:dataStore id="DataStore_2" name="Data Store 2"/>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="_Collaboration_2">
<bpmndi:BPMNShape id="_BPMNShape_Participant_2" bpmnElement="Participant_2" isHorizontal="true">
<dc:Bounds height="361.0" width="540.0" x="222.0" y="0.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Participant_3" bpmnElement="Participant_1" isHorizontal="true">
<dc:Bounds height="100.0" width="600.0" x="222.0" y="415.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Lane_2" bpmnElement="Lane_1" isHorizontal="true">
<dc:Bounds height="361.0" width="510.0" x="252.0" y="0.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Lane_3" bpmnElement="Lane_2" isHorizontal="true">
<dc:Bounds height="253.0" width="480.0" x="282.0" y="0.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Lane_4" bpmnElement="Lane_3" isHorizontal="true">
<dc:Bounds height="109.0" width="480.0" x="282.0" y="252.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_3" bpmnElement="SubProcess_1" isExpanded="true">
<dc:Bounds height="150.0" width="176.0" x="552.0" y="36.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_DataObjectReference_5" bpmnElement="DataObjectReference_1">
<dc:Bounds height="50.0" width="36.0" x="636.0" y="72.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="22.0" width="86.0" x="611.0" y="127.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_DataStoreReference_5" bpmnElement="DataStoreReference_5">
<dc:Bounds height="50.0" width="50.0" x="336.0" y="276.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="22.0" width="79.0" x="322.0" y="331.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_DataStoreReference_6" bpmnElement="DataStoreReference_6">
<dc:Bounds height="50.0" width="50.0" x="888.0" y="317.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="22.0" width="79.0" x="874.0" y="372.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_DataInput_5" bpmnElement="DataInput_1">
<dc:Bounds height="50.0" width="36.0" x="394.0" y="436.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_DataOutput_5" bpmnElement="DataOutput_1">
<dc:Bounds height="50.0" width="36.0" x="487.0" y="436.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="505.0" y="491.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_pHDz0KojEeOJhIBv1RySdg" targetNamespace="http://activiti.org/bpmn">
<bpmn2:collaboration id="_Collaboration_2">
<bpmn2:participant id="Participant_2" name="Pool" processRef="Process_1"/>
<bpmn2:participant id="Participant_1" name="Pool" processRef="Process_2"/>
<bpmn2:messageFlow id="MessageFlow_1" name="" sourceRef="Task_1" targetRef="Participant_1"/>
<bpmn2:messageFlow id="MessageFlow_2" name="" sourceRef="Participant_1" targetRef="Participant_2"/>
<bpmn2:messageFlow id="MessageFlow_4" name="" sourceRef="Task_1" targetRef="StartEvent_1"/>
<bpmn2:messageFlow id="MessageFlow_5" name="" sourceRef="EndEvent_1" targetRef="Participant_1"/>
</bpmn2:collaboration>
<bpmn2:process id="Process_1" isExecutable="false">
<bpmn2:task id="Task_1"/>
<bpmn2:endEvent id="EndEvent_1">
<bpmn2:messageEventDefinition id="MessageEventDefinition_2"/>
</bpmn2:endEvent>
</bpmn2:process>
<bpmn2:process id="Process_2" isExecutable="false">
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:messageEventDefinition id="MessageEventDefinition_1"/>
</bpmn2:startEvent>
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="_Collaboration_2">
<bpmndi:BPMNShape id="_BPMNShape_Participant_2" bpmnElement="Participant_2" isHorizontal="true">
<dc:Bounds height="217.0" width="456.0" x="278.0" y="84.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Participant_3" bpmnElement="Participant_1" isHorizontal="true">
<dc:Bounds height="100.0" width="600.0" x="222.0" y="415.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_3" bpmnElement="StartEvent_1">
<dc:Bounds height="36.0" width="36.0" x="300.0" y="448.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="318.0" y="489.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Task_3" bpmnElement="Task_1">
<dc:Bounds height="80.0" width="100.0" x="404.0" y="135.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_1" bpmnElement="MessageFlow_1" sourceElement="_BPMNShape_Task_3" targetElement="_BPMNShape_Participant_3">
<di:waypoint xsi:type="dc:Point" x="454.0" y="215.0"/>
<di:waypoint xsi:type="dc:Point" x="454.0" y="370.0"/>
<di:waypoint xsi:type="dc:Point" x="522.0" y="370.0"/>
<di:waypoint xsi:type="dc:Point" x="522.0" y="415.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="451.0" y="316.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_2" bpmnElement="MessageFlow_2" sourceElement="_BPMNShape_Participant_3" targetElement="_BPMNShape_Participant_2">
<di:waypoint xsi:type="dc:Point" x="522.0" y="415.0"/>
<di:waypoint xsi:type="dc:Point" x="522.0" y="386.0"/>
<di:waypoint xsi:type="dc:Point" x="506.0" y="386.0"/>
<di:waypoint xsi:type="dc:Point" x="506.0" y="300.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="504.0" y="386.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_4" bpmnElement="MessageFlow_4" sourceElement="_BPMNShape_Task_3" targetElement="_BPMNShape_StartEvent_3">
<di:waypoint xsi:type="dc:Point" x="454.0" y="215.0"/>
<di:waypoint xsi:type="dc:Point" x="454.0" y="387.0"/>
<di:waypoint xsi:type="dc:Point" x="318.0" y="387.0"/>
<di:waypoint xsi:type="dc:Point" x="318.0" y="448.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="451.0" y="322.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_2" bpmnElement="EndEvent_1">
<dc:Bounds height="36.0" width="36.0" x="653.0" y="178.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="671.0" y="219.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_5" bpmnElement="MessageFlow_5" sourceElement="_BPMNShape_EndEvent_2" targetElement="_BPMNShape_Participant_3">
<di:waypoint xsi:type="dc:Point" x="671.0" y="214.0"/>
<di:waypoint xsi:type="dc:Point" x="671.0" y="332.0"/>
<di:waypoint xsi:type="dc:Point" x="522.0" y="332.0"/>
<di:waypoint xsi:type="dc:Point" x="522.0" y="415.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="630.0" y="332.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_pHDz0KojEeOJhIBv1RySdg" targetNamespace="http://activiti.org/bpmn">
<bpmn2:collaboration id="_Collaboration_2">
<bpmn2:participant id="_Participant_2" name="Pool" processRef="Process_1"/>
<bpmn2:participant id="Participant_2" name="Pool" processRef="Process_1"/>
<bpmn2:participant id="Participant_1" name="Pool" processRef="Process_2"/>
</bpmn2:collaboration>
<bpmn2:process id="Process_1" isExecutable="false">
@ -22,7 +22,7 @@
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="_Collaboration_2">
<bpmndi:BPMNShape id="_BPMNShape_Participant_2" bpmnElement="_Participant_2" isHorizontal="true">
<bpmndi:BPMNShape id="_BPMNShape_Participant_2" bpmnElement="Participant_2" isHorizontal="true">
<dc:Bounds height="356.0" width="540.0" x="222.0" y="0.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Participant_3" bpmnElement="Participant_1" isHorizontal="true">

View File

@ -637,8 +637,8 @@
<targetRef>sid-8D8BD39F-1B08-433F-8F93-A1FF7520BA8B</targetRef>
</dataOutputAssociation>
</task>
<dataObject id="sid-8D8BD39F-1B08-433F-8F93-A1FF7520BA8B" isCollection="true" name="Bewerber">
</dataObject>
<dataObjectReference id="sid-8D8BD39F-1B08-433F-8F93-A1FF7520BA8B" isCollection="true" name="Bewerber">
</dataObjectReference>
<exclusiveGateway gatewayDirection="Diverging" id="sid-B9B94A24-2819-461A-B5E8-61182BDA87DD" name="Bewerbungen&#10;eingegangen?">
<incoming>sid-770DE0CC-14BD-46C1-B93A-3C10BD8A3933</incoming>
<outgoing>sid-155BB3AD-386C-4EF2-92C6-E2800D82A875</outgoing>
@ -903,8 +903,8 @@
<incoming>sid-3906E383-5898-47F6-84FE-CBA12360BCF9</incoming>
<outgoing>sid-11A2840A-596D-4937-BB37-0D5952E03535</outgoing>
</task>
<dataObject id="sid-DF651323-2973-4344-A5E5-4FFF3FDCD702" name="Führungskraft&#10;Fachbereich">
</dataObject>
<dataObjectReference id="sid-DF651323-2973-4344-A5E5-4FFF3FDCD702" name="Führungskraft&#10;Fachbereich">
</dataObjectReference>
<startEvent id="sid-3B833F36-ABCE-49A9-B268-445BAC9F758D" isInterrupting="true" name="Gesprächs-&#10;termin&#10;erreicht">
<outgoing>sid-3906E383-5898-47F6-84FE-CBA12360BCF9</outgoing>
<conditionalEventDefinition id="sid-3334a259-921f-4caa-bf4e-fc23785e7a21">

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="simple" targetNamespace="http://activiti.org/bpmn">
<bpmn2:process id="Process_1" isExecutable="false">
<bpmn2:ioSpecification id="InputOutputSpecification_1">
<bpmn2:dataInput id="DataInput_1"/>
<bpmn2:dataOutput id="DataOutput_1"/>
</bpmn2:ioSpecification>
<bpmn2:task id="Task_1">
<bpmn2:dataInputAssociation id="DataInputAssociation_1">
<bpmn2:sourceRef>DataInput_1</bpmn2:sourceRef>
</bpmn2:dataInputAssociation>
<bpmn2:dataOutputAssociation id="DataOutputAssociation_1">
<bpmn2:targetRef>DataOutput_1</bpmn2:targetRef>
</bpmn2:dataOutputAssociation>
</bpmn2:task>
<bpmn2:boundaryEvent id="BoundaryEvent_1" name="" attachedToRef="Task_1">
<bpmn2:compensateEventDefinition id="_CompensateEventDefinition_2" waitForCompletion="false"/>
</bpmn2:boundaryEvent>
<bpmn2:task id="Task_2" isForCompensation="true">
<bpmn2:dataInputAssociation id="DataInputAssociation_2">
<bpmn2:sourceRef>DataObjectReference_1</bpmn2:sourceRef>
</bpmn2:dataInputAssociation>
<bpmn2:dataOutputAssociation id="DataOutputAssociation_2">
<bpmn2:targetRef>DataStoreReference_4</bpmn2:targetRef>
</bpmn2:dataOutputAssociation>
</bpmn2:task>
<bpmn2:dataStoreReference id="DataStoreReference_4" name="Data Store 1" dataStoreRef="DataStore_1"/>
<bpmn2:dataObject id="DataObject_1" name="Data Object 1"/>
<bpmn2:dataObjectReference id="DataObjectReference_1" name="Data Object 1" dataObjectRef="DataObject_1"/>
<bpmn2:association id="Association_1" sourceRef="BoundaryEvent_1" targetRef="Task_2"/>
<bpmn2:association id="Association_2" sourceRef="DataObjectReference_1" targetRef="DataStoreReference_4"/>
</bpmn2:process>
<bpmn2:dataStore id="DataStore_1" name="Data Store 1"/>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="_BPMNShape_Task_5" bpmnElement="Task_1">
<dc:Bounds height="80.0" width="100.0" x="284.0" y="203.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_4" bpmnElement="BoundaryEvent_1">
<dc:Bounds height="36.0" width="36.0" x="331.0" y="265.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Task_6" bpmnElement="Task_2">
<dc:Bounds height="80.0" width="100.0" x="505.0" y="341.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_Association_1" bpmnElement="Association_1" sourceElement="_BPMNShape_BoundaryEvent_4" targetElement="_BPMNShape_Task_6">
<di:waypoint xsi:type="dc:Point" x="349.0" y="301.0"/>
<di:waypoint xsi:type="dc:Point" x="349.0" y="380.0"/>
<di:waypoint xsi:type="dc:Point" x="505.0" y="381.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_DataInput_4" bpmnElement="DataInput_1">
<dc:Bounds height="50.0" width="36.0" x="221.0" y="98.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_DataOutput_4" bpmnElement="DataOutput_1">
<dc:Bounds height="50.0" width="36.0" x="380.0" y="101.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShapeDataStoreReference_4" bpmnElement="DataStoreReference_4">
<dc:Bounds height="50.0" width="50.0" x="636.0" y="144.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="22.0" width="79.0" x="696.0" y="158.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_DataObjectReference_4" bpmnElement="DataObjectReference_1">
<dc:Bounds height="50.0" width="36.0" x="484.0" y="91.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="22.0" width="86.0" x="459.0" y="60.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_Association_2" bpmnElement="Association_2" sourceElement="_BPMNShape_DataObjectReference_4" targetElement="_BPMNShapeDataStoreReference_4">
<di:waypoint xsi:type="dc:Point" x="520.0" y="122.0"/>
<di:waypoint xsi:type="dc:Point" x="636.0" y="161.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_DataOutputAssociation_1" bpmnElement="DataOutputAssociation_1" sourceElement="_BPMNShape_Task_5" targetElement="_BPMNShape_DataOutput_4">
<di:waypoint xsi:type="dc:Point" x="356.0" y="203.0"/>
<di:waypoint xsi:type="dc:Point" x="384.0" y="151.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_DataInputAssociation_1" bpmnElement="DataInputAssociation_1" sourceElement="_BPMNShape_DataInput_4" targetElement="_BPMNShape_Task_5">
<di:waypoint xsi:type="dc:Point" x="257.0" y="146.0"/>
<di:waypoint xsi:type="dc:Point" x="302.0" y="203.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_DataOutputAssociation_2" bpmnElement="DataOutputAssociation_2" sourceElement="_BPMNShape_Task_6" targetElement="_BPMNShapeDataStoreReference_4">
<di:waypoint xsi:type="dc:Point" x="575.0" y="341.0"/>
<di:waypoint xsi:type="dc:Point" x="649.0" y="194.0"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_DataInputAssociation_2" bpmnElement="DataInputAssociation_2" sourceElement="_BPMNShape_DataObjectReference_4" targetElement="_BPMNShape_Task_6">
<di:waypoint xsi:type="dc:Point" x="494.0" y="141.0"/>
<di:waypoint xsi:type="dc:Point" x="459.0" y="249.0"/>
<di:waypoint xsi:type="dc:Point" x="526.0" y="341.0"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>

155
test/fixtures/bpmn/process-elements.bpmn vendored Normal file
View File

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="simple" targetNamespace="http://activiti.org/bpmn">
<bpmn2:process id="Process_1" isExecutable="false">
<bpmn2:ioSpecification id="InputOutputSpecification_1"/>
<bpmn2:parallelGateway id="ParallelGateway_1">
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
</bpmn2:parallelGateway>
<bpmn2:serviceTask id="ServiceTask_1" name="Service Task">
<bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:dataObject id="DataObject_1" name="Data Object 1"/>
<bpmn2:dataStoreReference id="DataStoreReference_2" name="Data Store 1" dataStoreRef="DataStore_1"/>
<bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ServiceTask_1" targetRef="CallActivity_1"/>
<bpmn2:callActivity id="CallActivity_1" name="Call Me">
<bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
</bpmn2:callActivity>
<bpmn2:startEvent id="StartEvent_2">
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="StartEvent_2" targetRef="SubProcess_1"/>
<bpmn2:exclusiveGateway id="ExclusiveGateway_1">
<bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="ExclusiveGateway_1" targetRef="ParallelGateway_1"/>
<bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_1" targetRef="ServiceTask_1"/>
<bpmn2:subProcess id="SubProcess_1" name="Sub Process 1">
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
<bpmn2:startEvent id="StartEvent_1" name="Start Event 1">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="Task_1"/>
<bpmn2:task id="Task_1" name="Task">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
</bpmn2:task>
<bpmn2:boundaryEvent id="BoundaryEvent_1" name="" attachedToRef="Task_1">
<bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
<bpmn2:timerEventDefinition id="TimerEventDefinition_1"/>
</bpmn2:boundaryEvent>
<bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="BoundaryEvent_1" targetRef="Task_1"/>
</bpmn2:subProcess>
<bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="SubProcess_1" targetRef="ExclusiveGateway_1"/>
</bpmn2:process>
<bpmn2:dataStore id="DataStore_1" name="Data Store 1"/>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_2" bpmnElement="SubProcess_1" isExpanded="true">
<dc:Bounds height="248.0" width="300.0" x="300.0" y="132.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds height="36.0" width="36.0" x="336.0" y="242.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="22.0" width="81.0" x="314.0" y="283.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="Task_1">
<dc:Bounds height="80.0" width="100.0" x="420.0" y="220.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_2" targetElement="_BPMNShape_Task_2">
<di:waypoint xsi:type="dc:Point" x="372.0" y="260.0"/>
<di:waypoint xsi:type="dc:Point" x="420.0" y="260.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="385.0" y="260.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_3" bpmnElement="StartEvent_2">
<dc:Bounds height="36.0" width="36.0" x="180.0" y="238.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="198.0" y="279.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_StartEvent_3" targetElement="_BPMNShape_SubProcess_2">
<di:waypoint xsi:type="dc:Point" x="216.0" y="256.0"/>
<di:waypoint xsi:type="dc:Point" x="300.0" y="256.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="254.0" y="256.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_2" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
<dc:Bounds height="50.0" width="50.0" x="650.0" y="231.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="675.0" y="286.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_SubProcess_2" targetElement="_BPMNShape_ExclusiveGateway_2">
<di:waypoint xsi:type="dc:Point" x="600.0" y="256.0"/>
<di:waypoint xsi:type="dc:Point" x="650.0" y="256.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="622.0" y="256.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_2" bpmnElement="ParallelGateway_1">
<dc:Bounds height="50.0" width="50.0" x="726.0" y="96.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="0.0" width="0.0" x="751.0" y="151.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ExclusiveGateway_2" targetElement="_BPMNShape_ParallelGateway_2">
<di:waypoint xsi:type="dc:Point" x="675.0" y="231.0"/>
<di:waypoint xsi:type="dc:Point" x="675.0" y="121.0"/>
<di:waypoint xsi:type="dc:Point" x="726.0" y="121.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="672.0" y="206.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_2" bpmnElement="BoundaryEvent_1">
<dc:Bounds height="36.0" width="36.0" x="463.0" y="282.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="478.0" y="323.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ServiceTask_2" bpmnElement="ServiceTask_1">
<dc:Bounds height="80.0" width="100.0" x="726.0" y="276.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_2" targetElement="_BPMNShape_ServiceTask_2">
<di:waypoint xsi:type="dc:Point" x="675.0" y="281.0"/>
<di:waypoint xsi:type="dc:Point" x="675.0" y="316.0"/>
<di:waypoint xsi:type="dc:Point" x="726.0" y="316.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="672.0" y="306.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShapeDataStoreReference_2" bpmnElement="DataStoreReference_2">
<dc:Bounds height="50.0" width="50.0" x="650.0" y="420.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="22.0" width="79.0" x="713.0" y="434.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_CallActivity_2" bpmnElement="CallActivity_1">
<dc:Bounds height="80.0" width="100.0" x="888.0" y="276.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ServiceTask_2" targetElement="_BPMNShape_CallActivity_2">
<di:waypoint xsi:type="dc:Point" x="826.0" y="316.0"/>
<di:waypoint xsi:type="dc:Point" x="888.0" y="316.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="852.0" y="316.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_BoundaryEvent_2" targetElement="_BPMNShape_Task_2">
<di:waypoint xsi:type="dc:Point" x="481.0" y="318.0"/>
<di:waypoint xsi:type="dc:Point" x="481.0" y="351.0"/>
<di:waypoint xsi:type="dc:Point" x="575.0" y="351.0"/>
<di:waypoint xsi:type="dc:Point" x="575.0" y="260.0"/>
<di:waypoint xsi:type="dc:Point" x="520.0" y="260.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="6.0" width="6.0" x="478.0" y="327.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>

View File

@ -21,76 +21,159 @@ describe('BpmnTreeWalker', function() {
return read(readBpmnDiagram(file), root, opts, callback);
}
beforeEach(Matchers.add);
var bpmnModel = BpmnModel.instance();
describe('should walk', function() {
it('should walk simple process', function(done) {
/**
* Expect a certain render order when parsing the given file contents.
*
* Call done when done.
*/
function expectWalkOrder(file, expectedOrder, done) {
readFile('simple.bpmn', 'bpmn:Definitions', function(err, definitions) {
readFile(file, 'bpmn:Definitions', function(err, definitions) {
if (err) {
done(err);
} else {
return;
}
var drawn = [];
var actualOrder = [];
var visitor = function(element, di, ctx) {
var id = element.id;
drawn.push({ id: id, parent: ctx });
actualOrder.push({ id: id, parent: ctx });
return id;
};
new BpmnTreeWalker(visitor).handleDefinitions(definitions);
var expectedDrawn = [
expect(actualOrder).toDeepEqual(expectedOrder);
done();
});
}
it('process / sub process', function(done) {
// given
var expectedOrder = [
{ id: 'SubProcess_1', parent: undefined },
{ id: 'StartEvent_1', parent: 'SubProcess_1' },
{ id: 'Task_1', parent: 'SubProcess_1' },
{ id: 'SequenceFlow_1', parent: 'SubProcess_1' } ];
expect(drawn).toDeepEqual(expectedDrawn);
done();
}
});
// then
expectWalkOrder('simple.bpmn', expectedOrder, done);
});
it('should walk collaboration', function(done) {
it('process elements', function(done) {
readFile('collaboration.bpmn', 'bpmn:Definitions', function(err, definitions) {
// given
var expectedOrder = [
{ id : 'ParallelGateway_1', parent : undefined },
{ id : 'ServiceTask_1', parent : undefined },
{ id : 'DataStoreReference_2', parent : undefined },
{ id : 'CallActivity_1', parent : undefined },
{ id : 'StartEvent_2', parent : undefined },
{ id : 'ExclusiveGateway_1', parent : undefined },
{ id : 'SubProcess_1', parent : undefined },
{ id : 'StartEvent_1', parent : 'SubProcess_1' },
{ id : 'Task_1', parent : 'SubProcess_1' },
{ id : 'BoundaryEvent_1', parent : 'SubProcess_1' },
{ id : 'SequenceFlow_1', parent : 'SubProcess_1' },
{ id : 'SequenceFlow_7', parent : 'SubProcess_1' },
{ id : 'SequenceFlow_6', parent : undefined },
{ id : 'SequenceFlow_2', parent : undefined },
{ id : 'SequenceFlow_4', parent : undefined },
{ id : 'SequenceFlow_5', parent : undefined },
{ id : 'SequenceFlow_3', parent : undefined }
];
if (err) {
done(err);
} else {
expectWalkOrder('process-elements.bpmn', expectedOrder, done);
});
var drawn = [];
it('associations / data objects', function(done) {
var visitor = function(element, di, ctx) {
var id = element.id;
// given
var expectedOrder = [
{ id : 'Task_1', parent : undefined },
{ id : 'DataInputAssociation_1', parent : null },
{ id : 'DataOutputAssociation_1', parent : null },
{ id : 'BoundaryEvent_1', parent : undefined },
{ id : 'Task_2', parent : undefined },
{ id : 'DataInputAssociation_2', parent : null },
{ id : 'DataOutputAssociation_2', parent : null },
{ id : 'DataStoreReference_4', parent : undefined },
{ id : 'DataObjectReference_1', parent : undefined },
{ id : 'DataInput_1', parent : undefined },
{ id : 'DataOutput_1', parent : undefined },
{ id : 'Association_1', parent : undefined },
{ id : 'Association_2', parent : undefined }
];
drawn.push({ id: id, parent: ctx });
expectWalkOrder('process-associations.bpmn', expectedOrder, done);
});
return id;
};
it('collaboration', function(done) {
new BpmnTreeWalker(visitor).handleDefinitions(definitions);
var expectedDrawn = [
{ id : '_Participant_2', parent : undefined },
{ id : 'Task_1', parent : '_Participant_2' },
// given
var expectedOrder = [
{ id : 'Participant_2', parent : undefined },
{ id : 'Lane_1', parent : 'Participant_2' },
{ id : 'Lane_2', parent : 'Lane_1' },
{ id : 'Lane_3', parent : 'Lane_1' },
{ id : 'Task_1', parent : 'Lane_3' },
{ id : 'Participant_1', parent : undefined },
{ id : 'StartEvent_1', parent : 'Participant_1' } ];
{ id : 'StartEvent_1', parent : 'Participant_1' }
];
expectWalkOrder('collaboration.bpmn', expectedOrder, done);
});
expect(drawn).toDeepEqual(expectedDrawn);
it('collaboration / message flows', function(done) {
// given
var expectedOrder = [
{ id : 'Participant_2', parent : undefined },
{ id : 'Task_1', parent : 'Participant_2' },
{ id : 'EndEvent_1', parent : 'Participant_2' },
{ id : 'Participant_1', parent : undefined },
{ id : 'StartEvent_1', parent : 'Participant_1' },
{ id : 'MessageFlow_1', parent : undefined },
{ id : 'MessageFlow_2', parent : undefined },
{ id : 'MessageFlow_4', parent : undefined },
{ id : 'MessageFlow_5', parent : undefined }
];
expectWalkOrder('collaboration-message-flows.bpmn', expectedOrder, done);
});
it('collaboration / data items', function(done) {
// given
var expectedOrder = [
{ id : 'Participant_2', parent : undefined },
{ id : 'Lane_1', parent : 'Participant_2' },
{ id : 'Lane_2', parent : 'Lane_1' },
{ id : 'SubProcess_1', parent : 'Lane_2' },
{ id : 'DataObjectReference_1', parent : 'SubProcess_1' },
{ id : 'Lane_3', parent : 'Lane_1' },
{ id : 'DataStoreReference_5', parent : undefined },
{ id : 'DataStoreReference_6', parent : undefined },
{ id : 'Participant_1', parent : undefined },
{ id : 'DataInput_1', parent : 'Participant_1' },
{ id : 'DataOutput_1', parent : 'Participant_1' }
];
expectWalkOrder('collaboration-data-items.bpmn', expectedOrder, done);
});
done();
}
});
});
});