2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
bootstrapModeler,
|
|
|
|
inject
|
|
|
|
} from 'test/TestHelper';
|
2015-07-30 08:48:17 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
expectCanConnect,
|
2019-08-08 08:50:05 +00:00
|
|
|
expectCanCopy,
|
|
|
|
expectCanCreate,
|
2018-04-02 19:01:53 +00:00
|
|
|
expectCanDrop,
|
2019-07-22 11:53:45 +00:00
|
|
|
expectCanInsert,
|
2019-08-08 08:50:05 +00:00
|
|
|
expectCanMove
|
2018-04-02 19:01:53 +00:00
|
|
|
} from './Helper';
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import modelingModule from 'lib/features/modeling';
|
|
|
|
import coreModule from 'lib/core';
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
describe('features/modeling/rules - BpmnRules', function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
var testModules = [ coreModule, modelingModule ];
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2019-08-06 16:57:30 +00:00
|
|
|
describe('create elements', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.process.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('create tasks -> process', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var task1 = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
task2 = elementFactory.createShape({ type: 'bpmn:Task' });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanCreate([ task1, task2 ], 'Process', true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('create tasks -> task', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var task1 = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
task2 = elementFactory.createShape({ type: 'bpmn:Task' });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanCreate([ task1, task2 ], 'Task', false);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('create tasks and sequence flow -> process', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var task1 = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
task2 = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
sequenceFlow = elementFactory.createConnection({
|
|
|
|
type: 'bpmn:SequenceFlow',
|
|
|
|
source: task1,
|
|
|
|
target: task2
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanCreate([ task1, task2, sequenceFlow ], 'Process', true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('create tasks and message flow -> process', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var task1 = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
task2 = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
sequenceFlow = elementFactory.createConnection({
|
|
|
|
type: 'bpmn:MessageFlow',
|
|
|
|
source: task1,
|
|
|
|
target: task2
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanCreate([ task1, task2, sequenceFlow ], 'Process', false);
|
|
|
|
}));
|
|
|
|
|
2019-08-12 14:21:49 +00:00
|
|
|
|
|
|
|
it('create task and non-interrupting boundary event', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var task = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
boundaryEvent = elementFactory.createShape({
|
|
|
|
type: 'bpmn:BoundaryEvent',
|
|
|
|
eventDefinitionType: 'bpmn:EscalationEventDefinition',
|
|
|
|
cancelActivity: false,
|
|
|
|
host: task
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanCreate([ task, boundaryEvent ], 'Process', true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('create task and interrupting boundary event', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var task = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
boundaryEvent = elementFactory.createShape({
|
|
|
|
type: 'bpmn:BoundaryEvent',
|
|
|
|
eventDefinitionType: 'bpmn:EscalationEventDefinition',
|
|
|
|
host: task
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanCreate([ task, boundaryEvent ], 'Process', true);
|
|
|
|
}));
|
2019-08-06 16:57:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2019-08-08 08:50:05 +00:00
|
|
|
describe('copy elements', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.process.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('copy task', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var task1 = elementFactory.createShape({ type: 'bpmn:Task' });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanCopy(task1, [ task1 ], true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('copy label', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var task = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
label = elementFactory.createLabel({ labelTarget: task });
|
|
|
|
|
|
|
|
// then
|
|
|
|
// copying labels should always be allowed
|
|
|
|
expectCanCopy(label, [], true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('copy lane with parent participant', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var participant = elementFactory.createShape({ type: 'bpmn:Participant' }),
|
|
|
|
lane = elementFactory.createShape({ type: 'bpmn:Lane', parent: participant });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanCopy(lane, [ participant ], true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('copy lane without parent participant', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var participant = elementFactory.createShape({ type: 'bpmn:Participant' }),
|
|
|
|
lane = elementFactory.createShape({ type: 'bpmn:Lane', parent: participant });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanCopy(lane, [], false);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('copy boundary event with host', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var task = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
boundaryEvent = elementFactory.createShape({ type: 'bpmn:BoundaryEvent', host: task });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanCopy(boundaryEvent, [ task ], true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('copy boundary event without host', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var task = elementFactory.createShape({ type: 'bpmn:Task' }),
|
|
|
|
boundaryEvent = elementFactory.createShape({ type: 'bpmn:BoundaryEvent', host: task });
|
|
|
|
|
|
|
|
// then
|
2019-10-11 14:39:29 +00:00
|
|
|
expectCanCopy(boundaryEvent, [ boundaryEvent ], true);
|
2019-08-08 08:50:05 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
describe('on process diagram', function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
var testXML = require('./BpmnRules.process.bpmn');
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect StartEvent_None -> Task', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('StartEvent_None', 'Task', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect StartEvent_None -> TextAnnotation', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('StartEvent_None', 'TextAnnotation', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect Task -> IntermediateThrowEvent_Link', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('Task', 'IntermediateThrowEvent_Link', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect IntermediateThrowEvent_Link -> EndEvent_None', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('IntermediateThrowEvent_Link', 'EndEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect StartEvent_None -> IntermediateCatchEvent_Link', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('StartEvent_None', 'IntermediateCatchEvent_Link', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect IntermediateCatchEvent_Link -> Task', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('IntermediateCatchEvent_Link', 'Task', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
|
|
|
}));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('drop TextAnnotation -> Process', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanDrop('TextAnnotation', 'Process', true);
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-10-06 10:33:21 +00:00
|
|
|
|
2016-01-26 17:24:05 +00:00
|
|
|
it('drop TextAnnotation -> SubProcess', inject(function() {
|
|
|
|
|
|
|
|
expectCanDrop('TextAnnotation', 'SubProcess', true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2016-06-07 06:46:45 +00:00
|
|
|
it('drop Start Event -> Collapsed Sub Process', function() {
|
2016-01-27 14:11:27 +00:00
|
|
|
|
|
|
|
expectCanDrop('StartEvent_None', 'CollapsedSubProcess', false);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-10-06 10:33:21 +00:00
|
|
|
it('connect DataObjectReference -> StartEvent_None', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataObjectReference', 'StartEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect StartEvent_None -> DataObjectReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('StartEvent_None', 'DataObjectReference', {
|
2015-10-21 14:25:56 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-21 14:25:56 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect DataObjectReference -> EndEvent_None', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataObjectReference', 'EndEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-21 14:25:56 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataInputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect EndEvent_None -> DataObjectReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('EndEvent_None', 'DataObjectReference', {
|
2015-10-06 10:33:21 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect Task -> DataObjectReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('Task', 'DataObjectReference', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect DataObjectReference -> Task', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataObjectReference', 'Task', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataInputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect SubProcess -> DataObjectReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('SubProcess', 'DataObjectReference', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect DataObjectReference -> SubProcess', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataObjectReference', 'SubProcess', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataInputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
2016-01-25 20:25:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
it('connect DataStoreReference -> StartEvent_None', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataStoreReference', 'StartEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-25 20:25:30 +00:00
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2017-05-17 14:37:05 +00:00
|
|
|
it('connect DataObjectReference -> TextAnnotation', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataObjectReference', 'TextAnnotation', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect TextAnnotation -> DataObjectReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('TextAnnotation', 'DataObjectReference', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect DataStoreReference -> TextAnnotation', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataStoreReference', 'TextAnnotation', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect TextAnnotation -> DataStoreReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('TextAnnotation', 'DataStoreReference', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2016-01-25 20:25:30 +00:00
|
|
|
it('connect StartEvent_None -> DataStoreReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('StartEvent_None', 'DataStoreReference', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-25 20:25:30 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect DataStoreReference -> EndEvent_None', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataStoreReference', 'EndEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-25 20:25:30 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataInputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect EndEvent_None -> DataStoreReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('EndEvent_None', 'DataStoreReference', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-25 20:25:30 +00:00
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect Task -> DataStoreReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('Task', 'DataStoreReference', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-25 20:25:30 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect DataStoreReference -> Task', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataStoreReference', 'Task', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-25 20:25:30 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataInputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect SubProcess -> DataStoreReference', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('SubProcess', 'DataStoreReference', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-25 20:25:30 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect DataStoreReference -> SubProcess', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('DataStoreReference', 'SubProcess', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-25 20:25:30 +00:00
|
|
|
dataAssociation: { type: 'bpmn:DataInputAssociation' }
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
2018-07-11 14:33:42 +00:00
|
|
|
|
|
|
|
it('connect Task -> Task', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('Task', 'Task', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
});
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
describe('boundary events', function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
var testXML = require('./BpmnRules.boundaryEvent.bpmn');
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> Task', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'Task', {
|
2015-04-16 07:11:04 +00:00
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> ExclusiveGateway', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'ExclusiveGateway', {
|
|
|
|
sequenceFlow: true,
|
2015-04-16 07:11:04 +00:00
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> SubProcess', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'SubProcess', {
|
2015-04-16 07:11:04 +00:00
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> BoundaryEvent_on_Task', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'BoundaryEvent_on_Task', {
|
2015-04-16 07:11:04 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> StartEvent_None', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'StartEvent_None', {
|
2015-04-16 07:11:04 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect StartEvent_None -> BoundaryEvent_on_SubProcess', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('StartEvent_None', 'BoundaryEvent_on_SubProcess', {
|
|
|
|
sequenceFlow: false,
|
2015-04-16 07:11:04 +00:00
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_nested -> Task', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_nested', 'Task', {
|
|
|
|
sequenceFlow: false,
|
2015-07-13 08:37:43 +00:00
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_nested -> EndEvent_nested', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_nested', 'EndEvent_nested', {
|
2015-07-13 08:37:43 +00:00
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> BoundaryEvent_in_OtherProcess', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'BoundaryEvent_in_OtherProcess', {
|
2015-07-13 08:37:43 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect BoundaryEvent_on_SubProcess -> Task_in_OtherProcess', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('BoundaryEvent_on_SubProcess', 'Task_in_OtherProcess', {
|
2015-07-13 08:37:43 +00:00
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
it('connect Task_in_OtherProcess -> BoundaryEvent_on_SubProcess', inject(function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanConnect('Task_in_OtherProcess', 'BoundaryEvent_on_SubProcess', {
|
2015-07-13 08:37:43 +00:00
|
|
|
sequenceFlow: false,
|
2015-07-30 08:48:17 +00:00
|
|
|
messageFlow: true,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
2019-06-24 11:16:11 +00:00
|
|
|
|
|
|
|
it('drop BoundaryEvent -> Task', function() {
|
|
|
|
expectCanDrop('BoundaryEvent_on_SubProcess', 'Task_in_OtherProcess', false);
|
|
|
|
});
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('event based gateway', function() {
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
describe('EventBasedGateway -> EventBasedGateway targets', function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
var testXML = require('./BpmnRules.eventBasedGatewayBasic.bpmn');
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent_Message', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Message', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent_Message', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Message', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent_Signal', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Signal', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent_Condition', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Condition', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent_Timer', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Timer', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateCatchEvent', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
it('connect EventBasedGateway -> IntermediateThrowEvent_Message', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
expectCanConnect('EventBasedGateway', 'IntermediateThrowEvent_Message', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect EventBasedGateway -> ReceiveTask', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'ReceiveTask', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect EventBasedGateway -> Task_None', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'Task_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect EventBasedGateway -> ParallelGateway', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'ParallelGateway', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect EventBasedGateway -> ParallelGateway', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('EventBasedGateway', 'ParallelGateway', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Task -> EventBasedGateway target with incoming sequence flow', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.eventBasedGatewayConfiguration.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
it('connect Task -> ReceiveTask', function() {
|
|
|
|
|
|
|
|
expectCanConnect('Task', 'ReceiveTask', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
it('connect Task -> IntermediateCatchEvent_Message', function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
expectCanConnect('Task', 'IntermediateCatchEvent_Message', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
it('connect Task -> IntermediateCatchEvent_Timer', function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
expectCanConnect('Task', 'IntermediateCatchEvent_Timer', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
it('connect Task -> IntermediateCatchEvent_Condition', function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
expectCanConnect('Task', 'IntermediateCatchEvent_Condition', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
it('connect Task -> IntermediateCatchEvent_Signal', function() {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
expectCanConnect('Task', 'IntermediateCatchEvent_Signal', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
|
2019-04-25 12:37:13 +00:00
|
|
|
});
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2016-01-20 17:30:34 +00:00
|
|
|
describe('compensation', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.compensation.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect CompensationBoundary -> Task', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('CompensationBoundary', 'Task', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-20 17:30:34 +00:00
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect CompensationBoundary -> TaskForCompensation', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('CompensationBoundary', 'TaskForCompensation', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect CompensationBoundary -> Gateway', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('CompensationBoundary', 'Gateway', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-20 17:30:34 +00:00
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect CompensationBoundary -> IntermediateEvent', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('CompensationBoundary', 'IntermediateEvent', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-20 17:30:34 +00:00
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect Task -> TaskForCompensation', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('Task', 'TaskForCompensation', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-20 17:30:34 +00:00
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect TaskForCompensation -> Task', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('TaskForCompensation', 'Task', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2016-01-20 17:30:34 +00:00
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
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
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
describe('on collaboration diagram', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.collaboration.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect StartEvent_None -> IntermediateEvent', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('StartEvent_None', 'IntermediateThrowEvent_Message', {
|
|
|
|
sequenceFlow: true,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect StartEvent_None -> OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('StartEvent_None', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> StartEvent_None', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'StartEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> StartEvent_Timer', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'StartEvent_Timer', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> StartEvent_Message', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'StartEvent_Message', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EndEvent_None -> OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('EndEvent_None', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EndEvent_Cancel -> OtherParticipant', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('EndEvent_Cancel', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EndEvent_Message -> OtherParticipant', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('EndEvent_Message', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> EndEvent_None', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'EndEvent_None', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect IntermediateThrowEvent_Message -> OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('IntermediateThrowEvent_Message', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect IntermediateThrowEvent_None -> OtherParticipant', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('IntermediateThrowEvent_None', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect IntermediateThrowEvent_Signal -> OtherParticipant', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('IntermediateThrowEvent_Signal', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> IntermediateThrowEvent_Message', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'IntermediateThrowEvent_Message', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect Task_in_SubProcess -> OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('Task_in_SubProcess', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect EndEvent_None_in_SubProcess -> OtherParticipant', inject(function() {
|
2015-05-11 15:55:06 +00:00
|
|
|
|
|
|
|
expectCanConnect('EndEvent_None_in_SubProcess', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-05-11 15:55:06 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect OtherParticipant -> Task_in_SubProcess', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('OtherParticipant', 'Task_in_SubProcess', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect Participant -> OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('Participant', 'OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
2017-04-10 12:21:14 +00:00
|
|
|
association: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('connect StartEvent_None -> TextAnnotation_OtherParticipant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
|
|
|
|
expectCanConnect('StartEvent_None', 'TextAnnotation_OtherParticipant', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
2015-10-06 10:33:21 +00:00
|
|
|
association: true,
|
|
|
|
dataAssociation: false
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
it('drop TextAnnotation_Global -> Participant', inject(function() {
|
2015-04-16 07:11:04 +00:00
|
|
|
expectCanDrop('TextAnnotation_Global', 'Participant', true);
|
|
|
|
}));
|
|
|
|
|
2018-05-03 14:02:41 +00:00
|
|
|
|
|
|
|
it('drop DataStoreReference -> Collaboration', function() {
|
|
|
|
expectCanDrop('DataStoreReference', 'Collaboration', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2018-08-22 08:56:57 +00:00
|
|
|
it('drop element -> collapsed Participant', inject(function() {
|
2016-03-08 16:21:41 +00:00
|
|
|
expectCanDrop('StartEvent_None', 'CollapsedParticipant', false);
|
|
|
|
expectCanDrop('SubProcess', 'CollapsedParticipant', false);
|
|
|
|
expectCanDrop('Task_in_SubProcess', 'CollapsedParticipant', false);
|
|
|
|
expectCanDrop('TextAnnotation_Global', 'CollapsedParticipant', false);
|
|
|
|
}));
|
|
|
|
|
2018-08-22 08:56:57 +00:00
|
|
|
|
|
|
|
describe('drop MessageFlow label', function() {
|
|
|
|
|
|
|
|
var label;
|
|
|
|
|
|
|
|
beforeEach(inject(function(elementRegistry) {
|
|
|
|
label = elementRegistry.get('MessageFlow_labeled').label;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('-> MessageFlow', function() {
|
2019-06-14 11:24:09 +00:00
|
|
|
expectCanDrop(label, 'MessageFlow_labeled', true);
|
2018-08-22 08:56:57 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> CollapsedParticipant', function() {
|
2019-06-14 11:24:09 +00:00
|
|
|
expectCanDrop(label, 'CollapsedParticipant', true);
|
2018-08-22 08:56:57 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> Collaboration', function() {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2018-08-22 08:56:57 +00:00
|
|
|
// then
|
2019-06-14 11:24:09 +00:00
|
|
|
expectCanDrop(label, 'Collaboration', true);
|
2018-08-22 08:56:57 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> Task_in_SubProcess', function() {
|
2019-06-14 11:24:09 +00:00
|
|
|
expectCanDrop(label, 'Task_in_SubProcess', true);
|
2018-08-22 08:56:57 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> SequenceFlow', function() {
|
2019-06-14 11:24:09 +00:00
|
|
|
expectCanDrop(label, 'SequenceFlow', true);
|
2018-08-22 08:56:57 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> DataOutputAssociation', function() {
|
2019-06-14 11:24:09 +00:00
|
|
|
expectCanDrop(label, 'DataOutputAssociation', true);
|
2019-06-11 11:15:11 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> Group', function() {
|
2019-06-14 11:24:09 +00:00
|
|
|
expectCanDrop(label, 'Group', true);
|
2018-08-22 08:56:57 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2019-07-22 11:53:45 +00:00
|
|
|
|
|
|
|
describe('create Group', function() {
|
|
|
|
|
|
|
|
var group;
|
|
|
|
|
|
|
|
beforeEach(inject(function(elementFactory) {
|
|
|
|
group = elementFactory.createShape({
|
|
|
|
type: 'bpmn:Group',
|
|
|
|
x: 413, y: 254
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('-> MessageFlow', function() {
|
|
|
|
expectCanCreate(group, 'MessageFlow_labeled', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> CollapsedParticipant', function() {
|
|
|
|
expectCanCreate(group, 'CollapsedParticipant', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> Collaboration', function() {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2019-07-22 11:53:45 +00:00
|
|
|
// then
|
|
|
|
expectCanCreate(group, 'Collaboration', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> Task_in_SubProcess', function() {
|
|
|
|
expectCanCreate(group, 'Task_in_SubProcess', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> SequenceFlow', function() {
|
|
|
|
expectCanCreate(group, 'SequenceFlow', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> DataOutputAssociation', function() {
|
|
|
|
expectCanCreate(group, 'DataOutputAssociation', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('-> Group', function() {
|
|
|
|
expectCanCreate(group, 'Group', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('reject create on Group', function() {
|
|
|
|
|
|
|
|
it('DataStoreReference ->', inject(function(elementFactory) {
|
|
|
|
var dataStoreReference = elementFactory.createShape({
|
|
|
|
type: 'bpmn:DataStoreReference',
|
|
|
|
x: 413, y: 254
|
|
|
|
});
|
|
|
|
|
|
|
|
expectCanCreate(dataStoreReference, 'Group', false);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('Task ->', inject(function(elementFactory) {
|
|
|
|
var task = elementFactory.createShape({
|
|
|
|
type: 'bpmn:Task',
|
|
|
|
x: 413, y: 254
|
|
|
|
});
|
|
|
|
|
|
|
|
expectCanCreate(task, 'Group', false);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('reject create on label', function() {
|
|
|
|
|
|
|
|
var label;
|
|
|
|
|
|
|
|
beforeEach(inject(function(elementRegistry) {
|
|
|
|
label = elementRegistry.get('MessageFlow_labeled').label;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('DataStoreReference ->', inject(function(elementFactory) {
|
|
|
|
var dataStoreReference = elementFactory.createShape({
|
|
|
|
type: 'bpmn:DataStoreReference',
|
|
|
|
x: 413, y: 254
|
|
|
|
});
|
|
|
|
|
|
|
|
expectCanCreate(dataStoreReference, label, false);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('Task ->', inject(function(elementFactory) {
|
|
|
|
var task = elementFactory.createShape({
|
|
|
|
type: 'bpmn:Task',
|
|
|
|
x: 413, y: 254
|
|
|
|
});
|
|
|
|
|
|
|
|
expectCanCreate(task, label, false);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-04-16 07:11:04 +00:00
|
|
|
});
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
|
2018-04-12 17:34:47 +00:00
|
|
|
describe('participants', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.collapsedPools.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect CollapsedPool_A -> CollapsedPool_B', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('CollapsedPool_A', 'CollapsedPool_B', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect CollapsedPool_A -> ExpandedPool', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('CollapsedPool_A', 'ExpandedPool', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('connect ExpandedPool -> CollapsedPool_A', inject(function() {
|
|
|
|
|
|
|
|
expectCanConnect('ExpandedPool', 'CollapsedPool_A', {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: true,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-05-12 16:03:51 +00:00
|
|
|
describe('message flows', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.messageFlow.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('drop MessageFlow -> Collaboration', inject(function() {
|
|
|
|
|
|
|
|
expectCanDrop('MessageFlow', 'Collaboration', true);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2016-01-21 14:15:21 +00:00
|
|
|
describe('data association move', function() {
|
|
|
|
|
2016-12-06 13:49:45 +00:00
|
|
|
describe('on process diagram', function() {
|
2016-01-21 14:15:21 +00:00
|
|
|
|
2016-12-06 13:49:45 +00:00
|
|
|
var testXML = require('./BpmnRules.dataAssociation.bpmn');
|
2016-01-21 14:15:21 +00:00
|
|
|
|
2016-12-06 13:49:45 +00:00
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
2016-01-21 14:15:21 +00:00
|
|
|
|
|
|
|
|
2016-12-06 13:49:45 +00:00
|
|
|
it('move selection including data association', inject(function(elementRegistry) {
|
2016-01-21 14:15:21 +00:00
|
|
|
|
2016-12-06 13:49:45 +00:00
|
|
|
// when
|
|
|
|
var elements = [
|
|
|
|
elementRegistry.get('Task'),
|
|
|
|
elementRegistry.get('DataAssociation'),
|
|
|
|
elementRegistry.get('DataObjectReference')
|
|
|
|
];
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanMove(elements, 'Process', {
|
|
|
|
attach: false,
|
|
|
|
move: true
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2016-12-19 14:57:34 +00:00
|
|
|
describe('on sub process', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.subProcess-dataAssociation.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('move task and data association', inject(function(elementRegistry) {
|
|
|
|
|
|
|
|
// when
|
|
|
|
var elements = [
|
|
|
|
elementRegistry.get('DataInputAssociation'),
|
|
|
|
elementRegistry.get('DataOutputAssociation'),
|
|
|
|
elementRegistry.get('DataStoreReference'),
|
|
|
|
elementRegistry.get('Task')
|
|
|
|
];
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanMove(elements, 'SubProcess', {
|
|
|
|
attach: false,
|
|
|
|
move: true
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2016-12-06 13:49:45 +00:00
|
|
|
describe('on collaboration', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.collaboration-dataAssociation.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('move participant and data association', inject(function(elementRegistry) {
|
|
|
|
|
|
|
|
// when
|
|
|
|
var elements = [
|
|
|
|
elementRegistry.get('DataInputAssociation'),
|
|
|
|
elementRegistry.get('Participant')
|
|
|
|
];
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanMove(elements, 'Collaboration', {
|
|
|
|
attach: false,
|
|
|
|
move: true
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
});
|
2016-01-21 14:15:21 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2016-09-22 18:41:12 +00:00
|
|
|
describe('multi selection move', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.multiSelectionPools.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
it('is allowed across pools when parent does not change', inject(function(elementRegistry) {
|
|
|
|
|
|
|
|
// when
|
|
|
|
var elements = [
|
|
|
|
elementRegistry.get('Task_A'),
|
|
|
|
elementRegistry.get('Task_B'),
|
|
|
|
elementRegistry.get('MessageFlow_1v3u2fb')
|
|
|
|
];
|
|
|
|
|
|
|
|
var target = 'Participant_1';
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanMove(elements, target, {
|
|
|
|
attach: false,
|
|
|
|
move: true
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
2018-05-03 14:02:41 +00:00
|
|
|
|
2015-07-13 08:37:43 +00:00
|
|
|
describe('event move', function() {
|
|
|
|
|
2015-08-19 15:16:21 +00:00
|
|
|
var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
it('attach/move multiple BoundaryEvents -> SubProcess_1', inject(
|
|
|
|
function(elementRegistry) {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// when
|
|
|
|
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
|
|
|
boundaryEvent2 = elementRegistry.get('BoundaryEvent_2');
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// we assume boundary events and labels
|
|
|
|
// to be already filtered during move
|
|
|
|
var elements = [ boundaryEvent, boundaryEvent2 ];
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// then
|
|
|
|
expectCanMove(elements, 'SubProcess_1', {
|
|
|
|
attach: false,
|
2019-05-24 12:46:01 +00:00
|
|
|
move: true
|
2018-02-15 23:11:50 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
it('attach/move SubProcess, BoundaryEvent and label -> Process', inject(
|
|
|
|
function(elementRegistry) {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// when
|
|
|
|
var subProcess = elementRegistry.get('SubProcess_1'),
|
|
|
|
boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
|
|
|
label = boundaryEvent.label;
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// we assume boundary events and labels
|
|
|
|
// to be already filtered during move
|
|
|
|
var elements = [ subProcess, boundaryEvent, label ];
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// then
|
|
|
|
expectCanMove(elements, 'Process_1', {
|
|
|
|
attach: false,
|
2019-05-24 12:46:01 +00:00
|
|
|
move: true
|
2018-02-15 23:11:50 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2019-05-22 08:42:07 +00:00
|
|
|
});
|
2019-05-17 12:26:13 +00:00
|
|
|
|
|
|
|
|
2019-05-22 08:42:07 +00:00
|
|
|
describe('event attaching', function() {
|
2019-05-17 12:26:13 +00:00
|
|
|
|
2019-05-22 08:42:07 +00:00
|
|
|
var testXML = require('./BpmnRules.attaching.bpmn');
|
2019-05-17 12:26:13 +00:00
|
|
|
|
2019-05-22 08:42:07 +00:00
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('should allow to attach attachable events to SubProcess', inject(function(elementRegistry) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var attachableEvents = [
|
|
|
|
'IntermediateThrowEvent',
|
|
|
|
'MessageCatchEvent',
|
|
|
|
'TimerCatchEvent',
|
|
|
|
'SignalCatchEvent',
|
2019-05-23 06:38:18 +00:00
|
|
|
'ConditionalCatchEvent',
|
|
|
|
'IntermediateThrowEventWithConnections'
|
2019-05-22 08:42:07 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
var events = attachableEvents.map(function(eventId) {
|
|
|
|
return elementRegistry.get(eventId);
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
events.forEach(function(event) {
|
|
|
|
|
|
|
|
expectCanMove([ event ], 'SubProcess_1', {
|
2019-05-17 12:26:13 +00:00
|
|
|
attach: 'attach',
|
|
|
|
move: true
|
|
|
|
});
|
2019-05-22 08:42:07 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
2019-05-17 12:26:13 +00:00
|
|
|
|
2019-05-22 08:42:07 +00:00
|
|
|
it('should not allow to attach non-attachable events to SubProcess',
|
|
|
|
inject(function(elementRegistry) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var nonAttachableEvents = [
|
|
|
|
'MessageThrowEvent',
|
|
|
|
'EscalationThrowEvent',
|
|
|
|
'LinkCatchEvent',
|
|
|
|
'LinkThrowEvent',
|
|
|
|
'CompensateThrowEvent',
|
|
|
|
'SignalThrowEvent'
|
|
|
|
];
|
|
|
|
|
|
|
|
var events = nonAttachableEvents.map(function(eventId) {
|
|
|
|
return elementRegistry.get(eventId);
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
events.forEach(function(event) {
|
|
|
|
|
|
|
|
expectCanMove([ event ], 'SubProcess_1', {
|
|
|
|
attach: false,
|
|
|
|
move: true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
);
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('event create', function() {
|
|
|
|
|
2015-08-19 15:16:21 +00:00
|
|
|
var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
2016-01-20 17:30:34 +00:00
|
|
|
it('attach IntermediateEvent to Task', inject(function(elementFactory) {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 254
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
2015-07-30 08:48:17 +00:00
|
|
|
expectCanMove([ eventShape ], 'Task_1', {
|
|
|
|
attach: 'attach',
|
|
|
|
move: false
|
2015-07-13 08:37:43 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
it('not attach IntermediateEvent to CompensationTask', inject(
|
|
|
|
function(elementFactory) {
|
2016-01-20 17:30:34 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// given
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 254
|
|
|
|
});
|
2016-01-20 17:30:34 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// then
|
|
|
|
expectCanMove([ eventShape ], 'CompensationTask', {
|
|
|
|
attach: false,
|
|
|
|
move: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
));
|
2016-01-20 17:30:34 +00:00
|
|
|
|
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
it('attach IntermediateEvent to SubProcess inner', inject(
|
|
|
|
function(elementFactory, elementRegistry, bpmnRules) {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess_1');
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 350
|
|
|
|
});
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
var position = {
|
|
|
|
x: subProcessElement.x + subProcessElement.width / 2,
|
|
|
|
y: subProcessElement.y + subProcessElement.height / 2
|
|
|
|
};
|
2015-08-06 07:40:58 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach(
|
|
|
|
[ eventShape ],
|
|
|
|
subProcessElement,
|
|
|
|
null,
|
|
|
|
position
|
|
|
|
);
|
2015-08-06 07:40:58 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// then
|
|
|
|
expect(canAttach).to.be.false;
|
|
|
|
}
|
|
|
|
));
|
2015-08-06 07:40:58 +00:00
|
|
|
|
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
it('attach IntermediateEvent to SubProcess border', inject(
|
|
|
|
function(elementFactory, elementRegistry, bpmnRules) {
|
2015-08-06 07:40:58 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess_1');
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 0, y: 0
|
|
|
|
});
|
2015-08-06 07:40:58 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
var position = {
|
|
|
|
x: subProcessElement.x + subProcessElement.width / 2,
|
|
|
|
y: subProcessElement.y + subProcessElement.height
|
|
|
|
};
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach(
|
|
|
|
[ eventShape ],
|
|
|
|
subProcessElement,
|
|
|
|
null,
|
|
|
|
position
|
|
|
|
);
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// then
|
|
|
|
expect(canAttach).to.equal('attach');
|
|
|
|
}
|
|
|
|
));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
it('not attach IntermediateEvent to compensation activity', inject(
|
|
|
|
function(elementFactory, elementRegistry, bpmnRules) {
|
2016-01-20 17:30:34 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// given
|
|
|
|
var compensationTask = elementRegistry.get('CompensationTask');
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 0, y: 0
|
|
|
|
});
|
2016-01-20 17:30:34 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
var position = {
|
|
|
|
x: compensationTask.x + compensationTask.width / 2,
|
|
|
|
y: compensationTask.y + compensationTask.height
|
|
|
|
};
|
2016-01-20 17:30:34 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach(
|
|
|
|
[ eventShape ],
|
|
|
|
compensationTask,
|
|
|
|
null,
|
|
|
|
position
|
|
|
|
);
|
2016-01-20 17:30:34 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// then
|
|
|
|
expect(canAttach).to.be.false;
|
|
|
|
}
|
|
|
|
));
|
2016-01-20 17:30:34 +00:00
|
|
|
|
2019-05-17 09:57:12 +00:00
|
|
|
|
2018-10-16 09:07:28 +00:00
|
|
|
it('not attach IntermediateEvent to ReceiveTask after EventBasedGateway', inject(
|
|
|
|
function(canvas, modeling, elementFactory, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var rootElement = canvas.getRootElement(),
|
|
|
|
eventBasedGatewayShape = elementFactory.createShape({ type: 'bpmn:EventBasedGateway' }),
|
|
|
|
receiveTaskShape = elementFactory.createShape({ type: 'bpmn:ReceiveTask' }),
|
|
|
|
eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 0, y: 0
|
|
|
|
});
|
|
|
|
|
|
|
|
var boundaryPosition = {
|
|
|
|
x: 175,
|
|
|
|
y: 100 + receiveTaskShape.height
|
|
|
|
};
|
|
|
|
|
|
|
|
// when
|
|
|
|
modeling.createShape(eventBasedGatewayShape, { x: 100, y: 100 }, rootElement);
|
|
|
|
modeling.createShape(receiveTaskShape, { x : 150, y: 100 }, rootElement);
|
|
|
|
modeling.connect(eventBasedGatewayShape, receiveTaskShape, {
|
|
|
|
type: 'bpmn:SequenceFlow'
|
|
|
|
});
|
|
|
|
|
|
|
|
var canAttach = bpmnRules.canAttach(
|
|
|
|
[ eventShape ],
|
|
|
|
receiveTaskShape,
|
|
|
|
null,
|
|
|
|
boundaryPosition
|
|
|
|
);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canAttach).to.be.false;
|
|
|
|
}
|
|
|
|
));
|
2016-01-20 17:30:34 +00:00
|
|
|
|
2019-05-17 09:57:12 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
it('create IntermediateEvent in SubProcess body', inject(
|
|
|
|
function(elementFactory, elementRegistry, bpmnRules) {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess_1');
|
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
var position = {
|
|
|
|
x: eventShape.x,
|
|
|
|
y: eventShape.y
|
|
|
|
};
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach(
|
|
|
|
[ eventShape ],
|
|
|
|
subProcessElement,
|
|
|
|
null,
|
|
|
|
position
|
|
|
|
);
|
|
|
|
|
|
|
|
var canCreate = bpmnRules.canCreate(
|
|
|
|
eventShape,
|
|
|
|
subProcessElement,
|
|
|
|
null,
|
|
|
|
position
|
|
|
|
);
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// then
|
|
|
|
expect(canAttach).to.be.false;
|
|
|
|
expect(canCreate).to.be.true;
|
|
|
|
}
|
|
|
|
));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('event append', function() {
|
|
|
|
|
2015-08-19 15:16:21 +00:00
|
|
|
var testXML = require('../../../fixtures/bpmn/boundary-events.bpmn');
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
it('append IntermediateEvent from Task', inject(
|
|
|
|
function(elementFactory, elementRegistry, bpmnRules) {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess_1'),
|
|
|
|
taskElement = elementRegistry.get('Task_2');
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
var position = {
|
|
|
|
x: eventShape.x,
|
|
|
|
y: eventShape.y
|
|
|
|
};
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach(
|
|
|
|
[ eventShape ],
|
|
|
|
subProcessElement,
|
|
|
|
taskElement,
|
|
|
|
position
|
|
|
|
);
|
|
|
|
|
|
|
|
var canCreate = bpmnRules.canCreate(
|
|
|
|
eventShape,
|
|
|
|
subProcessElement,
|
|
|
|
taskElement,
|
|
|
|
position
|
|
|
|
);
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// then
|
|
|
|
expect(canAttach).to.be.false;
|
|
|
|
expect(canCreate).to.be.true;
|
|
|
|
}
|
|
|
|
));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
it('append IntermediateEvent from BoundaryEvent', inject(
|
|
|
|
function(elementFactory, elementRegistry, bpmnRules) {
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// given
|
|
|
|
var boundaryElement = elementRegistry.get('BoundaryEvent_1'),
|
|
|
|
taskElement = elementRegistry.get('Task_2');
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
var eventShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:IntermediateThrowEvent',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// when
|
|
|
|
var canAttach = bpmnRules.canAttach(
|
|
|
|
[ eventShape ],
|
|
|
|
taskElement,
|
|
|
|
boundaryElement
|
|
|
|
);
|
|
|
|
|
|
|
|
var canCreate = bpmnRules.canCreate(
|
|
|
|
eventShape,
|
|
|
|
taskElement,
|
|
|
|
boundaryElement
|
|
|
|
);
|
2015-07-13 08:37:43 +00:00
|
|
|
|
2018-02-15 23:11:50 +00:00
|
|
|
// then
|
2019-05-17 12:26:13 +00:00
|
|
|
expect(canAttach).to.eql('attach');
|
2018-02-15 23:11:50 +00:00
|
|
|
expect(canCreate).to.be.false;
|
|
|
|
}
|
|
|
|
));
|
2015-07-13 08:37:43 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-08-11 12:46:17 +00:00
|
|
|
|
2019-05-02 08:39:07 +00:00
|
|
|
describe('groups', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.groups.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
describe('should resize', function() {
|
|
|
|
|
|
|
|
it('Group', inject(function(bpmnRules, elementRegistry) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var groupElement = elementRegistry.get('Group_1');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canResize = bpmnRules.canResize(groupElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canResize).to.be.true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-08-11 12:46:17 +00:00
|
|
|
describe('lanes', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.collaboration-lanes.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
describe('should add', function() {
|
|
|
|
|
|
|
|
it('Lane -> Participant', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var participantElement = elementRegistry.get('Participant');
|
|
|
|
|
|
|
|
var laneShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:Lane',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canCreate = bpmnRules.canCreate(laneShape, participantElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canCreate).to.be.true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('Lane -> Participant_Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var participantElement = elementRegistry.get('Participant_Lane');
|
|
|
|
|
|
|
|
var laneShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:Lane',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canCreate = bpmnRules.canCreate(laneShape, participantElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canCreate).to.be.true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('[not] Lane -> SubProcess', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess');
|
|
|
|
|
|
|
|
var laneShape = elementFactory.createShape({
|
|
|
|
type: 'bpmn:Lane',
|
|
|
|
x: 413, y: 250
|
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canCreate = bpmnRules.canCreate(laneShape, subProcessElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canCreate).to.be.false;
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-10-09 23:42:09 +00:00
|
|
|
describe('should not allow move', function() {
|
2015-08-11 12:46:17 +00:00
|
|
|
|
|
|
|
it('Lane -> Participant', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var participantElement = elementRegistry.get('Participant'),
|
|
|
|
laneElement = elementRegistry.get('Lane');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canMove = bpmnRules.canMove([ laneElement ], participantElement);
|
|
|
|
|
|
|
|
// then
|
2015-10-09 23:42:09 +00:00
|
|
|
expect(canMove).to.be.false;
|
2015-08-11 12:46:17 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-10-09 23:42:09 +00:00
|
|
|
it('Lane -> SubProcess', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
2015-08-11 12:46:17 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess'),
|
|
|
|
laneElement = elementRegistry.get('Lane');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canMove = bpmnRules.canMove([ laneElement ], subProcessElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canMove).to.be.false;
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('should resize', function() {
|
|
|
|
|
2015-08-21 11:58:23 +00:00
|
|
|
it('Lane', inject(function(bpmnRules, elementRegistry) {
|
2015-08-11 12:46:17 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
var laneElement = elementRegistry.get('Lane');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canResize = bpmnRules.canResize(laneElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canResize).to.be.true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('should allow drop', function() {
|
|
|
|
|
|
|
|
it('SubProcess -> Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var element = elementRegistry.get('SubProcess'),
|
|
|
|
laneElement = elementRegistry.get('Lane');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canMove = bpmnRules.canMove([ element ], laneElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canMove).to.be.true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('Task_in_SubProcess -> Lane', inject(function(elementFactory, elementRegistry, bpmnRules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var element = elementRegistry.get('Task_in_SubProcess'),
|
|
|
|
laneElement = elementRegistry.get('Lane');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var canMove = bpmnRules.canMove([ element ], laneElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(canMove).to.be.true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2018-07-24 14:16:53 +00:00
|
|
|
|
|
|
|
describe('insert', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.insert.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('insert END -> S1', function() {
|
|
|
|
expectCanInsert('END', 'S1', false);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('insert START -> S1', function() {
|
|
|
|
expectCanInsert('START', 'S1', false);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('insert GATEWAY -> S1', function() {
|
|
|
|
expectCanInsert('GATEWAY', 'S1', true);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2018-08-28 14:02:49 +00:00
|
|
|
|
2019-05-17 09:57:12 +00:00
|
|
|
describe('connect on create', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.connectOnCreate.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('should handle target without parent', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var types = [
|
|
|
|
'bpmn:Task',
|
|
|
|
'bpmn:StartEvent',
|
|
|
|
'bpmn:EndEvent',
|
|
|
|
'bpmn:Gateway'
|
|
|
|
];
|
|
|
|
|
|
|
|
types.forEach(function(type) {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2019-05-17 09:57:12 +00:00
|
|
|
// when
|
|
|
|
var element = elementFactory.createShape({ type: type });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanConnect('Task_A', element, {
|
|
|
|
sequenceFlow: false,
|
|
|
|
messageFlow: false,
|
|
|
|
association: false,
|
|
|
|
dataAssociation: false
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2019-03-29 10:20:45 +00:00
|
|
|
describe('data input / output', function() {
|
|
|
|
|
|
|
|
describe('in process', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.dataInputOutput.process.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('should move', inject(function(elementRegistry) {
|
|
|
|
|
|
|
|
// when
|
|
|
|
var elements = [
|
|
|
|
'Task',
|
|
|
|
'DataInput',
|
|
|
|
'DataOutput'
|
|
|
|
];
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanDrop('DataInput', 'Process', true);
|
|
|
|
expectCanDrop('DataOutput', 'Process', true);
|
|
|
|
|
|
|
|
expectCanMove(elements, 'Process', {
|
|
|
|
attach: false,
|
|
|
|
move: true
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('in collaboration', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.dataInputOutput.collaboration.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('should move', inject(function(elementRegistry) {
|
|
|
|
|
|
|
|
// when
|
|
|
|
var elements = [
|
|
|
|
'Task',
|
|
|
|
'DataInput',
|
|
|
|
'DataOutput'
|
|
|
|
];
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectCanDrop('DataInput', 'Participant_A', true);
|
|
|
|
expectCanDrop('DataInput', 'Participant_B', false);
|
|
|
|
|
|
|
|
expectCanDrop('DataOutput', 'Participant_A', true);
|
|
|
|
expectCanDrop('DataOutput', 'Participant_B', false);
|
|
|
|
|
|
|
|
expectCanMove(elements, 'Participant_A', {
|
|
|
|
attach: false,
|
|
|
|
move: true
|
|
|
|
});
|
|
|
|
|
|
|
|
expectCanMove(elements, 'Participant_B', {
|
|
|
|
attach: false,
|
|
|
|
move: false
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2018-08-28 14:02:49 +00:00
|
|
|
describe('integration', function() {
|
|
|
|
|
|
|
|
describe('move Lane', function() {
|
|
|
|
|
|
|
|
var testXML = require('./BpmnRules.moveLane.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('should disallow', inject(function(elementRegistry, rules) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var lane = elementRegistry.get('Lane_1');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var result = rules.allowed('elements.move', {
|
|
|
|
shapes: [ lane ]
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(result).to.be.false;
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2019-05-17 09:57:12 +00:00
|
|
|
|
2018-10-10 15:26:03 +00:00
|
|
|
describe('start connection', function() {
|
|
|
|
|
|
|
|
var testXML = require('../../../fixtures/bpmn/simple.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(testXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('should allow start for given element types', inject(function(elementFactory, rules) {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2018-10-10 15:26:03 +00:00
|
|
|
// given
|
|
|
|
var types = [
|
|
|
|
'bpmn:FlowNode',
|
|
|
|
'bpmn:InteractionNode',
|
|
|
|
'bpmn:DataObjectReference',
|
|
|
|
'bpmn:DataStoreReference'
|
|
|
|
];
|
|
|
|
|
|
|
|
// when
|
|
|
|
var results = types.map(function(type) {
|
|
|
|
var element = elementFactory.createShape({ type: type });
|
|
|
|
return rules.allowed('connection.start', { source: element });
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
results.forEach(function(result) {
|
|
|
|
expect(result).to.be.true;
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should ignore label elements', inject(function(elementFactory, rules) {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2018-10-10 15:26:03 +00:00
|
|
|
// given
|
|
|
|
var label = elementFactory.createShape({ type: 'bpmn:FlowNode', labelTarget: {} });
|
|
|
|
|
|
|
|
// when
|
|
|
|
var result = rules.allowed('connection.start', { source: label });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(result).to.be.null;
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should NOT allow start on unknown element', inject(function(rules) {
|
2019-08-19 08:39:20 +00:00
|
|
|
|
2018-10-10 15:26:03 +00:00
|
|
|
// given
|
|
|
|
var element = { type: 'bpmn:SomeUnknownType' };
|
|
|
|
|
|
|
|
// when
|
|
|
|
var result = rules.allowed('connection.start', { source: element });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(result).to.be.false;
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-07-15 15:22:19 +00:00
|
|
|
});
|