Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
iantmoore committed Oct 28, 2013
2 parents 886d97d + b587a39 commit 10f7f9e
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Ant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>com.technophobia.substeps</groupId>
<artifactId>substeps-runner-parent</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
</parent>

<name>SubSteps Ant Runner</name>
Expand Down
2 changes: 1 addition & 1 deletion Common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>com.technophobia.substeps</groupId>
<artifactId>substeps-runner-parent</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
</parent>

<name>SubSteps Runner Common</name>
Expand Down
2 changes: 1 addition & 1 deletion Junit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>com.technophobia.substeps</groupId>
<artifactId>substeps-runner-parent</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
</parent>

<name>SubSteps JUnit Runner</name>
Expand Down
2 changes: 1 addition & 1 deletion Maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.technophobia.substeps</groupId>
<artifactId>substeps-runner-parent</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private InputStreamConsumer startMBeanJVM() throws MojoExecutionException {
final CountDownLatch processStarted = new CountDownLatch(1);
final AtomicBoolean processStartedOk = new AtomicBoolean(false);

InputStreamConsumer consumer = null;
InputStreamConsumer localConsumer = null;

final List<String> command = buildSubstepsRunnerCommand();

Expand All @@ -168,10 +168,10 @@ private InputStreamConsumer startMBeanJVM() throws MojoExecutionException {
// need to add the shutdown hook straight away
this.shutdownHook = ForkedProcessCloser.addHook(this.substepsJmxClient, this.forkedJVMProcess, this.log);

consumer = new InputStreamConsumer(this.forkedJVMProcess.getInputStream(), this.log, processStarted,
localConsumer = new InputStreamConsumer(this.forkedJVMProcess.getInputStream(), this.log, processStarted,
processStartedOk);

final Thread t = new Thread(consumer);
final Thread t = new Thread(this.consumer);
t.start();

} catch (final IOException e) {
Expand All @@ -195,7 +195,7 @@ private InputStreamConsumer startMBeanJVM() throws MojoExecutionException {
e.printStackTrace();
}

return consumer;
return localConsumer;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public class SubstepsRunnerMojo extends AbstractMojo {

private MojoRunner runner;


public void execute() throws MojoExecutionException, MojoFailureException {

assertCompatibleCoreVersion();
Expand All @@ -156,52 +157,65 @@ public void execute() throws MojoExecutionException, MojoFailureException {

processBuildData();

runner.shutdown();
this.runner.shutdown();
}


private void assertCompatibleCoreVersion() throws MojoExecutionException {

CoreVersionChecker.assertCompatibleVersion(getLog(), artifactFactory, artifactResolver, remoteRepositories,
localRepository, mavenProjectBuilder, project, pluginDependencies);
CoreVersionChecker.assertCompatibleVersion(getLog(), this.artifactFactory, this.artifactResolver,
this.remoteRepositories, this.localRepository, this.mavenProjectBuilder, this.project,
this.pluginDependencies);
}


private ForkedRunner createForkedRunner() throws MojoExecutionException {

try {

return new ForkedRunner(getLog(), jmxPort, vmArgs, project.getTestClasspathElements(),
stepImplementationArtifacts, artifactResolver, artifactFactory, mavenProjectBuilder,
localRepository, remoteRepositories, artifactMetadataSource);
} catch (DependencyResolutionRequiredException e) {
return new ForkedRunner(getLog(), this.jmxPort, this.vmArgs, this.project.getTestClasspathElements(),
this.stepImplementationArtifacts, this.artifactResolver, this.artifactFactory,
this.mavenProjectBuilder, this.localRepository, this.remoteRepositories,
this.artifactMetadataSource);
} catch (final DependencyResolutionRequiredException e) {

throw new MojoExecutionException("Unable to resolve dependencies", e);
}
}


private InProcessRunner createInProcessRunner() {

return new InProcessRunner(getLog());
}


private void executeConfigs() throws MojoExecutionException {

if (executionConfigs == null || executionConfigs.isEmpty()) {
if (this.executionConfigs == null || this.executionConfigs.isEmpty()) {

throw new MojoExecutionException("executionConfigs cannot be null or empty");
}

for (final ExecutionConfig executionConfig : executionConfigs) {
try {
for (final ExecutionConfig executionConfig : this.executionConfigs) {

runExecutionConfig(executionConfig);
}
runExecutionConfig(executionConfig);
}
} catch (final Throwable t) {

// to cater for any odd exceptions thrown out.. at least this way
// jvm shouldn't just die, unless it was going to die anyway
throw new MojoExecutionException("Unhandled exception: " + t.getMessage(), t);
}
}


private void runExecutionConfig(final ExecutionConfig theConfig) throws MojoExecutionException {

runner.prepareExecutionConfig(theConfig.asSubstepsExecutionConfig());
this.runner.prepareExecutionConfig(theConfig.asSubstepsExecutionConfig());

RootNode rootNode = runner.run();
final RootNode rootNode = this.runner.run();

if (theConfig.getDescription() != null) {

Expand All @@ -213,13 +227,15 @@ private void runExecutionConfig(final ExecutionConfig theConfig) throws MojoExec
this.buildFailureManager.addExecutionResult(rootNode);
}

private void addToReport(RootNode rootNode) {

if (executionReportBuilder != null) {
executionReportBuilder.addRootExecutionNode(rootNode);
private void addToReport(final RootNode rootNode) {

if (this.executionReportBuilder != null) {
this.executionReportBuilder.addRootExecutionNode(rootNode);
}
}


/**
* @param data
* @throws MojoFailureException
Expand All @@ -241,14 +257,17 @@ private void processBuildData() throws MojoFailureException {
}
}


private void ensureValidConfiguration() throws MojoExecutionException {

ensureForkedIfStepImplementationArtifactsSpecified();
}


private void ensureForkedIfStepImplementationArtifactsSpecified() throws MojoExecutionException {

if (stepImplementationArtifacts != null && !stepImplementationArtifacts.isEmpty() && !runTestsInForkedVM) {
if (this.stepImplementationArtifacts != null && !this.stepImplementationArtifacts.isEmpty()
&& !this.runTestsInForkedVM) {
throw new MojoExecutionException(
"Invalid configuration of substeps runner, if stepImplementationArtifacts are specified runTestsInForkedVM must be true");
}
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ Runners to execute substeps, currently includes an ANT runner, a Maven plugin an
Substeps documentation can be found [here](http://substeps.technophobia.com/ "Substeps documentation").

There is also a [Substeps Google group](http://groups.google.com/group/substeps?hl=en-GB "Substeps Google group") if you have any queries and where new releases will ne announced.

Release Notes
=============

1.1.1
-----
* A 'Catch all' in the Maven runner to handle hidden exceptions in spawned VMs
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>com.technophobia.substeps</groupId>
<artifactId>substeps-runner-parent</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>pom</packaging>

<!-- for OSS hosting -->
Expand All @@ -21,8 +21,8 @@
</modules>

<properties>
<substeps.core.version>1.1.0</substeps.core.version>
<substeps.api.version>1.1.0</substeps.api.version>
<substeps.core.version>1.1.1</substeps.core.version>
<substeps.api.version>1.1.1</substeps.api.version>

<guava.version>10.0</guava.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -263,6 +263,7 @@
<connection>${substeps-runner.scm}</connection>
<developerConnection>${substeps-runner.scm}</developerConnection>
<url>${substeps-runner.scm.url}</url>
</scm>
<tag>HEAD</tag>
</scm>

</project>

0 comments on commit 10f7f9e

Please sign in to comment.