diff --git a/lib/import/BpmnTreeWalker.js b/lib/import/BpmnTreeWalker.js index e2f951d7..2ab53130 100644 --- a/lib/import/BpmnTreeWalker.js +++ b/lib/import/BpmnTreeWalker.js @@ -380,7 +380,10 @@ function BpmnTreeWalker(handler) { handleArtifacts(collaboration.artifacts); - handleMessageFlows(collaboration.messageFlows); + // handle message flows latest in the process + deferred.push(function() { + handleMessageFlows(collaboration.messageFlows); + }); } diff --git a/test/fixtures/bpmn/import/dangling-process-message-flow.bpmn b/test/fixtures/bpmn/import/dangling-process-message-flow.bpmn new file mode 100644 index 00000000..c1511b6b --- /dev/null +++ b/test/fixtures/bpmn/import/dangling-process-message-flow.bpmn @@ -0,0 +1,82 @@ + + + + + + + + + + + + _1c347d0d-750b-4c09-980d-6877caae409b + _6fed62c8-8241-4a1d-ae67-266fda7dcead + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/spec/import/ImporterSpec.js b/test/spec/import/ImporterSpec.js index f7aeeecc..8b5c6924 100644 --- a/test/spec/import/ImporterSpec.js +++ b/test/spec/import/ImporterSpec.js @@ -332,6 +332,25 @@ describe('import - importer', function() { done(err); }); }); + + + it('should import dangling process message flows', function(done) { + + // given + var xml = fs.readFileSync('test/fixtures/bpmn/import/dangling-process-message-flow.bpmn', 'utf8'); + + // when + runImport(diagram, xml, function(err, warnings) { + + // then + expect(warnings.length).toBe(0); + + expect(diagram.get('elementRegistry').get('_b467921a-ef7b-44c5-bf78-fd624c400d17')).toBeDefined(); + expect(diagram.get('elementRegistry').get('_c311cc87-677e-47a4-bdb1-8744c4ec3147')).toBeDefined(); + + done(err); + }); + }); }); describe('position', function() {