From f157c4fb63914a9869d6692290d9cd1c86b4e585 Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Thu, 21 Sep 2017 21:29:20 +0200 Subject: [PATCH] corrected test szenarios issue #302 --- .../imixs/workflow/bpmn/BPMNModelHandler.java | 28 +++++----------- .../bpmn/TestBPMNParserSplitEvents.java | 9 +++-- .../src/test/resources/bpmn/split_event1.bpmn | 33 ++++++++++++++----- ..._event2.bpmn => split_event1_invalid.bpmn} | 33 +++++-------------- 4 files changed, 45 insertions(+), 58 deletions(-) rename imixs-workflow-core/src/test/resources/bpmn/{split_event2.bpmn => split_event1_invalid.bpmn} (84%) diff --git a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java index 353176ed0..34b521c50 100644 --- a/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java +++ b/imixs-workflow-core/src/main/java/org/imixs/workflow/bpmn/BPMNModelHandler.java @@ -700,10 +700,11 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod // build the condition if (targetTask != null) { String sExpression = findConditionBySquenceFlow(condFlow); - if (sExpression!=null && !sExpression.trim().isEmpty()) { + if (sExpression != null && !sExpression.trim().isEmpty()) { logger.fine("add condition: " + targetTask.getItemValueInteger("numProcessid") + "=" + sExpression); - conditions.put("task=" + targetTask.getItemValueInteger("numProcessid"), sExpression); + conditions.put("task=" + targetTask.getItemValueInteger("numProcessid"), + sExpression); } } else { // test for an event.... @@ -711,7 +712,7 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod ItemCollection targetEvent = eventCache.get(targetEventID); if (targetEvent != null) { String sExpression = findConditionBySquenceFlow(condFlow); - if (sExpression!=null && !sExpression.trim().isEmpty()) { + if (sExpression != null && !sExpression.trim().isEmpty()) { logger.fine("add condition: " + targetEvent.getItemValueInteger("numActivityid") + "=" + sExpression); conditions.put("event=" + targetEvent.getItemValueInteger("numActivityid"), @@ -739,7 +740,6 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod for (SequenceFlow flow : outgoingList) { if (parallelGatewayCache.contains(flow.target)) { - boolean foundConditionForMasterVersion=false; String parallelGatewayID = flow.target; // get all outgoing flows from this gateway List parallelFlows = this.findOutgoingFlows(parallelGatewayID); @@ -748,15 +748,11 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod // build the condition if (targetTask != null) { String sExpression = findConditionBySquenceFlow(parallelFlow); - if (sExpression!=null && !sExpression.trim().isEmpty()) { + if (sExpression != null && !sExpression.trim().isEmpty()) { logger.fine("add condition: " + targetTask.getItemValueInteger("numProcessid") + "=" + sExpression); - conditions.put("task=" + targetTask.getItemValueInteger("numProcessid"), sExpression); - - if (foundConditionForMasterVersion) { - logger.warning("ParallelGateway does not uniquely define an outcome for the Master Version! Multiple condition defined!"); - } - foundConditionForMasterVersion=true; + conditions.put("task=" + targetTask.getItemValueInteger("numProcessid"), + sExpression); } } else { // test for an event.... @@ -764,23 +760,15 @@ private void addImixsEvent(String eventID, ItemCollection sourceTask) throws Mod ItemCollection targetEvent = eventCache.get(targetEventID); if (targetEvent != null) { String sExpression = findConditionBySquenceFlow(parallelFlow); - if (sExpression!=null && !sExpression.trim().isEmpty()) { + if (sExpression != null && !sExpression.trim().isEmpty()) { logger.fine("add condition: " + targetEvent.getItemValueInteger("numActivityid") + "=" + sExpression); conditions.put("event=" + targetEvent.getItemValueInteger("numActivityid"), sExpression); - if (foundConditionForMasterVersion) { - logger.warning("ParallelGateway does not uniquely define an outcome for the Master Version! Multiple condition defined!"); - } - foundConditionForMasterVersion=true; } } - } } - if (!foundConditionForMasterVersion) { - logger.warning("ParallelGateway dose not uniquely define an outcome for the Master Version! Master condition is missing"); - } } diff --git a/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/TestBPMNParserSplitEvents.java b/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/TestBPMNParserSplitEvents.java index bc38060b4..b42961ff9 100644 --- a/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/TestBPMNParserSplitEvents.java +++ b/imixs-workflow-core/src/test/java/org/imixs/workflow/bpmn/TestBPMNParserSplitEvents.java @@ -71,7 +71,7 @@ public void testSimple() // test events for task 1000 List events = model.findAllEventsByTask(1000); Assert.assertNotNull(events); - Assert.assertEquals(1, events.size()); + Assert.assertEquals(2, events.size()); // test activity 1000.10 submit ItemCollection activity = model.getEvent(1000, 10); @@ -83,12 +83,11 @@ public void testSimple() // Now we need to evaluate if the Event is marked as an conditional Event with // the condition list copied from the gateway. Assert.assertTrue(activity.hasItem("keySplitConditions")); - Map conditions=(Map) activity.getItemValue("keySplitConditions").get(0); + Map conditions = (Map) activity.getItemValue("keySplitConditions").get(0); Assert.assertNotNull(conditions); Assert.assertEquals("true", conditions.get("task=1100")); } - - - + + } \ No newline at end of file diff --git a/imixs-workflow-core/src/test/resources/bpmn/split_event1.bpmn b/imixs-workflow-core/src/test/resources/bpmn/split_event1.bpmn index fab0f2c64..6055d7a88 100644 --- a/imixs-workflow-core/src/test/resources/bpmn/split_event1.bpmn +++ b/imixs-workflow-core/src/test/resources/bpmn/split_event1.bpmn @@ -38,7 +38,7 @@ - SequenceFlow_6 + SequenceFlow_7 SequenceFlow_12 @@ -52,15 +52,20 @@ SequenceFlow_2 SequenceFlow_3 - SequenceFlow_6 + SequenceFlow_5 true - - false + + SequenceFlow_5 + SequenceFlow_7 + + + false + @@ -106,6 +111,12 @@ + + + + + + @@ -144,14 +155,20 @@ - + - - - + + + + + + + + + diff --git a/imixs-workflow-core/src/test/resources/bpmn/split_event2.bpmn b/imixs-workflow-core/src/test/resources/bpmn/split_event1_invalid.bpmn similarity index 84% rename from imixs-workflow-core/src/test/resources/bpmn/split_event2.bpmn rename to imixs-workflow-core/src/test/resources/bpmn/split_event1_invalid.bpmn index 6055d7a88..fab0f2c64 100644 --- a/imixs-workflow-core/src/test/resources/bpmn/split_event2.bpmn +++ b/imixs-workflow-core/src/test/resources/bpmn/split_event1_invalid.bpmn @@ -38,7 +38,7 @@ - SequenceFlow_7 + SequenceFlow_6 SequenceFlow_12 @@ -52,20 +52,15 @@ SequenceFlow_2 SequenceFlow_3 - SequenceFlow_5 + SequenceFlow_6 true - - SequenceFlow_5 - SequenceFlow_7 - - - false + + false - @@ -111,12 +106,6 @@ - - - - - - @@ -155,19 +144,13 @@ - + - - - - - - - - - + + +