- Revision
- 960
- Author
- mauro
- Date
- 2008-10-02 05:41:37 -0500 (Thu, 02 Oct 2008)
Log Message
Added example of scenarios being run via Ant task.
Modified Paths
- trunk/examples/pom.xml
- trunk/examples/trader/pom.xml
- trunk/examples/trader/src/main/java/org/jbehave/examples/trader/container/TraderContainer.java
- trunk/jbehave-ant/src/main/java/org/jbehave/ant/AbstractScenarioTask.java
Diff
Modified: trunk/examples/pom.xml (959 => 960)
--- trunk/examples/pom.xml 2008-10-02 08:14:35 UTC (rev 959) +++ trunk/examples/pom.xml 2008-10-02 10:41:37 UTC (rev 960) @@ -24,6 +24,11 @@ <artifactId>jbehave-core</artifactId> <version>${pom.version}</version> </dependency> + <dependency> + <groupId>org.jbehave</groupId> + <artifactId>jbehave-ant</artifactId> + <version>${pom.version}</version> + </dependency> </dependencies> <build>
Modified: trunk/examples/trader/pom.xml (959 => 960)
--- trunk/examples/trader/pom.xml 2008-10-02 08:14:35 UTC (rev 959) +++ trunk/examples/trader/pom.xml 2008-10-02 10:41:37 UTC (rev 960) @@ -51,6 +51,7 @@ <scenarioExcludes> <scenarioExclude>**/*Steps.java</scenarioExclude> </scenarioExcludes> + <skip>true</skip> </configuration> <goals> <goal>run-scenarios</goal> @@ -58,6 +59,30 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>run-scenarios-via-ant</id> + <phase>integration-test</phase> + <configuration> + <tasks> + <property name="runtime_classpath" refid="maven.runtime.classpath" /> + <echo message="Using runtime classpath: ${runtime_classpath}" /> + <taskdef name="scenarioRunner" classname="org.jbehave.ant.ScenarioRunnerTask" classpathref="maven.runtime.classpath" /> + <scenarioRunner scenarioIncludes="org/jbehave/examples/trader/scenarios/*.java" + scenarioExcludes="**/*Steps.java" skip="false" /> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + </plugins> </build> </project> \ No newline at end of file
Modified: trunk/examples/trader/src/main/java/org/jbehave/examples/trader/container/TraderContainer.java (959 => 960)
--- trunk/examples/trader/src/main/java/org/jbehave/examples/trader/container/TraderContainer.java 2008-10-02 08:14:35 UTC (rev 959) +++ trunk/examples/trader/src/main/java/org/jbehave/examples/trader/container/TraderContainer.java 2008-10-02 10:41:37 UTC (rev 960) @@ -1,9 +1,12 @@ package org.jbehave.examples.trader.container; +import org.jbehave.container.pico.XMLPicoContainer; + //FIXME there are classloading issues (only using maven plugin) if TraderContainer extends the XMLPicoContainer cointained in core +//If the scenarios are run as Ant tasks, injecting in the taskdef the maven.runtime.classpath, it works fine //Not quite sure what the root cause is - need more investigation. -public class TraderContainer extends XMLContainer { +public class TraderContainer extends XMLPicoContainer { public TraderContainer(ClassLoader classLoader) { super("org/jbehave/examples/trader/container/trader.xml", classLoader);
Modified: trunk/jbehave-ant/src/main/java/org/jbehave/ant/AbstractScenarioTask.java (959 => 960)
--- trunk/jbehave-ant/src/main/java/org/jbehave/ant/AbstractScenarioTask.java 2008-10-02 08:14:35 UTC (rev 959) +++ trunk/jbehave-ant/src/main/java/org/jbehave/ant/AbstractScenarioTask.java 2008-10-02 10:41:37 UTC (rev 960) @@ -1,7 +1,7 @@ package org.jbehave.ant; import static java.util.Arrays.asList; -import static org.apache.tools.ant.Project.MSG_INFO; +import static org.apache.tools.ant.Project.*; import java.net.MalformedURLException; import java.util.ArrayList; @@ -93,9 +93,9 @@ private List<String> classpathElements() { CommandlineJava commandLine = new CommandlineJava(); - Path path = commandLine.createClasspath(getProject()).createPath(); + Path path = commandLine.createClasspath(getProject()); List<String> classpathElements = asList(path.list()); - log("Created classpath with elements "+classpathElements, MSG_INFO); + log("Created classpath with elements " + classpathElements, MSG_DEBUG); return classpathElements; } @@ -145,16 +145,16 @@ this.scope = scope; } - public void setScenarioClassNames(List<String> scenarioClassNames) { - this.scenarioClassNames = scenarioClassNames; + public void setScenarioClassNames(String scenarioClassNamesCSV) { + this.scenarioClassNames = asList(scenarioClassNamesCSV.split(",")); } - public void setScenarioIncludes(List<String> scenarioIncludes) { - this.scenarioIncludes = scenarioIncludes; + public void setScenarioIncludes(String scenarioIncludesCSV) { + this.scenarioIncludes = asList(scenarioIncludesCSV.split(",")); } - public void setScenarioExcludes(List<String> scenarioExcludes) { - this.scenarioExcludes = scenarioExcludes; + public void setScenarioExcludes(String scenarioExcludesCSV) { + this.scenarioExcludes = asList(scenarioExcludesCSV.split(",")); } }
To unsubscribe from this list please visit:
