test(import): verify data-association in collaboration import

* Restructure association import test fixtures
* Add data-association + collaboration test cases

Related to #638
This commit is contained in:
Nico Rehwaldt 2016-12-06 14:51:09 +01:00
parent bf133bb8da
commit 8b0001f709
7 changed files with 120 additions and 46 deletions

View File

@ -0,0 +1,51 @@
<?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="_c7U8wGD8EeSCE95aAM9ZMQ" targetNamespace="http://activiti.org/bpmn" exporter="camunda modeler" exporterVersion="2.6.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:collaboration id="Collaboration_0y2uddj">
<bpmn2:participant id="Participant_1m4ccak" processRef="Process_1" />
</bpmn2:collaboration>
<bpmn2:process id="Process_1" isExecutable="false">
<bpmn2:dataObjectReference id="DataObjectReference_1" name="" dataObjectRef="DataObject_1" />
<bpmn2:dataObject id="DataObject_1" name="Data Object 1" />
<bpmn2:task id="Task_1">
<bpmn2:dataOutputAssociation id="DataOutputAssociation">
<bpmn2:targetRef>DataObjectReference_1</bpmn2:targetRef>
</bpmn2:dataOutputAssociation>
</bpmn2:task>
<bpmn2:task id="Task_2">
<bpmn2:property id="Property_02nwoq1" name="__targetRef_placeholder" />
<bpmn2:dataInputAssociation id="DataInputAssociation">
<bpmn2:sourceRef>DataObjectReference_1</bpmn2:sourceRef>
<bpmn2:targetRef>Property_02nwoq1</bpmn2:targetRef>
</bpmn2:dataInputAssociation>
</bpmn2:task>
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0y2uddj">
<bpmndi:BPMNShape id="Participant_1m4ccak_di" bpmnElement="Participant_1m4ccak">
<dc:Bounds x="72" y="7" width="600" height="250" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_DataObjectReference_2" bpmnElement="DataObjectReference_1">
<dc:Bounds x="341" y="27" width="36" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="359" y="77" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="Task_1">
<dc:Bounds x="122" y="145" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Task_3" bpmnElement="Task_2">
<dc:Bounds x="504" y="145" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_DataOutputAssociation" bpmnElement="DataOutputAssociation" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_DataObjectReference_2">
<di:waypoint xsi:type="dc:Point" x="172" y="145" />
<di:waypoint xsi:type="dc:Point" x="172" y="52" />
<di:waypoint xsi:type="dc:Point" x="341" y="52" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_DataInputAssociation" bpmnElement="DataInputAssociation" sourceElement="_BPMNShape_DataObjectReference_2" targetElement="_BPMNShape_Task_3">
<di:waypoint xsi:type="dc:Point" x="377" y="52" />
<di:waypoint xsi:type="dc:Point" x="554" y="52" />
<di:waypoint xsi:type="dc:Point" x="554" y="145" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>

View File

@ -4,12 +4,12 @@
<bpmn2:dataObject id="DataObject_1" name="Data Object 1"/> <bpmn2:dataObject id="DataObject_1" name="Data Object 1"/>
<bpmn2:dataObjectReference id="DataObjectReference_1" name="" dataObjectRef="DataObject_1"/> <bpmn2:dataObjectReference id="DataObjectReference_1" name="" dataObjectRef="DataObject_1"/>
<bpmn2:task id="Task_1"> <bpmn2:task id="Task_1">
<bpmn2:dataOutputAssociation id="DataOutputAssociation_1"> <bpmn2:dataOutputAssociation id="DataOutputAssociation">
<bpmn2:targetRef>DataObjectReference_1</bpmn2:targetRef> <bpmn2:targetRef>DataObjectReference_1</bpmn2:targetRef>
</bpmn2:dataOutputAssociation> </bpmn2:dataOutputAssociation>
</bpmn2:task> </bpmn2:task>
<bpmn2:task id="Task_2"> <bpmn2:task id="Task_2">
<bpmn2:dataInputAssociation id="DataInputAssociation_1"> <bpmn2:dataInputAssociation id="DataInputAssociation">
<bpmn2:sourceRef>DataObjectReference_1</bpmn2:sourceRef> <bpmn2:sourceRef>DataObjectReference_1</bpmn2:sourceRef>
</bpmn2:dataInputAssociation> </bpmn2:dataInputAssociation>
</bpmn2:task> </bpmn2:task>
@ -25,12 +25,12 @@
<bpmndi:BPMNShape id="_BPMNShape_DataObjectReference_2" bpmnElement="DataObjectReference_1"> <bpmndi:BPMNShape id="_BPMNShape_DataObjectReference_2" bpmnElement="DataObjectReference_1">
<dc:Bounds height="50.0" width="36.0" x="341.0" y="27.0"/> <dc:Bounds height="50.0" width="36.0" x="341.0" y="27.0"/>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_DataOutputAssociation_1" bpmnElement="DataOutputAssociation_1" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_DataObjectReference_2"> <bpmndi:BPMNEdge id="BPMNEdge_DataOutputAssociation" bpmnElement="DataOutputAssociation" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_DataObjectReference_2">
<di:waypoint xsi:type="dc:Point" x="172.0" y="145.0"/> <di:waypoint xsi:type="dc:Point" x="172.0" y="145.0"/>
<di:waypoint xsi:type="dc:Point" x="172.0" y="52.0"/> <di:waypoint xsi:type="dc:Point" x="172.0" y="52.0"/>
<di:waypoint xsi:type="dc:Point" x="341.0" y="52.0"/> <di:waypoint xsi:type="dc:Point" x="341.0" y="52.0"/>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_DataInputAssociation_1" bpmnElement="DataInputAssociation_1" sourceElement="_BPMNShape_DataObjectReference_2" targetElement="_BPMNShape_Task_3"> <bpmndi:BPMNEdge id="BPMNEdge_DataInputAssociation" bpmnElement="DataInputAssociation" sourceElement="_BPMNShape_DataObjectReference_2" targetElement="_BPMNShape_Task_3">
<di:waypoint xsi:type="dc:Point" x="377.0" y="52.0"/> <di:waypoint xsi:type="dc:Point" x="377.0" y="52.0"/>
<di:waypoint xsi:type="dc:Point" x="554.0" y="52.0"/> <di:waypoint xsi:type="dc:Point" x="554.0" y="52.0"/>
<di:waypoint xsi:type="dc:Point" x="554.0" y="145.0"/> <di:waypoint xsi:type="dc:Point" x="554.0" y="145.0"/>

View File

@ -6,10 +6,10 @@
<bpmn2:dataOutput id="DataOutput_1"/> <bpmn2:dataOutput id="DataOutput_1"/>
</bpmn2:ioSpecification> </bpmn2:ioSpecification>
<bpmn2:task id="Task_1"> <bpmn2:task id="Task_1">
<bpmn2:dataInputAssociation id="DataInputAssociation_1"> <bpmn2:dataInputAssociation id="DataInputAssociation">
<bpmn2:sourceRef>DataInput_1</bpmn2:sourceRef> <bpmn2:sourceRef>DataInput_1</bpmn2:sourceRef>
</bpmn2:dataInputAssociation> </bpmn2:dataInputAssociation>
<bpmn2:dataOutputAssociation id="DataOutputAssociation_1"> <bpmn2:dataOutputAssociation id="DataOutputAssociation">
<bpmn2:targetRef>DataOutput_1</bpmn2:targetRef> <bpmn2:targetRef>DataOutput_1</bpmn2:targetRef>
</bpmn2:dataOutputAssociation> </bpmn2:dataOutputAssociation>
</bpmn2:task> </bpmn2:task>
@ -28,11 +28,11 @@
<bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="Task_1"> <bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="Task_1">
<dc:Bounds height="80.0" width="100.0" x="324.0" y="84.0"/> <dc:Bounds height="80.0" width="100.0" x="324.0" y="84.0"/>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_DataInputAssociation_1" bpmnElement="DataInputAssociation_1" sourceElement="_BPMNShape_DataInput_2" targetElement="_BPMNShape_Task_2"> <bpmndi:BPMNEdge id="BPMNEdge_DataInputAssociation" bpmnElement="DataInputAssociation" sourceElement="_BPMNShape_DataInput_2" targetElement="_BPMNShape_Task_2">
<di:waypoint xsi:type="dc:Point" x="296.0" y="227.0"/> <di:waypoint xsi:type="dc:Point" x="296.0" y="227.0"/>
<di:waypoint xsi:type="dc:Point" x="344.0" y="164.0"/> <di:waypoint xsi:type="dc:Point" x="344.0" y="164.0"/>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_DataOutputAssociation_1" bpmnElement="DataOutputAssociation_1" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_DataOutput_2"> <bpmndi:BPMNEdge id="BPMNEdge_DataOutputAssociation" bpmnElement="DataOutputAssociation" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_DataOutput_2">
<di:waypoint xsi:type="dc:Point" x="407.0" y="164.0"/> <di:waypoint xsi:type="dc:Point" x="407.0" y="164.0"/>
<di:waypoint xsi:type="dc:Point" x="462.0" y="229.0"/> <di:waypoint xsi:type="dc:Point" x="462.0" y="229.0"/>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>

View File

@ -11,7 +11,7 @@ describe('import - associations', function() {
it('connecting task -> text annotation', function(done) { it('connecting task -> text annotation', function(done) {
var xml = require('../../../fixtures/bpmn/import/association/text-annotation.bpmn'); var xml = require('./AssociationSpec.text-annotation.bpmn');
// given // given
bootstrapViewer(xml)(function(err) { bootstrapViewer(xml)(function(err) {
@ -37,7 +37,7 @@ describe('import - associations', function() {
it('connecting boundary -> compensate task', function(done) { it('connecting boundary -> compensate task', function(done) {
var xml = require('../../../fixtures/bpmn/import/association/compensation.bpmn'); var xml = require('./AssociationSpec.compensation.bpmn');
// given // given
bootstrapViewer(xml)(function(err) { bootstrapViewer(xml)(function(err) {
@ -65,9 +65,27 @@ describe('import - associations', function() {
describe('should import data association', function() { describe('should import data association', function() {
function expectRendered(elementIds) {
inject(function(elementRegistry, canvas) {
elementIds.forEach(function(id) {
var element = elementRegistry.get(id);
// then
expect(element).to.exist;
// data associations always rendered on root
expect(element.parent).to.eql(canvas.getRootElement());
});
})();
}
it('task -> data object -> task', function(done) { it('task -> data object -> task', function(done) {
var xml = require('../../../fixtures/bpmn/import/association/data-association.bpmn'); var xml = require('./AssociationSpec.data-association.bpmn');
// given // given
bootstrapViewer(xml)(function(err) { bootstrapViewer(xml)(function(err) {
@ -76,26 +94,20 @@ describe('import - associations', function() {
return done(err); return done(err);
} }
// when
inject(function(elementRegistry) {
var dataInputAssociation = elementRegistry.get('DataInputAssociation_1');
var dataOutputAssociation = elementRegistry.get('DataOutputAssociation_1');
// then // then
expect(dataInputAssociation).to.exist; expectRendered([
expect(dataOutputAssociation).to.exist; 'DataInputAssociation',
'DataOutputAssociation'
]);
done(); done();
})();
}); });
}); });
it('data input -> task -> data output', function(done) { it('data input -> task -> data output', function(done) {
var xml = require('../../../fixtures/bpmn/import/association/data-input-output.bpmn'); var xml = require('./AssociationSpec.data-input-output.bpmn');
// given // given
bootstrapViewer(xml)(function(err) { bootstrapViewer(xml)(function(err) {
@ -104,18 +116,35 @@ describe('import - associations', function() {
return done(err); return done(err);
} }
// when
inject(function(elementRegistry) {
var dataInputAssociation = elementRegistry.get('DataInputAssociation_1');
var dataOutputAssociation = elementRegistry.get('DataOutputAssociation_1');
// then // then
expect(dataInputAssociation).to.exist; expectRendered([
expect(dataOutputAssociation).to.exist; 'DataInputAssociation',
'DataOutputAssociation'
]);
done();
});
});
it('in collaboration', function(done) {
var xml = require('./AssociationSpec.collaboration.bpmn');
// given
bootstrapViewer(xml)(function(err) {
if (err) {
return done(err);
}
// then
expectRendered([
'DataInputAssociation',
'DataOutputAssociation'
]);
done(); done();
})();
}); });
}); });
@ -123,7 +152,7 @@ describe('import - associations', function() {
it('catch event -> data object -> throw event', function(done) { it('catch event -> data object -> throw event', function(done) {
var xml = require('../../../fixtures/bpmn/import/association/data-association-events.bpmn'); var xml = require('./AssociationSpec.events.bpmn');
// given // given
bootstrapViewer(xml)(function(err) { bootstrapViewer(xml)(function(err) {
@ -132,19 +161,13 @@ describe('import - associations', function() {
return done(err); return done(err);
} }
// when
inject(function(elementRegistry) {
var dataInputAssociation = elementRegistry.get('DataInputAssociation');
var dataOutputAssociation = elementRegistry.get('DataOutputAssociation');
// then // then
expect(dataInputAssociation).to.exist; expectRendered([
expect(dataOutputAssociation).to.exist; 'DataInputAssociation',
'DataOutputAssociation'
]);
done(); done();
})();
}); });
}); });