test(project): verify flowNodeRefs updating

This commit is contained in:
Nico Rehwaldt 2019-12-11 10:01:21 +01:00 committed by fake-join[bot]
parent ccc9158ec8
commit c8eedf959f
2 changed files with 67 additions and 19 deletions

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?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" id="_2_FUoE-xEeWT0c1N_GlSWA" targetNamespace="http://activiti.org/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.0-dev" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <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" id="_2_FUoE-xEeWT0c1N_GlSWA" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:collaboration id="_Collaboration_2"> <bpmn2:collaboration id="Collaboration">
<bpmn2:participant id="Participant_A" name="Participant_A" processRef="Process_A" /> <bpmn2:participant id="Participant_A" name="Participant_A" processRef="Process_A" />
<bpmn2:participant id="Participant_B" name="Participant_B" processRef="Process_B" /> <bpmn2:participant id="Participant_B" name="Participant_B" processRef="Process_B" />
<bpmn2:participant id="Participant_0emukbw" name="Participant_C" processRef="Process_1gjk6nk" /> <bpmn2:participant id="Participant_C" name="Participant_C" processRef="Process_C" />
<bpmn2:participant id="Participant_D" name="Participant_D" processRef="Process_D" />
</bpmn2:collaboration> </bpmn2:collaboration>
<bpmn2:process id="Process_A" isExecutable="false"> <bpmn2:process id="Process_A" isExecutable="false">
<bpmn2:laneSet id="LaneSet_1" name="Lane Set 1"> <bpmn2:laneSet id="LaneSet_1" name="Lane Set 1">
@ -23,22 +24,37 @@
<bpmn2:process id="Process_B" isExecutable="false"> <bpmn2:process id="Process_B" isExecutable="false">
<bpmn2:task id="Task_B" name="Task_B" /> <bpmn2:task id="Task_B" name="Task_B" />
</bpmn2:process> </bpmn2:process>
<bpmn2:process id="Process_1gjk6nk" isExecutable="false"> <bpmn2:process id="Process_C" isExecutable="false">
<bpmn2:laneSet id="LaneSet_06y7y48"> <bpmn2:laneSet id="LaneSet_06y7y48">
<bpmn2:lane id="Participant_C_Lane_1"> <bpmn2:lane id="Participant_C_Lane_1" name="Participant_C_Lane_1">
<bpmn2:flowNodeRef>Task_1</bpmn2:flowNodeRef> <bpmn2:flowNodeRef>Task_C</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>IntermediateThrowEvent</bpmn2:flowNodeRef> <bpmn2:flowNodeRef>IntermediateThrowEvent</bpmn2:flowNodeRef>
</bpmn2:lane> </bpmn2:lane>
<bpmn2:lane id="Participant_C_Lane_2"> <bpmn2:lane id="Participant_C_Lane_2" name="Participant_C_Lane_2">
<bpmn2:flowNodeRef>Task_2</bpmn2:flowNodeRef> <bpmn2:flowNodeRef>Task_D</bpmn2:flowNodeRef>
</bpmn2:lane> </bpmn2:lane>
</bpmn2:laneSet> </bpmn2:laneSet>
<bpmn2:task id="Task_1" /> <bpmn2:task id="Task_C" name="Task_C" />
<bpmn2:task id="Task_2" /> <bpmn2:task id="Task_D" name="Task_D" />
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent" />
</bpmn2:process> </bpmn2:process>
<bpmn2:process id="Process_D" isExecutable="false">
<bpmn2:laneSet id="LaneSet_1fp2wy1">
<bpmn2:lane id="Lane_D_1" name="Lane_D_1">
<bpmn2:flowNodeRef>Task_E</bpmn2:flowNodeRef>
<bpmn2:childLaneSet id="LaneSet_10kvuaz">
<bpmn2:lane id="Lane_D_1_2" name="Lane_D_1_2" />
<bpmn2:lane id="Lane_D_1_1" name="Lane_D_1_1">
<bpmn2:flowNodeRef>Task_E</bpmn2:flowNodeRef>
</bpmn2:lane>
</bpmn2:childLaneSet>
</bpmn2:lane>
<bpmn2:lane id="Lane_0z1sraf" />
</bpmn2:laneSet>
<bpmn2:task id="Task_E" name="Task_E" />
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="_Collaboration_2"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration">
<bpmndi:BPMNShape id="_BPMNShape_Participant_2" bpmnElement="Participant_A" isHorizontal="true"> <bpmndi:BPMNShape id="_BPMNShape_Participant_2" bpmnElement="Participant_A" isHorizontal="true">
<dc:Bounds x="154" y="96" width="540" height="145" /> <dc:Bounds x="154" y="96" width="540" height="145" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
@ -67,7 +83,7 @@
<bpmndi:BPMNShape id="_BPMNShape_Task_3" bpmnElement="Task_B"> <bpmndi:BPMNShape id="_BPMNShape_Task_3" bpmnElement="Task_B">
<dc:Bounds x="562" y="339" width="100" height="80" /> <dc:Bounds x="562" y="339" width="100" height="80" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Participant_0emukbw_di" bpmnElement="Participant_0emukbw" isHorizontal="true"> <bpmndi:BPMNShape id="Participant_C_di" bpmnElement="Participant_C" isHorizontal="true">
<dc:Bounds x="154" y="475" width="540" height="285" /> <dc:Bounds x="154" y="475" width="540" height="285" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Lane_0lsm3hs_di" bpmnElement="Participant_C_Lane_1" isHorizontal="true"> <bpmndi:BPMNShape id="Lane_0lsm3hs_di" bpmnElement="Participant_C_Lane_1" isHorizontal="true">
@ -76,15 +92,33 @@
<bpmndi:BPMNShape id="Lane_16dmnot_di" bpmnElement="Participant_C_Lane_2" isHorizontal="true"> <bpmndi:BPMNShape id="Lane_16dmnot_di" bpmnElement="Participant_C_Lane_2" isHorizontal="true">
<dc:Bounds x="184" y="625" width="510" height="135" /> <dc:Bounds x="184" y="625" width="510" height="135" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_1abs8bh_di" bpmnElement="Task_1"> <bpmndi:BPMNShape id="Task_1abs8bh_di" bpmnElement="Task_C">
<dc:Bounds x="230" y="510" width="100" height="80" /> <dc:Bounds x="230" y="510" width="100" height="80" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateThrowEvent_0oto7vx_di" bpmnElement="IntermediateThrowEvent"> <bpmndi:BPMNShape id="IntermediateThrowEvent_0oto7vx_di" bpmnElement="IntermediateThrowEvent">
<dc:Bounds x="592" y="532" width="36" height="36" /> <dc:Bounds x="592" y="532" width="36" height="36" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_0j7a294_di" bpmnElement="Task_2"> <bpmndi:BPMNShape id="Task_0j7a294_di" bpmnElement="Task_D">
<dc:Bounds x="230" y="650" width="100" height="80" /> <dc:Bounds x="230" y="650" width="100" height="80" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Participant_D_di" bpmnElement="Participant_D">
<dc:Bounds x="154" y="835" width="539" height="379" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Lane_1x5l7tv_di" bpmnElement="Lane_D_1">
<dc:Bounds x="184" y="835" width="509" height="315" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Lane_0z1sraf_di" bpmnElement="Lane_0z1sraf">
<dc:Bounds x="184" y="1150" width="509" height="64" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Lane_0l34pdv_di" bpmnElement="Lane_D_1_2">
<dc:Bounds x="214" y="835" width="479" height="137" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Lane_05oigjv_di" bpmnElement="Lane_D_1_1">
<dc:Bounds x="214" y="972" width="479" height="178" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_196nq81_di" bpmnElement="Task_E">
<dc:Bounds x="358" y="1011" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane> </bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram> </bpmndi:BPMNDiagram>
</bpmn2:definitions> </bpmn2:definitions>

View File

@ -7,12 +7,16 @@ import modelingModule from 'lib/features/modeling';
import coreModule from 'lib/core'; import coreModule from 'lib/core';
import copyPasteModule from 'lib/features/copy-paste'; import copyPasteModule from 'lib/features/copy-paste';
import {
find
} from 'min-dash';
/* global sinon */ /* global sinon */
describe('features/modeling - lanes - flowNodeRefs', function() { describe('features/modeling - lanes - flowNodeRefs', function() {
var diagramXML = require('./flowNodeRefs.bpmn'); var diagramXML = require('./UpdateFlowNodeRefs.basic.bpmn');
beforeEach(bootstrapModeler(diagramXML, { beforeEach(bootstrapModeler(diagramXML, {
modules: [ modules: [
@ -279,8 +283,8 @@ describe('features/modeling - lanes - flowNodeRefs', function() {
// given // given
var eventID = 'IntermediateThrowEvent', var eventID = 'IntermediateThrowEvent',
throwEvent = elementRegistry.get(eventID), throwEvent = elementRegistry.get(eventID),
task1 = elementRegistry.get('Task_1'), task1 = elementRegistry.get('Task_C'),
task2 = elementRegistry.get('Task_2'), task2 = elementRegistry.get('Task_D'),
lane1 = elementRegistry.get('Participant_C_Lane_1').businessObject, lane1 = elementRegistry.get('Participant_C_Lane_1').businessObject,
lane2 = elementRegistry.get('Participant_C_Lane_2').businessObject; lane2 = elementRegistry.get('Participant_C_Lane_2').businessObject;
@ -304,7 +308,7 @@ describe('features/modeling - lanes - flowNodeRefs', function() {
it('execute', inject(function(canvas, eventBus, elementRegistry, copyPaste) { it('execute', inject(function(canvas, eventBus, elementRegistry, copyPaste) {
// given // given
var participant = elementRegistry.get('Participant_A'); var participant = elementRegistry.get('Participant_D');
var updateRefsSpy = sinon.spy(); var updateRefsSpy = sinon.spy();
@ -313,7 +317,7 @@ describe('features/modeling - lanes - flowNodeRefs', function() {
// when // when
copyPaste.copy(participant); copyPaste.copy(participant);
copyPaste.paste({ var pastedElements = copyPaste.paste({
element: canvas.getRootElement(), element: canvas.getRootElement(),
point: { point: {
x: 350, x: 350,
@ -321,8 +325,18 @@ describe('features/modeling - lanes - flowNodeRefs', function() {
} }
}); });
var pastedLane = find(pastedElements, function(e) {
return e.businessObject.name === 'Lane_D_1_1';
});
var pastedTask = find(pastedElements, function(e) {
return e.businessObject.name === 'Task_E';
});
// then // then
expect(updateRefsSpy).to.have.been.calledOnce; expect(updateRefsSpy).to.have.been.calledOnce;
expect(pastedLane.businessObject.flowNodeRef).to.include(pastedTask.businessObject);
})); }));
}); });