Skip to content

Commit

Permalink
Remove old style remoting
Browse files Browse the repository at this point in the history
  • Loading branch information
nickebbutt committed Apr 20, 2018
1 parent 666e437 commit 2eccac8
Show file tree
Hide file tree
Showing 26 changed files with 141 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
And I connect to the process named remotePolled
When call a passes within step method remotely it can be terminated immediately by FailImmediatelyException
Original file line number Diff line number Diff line change
Expand Up @@ -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: <system specific process details replaced>
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: <system specific process details replaced>
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: <system specific process details replaced>
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
Expand All @@ -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: <system specific process details replaced>
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)
Steps (total:31) (passed:22) (failed:8) (undefined:0) (pending:0) (skipped:1)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Pattern> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
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



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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ Chorus --> INFO - About to run process: <system specific process details rep
First I start a featurescopedone process PASSED
Scenario: I can call the process in scenario one
Chorus --> 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: <system specific process details replaced>
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)
Steps (total:7) (passed:7) (failed:0) (undefined:0) (pending:0) (skipped:0)
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: <system specific process details replaced>
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: <system specific process details replaced>
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)
Steps (total:10) (passed:8) (failed:1) (undefined:0) (pending:0) (skipped:1)
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Chorus --> INFO - Processing scenario: Config Properties Override Main Proper
Chorus --> INFO - About to run process: <system specific process details replaced>
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
Expand All @@ -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: <system specific process details replaced>
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)
Steps (total:6) (passed:4) (failed:1) (undefined:0) (pending:0) (skipped:1)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Pattern> 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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading

0 comments on commit 2eccac8

Please sign in to comment.