Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] use external BPMN files #452

Merged
merged 1 commit into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 1 addition & 81 deletions test/e2e/mxGraph.model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,87 +442,7 @@ describe('mxGraph model', () => {
});

it('lanes and bpmn element shapes should have coordinates relative to the pool or the lane', async () => {
const bpmn = `<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="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" id="Definitions_1" targetNamespace="http://example.com/schema/bpmn">
<bpmn:collaboration id="Collaboration_1">
<bpmn:participant id="Participant_1" name="Process" processRef="Process_1" />
<bpmn:participant id="Participant_2" name="Process 2" processRef="Process_2" />
<bpmn:messageFlow id="MessageFlow_1" sourceRef="Participant_1" targetRef="StartEvent_2" />
</bpmn:collaboration>
<bpmn:process id="Process_1" isExecutable="false">
<bpmn:laneSet id="LaneSet_1">
<bpmn:lane id="Lane_1_2" />
<bpmn:lane id="Lane_1_1" name="Lane 1">
<bpmn:flowNodeRef>SequenceFlow_id</bpmn:flowNodeRef>
<bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
<bpmn:flowNodeRef>EndEvent_1</bpmn:flowNodeRef>
</bpmn:lane>
</bpmn:laneSet>
<bpmn:startEvent id="StartEvent_1" name="Start Event" />
<bpmn:endEvent id="EndEvent_1" name="End Event" />
<bpmn:sequenceFlow id="SequenceFlow_id" sourceRef="StartEvent_1" targetRef="EndEvent_1" />
</bpmn:process>
<bpmn:process id="Process_2" isExecutable="false">
<bpmn:laneSet id="LaneSet_2">
<bpmn:lane id="Lane_2_1">
<bpmn:flowNodeRef>StartEvent_2</bpmn:flowNodeRef>
</bpmn:lane>
<bpmn:lane id="Lane_2_2" />
</bpmn:laneSet>
<bpmn:startEvent id="StartEvent_2" name="Start Event 2" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPLane_1_1" bpmnElement="Collaboration_1">
<bpmndi:BPMNShape id="BPMNShape_Participant_1" bpmnElement="Participant_1" isHorizontal="true">
<dc:Bounds x="160" y="80" width="900" height="400" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Lane_1_1" bpmnElement="Lane_1_1" isHorizontal="true">
<dc:Bounds x="190" y="80" width="870" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Lane_1_2" bpmnElement="Lane_1_2" isHorizontal="true">
<dc:Bounds x="190" y="280" width="870" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_StartEvent_1" bpmnElement="StartEvent_1">
<dc:Bounds x="310" y="160" width="40" height="40" />
<bpmndi:BPMNLabel>
<dc:Bounds x="306" y="133" width="55" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_EndEvent_1" bpmnElement="EndEvent_1">
<dc:Bounds x="510" y="160" width="40" height="40" />
<bpmndi:BPMNLabel>
<dc:Bounds x="505" y="213" width="51" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Participant_2" bpmnElement="Participant_2" isHorizontal="true">
<dc:Bounds x="160" y="570" width="900" height="300" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Lane_2_1" bpmnElement="Lane_2_1" isHorizontal="true">
<dc:Bounds x="190" y="570" width="870" height="180" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Lane_2_2" bpmnElement="Lane_2_2" isHorizontal="true">
<dc:Bounds x="190" y="750" width="870" height="120" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_StartEvent_2" bpmnElement="StartEvent_2">
<dc:Bounds x="316" y="632" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="302" y="683" width="64" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_id" bpmnElement="SequenceFlow_id">
<di:waypoint x="350" y="180" />
<di:waypoint x="510" y="180" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_1" bpmnElement="MessageFlow_1">
<di:waypoint x="334" y="480" />
<di:waypoint x="334" y="632" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
`;
bpmnVisualization.load(bpmn);
bpmnVisualization.load(readFileSync('../fixtures/bpmn/model-coordinates-relative-to-pool-or-lane.bpmn'));

expectModelContainsCellWithGeometry(
'Participant_1',
Expand Down
79 changes: 79 additions & 0 deletions test/fixtures/bpmn/model-coordinates-relative-to-pool-or-lane.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="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" id="Definitions_1" targetNamespace="http://example.com/schema/bpmn">
<bpmn:collaboration id="Collaboration_1">
<bpmn:participant id="Participant_1" name="Process" processRef="Process_1" />
<bpmn:participant id="Participant_2" name="Process 2" processRef="Process_2" />
<bpmn:messageFlow id="MessageFlow_1" sourceRef="Participant_1" targetRef="StartEvent_2" />
</bpmn:collaboration>
<bpmn:process id="Process_1" isExecutable="false">
<bpmn:laneSet id="LaneSet_1">
<bpmn:lane id="Lane_1_2" />
<bpmn:lane id="Lane_1_1" name="Lane 1">
<bpmn:flowNodeRef>SequenceFlow_id</bpmn:flowNodeRef>
<bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
<bpmn:flowNodeRef>EndEvent_1</bpmn:flowNodeRef>
</bpmn:lane>
</bpmn:laneSet>
<bpmn:startEvent id="StartEvent_1" name="Start Event" />
<bpmn:endEvent id="EndEvent_1" name="End Event" />
<bpmn:sequenceFlow id="SequenceFlow_id" sourceRef="StartEvent_1" targetRef="EndEvent_1" />
</bpmn:process>
<bpmn:process id="Process_2" isExecutable="false">
<bpmn:laneSet id="LaneSet_2">
<bpmn:lane id="Lane_2_1">
<bpmn:flowNodeRef>StartEvent_2</bpmn:flowNodeRef>
</bpmn:lane>
<bpmn:lane id="Lane_2_2" />
</bpmn:laneSet>
<bpmn:startEvent id="StartEvent_2" name="Start Event 2" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPLane_1_1" bpmnElement="Collaboration_1">
<bpmndi:BPMNShape id="BPMNShape_Participant_1" bpmnElement="Participant_1" isHorizontal="true">
<dc:Bounds x="160" y="80" width="900" height="400" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Lane_1_1" bpmnElement="Lane_1_1" isHorizontal="true">
<dc:Bounds x="190" y="80" width="870" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Lane_1_2" bpmnElement="Lane_1_2" isHorizontal="true">
<dc:Bounds x="190" y="280" width="870" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_StartEvent_1" bpmnElement="StartEvent_1">
<dc:Bounds x="310" y="160" width="40" height="40" />
<bpmndi:BPMNLabel>
<dc:Bounds x="306" y="133" width="55" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_EndEvent_1" bpmnElement="EndEvent_1">
<dc:Bounds x="510" y="160" width="40" height="40" />
<bpmndi:BPMNLabel>
<dc:Bounds x="505" y="213" width="51" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Participant_2" bpmnElement="Participant_2" isHorizontal="true">
<dc:Bounds x="160" y="570" width="900" height="300" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Lane_2_1" bpmnElement="Lane_2_1" isHorizontal="true">
<dc:Bounds x="190" y="570" width="870" height="180" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_Lane_2_2" bpmnElement="Lane_2_2" isHorizontal="true">
<dc:Bounds x="190" y="750" width="870" height="120" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_StartEvent_2" bpmnElement="StartEvent_2">
<dc:Bounds x="316" y="632" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="302" y="683" width="64" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_id" bpmnElement="SequenceFlow_id">
<di:waypoint x="350" y="180" />
<di:waypoint x="510" y="180" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_1" bpmnElement="MessageFlow_1">
<di:waypoint x="334" y="480" />
<di:waypoint x="334" y="632" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="myProcess" name="My process" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<userTask id="usertask1" name="Task 1"></userTask>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
<exclusiveGateway id="exclusivegateway1" name="Gateway (split flow)"></exclusiveGateway>
<sequenceFlow id="flow2" sourceRef="usertask1" targetRef="exclusivegateway1"></sequenceFlow>
<userTask id="usertask2" name="Task 3"></userTask>
<sequenceFlow id="flow3" sourceRef="exclusivegateway1" targetRef="usertask2"></sequenceFlow>
<userTask id="usertask3" name="Task 2"></userTask>
<sequenceFlow id="flow4" sourceRef="exclusivegateway1" targetRef="usertask3"></sequenceFlow>
<userTask id="usertask4" name="Task 4"></userTask>
<sequenceFlow id="flow5" sourceRef="exclusivegateway1" targetRef="usertask4"></sequenceFlow>
<exclusiveGateway id="exclusivegateway2" name="Gateway (merge flows)"></exclusiveGateway>
<sequenceFlow id="flow6" sourceRef="usertask4" targetRef="exclusivegateway2"></sequenceFlow>
<sequenceFlow id="flow7" sourceRef="usertask2" targetRef="exclusivegateway2"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow8" sourceRef="exclusivegateway2" targetRef="endevent1"></sequenceFlow>
<sequenceFlow id="flow9" sourceRef="usertask3" targetRef="endevent1"></sequenceFlow>
<textAnnotation id="textannotation1">
<text>3. Gateways display the X symbol in all cases (no user control) but actually do not write it to the file. Always displaying it seems quite reasonable if the attribute is stored in the model.
4. Gateway labels not displayed on diagram. </text>
</textAnnotation>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
<bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35.0" width="35.0" x="20.0" y="190.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
<omgdc:Bounds height="55.0" width="105.0" x="100.0" y="180.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
<omgdc:Bounds height="40.0" width="40.0" x="250.0" y="188.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
<omgdc:Bounds height="55.0" width="105.0" x="335.0" y="181.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
<omgdc:Bounds height="55.0" width="105.0" x="335.0" y="90.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask4" id="BPMNShape_usertask4">
<omgdc:Bounds height="55.0" width="105.0" x="335.0" y="270.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
<omgdc:Bounds height="40.0" width="40.0" x="489.0" y="236.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="570.0" y="160.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="textannotation1" id="BPMNShape_textannotation1">
<omgdc:Bounds height="81.0" width="201.0" x="50.0" y="350.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
<omgdi:waypoint x="55.0" y="207.0"></omgdi:waypoint>
<omgdi:waypoint x="100.0" y="207.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="205.0" y="207.0"></omgdi:waypoint>
<omgdi:waypoint x="250.0" y="208.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="290.0" y="208.0"></omgdi:waypoint>
<omgdi:waypoint x="335.0" y="208.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
<omgdi:waypoint x="270.0" y="188.0"></omgdi:waypoint>
<omgdi:waypoint x="270.0" y="117.0"></omgdi:waypoint>
<omgdi:waypoint x="335.0" y="117.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="270.0" y="228.0"></omgdi:waypoint>
<omgdi:waypoint x="270.0" y="297.0"></omgdi:waypoint>
<omgdi:waypoint x="335.0" y="297.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="440.0" y="297.0"></omgdi:waypoint>
<omgdi:waypoint x="509.0" y="297.0"></omgdi:waypoint>
<omgdi:waypoint x="509.0" y="276.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
<omgdi:waypoint x="440.0" y="208.0"></omgdi:waypoint>
<omgdi:waypoint x="508.0" y="208.0"></omgdi:waypoint>
<omgdi:waypoint x="509.0" y="236.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
<omgdi:waypoint x="529.0" y="256.0"></omgdi:waypoint>
<omgdi:waypoint x="587.0" y="256.0"></omgdi:waypoint>
<omgdi:waypoint x="587.0" y="195.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
<omgdi:waypoint x="440.0" y="117.0"></omgdi:waypoint>
<omgdi:waypoint x="587.0" y="117.0"></omgdi:waypoint>
<omgdi:waypoint x="587.0" y="160.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
Loading