fix(modeling/rules): make compensation activity a message flow source
Related to camunda/camunda-modeler#661
This commit is contained in:
parent
b063addb76
commit
25dc30df06
|
@ -241,8 +241,7 @@ function isSameOrganization(a, b) {
|
|||
|
||||
function isMessageFlowSource(element) {
|
||||
return (
|
||||
is(element, 'bpmn:InteractionNode') &&
|
||||
!isForCompensation(element) && (
|
||||
is(element, 'bpmn:InteractionNode') && (
|
||||
!is(element, 'bpmn:Event') || (
|
||||
is(element, 'bpmn:ThrowEvent') &&
|
||||
hasEventDefinitionOrNone(element, 'bpmn:MessageEventDefinition')
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?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="_9X-DgL31EeWxRuodBysTLQ" 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_0loy6fl">
|
||||
<bpmn2:participant id="Participant_05lagcz" processRef="Process_1" />
|
||||
<bpmn2:participant id="CollapsedPool" />
|
||||
</bpmn2:collaboration>
|
||||
<bpmn2:process id="Process_1" isExecutable="false">
|
||||
<bpmn2:task id="Task" />
|
||||
<bpmn2:task id="CompensationTask" isForCompensation="true" />
|
||||
<bpmn2:boundaryEvent id="CompensationBoundary" attachedToRef="Task">
|
||||
<bpmn2:compensateEventDefinition id="_CompensateEventDefinition_2" waitForCompletion="false" />
|
||||
</bpmn2:boundaryEvent>
|
||||
<bpmn2:association id="Association_1eqfqtu" associationDirection="One" sourceRef="CompensationBoundary" targetRef="CompensationTask" />
|
||||
</bpmn2:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0loy6fl">
|
||||
<bpmndi:BPMNShape id="Participant_05lagcz_di" bpmnElement="Participant_05lagcz">
|
||||
<dc:Bounds x="50" y="45" width="600" height="250" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="_BPMNShape_TaskForCompensation" bpmnElement="Task">
|
||||
<dc:Bounds x="100" y="65" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="CompensationTask_di" bpmnElement="CompensationTask">
|
||||
<dc:Bounds x="230" y="185" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_2" bpmnElement="CompensationBoundary">
|
||||
<dc:Bounds x="144" y="127" width="36" height="36" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="117" y="97" width="90" height="20" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="Association_1eqfqtu_di" bpmnElement="Association_1eqfqtu">
|
||||
<di:waypoint x="162" y="163" />
|
||||
<di:waypoint x="162" y="225" />
|
||||
<di:waypoint x="230" y="225" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="Participant_08qzqg7_di" bpmnElement="CollapsedPool">
|
||||
<dc:Bounds x="133" y="368" width="332" height="96" />
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn2:definitions>
|
|
@ -670,6 +670,38 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('compensation in collaboration', function() {
|
||||
|
||||
var testXML = require('./BpmnRules.compensation-collaboration.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
||||
|
||||
|
||||
it('connect CompensationTask -> CollapsedPool', inject(function() {
|
||||
|
||||
expectCanConnect('CompensationTask', 'CollapsedPool', {
|
||||
sequenceFlow: false,
|
||||
messageFlow: true,
|
||||
association: false,
|
||||
dataAssociation: false
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
it('connect CollapsedPool -> CompensationTask', inject(function() {
|
||||
|
||||
expectCanConnect('CollapsedPool', 'CompensationTask', {
|
||||
sequenceFlow: false,
|
||||
messageFlow: false,
|
||||
association: false,
|
||||
dataAssociation: false
|
||||
});
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('on collaboration diagram', function() {
|
||||
|
||||
var testXML = require('./BpmnRules.collaboration.bpmn');
|
||||
|
@ -1052,7 +1084,8 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('attach/move BoundaryEvent label -> SubProcess', inject(function(elementRegistry) {
|
||||
it('attach/move BoundaryEvent label -> SubProcess', inject(
|
||||
function(elementRegistry) {
|
||||
|
||||
// when
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
|
@ -1066,10 +1099,12 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
move: true
|
||||
});
|
||||
|
||||
}));
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
it('attach/move multiple BoundaryEvents -> SubProcess_1', inject(function(elementRegistry) {
|
||||
it('attach/move multiple BoundaryEvents -> SubProcess_1', inject(
|
||||
function(elementRegistry) {
|
||||
// when
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
boundaryEvent2 = elementRegistry.get('BoundaryEvent_2');
|
||||
|
@ -1083,10 +1118,12 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
attach: false,
|
||||
move: false
|
||||
});
|
||||
}));
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
it('attach/move SubProcess, BoundaryEvent and label -> Process', inject(function(elementRegistry) {
|
||||
it('attach/move SubProcess, BoundaryEvent and label -> Process', inject(
|
||||
function(elementRegistry) {
|
||||
// when
|
||||
var subProcess = elementRegistry.get('SubProcess_1'),
|
||||
boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
|
@ -1101,7 +1138,8 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
attach: false,
|
||||
move: false
|
||||
});
|
||||
}));
|
||||
}
|
||||
));
|
||||
|
||||
});
|
||||
|
||||
|
@ -1129,7 +1167,8 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('not attach IntermediateEvent to CompensationTask', inject(function(elementFactory) {
|
||||
it('not attach IntermediateEvent to CompensationTask', inject(
|
||||
function(elementFactory) {
|
||||
|
||||
// given
|
||||
var eventShape = elementFactory.createShape({
|
||||
|
@ -1142,10 +1181,12 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
attach: false,
|
||||
move: false
|
||||
});
|
||||
}));
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
it('attach IntermediateEvent to SubProcess inner', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
||||
it('attach IntermediateEvent to SubProcess inner', inject(
|
||||
function(elementFactory, elementRegistry, bpmnRules) {
|
||||
|
||||
// given
|
||||
var subProcessElement = elementRegistry.get('SubProcess_1');
|
||||
|
@ -1160,14 +1201,21 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
};
|
||||
|
||||
// when
|
||||
var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position);
|
||||
var canAttach = bpmnRules.canAttach(
|
||||
[ eventShape ],
|
||||
subProcessElement,
|
||||
null,
|
||||
position
|
||||
);
|
||||
|
||||
// then
|
||||
expect(canAttach).to.be.false;
|
||||
}));
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
it('attach IntermediateEvent to SubProcess border', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
||||
it('attach IntermediateEvent to SubProcess border', inject(
|
||||
function(elementFactory, elementRegistry, bpmnRules) {
|
||||
|
||||
// given
|
||||
var subProcessElement = elementRegistry.get('SubProcess_1');
|
||||
|
@ -1182,14 +1230,21 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
};
|
||||
|
||||
// when
|
||||
var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position);
|
||||
var canAttach = bpmnRules.canAttach(
|
||||
[ eventShape ],
|
||||
subProcessElement,
|
||||
null,
|
||||
position
|
||||
);
|
||||
|
||||
// then
|
||||
expect(canAttach).to.equal('attach');
|
||||
}));
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
it('not attach IntermediateEvent to compensation activity', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
||||
it('not attach IntermediateEvent to compensation activity', inject(
|
||||
function(elementFactory, elementRegistry, bpmnRules) {
|
||||
|
||||
// given
|
||||
var compensationTask = elementRegistry.get('CompensationTask');
|
||||
|
@ -1204,14 +1259,21 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
};
|
||||
|
||||
// when
|
||||
var canAttach = bpmnRules.canAttach([ eventShape ], compensationTask, null, position);
|
||||
var canAttach = bpmnRules.canAttach(
|
||||
[ eventShape ],
|
||||
compensationTask,
|
||||
null,
|
||||
position
|
||||
);
|
||||
|
||||
// then
|
||||
expect(canAttach).to.be.false;
|
||||
}));
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
it('create IntermediateEvent in SubProcess body', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
||||
it('create IntermediateEvent in SubProcess body', inject(
|
||||
function(elementFactory, elementRegistry, bpmnRules) {
|
||||
|
||||
// given
|
||||
var subProcessElement = elementRegistry.get('SubProcess_1');
|
||||
|
@ -1226,13 +1288,25 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
};
|
||||
|
||||
// when
|
||||
var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, null, position),
|
||||
canCreate = bpmnRules.canCreate(eventShape, subProcessElement, null, position);
|
||||
var canAttach = bpmnRules.canAttach(
|
||||
[ eventShape ],
|
||||
subProcessElement,
|
||||
null,
|
||||
position
|
||||
);
|
||||
|
||||
var canCreate = bpmnRules.canCreate(
|
||||
eventShape,
|
||||
subProcessElement,
|
||||
null,
|
||||
position
|
||||
);
|
||||
|
||||
// then
|
||||
expect(canAttach).to.be.false;
|
||||
expect(canCreate).to.be.true;
|
||||
}));
|
||||
}
|
||||
));
|
||||
|
||||
});
|
||||
|
||||
|
@ -1244,7 +1318,8 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
||||
|
||||
|
||||
it('append IntermediateEvent from Task', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
||||
it('append IntermediateEvent from Task', inject(
|
||||
function(elementFactory, elementRegistry, bpmnRules) {
|
||||
|
||||
// given
|
||||
var subProcessElement = elementRegistry.get('SubProcess_1'),
|
||||
|
@ -1261,16 +1336,29 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
};
|
||||
|
||||
// when
|
||||
var canAttach = bpmnRules.canAttach([ eventShape ], subProcessElement, taskElement, position),
|
||||
canCreate = bpmnRules.canCreate(eventShape, subProcessElement, taskElement, position);
|
||||
var canAttach = bpmnRules.canAttach(
|
||||
[ eventShape ],
|
||||
subProcessElement,
|
||||
taskElement,
|
||||
position
|
||||
);
|
||||
|
||||
var canCreate = bpmnRules.canCreate(
|
||||
eventShape,
|
||||
subProcessElement,
|
||||
taskElement,
|
||||
position
|
||||
);
|
||||
|
||||
// then
|
||||
expect(canAttach).to.be.false;
|
||||
expect(canCreate).to.be.true;
|
||||
}));
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
it('append IntermediateEvent from BoundaryEvent', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
||||
it('append IntermediateEvent from BoundaryEvent', inject(
|
||||
function(elementFactory, elementRegistry, bpmnRules) {
|
||||
|
||||
// given
|
||||
var boundaryElement = elementRegistry.get('BoundaryEvent_1'),
|
||||
|
@ -1282,13 +1370,23 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
});
|
||||
|
||||
// when
|
||||
var canAttach = bpmnRules.canAttach([ eventShape ], taskElement, boundaryElement),
|
||||
canCreate = bpmnRules.canCreate(eventShape, taskElement, boundaryElement);
|
||||
var canAttach = bpmnRules.canAttach(
|
||||
[ eventShape ],
|
||||
taskElement,
|
||||
boundaryElement
|
||||
);
|
||||
|
||||
var canCreate = bpmnRules.canCreate(
|
||||
eventShape,
|
||||
taskElement,
|
||||
boundaryElement
|
||||
);
|
||||
|
||||
// then
|
||||
expect(canAttach).to.be.false;
|
||||
expect(canCreate).to.be.false;
|
||||
}));
|
||||
}
|
||||
));
|
||||
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue