diff --git a/Junit/src/main/java/com/technophobia/substeps/runner/IJunitNotifier.java b/Junit/src/main/java/com/technophobia/substeps/runner/IJunitNotifier.java index 8eb0fb4..09eb1f7 100644 --- a/Junit/src/main/java/com/technophobia/substeps/runner/IJunitNotifier.java +++ b/Junit/src/main/java/com/technophobia/substeps/runner/IJunitNotifier.java @@ -27,33 +27,18 @@ * @author ian * */ -public interface IJunitNotifier extends INotifier { - // - // void notifyTestStarted(final Description junitDescription); - // - // - // void notifyTestFinished(final Description junitDescription); - // - // - // void notifyTestFailed(final Description junitDescription, final Throwable - // cause); - // - // - // void notifyTestIgnored(Description junitDescription); - // +public interface IJunitNotifier extends IExecutionListener { /** * @param junitNotifier */ void setJunitRunNotifier(RunNotifier junitNotifier); - /** * @param descriptionMap */ void setDescriptionMap(Map descriptionMap); - /** * */ diff --git a/Junit/src/main/java/com/technophobia/substeps/runner/JunitNotifier.java b/Junit/src/main/java/com/technophobia/substeps/runner/JunitNotifier.java index 702887a..fe0c5a7 100644 --- a/Junit/src/main/java/com/technophobia/substeps/runner/JunitNotifier.java +++ b/Junit/src/main/java/com/technophobia/substeps/runner/JunitNotifier.java @@ -120,7 +120,7 @@ public void setDescriptionMap(final Map descriptionMap) { * (com.technophobia.substeps.execution.ExecutionNode, java.lang.Throwable) */ - public void notifyNodeFailed(final IExecutionNode node, final Throwable cause) { + public void onNodeFailed(final IExecutionNode node, final Throwable cause) { final Description description = descriptionMap.get(Long.valueOf(node.getId())); notifyTestFailed(description, cause); @@ -135,7 +135,7 @@ public void notifyNodeFailed(final IExecutionNode node, final Throwable cause) { * (com.technophobia.substeps.execution.ExecutionNode) */ - public void notifyNodeStarted(final IExecutionNode node) { + public void onNodeStarted(final IExecutionNode node) { final Description description = descriptionMap.get(Long.valueOf(node.getId())); @@ -154,7 +154,7 @@ public void notifyNodeStarted(final IExecutionNode node) { * (com.technophobia.substeps.execution.ExecutionNode) */ - public void notifyNodeFinished(final IExecutionNode node) { + public void onNodeFinished(final IExecutionNode node) { final Description description = descriptionMap.get(Long.valueOf(node.getId())); notifyTestFinished(description); @@ -169,7 +169,7 @@ public void notifyNodeFinished(final IExecutionNode node) { * (com.technophobia.substeps.execution.ExecutionNode) */ - public void notifyNodeIgnored(final IExecutionNode node) { + public void onNodeIgnored(final IExecutionNode node) { final Description description = descriptionMap.get(Long.valueOf(node.getId())); notifyTestIgnored(description); diff --git a/Junit/src/test/java/com/technophobia/substeps/runner/TestNotifier.java b/Junit/src/test/java/com/technophobia/substeps/runner/TestNotifier.java index d22f077..095ea9c 100644 --- a/Junit/src/test/java/com/technophobia/substeps/runner/TestNotifier.java +++ b/Junit/src/test/java/com/technophobia/substeps/runner/TestNotifier.java @@ -119,7 +119,7 @@ public void notifyTestIgnored(final Description des) { * uk.co.itmoore.bddrunner.runner.INotifier#notifyTestFailed(uk.co.itmoore * .bddrunner.execution.ExecutionNode, java.lang.Throwable) */ - public void notifyTestFailed(final IExecutionNode rootNode, final Throwable cause) { + public void onTestFailed(final IExecutionNode rootNode, final Throwable cause) { } @@ -130,7 +130,7 @@ public void notifyTestFailed(final IExecutionNode rootNode, final Throwable caus * uk.co.itmoore.bddrunner.runner.INotifier#notifyTestStarted(uk.co.itmoore * .bddrunner.execution.ExecutionNode) */ - public void notifyTestStarted(final IExecutionNode node) { + public void onTestStarted(final IExecutionNode node) { } @@ -141,7 +141,7 @@ public void notifyTestStarted(final IExecutionNode node) { * uk.co.itmoore.bddrunner.runner.INotifier#notifyTestFinished(uk.co.itmoore * .bddrunner.execution.ExecutionNode) */ - public void notifyTestFinished(final IExecutionNode node) { + public void onTestFinished(final IExecutionNode node) { } @@ -163,7 +163,7 @@ public void setDescriptionMap(final Map descriptionMap) { * uk.co.itmoore.bddrunner.runner.INotifier#addListener(uk.co.itmoore.bddrunner * .runner.INotifier) */ - public void addListener(final INotifier listener) { + public void addListener(final IExecutionListener listener) { } @@ -174,7 +174,7 @@ public void addListener(final INotifier listener) { * com.technophobia.substeps.runner.INotifier#notifyTestIgnored(com.technophobia * .substeps.execution.ExecutionNode) */ - public void notifyTestIgnored(final IExecutionNode node) { + public void onTestIgnored(final IExecutionNode node) { } @@ -185,7 +185,7 @@ public void notifyTestIgnored(final IExecutionNode node) { * com.technophobia.substeps.runner.INotifier#notifyNodeFailed(com.technophobia * .substeps.execution.ExecutionNode, java.lang.Throwable) */ - public void notifyNodeFailed(final IExecutionNode rootNode, final Throwable cause) { + public void onNodeFailed(final IExecutionNode rootNode, final Throwable cause) { } @@ -196,7 +196,7 @@ public void notifyNodeFailed(final IExecutionNode rootNode, final Throwable caus * com.technophobia.substeps.runner.INotifier#notifyNodeStarted(com.technophobia * .substeps.execution.ExecutionNode) */ - public void notifyNodeStarted(final IExecutionNode node) { + public void onNodeStarted(final IExecutionNode node) { } @@ -206,7 +206,7 @@ public void notifyNodeStarted(final IExecutionNode node) { * @see com.technophobia.substeps.runner.INotifier#notifyNodeFinished(com. * technophobia.substeps.execution.ExecutionNode) */ - public void notifyNodeFinished(final IExecutionNode node) { + public void onNodeFinished(final IExecutionNode node) { } @@ -217,7 +217,7 @@ public void notifyNodeFinished(final IExecutionNode node) { * com.technophobia.substeps.runner.INotifier#notifyNodeIgnored(com.technophobia * .substeps.execution.ExecutionNode) */ - public void notifyNodeIgnored(final IExecutionNode node) { + public void onNodeIgnored(final IExecutionNode node) { } diff --git a/Maven/src/main/java/com/technophobia/substeps/runner/ExecutionConfig.java b/Maven/src/main/java/com/technophobia/substeps/runner/ExecutionConfig.java index 57a78b7..2b18498 100644 --- a/Maven/src/main/java/com/technophobia/substeps/runner/ExecutionConfig.java +++ b/Maven/src/main/java/com/technophobia/substeps/runner/ExecutionConfig.java @@ -85,7 +85,7 @@ public class ExecutionConfig { * @parameter default-value=true * @required */ - private boolean strict = true; + private final boolean strict = true; /** * If true any parse errors will fail the build immediately, rather than @@ -95,7 +95,7 @@ public class ExecutionConfig { * @parameter default-value=true * @required */ - private boolean fastFailParseErrors = true; + private final boolean fastFailParseErrors = true; /** * @parameter @@ -131,29 +131,41 @@ public class ExecutionConfig { */ private String[] initialisationClass; + /** + * + * + * + * Class that implements INotifier will be called to notify of execution + * events + * + * @parameter + * @required + */ + private String[] executionListeners; + public SubstepsExecutionConfig asSubstepsExecutionConfig() throws MojoExecutionException { try { - SubstepsExecutionConfig executionConfig = new SubstepsExecutionConfig(); + final SubstepsExecutionConfig executionConfig = new SubstepsExecutionConfig(); reflectivelySetFields(executionConfig); return executionConfig; - } catch (Exception exception) { + } catch (final Exception exception) { throw new MojoExecutionException("Unable to convert " + ExecutionConfig.class.getName() + " into " + SubstepsExecutionConfig.class.getName(), exception); } } - private void reflectivelySetFields(SubstepsExecutionConfig executionConfig) throws NoSuchFieldException, + private void reflectivelySetFields(final SubstepsExecutionConfig executionConfig) throws NoSuchFieldException, IllegalAccessException { - for (Field mojoField : ExecutionConfig.class.getDeclaredFields()) { + for (final Field mojoField : ExecutionConfig.class.getDeclaredFields()) { if (!Modifier.isFinal(mojoField.getModifiers())) { - Field executionConfigField = SubstepsExecutionConfig.class.getDeclaredField(mojoField.getName()); + final Field executionConfigField = SubstepsExecutionConfig.class.getDeclaredField(mojoField.getName()); executionConfigField.setAccessible(true); executionConfigField.set(executionConfig, mojoField.get(this)); } diff --git a/Maven/src/main/java/com/technophobia/substeps/runner/ForkedRunner.java b/Maven/src/main/java/com/technophobia/substeps/runner/ForkedRunner.java index ee54558..402dd0b 100644 --- a/Maven/src/main/java/com/technophobia/substeps/runner/ForkedRunner.java +++ b/Maven/src/main/java/com/technophobia/substeps/runner/ForkedRunner.java @@ -80,7 +80,6 @@ public class ForkedRunner implements MojoRunner { private final InputStreamConsumer consumer; - ForkedRunner(final Log log, final int jmxPort, final String vmArgs, final List testClasspathElements, final List stepImplementationArtifacts, final ArtifactResolver artifactResolver, final ArtifactFactory artifactFactory, final MavenProjectBuilder mavenProjectBuilder, @@ -106,13 +105,11 @@ public class ForkedRunner implements MojoRunner { initialiseClient(); } - private void initialiseClient() throws MojoExecutionException { this.substepsJmxClient.init(this.jmxPort); } - public void shutdown() { this.substepsJmxClient.shutdown(); @@ -143,7 +140,6 @@ public void shutdown() { } - private InputStreamConsumer startMBeanJVM() throws MojoExecutionException { // launch the jvm process that will contain the Substeps MBean Server // build up the class path based on this projects classpath @@ -198,7 +194,6 @@ private InputStreamConsumer startMBeanJVM() throws MojoExecutionException { return localConsumer; } - /** * @param cpBuf * @return @@ -248,7 +243,6 @@ private List buildSubstepsRunnerCommand() throws MojoExecutionException return command; } - @SuppressWarnings("unchecked") private void addCurrentVmArgs(final List command) { @@ -259,7 +253,6 @@ private void addCurrentVmArgs(final List command) { } - private String createClasspathString() throws MojoExecutionException { final List classPathElements = Lists.newArrayList(); @@ -270,7 +263,6 @@ private String createClasspathString() throws MojoExecutionException { return Joiner.on(File.pathSeparator).join(classPathElements); } - @SuppressWarnings("unchecked") private List resolveStepImplementationArtifacts() throws MojoExecutionException { @@ -337,36 +329,31 @@ private List resolveStepImplementationArtifacts() throws MojoExecutionEx return stepImplementationArtifactJars; } - private void addArtifactPath(final List stepImplementationArtifactJars, final Artifact artifact) { final String path = artifact.getFile().getPath(); this.log.info("Adding dependency to classpath for forked jvm: " + path); stepImplementationArtifactJars.add(path); } - public RootNode prepareExecutionConfig(final SubstepsExecutionConfig theConfig) { return this.substepsJmxClient.prepareExecutionConfig(theConfig); } - public RootNode run() { this.log.info("Running substeps tests in forked jvm"); return this.substepsJmxClient.run(); } - public List getFailures() { return this.substepsJmxClient.getFailures(); } + public void addNotifier(final IExecutionListener listener) { - public void addNotifier(final INotifier notifier) { - - this.substepsJmxClient.addNotifier(notifier); + this.substepsJmxClient.addNotifier(listener); } } diff --git a/Maven/src/main/java/com/technophobia/substeps/runner/InProcessRunner.java b/Maven/src/main/java/com/technophobia/substeps/runner/InProcessRunner.java index 329fe37..1fd6fc0 100644 --- a/Maven/src/main/java/com/technophobia/substeps/runner/InProcessRunner.java +++ b/Maven/src/main/java/com/technophobia/substeps/runner/InProcessRunner.java @@ -29,7 +29,7 @@ public class InProcessRunner implements MojoRunner { SubstepsRunner executionNodeRunner = ExecutionNodeRunnerFactory.createRunner(); private final Log log; - InProcessRunner(Log log) { + InProcessRunner(final Log log) { this.log = log; } @@ -39,7 +39,7 @@ public RootNode run() { return executionNodeRunner.run(); } - public RootNode prepareExecutionConfig(SubstepsExecutionConfig theConfig) { + public RootNode prepareExecutionConfig(final SubstepsExecutionConfig theConfig) { return executionNodeRunner.prepareExecutionConfig(theConfig); } @@ -48,8 +48,8 @@ public List getFailures() { return executionNodeRunner.getFailures(); } - public void addNotifier(INotifier notifier) { - executionNodeRunner.addNotifier(notifier); + public void addNotifier(final IExecutionListener listener) { + executionNodeRunner.addNotifier(listener); } public void shutdown() { diff --git a/Maven/src/main/java/com/technophobia/substeps/runner/SubstepsJMXClient.java b/Maven/src/main/java/com/technophobia/substeps/runner/SubstepsJMXClient.java index 7092752..09a56b0 100644 --- a/Maven/src/main/java/com/technophobia/substeps/runner/SubstepsJMXClient.java +++ b/Maven/src/main/java/com/technophobia/substeps/runner/SubstepsJMXClient.java @@ -74,10 +74,10 @@ public void init(final int portNumber) throws MojoExecutionException { throw new MojoExecutionException("Failed to connect to substeps server", e); - } catch (NullPointerException e) { + } catch (final NullPointerException e) { throw new MojoExecutionException("Failed to connect to substeps server", e); - } catch (MalformedObjectNameException e) { + } catch (final MalformedObjectNameException e) { throw new MojoExecutionException("Failed to connect to substeps server", e); } @@ -99,9 +99,9 @@ public RootNode run() { return this.mbean.run(); } - public void addNotifier(INotifier notifier) { + public void addNotifier(final IExecutionListener listener) { - this.mbean.addNotifier(notifier); + this.mbean.addNotifier(listener); } public boolean shutdown() { @@ -112,7 +112,7 @@ public boolean shutdown() { this.mbean.shutdown(); successfulShutdown = true; - } catch (RuntimeException re) { + } catch (final RuntimeException re) { this.log.debug("Unable to connect to server to shutdown, it may have already closed"); diff --git a/README.md b/README.md index 4fa9ff9..746c351 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,13 @@ There is also a [Substeps Google group](http://groups.google.com/group/substeps? Release Notes ============= +1.1.3 +----- +* Changes to support ExecutionListener refactoring in core and api projects + +1.1.2 +----- +* version number bump in line with other substeps libraries 1.1.1 ----- diff --git a/pom.xml b/pom.xml index 4cafbf4..f025bec 100755 --- a/pom.xml +++ b/pom.xml @@ -21,8 +21,8 @@ - 1.1.2 - 1.1.2 + 1.1.3-SNAPSHOT + 1.1.3-SNAPSHOT 10.0 UTF-8