From 4f28d14cbcd7752fc74786acb622e7f177f798ea Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Mon, 25 Jan 2016 21:25:30 +0100 Subject: [PATCH] feat(rules): add DataStore rules Related to #345 --- lib/features/rules/BpmnRules.js | 4 +- .../features/rules/BpmnRules.process.bpmn | 66 ++++++++------ test/spec/features/rules/BpmnRulesSpec.js | 89 +++++++++++++++++++ 3 files changed, 128 insertions(+), 31 deletions(-) diff --git a/lib/features/rules/BpmnRules.js b/lib/features/rules/BpmnRules.js index d0d4ecde..848b66f5 100644 --- a/lib/features/rules/BpmnRules.js +++ b/lib/features/rules/BpmnRules.js @@ -619,12 +619,12 @@ function canConnectSequenceFlow(source, target) { function canConnectDataAssociation(source, target) { - if (is(source, 'bpmn:DataObjectReference') && + if (isAny(source, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ]) && isAny(target, [ 'bpmn:Activity', 'bpmn:ThrowEvent' ])) { return { type: 'bpmn:DataInputAssociation' }; } - if (is(target, 'bpmn:DataObjectReference') && + if (isAny(target, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ]) && isAny(source, [ 'bpmn:Activity', 'bpmn:CatchEvent' ])) { return { type: 'bpmn:DataOutputAssociation' }; } diff --git a/test/spec/features/rules/BpmnRules.process.bpmn b/test/spec/features/rules/BpmnRules.process.bpmn index c7b97fa1..5882a014 100644 --- a/test/spec/features/rules/BpmnRules.process.bpmn +++ b/test/spec/features/rules/BpmnRules.process.bpmn @@ -1,80 +1,88 @@ - + - + - + - + - + - + - + - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + - + \ No newline at end of file diff --git a/test/spec/features/rules/BpmnRulesSpec.js b/test/spec/features/rules/BpmnRulesSpec.js index 09b5e49e..981c929d 100644 --- a/test/spec/features/rules/BpmnRulesSpec.js +++ b/test/spec/features/rules/BpmnRulesSpec.js @@ -188,6 +188,95 @@ describe('features/modeling/rules - BpmnRules', function() { dataAssociation: { type: 'bpmn:DataInputAssociation' } }); })); + + + it('connect DataStoreReference -> StartEvent_None', inject(function() { + + expectCanConnect('DataStoreReference', 'StartEvent_None', { + sequenceFlow: false, + messageFlow: false, + association: true, + dataAssociation: false + }); + })); + + + it('connect StartEvent_None -> DataStoreReference', inject(function() { + + expectCanConnect('StartEvent_None', 'DataStoreReference', { + sequenceFlow: false, + messageFlow: false, + association: true, + dataAssociation: { type: 'bpmn:DataOutputAssociation' } + }); + })); + + + it('connect DataStoreReference -> EndEvent_None', inject(function() { + + expectCanConnect('DataStoreReference', 'EndEvent_None', { + sequenceFlow: false, + messageFlow: false, + association: true, + dataAssociation: { type: 'bpmn:DataInputAssociation' } + }); + })); + + + it('connect EndEvent_None -> DataStoreReference', inject(function() { + + expectCanConnect('EndEvent_None', 'DataStoreReference', { + sequenceFlow: false, + messageFlow: false, + association: true, + dataAssociation: false + }); + })); + + + it('connect Task -> DataStoreReference', inject(function() { + + expectCanConnect('Task', 'DataStoreReference', { + sequenceFlow: false, + messageFlow: false, + association: true, + dataAssociation: { type: 'bpmn:DataOutputAssociation' } + }); + })); + + + it('connect DataStoreReference -> Task', inject(function() { + + expectCanConnect('DataStoreReference', 'Task', { + sequenceFlow: false, + messageFlow: false, + association: true, + dataAssociation: { type: 'bpmn:DataInputAssociation' } + }); + })); + + + it('connect SubProcess -> DataStoreReference', inject(function() { + + expectCanConnect('SubProcess', 'DataStoreReference', { + sequenceFlow: false, + messageFlow: false, + association: true, + dataAssociation: { type: 'bpmn:DataOutputAssociation' } + }); + })); + + + it('connect DataStoreReference -> SubProcess', inject(function() { + + expectCanConnect('DataStoreReference', 'SubProcess', { + sequenceFlow: false, + messageFlow: false, + association: true, + dataAssociation: { type: 'bpmn:DataInputAssociation' } + }); + })); + });