From commits-return-64983-archive-asf-public=cust-asf.ponee.io@commons.apache.org Thu Oct 18 00:52:59 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 75D0D18061A for ; Thu, 18 Oct 2018 00:52:58 +0200 (CEST) Received: (qmail 20359 invoked by uid 500); 17 Oct 2018 22:52:57 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 20350 invoked by uid 99); 17 Oct 2018 22:52:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2018 22:52:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6BA96DFC30; Wed, 17 Oct 2018 22:52:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ate@apache.org To: commits@commons.apache.org Message-Id: <566288f7dbae404483f8660c4c93a832@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: commons-scxml git commit: SCXML-285 Fix: Before executing invoke handlers after a macrostep all internal events must have been processed Date: Wed, 17 Oct 2018 22:52:57 +0000 (UTC) Repository: commons-scxml Updated Branches: refs/heads/master b9e67c07f -> c2656e992 SCXML-285 Fix: Before executing invoke handlers after a macrostep all internal events must have been processed Project: http://git-wip-us.apache.org/repos/asf/commons-scxml/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-scxml/commit/c2656e99 Tree: http://git-wip-us.apache.org/repos/asf/commons-scxml/tree/c2656e99 Diff: http://git-wip-us.apache.org/repos/asf/commons-scxml/diff/c2656e99 Branch: refs/heads/master Commit: c2656e9926477da08cd26d60e55691ba26ee6b9f Parents: b9e67c0 Author: Ate Douma Authored: Thu Oct 18 00:52:51 2018 +0200 Committer: Ate Douma Committed: Thu Oct 18 00:52:51 2018 +0200 ---------------------------------------------------------------------- src/changes/changes.xml | 4 ++ .../scxml2/semantics/SCXMLSemanticsImpl.java | 8 +-- .../commons/scxml2/invoke/InvokeTest.java | 13 ++++ .../apache/commons/scxml2/invoke/invoker-05.xml | 65 ++++++++++++++++++++ 4 files changed, 85 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/c2656e99/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 7f7a61a..94c7220 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -35,6 +35,10 @@ + + [18-10-2018] Before executing invoke handlers after a macrostep all internal events must have been processed + + [10-10-2018] Clear up exception handling in tests http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/c2656e99/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java b/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java index 5fb5f2a..423f13f 100644 --- a/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java +++ b/src/main/java/org/apache/commons/scxml2/semantics/SCXMLSemanticsImpl.java @@ -316,15 +316,13 @@ public class SCXMLSemanticsImpl implements SCXMLSemantics { step = new Step(event); selectTransitions(exctx, step); } + } else { + macroStepDone = true; } } - if (step.getTransitList().isEmpty()) { - macroStepDone = true; - } - else { + if (!step.getTransitList().isEmpty()) { microStep(exctx, step, statesToInvoke); } - } while (exctx.isRunning() && !macroStepDone); if (exctx.isRunning() && !statesToInvoke.isEmpty()) { http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/c2656e99/src/test/java/org/apache/commons/scxml2/invoke/InvokeTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/scxml2/invoke/InvokeTest.java b/src/test/java/org/apache/commons/scxml2/invoke/InvokeTest.java index fcf5c56..7f2be71 100644 --- a/src/test/java/org/apache/commons/scxml2/invoke/InvokeTest.java +++ b/src/test/java/org/apache/commons/scxml2/invoke/InvokeTest.java @@ -72,5 +72,18 @@ public class InvokeTest { SCXMLTestHelper.fireEvent(exec, "s1.next"); SCXMLTestHelper.fireEvent(exec, "state1.next"); } + + @Test + public void testExecuteInvokeAfterAllInternalEventsAreProcessed() throws Exception { + SCXML scxml = SCXMLReader.read(SCXMLTestHelper.getResource("org/apache/commons/scxml2/invoke/invoker-05.xml")); + SCXMLExecutor exec = new SCXMLExecutor(null, new SimpleDispatcher(), new SimpleErrorReporter()); + exec.setStateMachine(scxml); + exec.registerInvokerClass("scxml", SimpleSCXMLInvoker.class); + exec.go(); + while (exec.isRunning()) { + exec.triggerEvents(); + } + Assertions.assertEquals("success", exec.getStatus().getStates().iterator().next().getId()); + } } http://git-wip-us.apache.org/repos/asf/commons-scxml/blob/c2656e99/src/test/java/org/apache/commons/scxml2/invoke/invoker-05.xml ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/scxml2/invoke/invoker-05.xml b/src/test/java/org/apache/commons/scxml2/invoke/invoker-05.xml new file mode 100644 index 0000000..99dc87b --- /dev/null +++ b/src/test/java/org/apache/commons/scxml2/invoke/invoker-05.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +