From 2eccac8e4a70acad22b57df21bdf0133aa02a4dd Mon Sep 17 00:00:00 2001 From: Nick Ebbutt Date: Fri, 20 Apr 2018 09:07:28 +0100 Subject: [PATCH] Remove old style remoting --- .../RemoteProcessWithPolledAssertion.java | 2 +- .../polledassertion/polledassertion.feature | 16 ++++++++++------ .../chorus/selftest/polledassertion/stdout.txt | 18 +++++++++++------- .../FeatureScopedProcessMain.java | 12 +++++++++++- .../featurescopedprocess.feature | 2 ++ .../featurescopedprocess.properties | 2 ++ .../featurescopedprocess/stdout.txt | 4 +++- .../jmxdualhandlerexport.feature | 14 ++++++++------ .../remoting/jmx/dualhandlerexport/stdout.txt | 12 +++++++----- .../jmxwithconfigurations.feature | 3 ++- .../jmx/jmxwithconfigurations/stdout.txt | 8 +++++--- .../remotechoruscontext/StartAProcessMain.java | 10 +++++++++- .../conf/remotechoruscontext.properties | 5 +++++ .../remotechoruscontext.feature | 6 +++++- .../jmx/remotechoruscontext/stdout.txt | 8 ++++++-- .../jmxremoteexceptions.feature | 13 ++++++++----- .../remoting/jmx/remoteexceptions/stdout.txt | 11 +++++++---- .../remotingwithlocalprocess.feature | 8 -------- .../jmx/remotingwithlocalprocess/stdout.txt | 15 ++------------- .../jmxsinglehandlerexport.feature | 10 ++++++---- .../jmx/singlehandlerexport/stdout.txt | 12 +++++++----- .../stepretry/RemoteProcessWithStepRetry.java | 2 +- .../chorus/selftest/stepretry/stdout.txt | 15 ++++++++------- .../selftest/stepretry/stepretry.feature | 13 +++++++------ .../remoting/jmx/ChorusHandlerJmxExporter.java | 7 ++++--- .../util/PatternPreProcessingProvider.java | 8 ++++---- 26 files changed, 141 insertions(+), 95 deletions(-) diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/RemoteProcessWithPolledAssertion.java b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/RemoteProcessWithPolledAssertion.java index eab615724..8b83b9926 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/RemoteProcessWithPolledAssertion.java +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/RemoteProcessWithPolledAssertion.java @@ -95,7 +95,7 @@ public void testFailsWithRuntimeException() throws Exception { private AtomicLong passesWithinStartTime = new AtomicLong(); - @Step(".*call a passes within step method it can be terminated immediately by FailImmediatelyException") + @Step(".*call a passes within step method remotely it can be terminated immediately by FailImmediatelyException") @PassesWithin(length=360, timeUnit = TimeUnit.SECONDS) public void testFailImmediately() { passesWithinStartTime.compareAndSet(0, System.currentTimeMillis()); diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/polledassertion.feature b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/polledassertion.feature index 71d0f92f8..7e12312a1 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/polledassertion.feature +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/polledassertion.feature @@ -23,17 +23,20 @@ Feature: Polled Assertion Scenario: Remoting with Polled Assertions Given I start a remotePolled process - When I start a timer in remotePolled - Then test condition eventually passes in remotePolled - And another test condition fails with AssertionError in remotePolled + And I connect to the process named remotePolled + When I start a timer + Then test condition eventually passes + And another test condition fails with AssertionError Scenario: Remoting with Polled Assertions with Exception Given I start a remotePolled process - Then another test condition fails with Exception in remotePolled + And I connect to the process named remotePolled + Then another test condition fails with Exception Scenario: Remoting with Polled Assertions with RuntimeException Given I start a remotePolled process - Then another test condition fails with RuntimeException in remotePolled + And I connect to the process named remotePolled + Then another test condition fails with RuntimeException Scenario: Long running step method overruns passes within period @@ -56,4 +59,5 @@ Feature: Polled Assertion Scenario: I can immediately break out of a remote passes within by throwing FailImmediatelyException Given I start a remotePolled process - When call a passes within step method it can be terminated immediately by FailImmediatelyException in remotePolled \ No newline at end of file + And I connect to the process named remotePolled + When call a passes within step method remotely it can be terminated immediately by FailImmediatelyException \ No newline at end of file diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/stdout.txt b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/stdout.txt index 00c8c9d48..2586b05aa 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/stdout.txt +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/polledassertion/stdout.txt @@ -20,19 +20,22 @@ Chorus --> INFO - Processing scenario: Passes For Invoker Is Working Chorus --> INFO - Processing scenario: Remoting with Polled Assertions Chorus --> INFO - About to run process: Given I start a remotePolled process PASSED - When I start a timer in remotePolled PASSED - Then test condition eventually passes in remotePolled PASSED - And another test condition fails with AssertionError in remotePolled FAILED remote ChorusAssertionError - Failed condition (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException + And I connect to the process named remotePolled PASSED + When I start a timer PASSED + Then test condition eventually passes PASSED + And another test condition fails with AssertionError FAILED remote ChorusAssertionError - Failed condition (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException Scenario: Remoting with Polled Assertions with Exception Chorus --> INFO - Processing scenario: Remoting with Polled Assertions with Exception Chorus --> INFO - About to run process: Given I start a remotePolled process PASSED - Then another test condition fails with Exception in remotePolled FAILED remote Exception - My Exception Message (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException + And I connect to the process named remotePolled PASSED + Then another test condition fails with Exception FAILED remote Exception - My Exception Message (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException Scenario: Remoting with Polled Assertions with RuntimeException Chorus --> INFO - Processing scenario: Remoting with Polled Assertions with RuntimeException Chorus --> INFO - About to run process: Given I start a remotePolled process PASSED - Then another test condition fails with RuntimeException in remotePolled FAILED remote RuntimeException - My Runtime Exception Message (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException + And I connect to the process named remotePolled PASSED + Then another test condition fails with RuntimeException FAILED remote RuntimeException - My Runtime Exception Message (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException Scenario: Long running step method overruns passes within period Chorus --> INFO - Processing scenario: Long running step method overruns passes within period When I call a 1 second to run step method with passes within 1 second annotation FAILED Whoops (PolledAssertionHandler:linenumber)-AssertionError @@ -48,9 +51,10 @@ Chorus --> INFO - Processing scenario: I can immediately break out of a passe Chorus --> INFO - Processing scenario: I can immediately break out of a remote passes within by throwing FailImmediatelyException Chorus --> INFO - About to run process: Given I start a remotePolled process PASSED - When call a passes within step method it can be terminated immediately by FailImmediatelyException in remotePolled FAILED remote FailImmediatelyException - Fail this step immediately - time elapsed 0 seconds (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException + And I connect to the process named remotePolled PASSED + When call a passes within step method remotely it can be terminated immediately by FailImmediatelyException FAILED remote FailImmediatelyException - Fail this step immediately - time elapsed 0 seconds (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException Features (total:1) (passed:0) (failed:1) Scenarios (total:9) (passed:1) (failed:8) -Steps (total:27) (passed:18) (failed:8) (undefined:0) (pending:0) (skipped:1) \ No newline at end of file +Steps (total:31) (passed:22) (failed:8) (undefined:0) (pending:0) (skipped:1) \ No newline at end of file diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/FeatureScopedProcessMain.java b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/FeatureScopedProcessMain.java index 2000776a8..48eee5c48 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/FeatureScopedProcessMain.java +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/FeatureScopedProcessMain.java @@ -25,6 +25,10 @@ import org.chorusbdd.chorus.remoting.jmx.ChorusHandlerJmxExporter; +import java.util.function.Function; +import java.util.function.UnaryOperator; +import java.util.regex.Pattern; + /** * Created by IntelliJ IDEA. * User: Nick Ebbutt @@ -34,8 +38,14 @@ public class FeatureScopedProcessMain { public static void main(String[] args) throws InterruptedException { + + String name = args[0]; + + //add the process name to the step patterns so we can distinguish steps on each process + UnaryOperator patternPreProcessor = pattern -> Pattern.compile(pattern.pattern() + " in " + name); + FeatureScopedProcessHandler handler = new FeatureScopedProcessHandler(); - ChorusHandlerJmxExporter exporter = new ChorusHandlerJmxExporter(handler); + ChorusHandlerJmxExporter exporter = new ChorusHandlerJmxExporter(patternPreProcessor, handler); exporter.export(); Thread.sleep(60000); diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/featurescopedprocess.feature b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/featurescopedprocess.feature index a9b7d84b2..0acbdd189 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/featurescopedprocess.feature +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/featurescopedprocess.feature @@ -9,11 +9,13 @@ Feature: Feature Scoped Process Feature-Start: First I start a featurescopedone process + #! Remoting connect featurescopedone Scenario: I can call the process in scenario one I say hello in featurescopedone Then I start a featurescopedtwo process And I stop the process named featurescopedone + #! Remoting connect featurescopedtwo Feature-End: I say hello in featurescopedtwo #two should be stopped at the end of this section diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/featurescopedprocess.properties b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/featurescopedprocess.properties index c43bc811c..ae5ac0d04 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/featurescopedprocess.properties +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/featurescopedprocess.properties @@ -2,6 +2,7 @@ processes.featurescopedone.mainclass:org.chorusbdd.chorus.selftest.processhandler.featurescopedprocess.FeatureScopedProcessMain processes.featurescopedone.remotingPort: 18806 processes.featurescopedone.scope: feature +processes.featurescopedone.args: featurescopedone remoting.featurescopedone.connection=jmx:localhost:18806 @@ -9,6 +10,7 @@ remoting.featurescopedone.connection=jmx:localhost:18806 processes.featurescopedtwo.mainclass:org.chorusbdd.chorus.selftest.processhandler.featurescopedprocess.FeatureScopedProcessMain processes.featurescopedtwo.remotingPort: 18807 processes.featurescopedtwo.scope: feature +processes.featurescopedtwo.args: featurescopedtwo remoting.featurescopedtwo.connection=jmx:localhost:18807 diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/stdout.txt b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/stdout.txt index d52cab3ce..f14b331e5 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/stdout.txt +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/processhandler/featurescopedprocess/stdout.txt @@ -6,15 +6,17 @@ Chorus --> INFO - About to run process: INFO - Processing scenario: I can call the process in scenario one + #! Remoting connect featurescopedone PASSED I say hello in featurescopedone PASSED Chorus --> INFO - About to run process: Then I start a featurescopedtwo process PASSED And I stop the process named featurescopedone PASSED Scenario: Feature-End Chorus --> INFO - Processing scenario: Feature-End + #! Remoting connect featurescopedtwo PASSED I say hello in featurescopedtwo PASSED Features (total:1) (passed:1) (failed:0) Scenarios (total:1) (passed:1) (failed:0) -Steps (total:5) (passed:5) (failed:0) (undefined:0) (pending:0) (skipped:0) \ No newline at end of file +Steps (total:7) (passed:7) (failed:0) (undefined:0) (pending:0) (skipped:0) \ No newline at end of file diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/dualhandlerexport/jmxdualhandlerexport.feature b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/dualhandlerexport/jmxdualhandlerexport.feature index 8755dd0cf..c86602743 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/dualhandlerexport/jmxdualhandlerexport.feature +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/dualhandlerexport/jmxdualhandlerexport.feature @@ -8,15 +8,17 @@ Feature: Jmx Dual Handler Export Scenario: Call An Exported Method Given I start a config1 process named DualHandlerExport - Then I can call a step method exported by the handler in DualHandlerExport + And I connect to the process named DualHandlerExport + Then I can call a step method exported by the handler And I can stop process DualHandlerExport Scenario: Call A Conflicting Method - Given I start a config1 process named DualHandlerExport - And I call a step method exported by handler one in DualHandlerExport - And I call a step method exported by handler two in DualHandlerExport - And I call a step method exported by both handlers in DualHandlerExport - Then a ChorusException is thrown with a message which reports the ambiguity + Given I start a config1 process named DualHandlerExport + And I connect to the process named DualHandlerExport + And I call a step method exported by handler one + And I call a step method exported by handler two + And I call a step method exported by both handlers + Then a ChorusException is thrown with a message which reports the ambiguity diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/dualhandlerexport/stdout.txt b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/dualhandlerexport/stdout.txt index b3cbc6957..1caa1a861 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/dualhandlerexport/stdout.txt +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/dualhandlerexport/stdout.txt @@ -5,18 +5,20 @@ Chorus --> INFO - No default handler found for Feature: (Jmx Dual Handler Exp Chorus --> INFO - Processing scenario: Call An Exported Method Chorus --> INFO - About to run process: Given I start a config1 process named DualHandlerExport PASSED - Then I can call a step method exported by the handler in DualHandlerExport PASSED + And I connect to the process named DualHandlerExport PASSED + Then I can call a step method exported by the handler PASSED And I can stop process DualHandlerExport PASSED Scenario: Call A Conflicting Method Chorus --> INFO - Processing scenario: Call A Conflicting Method Chorus --> INFO - About to run process: Given I start a config1 process named DualHandlerExport PASSED - And I call a step method exported by handler one in DualHandlerExport PASSED One - And I call a step method exported by handler two in DualHandlerExport PASSED two - And I call a step method exported by both handlers in DualHandlerExport FAILED Ambiguous step [I call a step method exported by both handlers], more than one implementation (RemoteComponent:DualHandlerExport:JmxDualHandlerExportHandler:canCallAStepMethodExportedByBoth / RemoteComponent:DualHandlerExport:JmxDualHandlerExportHandlerTwo:canCallAStepMethodExportedByBoth) (StepMatcher:linenumber)-DuplicateStepMatchException + And I connect to the process named DualHandlerExport PASSED + And I call a step method exported by handler one PASSED One + And I call a step method exported by handler two PASSED two + And I call a step method exported by both handlers FAILED Ambiguous step [I call a step method exported by both handlers], more than one implementation (RemoteComponent:DualHandlerExport:JmxDualHandlerExportHandler:canCallAStepMethodExportedByBoth / RemoteComponent:DualHandlerExport:JmxDualHandlerExportHandlerTwo:canCallAStepMethodExportedByBoth) (StepMatcher:linenumber)-DuplicateStepMatchException Then a ChorusException is thrown with a message which reports the ambiguity SKIPPED Features (total:1) (passed:0) (failed:1) Scenarios (total:2) (passed:1) (failed:1) -Steps (total:8) (passed:6) (failed:1) (undefined:0) (pending:0) (skipped:1) \ No newline at end of file +Steps (total:10) (passed:8) (failed:1) (undefined:0) (pending:0) (skipped:1) \ No newline at end of file diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/jmxwithconfigurations/jmxwithconfigurations.feature b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/jmxwithconfigurations/jmxwithconfigurations.feature index 7b6b54410..94ef99cb2 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/jmxwithconfigurations/jmxwithconfigurations.feature +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/jmxwithconfigurations/jmxwithconfigurations.feature @@ -10,7 +10,8 @@ Feature: Jmx With Configurations Scenario: Config Properties Override Main Properties For Jmx Remoting Given I start a config1 process named SingleHandlerExport - Then I can call a step method exported by the handler in SingleHandlerExport + And I connect to the process named SingleHandlerExport + Then I can call a step method exported by the handler diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/jmxwithconfigurations/stdout.txt b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/jmxwithconfigurations/stdout.txt index b59fc5aff..da3c5c838 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/jmxwithconfigurations/stdout.txt +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/jmxwithconfigurations/stdout.txt @@ -6,7 +6,8 @@ Chorus --> INFO - Processing scenario: Config Properties Override Main Proper Chorus --> INFO - About to run process: Given I start a config1 process named SingleHandlerExport PASSED Chorus --> ERROR - Failed to connect to mBean server on (localhost:18800) - Then I can call a step method exported by the handler in SingleHandlerExport FAILED Failed to connect to mBean server on (localhost:18800) caused by: [replaced] (AbstractJmxProxy:linenumber)-ChorusException + And I connect to the process named SingleHandlerExport FAILED Failed to connect to mBean server on (localhost:18800) caused by: [replaced] (AbstractJmxProxy:linenumber)-ChorusException + Then I can call a step method exported by the handler SKIPPED Feature: Jmx With Configurations [config2] Chorus --> INFO - Running feature from file: src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/jmxwithconfigurations/jmxwithconfigurations.feature in config config2 @@ -15,9 +16,10 @@ Chorus --> INFO - No default handler found for Feature: (Jmx With Configurati Chorus --> INFO - Processing scenario: Config Properties Override Main Properties For Jmx Remoting Chorus --> INFO - About to run process: Given I start a config1 process named SingleHandlerExport PASSED - Then I can call a step method exported by the handler in SingleHandlerExport PASSED + And I connect to the process named SingleHandlerExport PASSED + Then I can call a step method exported by the handler PASSED Features (total:2) (passed:1) (failed:1) Scenarios (total:2) (passed:1) (failed:1) -Steps (total:4) (passed:3) (failed:1) (undefined:0) (pending:0) (skipped:0) \ No newline at end of file +Steps (total:6) (passed:4) (failed:1) (undefined:0) (pending:0) (skipped:1) \ No newline at end of file diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/StartAProcessMain.java b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/StartAProcessMain.java index 070f45107..f16df5c44 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/StartAProcessMain.java +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/StartAProcessMain.java @@ -25,6 +25,9 @@ import org.chorusbdd.chorus.remoting.jmx.ChorusHandlerJmxExporter; +import java.util.function.UnaryOperator; +import java.util.regex.Pattern; + /** * Created by IntelliJ IDEA. * User: Nick Ebbutt @@ -34,13 +37,18 @@ public class StartAProcessMain { public static void main(String[] args) throws InterruptedException { + String name = args[0]; + + //add a suffix to step patterns to identify the process instance + UnaryOperator patternPreProcessor = pattern -> Pattern.compile(pattern + " in " + name); + //write out all the arguments so we can test them for (String s : args) { System.out.println(s); } JmxRemoteChorusContextHandler handler = new JmxRemoteChorusContextHandler(); - ChorusHandlerJmxExporter exporter = new ChorusHandlerJmxExporter(handler); + ChorusHandlerJmxExporter exporter = new ChorusHandlerJmxExporter(patternPreProcessor, handler); exporter.export(); Thread.sleep(10000); diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/conf/remotechoruscontext.properties b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/conf/remotechoruscontext.properties index 6d85ee653..5b5b10376 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/conf/remotechoruscontext.properties +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/conf/remotechoruscontext.properties @@ -1,6 +1,11 @@ #for testing processes with configurations processes.config1.mainclass:org.chorusbdd.chorus.selftest.remoting.jmx.remotechoruscontext.StartAProcessMain processes.config1.remotingPort: 18806 +processes.config1.args:Casablanca + +processes.config2.mainclass:org.chorusbdd.chorus.selftest.remoting.jmx.remotechoruscontext.StartAProcessMain +processes.config2.remotingPort: 18807 +processes.config2.args:Casablanca2 # used to test the Processes with JMX feature remoting.Casablanca.connection=jmx:localhost:18806 diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/remotechoruscontext.feature b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/remotechoruscontext.feature index f0a42ad48..fdfbb1f97 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/remotechoruscontext.feature +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/remotechoruscontext.feature @@ -12,6 +12,7 @@ Feature: JMX Remote Chorus Context Scenario: View And Change A Context Variable Remotely Given I start a config1 process named Casablanca + And I connect to the process named Casablanca And I set the context variable theUsualSuspects to Nick in Casablanca Then I can access the context variable theUsualSuspects in Casablanca And_if I set the context variable theUsualSuspects to Steve in Casablanca @@ -19,17 +20,20 @@ Feature: JMX Remote Chorus Context Scenario: Set a Variable Locally and Read it Remotely Given I start a config1 process named Casablanca + And I connect to the process named Casablanca And I create a context variable myVar with the value localValue Then the value of variable myVar is localValue in Casablanca Scenario: Can serialize a map Given I start a config1 process named Casablanca + And I connect to the process named Casablanca And I create a context map myMap in Casablanca Then the size of map myMap is 3 Scenario: Can share a context variable between two remote processes Given I start a config1 process named Casablanca - And I start a config1 process named Casablanca2 + And I start a config2 process named Casablanca2 + And I connect to the processes named Casablanca, Casablanca2 When I set the context variable theUsualSuspects to Nick in Casablanca Then I can access the context variable theUsualSuspects in Casablanca2 diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/stdout.txt b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/stdout.txt index 23bd62e51..df081deef 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/stdout.txt +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotechoruscontext/stdout.txt @@ -5,6 +5,7 @@ Chorus --> INFO - No default handler found for Feature: (JMX Remote Chorus Co Chorus --> INFO - Processing scenario: View And Change A Context Variable Remotely Chorus --> INFO - About to run process: Given I start a config1 process named Casablanca PASSED + And I connect to the process named Casablanca PASSED And I set the context variable theUsualSuspects to Nick in Casablanca PASSED Then I can access the context variable theUsualSuspects in Casablanca PASSED Nick:String And_if I set the context variable theUsualSuspects to Steve in Casablanca PASSED @@ -13,12 +14,14 @@ Chorus --> INFO - About to run process: INFO - Processing scenario: Set a Variable Locally and Read it Remotely Chorus --> INFO - About to run process: Given I start a config1 process named Casablanca PASSED + And I connect to the process named Casablanca PASSED And I create a context variable myVar with the value localValue PASSED Then the value of variable myVar is localValue in Casablanca PASSED Scenario: Can serialize a map Chorus --> INFO - Processing scenario: Can serialize a map Chorus --> INFO - About to run process: Given I start a config1 process named Casablanca PASSED + And I connect to the process named Casablanca PASSED And I create a context map myMap in Casablanca PASSED Then the size of map myMap is 3 PASSED Scenario: Can share a context variable between two remote processes @@ -26,11 +29,12 @@ Chorus --> INFO - Processing scenario: Can share a context variable between t Chorus --> INFO - About to run process: Given I start a config1 process named Casablanca PASSED Chorus --> INFO - About to run process: - And I start a config1 process named Casablanca2 PASSED + And I start a config2 process named Casablanca2 PASSED + And I connect to the processes named Casablanca, Casablanca2 PASSED When I set the context variable theUsualSuspects to Nick in Casablanca PASSED Then I can access the context variable theUsualSuspects in Casablanca2 PASSED Nick:String Features (total:1) (passed:1) (failed:0) Scenarios (total:4) (passed:4) (failed:0) -Steps (total:15) (passed:15) (failed:0) (undefined:0) (pending:0) (skipped:0) \ No newline at end of file +Steps (total:19) (passed:19) (failed:0) (undefined:0) (pending:0) (skipped:0) \ No newline at end of file diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remoteexceptions/jmxremoteexceptions.feature b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remoteexceptions/jmxremoteexceptions.feature index b2ff9a406..889efc55f 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remoteexceptions/jmxremoteexceptions.feature +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remoteexceptions/jmxremoteexceptions.feature @@ -7,18 +7,21 @@ Feature: Jmx Single Handler Export Scenario: Handle Exceptions In Remote Steps Given I start a config1 process named SingleHandlerExport - And I call a method which throws an exception in SingleHandlerExport + And I connect to the process named SingleHandlerExport + And I call a method which throws an exception Then my subsequent steps are skipped Scenario: Handle Assertion Exceptions In Remote Steps - Given I start a config1 process named SingleHandlerExport - And I call a method which throws an assertion exception in SingleHandlerExport - Then my subsequent steps are skipped + Given I start a config1 process named SingleHandlerExport + And I connect to the process named SingleHandlerExport + And I call a method which throws an assertion exception + Then my subsequent steps are skipped Scenario: Handler Null Pointer Exceptions in Remote Steps #or any Exception which does not set a message Given I start a config1 process named SingleHandlerExport - And I call a method which throws a NullPointerException in SingleHandlerExport + And I connect to the process named SingleHandlerExport + And I call a method which throws a NullPointerException Then my subsequent steps are skipped diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remoteexceptions/stdout.txt b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remoteexceptions/stdout.txt index 1fe540662..b74cfaa51 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remoteexceptions/stdout.txt +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remoteexceptions/stdout.txt @@ -5,22 +5,25 @@ Chorus --> INFO - No default handler found for Feature: (Jmx Single Handler E Chorus --> INFO - Processing scenario: Handle Exceptions In Remote Steps Chorus --> INFO - About to run process: Given I start a config1 process named SingleHandlerExport PASSED - And I call a method which throws an exception in SingleHandlerExport FAILED remote RuntimeException - This message should appear in interpreter output (JmxRemoteExceptionsHandler:linenumber)-JmxRemotingException + And I connect to the process named SingleHandlerExport PASSED + And I call a method which throws an exception FAILED remote RuntimeException - This message should appear in interpreter output (JmxRemoteExceptionsHandler:linenumber)-JmxRemotingException Then my subsequent steps are skipped SKIPPED Scenario: Handle Assertion Exceptions In Remote Steps Chorus --> INFO - Processing scenario: Handle Assertion Exceptions In Remote Steps Chorus --> INFO - About to run process: Given I start a config1 process named SingleHandlerExport PASSED - And I call a method which throws an assertion exception in SingleHandlerExport FAILED remote ChorusAssertionError - This assertion failed (JmxRemoteExceptionsHandler:linenumber)-JmxRemotingException + And I connect to the process named SingleHandlerExport PASSED + And I call a method which throws an assertion exception FAILED remote ChorusAssertionError - This assertion failed (JmxRemoteExceptionsHandler:linenumber)-JmxRemotingException Then my subsequent steps are skipped SKIPPED Scenario: Handler Null Pointer Exceptions in Remote Steps Chorus --> INFO - Processing scenario: Handler Null Pointer Exceptions in Remote Steps Chorus --> INFO - About to run process: Given I start a config1 process named SingleHandlerExport PASSED - And I call a method which throws a NullPointerException in SingleHandlerExport FAILED remote NullPointerException (JmxRemoteExceptionsHandler:linenumber)-JmxRemotingException + And I connect to the process named SingleHandlerExport PASSED + And I call a method which throws a NullPointerException FAILED remote NullPointerException (JmxRemoteExceptionsHandler:linenumber)-JmxRemotingException Then my subsequent steps are skipped SKIPPED Features (total:1) (passed:0) (failed:1) Scenarios (total:3) (passed:0) (failed:3) -Steps (total:9) (passed:3) (failed:3) (undefined:0) (pending:0) (skipped:3) \ No newline at end of file +Steps (total:12) (passed:6) (failed:3) (undefined:0) (pending:0) (skipped:3) \ No newline at end of file diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotingwithlocalprocess/remotingwithlocalprocess.feature b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotingwithlocalprocess/remotingwithlocalprocess.feature index 1acff3752..ef2351743 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotingwithlocalprocess/remotingwithlocalprocess.feature +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotingwithlocalprocess/remotingwithlocalprocess.feature @@ -23,14 +23,6 @@ Feature: Remoting With Local Process Then I can call a step and get the jmx port from the 18808 handler And I can get the debug port for Flowerpot from processes manager - Scenario: I can run steps using the Remoting handler 'in componentName' suffix without a remoting config - Given I start a config1 process named Bill - And I start a config1 process named Ben - And I start a config1 process named Flowerpot - Then I can call a step and get the jmx port from the 18806 handler in Bill - Then I can call a step and get the jmx port from the 18807 handler in Ben - Then I can call a step and get the jmx port from the 18808 handler in Flowerpot - Scenario: Remoting and debug ports do not auto-increment if no initial port set in template configuration Given I start a withoutRemotingOrDebug process named Bill And I start a withoutRemotingOrDebug process named Ben diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotingwithlocalprocess/stdout.txt b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotingwithlocalprocess/stdout.txt index 21e0a953d..605079319 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotingwithlocalprocess/stdout.txt +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/remoting/jmx/remotingwithlocalprocess/stdout.txt @@ -21,17 +21,6 @@ Chorus --> INFO - About to run process: INFO - Processing scenario: I can run steps using the Remoting handler 'in componentName' suffix without a remoting config -Chorus --> INFO - About to run process: - Given I start a config1 process named Bill PASSED -Chorus --> INFO - About to run process: - And I start a config1 process named Ben PASSED -Chorus --> INFO - About to run process: - And I start a config1 process named Flowerpot PASSED - Then I can call a step and get the jmx port from the 18806 handler in Bill PASSED 18806 - Then I can call a step and get the jmx port from the 18807 handler in Ben PASSED 18807 - Then I can call a step and get the jmx port from the 18808 handler in Flowerpot PASSED 18808 Scenario: Remoting and debug ports do not auto-increment if no initial port set in template configuration Chorus --> INFO - Processing scenario: Remoting and debug ports do not auto-increment if no initial port set in template configuration Chorus --> INFO - About to run process: @@ -45,5 +34,5 @@ Chorus --> INFO - About to run process: INFO - No default handler found for Feature: (Jmx Single Handler E Scenario: Call An Exported Method Chorus --> INFO - Processing scenario: Call An Exported Method Chorus --> INFO - About to run process: - Given I start a config1 process named SingleHandlerExport PASSED - Then I can call a step method exported by the handler in SingleHandlerExport PASSED - And I can stop the process named SingleHandlerExport PASSED + Given I start a config1 process PASSED + When I connect to the process named config1 PASSED + Then I can call a step method exported by the handler PASSED + And I can stop the process named config1 PASSED Scenario: Call a Pending Method Chorus --> INFO - Processing scenario: Call a Pending Method Chorus --> INFO - About to run process: Given I start a config1 process named SingleHandlerExport PASSED - And I can declare a step pending remotely in SingleHandlerExport PENDING This step is pending + When I connect to the process named SingleHandlerExport PASSED + Then I can declare a step pending remotely PENDING This step is pending Features (total:1) (passed:0) (pending:1) (failed:0) Scenarios (total:2) (passed:1) (pending:1) (failed:0) -Steps (total:5) (passed:4) (failed:0) (undefined:0) (pending:1) (skipped:0) \ No newline at end of file +Steps (total:7) (passed:6) (failed:0) (undefined:0) (pending:1) (skipped:0) \ No newline at end of file diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/RemoteProcessWithStepRetry.java b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/RemoteProcessWithStepRetry.java index cc777e33f..16eeb9396 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/RemoteProcessWithStepRetry.java +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/RemoteProcessWithStepRetry.java @@ -89,7 +89,7 @@ public void testFailsWithRuntimeException() throws Exception { private AtomicLong passesWithinStartTime = new AtomicLong(); - @Step(value = ".*call a passes within step method it can be terminated immediately by FailImmediatelyException", retryDuration = 360) + @Step(value = ".*call a passes within step method remotely it can be terminated immediately by FailImmediatelyException", retryDuration = 360) public void testFailImmediately() { passesWithinStartTime.compareAndSet(0, System.currentTimeMillis()); long zeroWhenFailingImmediately = (System.currentTimeMillis() - passesWithinStartTime.get()) / 1000; diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/stdout.txt b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/stdout.txt index 2bb1ebf02..63db11336 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/stdout.txt +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/stdout.txt @@ -4,6 +4,7 @@ Chorus --> INFO - Running feature from file: src/test/java/org/chorusbdd/chor Chorus --> INFO - Processing scenario: Feature-Start Chorus --> INFO - About to run process: First I start a remotePolled process PASSED + And I connect to the process named remotePolled PASSED Scenario: Step Retry Is Working In Local Handler Chorus --> INFO - Processing scenario: Step Retry Is Working In Local Handler Given I increment a value with a timer task PASSED @@ -21,20 +22,20 @@ Chorus --> INFO - Processing scenario: I can immediately break out of a Step When call a passes within step method it can be terminated immediately by FailImmediatelyException FAILED Fail this step immediately - time elapsed 0 seconds (StepRetryHandler:linenumber)-FailImmediatelyException Scenario: Remoting with Step Retry Chorus --> INFO - Processing scenario: Remoting with Step Retry - When I start a timer in remotePolled PASSED - Then test condition eventually passes in remotePolled PASSED - And another test condition fails with AssertionError in remotePolled FAILED remote ChorusAssertionError - Failed condition (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException + When I start a timer PASSED + Then test condition eventually passes PASSED + And another test condition fails with AssertionError FAILED remote ChorusAssertionError - Failed condition (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException Scenario: Exceptions fail tests with remote Step Retry Chorus --> INFO - Processing scenario: Exceptions fail tests with remote Step Retry - Then another test condition fails with Exception in remotePolled FAILED remote Exception - My Exception Message (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException + Then another test condition fails with Exception FAILED remote Exception - My Exception Message (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException Scenario: Runtime Exceptions fail tests with remote Step Retry Chorus --> INFO - Processing scenario: Runtime Exceptions fail tests with remote Step Retry - Then another test condition fails with RuntimeException in remotePolled FAILED remote RuntimeException - My Runtime Exception Message (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException + Then another test condition fails with RuntimeException FAILED remote RuntimeException - My Runtime Exception Message (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException Scenario: I can immediately break out of a remote Step Retry by throwing FailImmediatelyException Chorus --> INFO - Processing scenario: I can immediately break out of a remote Step Retry by throwing FailImmediatelyException - When call a passes within step method it can be terminated immediately by FailImmediatelyException in remotePolled FAILED remote FailImmediatelyException - Fail this step immediately - time elapsed 0 seconds (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException + When call a passes within step method remotely it can be terminated immediately by FailImmediatelyException FAILED remote FailImmediatelyException - Fail this step immediately - time elapsed 0 seconds (RemoteProcessWithPolledAssertion$MyHandler:linenumber)-JmxRemotingException Features (total:1) (passed:0) (failed:1) Scenarios (total:7) (passed:0) (failed:7) -Steps (total:16) (passed:8) (failed:7) (undefined:0) (pending:0) (skipped:1) \ No newline at end of file +Steps (total:17) (passed:9) (failed:7) (undefined:0) (pending:0) (skipped:1) \ No newline at end of file diff --git a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/stepretry.feature b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/stepretry.feature index 9a0ae77b9..4b85641e1 100644 --- a/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/stepretry.feature +++ b/integrationtest/src/test/java/org/chorusbdd/chorus/selftest/stepretry/stepretry.feature @@ -7,6 +7,7 @@ Feature: Step Retry Feature-Start: First I start a remotePolled process + And I connect to the process named remotePolled Scenario: Step Retry Is Working In Local Handler Given I increment a value with a timer task @@ -28,15 +29,15 @@ Feature: Step Retry When call a passes within step method it can be terminated immediately by FailImmediatelyException Scenario: Remoting with Step Retry - When I start a timer in remotePolled - Then test condition eventually passes in remotePolled - And another test condition fails with AssertionError in remotePolled + When I start a timer + Then test condition eventually passes + And another test condition fails with AssertionError Scenario: Exceptions fail tests with remote Step Retry - Then another test condition fails with Exception in remotePolled + Then another test condition fails with Exception Scenario: Runtime Exceptions fail tests with remote Step Retry - Then another test condition fails with RuntimeException in remotePolled + Then another test condition fails with RuntimeException Scenario: I can immediately break out of a remote Step Retry by throwing FailImmediatelyException - When call a passes within step method it can be terminated immediately by FailImmediatelyException in remotePolled \ No newline at end of file + When call a passes within step method remotely it can be terminated immediately by FailImmediatelyException \ No newline at end of file diff --git a/interpreter/chorus-remoting/src/main/java/org/chorusbdd/chorus/remoting/jmx/ChorusHandlerJmxExporter.java b/interpreter/chorus-remoting/src/main/java/org/chorusbdd/chorus/remoting/jmx/ChorusHandlerJmxExporter.java index 17666a6af..be2c4f49b 100644 --- a/interpreter/chorus-remoting/src/main/java/org/chorusbdd/chorus/remoting/jmx/ChorusHandlerJmxExporter.java +++ b/interpreter/chorus-remoting/src/main/java/org/chorusbdd/chorus/remoting/jmx/ChorusHandlerJmxExporter.java @@ -44,6 +44,7 @@ import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Function; +import java.util.function.UnaryOperator; import java.util.regex.Pattern; /** @@ -55,9 +56,9 @@ */ public class ChorusHandlerJmxExporter implements ChorusHandlerJmxExporterMBean { - private static final Function DEFAULT_STEP_PATTERN_PREPROCESSOR = Function.identity(); + private static final UnaryOperator DEFAULT_STEP_PATTERN_PREPROCESSOR = UnaryOperator.identity(); - private final Function patternPreProcessor; + private final UnaryOperator patternPreProcessor; private ChorusLog log = ChorusLogFactory.getLog(ChorusHandlerJmxExporter.class); @@ -83,7 +84,7 @@ public ChorusHandlerJmxExporter(Object... handlers) { * @param patternPreProcessor - A function to perform a mapping on the patterns of all exported handler steps * @param handlers - Instances of handler classes which should be exported */ - public ChorusHandlerJmxExporter(Function patternPreProcessor, Object... handlers) { + public ChorusHandlerJmxExporter(UnaryOperator patternPreProcessor, Object... handlers) { this.patternPreProcessor = patternPreProcessor; for ( Object handler : handlers) { diff --git a/interpreter/chorus-stepinvoker/src/main/java/org/chorusbdd/chorus/stepinvoker/util/PatternPreProcessingProvider.java b/interpreter/chorus-stepinvoker/src/main/java/org/chorusbdd/chorus/stepinvoker/util/PatternPreProcessingProvider.java index 9e5243959..2e19524ea 100644 --- a/interpreter/chorus-stepinvoker/src/main/java/org/chorusbdd/chorus/stepinvoker/util/PatternPreProcessingProvider.java +++ b/interpreter/chorus-stepinvoker/src/main/java/org/chorusbdd/chorus/stepinvoker/util/PatternPreProcessingProvider.java @@ -4,7 +4,7 @@ import org.chorusbdd.chorus.stepinvoker.StepInvokerProvider; import java.util.List; -import java.util.function.Function; +import java.util.function.UnaryOperator; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -15,10 +15,10 @@ */ public class PatternPreProcessingProvider implements StepInvokerProvider { - private final Function patternProcessingFunction; + private final UnaryOperator patternProcessingFunction; private final StepInvokerProvider wrappedProvider; - public PatternPreProcessingProvider(Function patternProcessingFunction, StepInvokerProvider wrappedProvider) { + public PatternPreProcessingProvider(UnaryOperator patternProcessingFunction, StepInvokerProvider wrappedProvider) { this.patternProcessingFunction = patternProcessingFunction; this.wrappedProvider = wrappedProvider; } @@ -35,7 +35,7 @@ private static final class StepInvokerPatternWrapper extends StepInvokerWrapper private final Pattern processedPattern; - public StepInvokerPatternWrapper(StepInvoker wrappedInvoker, Function patternFunction) { + public StepInvokerPatternWrapper(StepInvoker wrappedInvoker, UnaryOperator patternFunction) { super(wrappedInvoker); this.processedPattern = patternFunction.apply(wrappedInvoker.getStepPattern()); }