Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: cucumber/cucumber-jvm
...
head fork: cucumber/cucumber-jvm
  • 15 commits
  • 40 files changed
  • 0 commit comments
  • 4 contributors
Showing with 168 additions and 228 deletions.
  1. +8 −0 History.md
  2. +2 −2 README.md
  3. +1 −1  clojure/pom.xml
  4. +1 −1  core/pom.xml
  5. +5 −7 core/src/main/java/cucumber/io/ClasspathIterable.java
  6. +9 −7 core/src/main/java/cucumber/io/ClasspathResourceLoader.java
  7. +4 −4 core/src/main/java/cucumber/runtime/Runtime.java
  8. +7 −7 core/src/main/java/cucumber/runtime/Utils.java
  9. +6 −5 core/src/main/java/cucumber/runtime/model/CucumberScenario.java
  10. +2 −2 core/src/main/java/cucumber/runtime/model/CucumberScenarioOutline.java
  11. +1 −1  core/src/main/java/cucumber/runtime/model/CucumberTagStatement.java
  12. +4 −4 core/src/main/java/cucumber/runtime/model/StepContainer.java
  13. +8 −0 core/src/main/java/cucumber/runtime/model/StepRunner.java
  14. +39 −0 core/src/test/java/cucumber/io/ClasspathIterableTest.java
  15. +1 −1  core/src/test/java/cucumber/runtime/HookTest.java
  16. +3 −4 groovy/pom.xml
  17. +0 −46 groovy/src/main/java/cucumber/runtime/groovy/.gitignore
  18. +1 −1  guice/pom.xml
  19. +1 −1  ioke/pom.xml
  20. +3 −4 java/pom.xml
  21. +0 −45 java/src/main/java/cucumber/annotation/.gitignore
  22. +5 −9 java/src/main/java/cucumber/runtime/java/ClasspathMethodScanner.java
  23. +1 −1  java/src/main/java/cucumber/runtime/java/JavaBackend.java
  24. +1 −1  jruby/pom.xml
  25. +7 −5 jruby/src/main/java/cucumber/runtime/jruby/JRubyBackend.java
  26. +1 −1  junit/pom.xml
  27. +3 −3 junit/src/main/java/cucumber/junit/Cucumber.java
  28. +3 −2 junit/src/main/java/cucumber/junit/ExamplesRunner.java
  29. +9 −19 junit/src/main/java/cucumber/junit/ExecutionUnitRunner.java
  30. +2 −4 junit/src/main/java/cucumber/junit/FeatureRunner.java
  31. +0 −1  junit/src/main/java/cucumber/junit/JUnitReporter.java
  32. +2 −3 junit/src/main/java/cucumber/junit/ScenarioOutlineRunner.java
  33. +1 −1  jython/pom.xml
  34. +16 −2 picocontainer/pom.xml
  35. +3 −3 pom.xml
  36. +1 −1  rhino/pom.xml
  37. +5 −26 scala/pom.xml
  38. +0 −1  scala/src/main/scala/cucumber/runtime/.gitignore
  39. +1 −1  spring/pom.xml
  40. +1 −1  weld/pom.xml
8 History.md
View
@@ -1,3 +1,11 @@
+## [1.0.0.RC12](https://github.com/cucumber/cucumber-jvm/compare/v1.0.0.RC11...v1.0.0.RC12)
+
+* [JUnit] Tagged hooks are executed properly (Aslak Hellesøy)
+* [JRuby] Better support for World blocks ([#166](https://github.com/cucumber/cucumber-jvm/pull/166) David Kowis)
+* [Java] GluePath can be a package name ([#164](https://github.com/cucumber/cucumber-jvm/issues/164) Aslak Hellesøy)
+* [Build] Fixed subtle path issues on Windows
+* [Build] Fixed Build Failure: Cucumber-JVM: Scala (FAILURE) ([#167](https://github.com/cucumber/cucumber-jvm/issues/167) Aslak Hellesøy)
+
## [1.0.0.RC11](https://github.com/cucumber/cucumber-jvm/compare/v1.0.0.RC6...v1.0.0.RC11)
* [Build] The build is Maven-based again. It turned out to be the best choice.
4 README.md
View
@@ -38,7 +38,7 @@ Add a dependency in your [POM](http://maven.apache.org/pom.html):
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
- <version>1.0.0.RC6</version>
+ <version>1.0.0.RC11</version>
</dependency>
```
@@ -60,7 +60,7 @@ Alternatively you can define your own resolver:
m2compatible="true"
usepoms="true"
pattern="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
- root="https://oss.sonatype.org/content/repositories/releases/info/cukes/"/>
+ root="https://oss.sonatype.org/content/repositories/releases"/>
```
## Documentation
2  clojure/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-clojure</artifactId>
2  core/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-core</artifactId>
12 core/src/main/java/cucumber/io/ClasspathIterable.java
View
@@ -5,6 +5,7 @@
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.Enumeration;
@@ -29,7 +30,7 @@ public ClasspathIterable(ClassLoader cl, String path, String suffix) {
while (resources.hasMoreElements()) {
URL url = resources.nextElement();
if (url.getProtocol().equals("jar")) {
- String jarPath = filePath(url.toExternalForm());
+ String jarPath = filePath(url);
iterator.push(new ZipResourceIterator(jarPath, path, suffix));
} else {
File file = new File(getPath(url));
@@ -43,12 +44,9 @@ public ClasspathIterable(ClassLoader cl, String path, String suffix) {
}
}
- static String filePath(String jarUrl) throws UnsupportedEncodingException {
- String pathWithProtocol = jarUrl.substring(0, jarUrl.indexOf("!/"));
- String[] segments = pathWithProtocol.split(":");
- // WINDOWS: jar:file:/C:/Users/ahellesoy/scm/cucumber-jvm/java/target/java-1.0.0-SNAPSHOT.jar
- // POSIX: jar:file:/Users/ahellesoy/scm/cucumber-jvm/java/target/java-1.0.0-SNAPSHOT.jar
- String pathToJar = segments.length == 4 ? segments[2].substring(1) + ":" + segments[3] : segments[2];
+ static String filePath(URL jarUrl) throws UnsupportedEncodingException, MalformedURLException {
+ String path = new File(new URL(jarUrl.getFile()).getFile()).getAbsolutePath();
+ String pathToJar = path.substring(0, path.indexOf("!"));
return URLDecoder.decode(pathToJar, "UTF-8");
}
16 core/src/main/java/cucumber/io/ClasspathResourceLoader.java
View
@@ -3,6 +3,7 @@
import cucumber.runtime.CucumberException;
import cucumber.runtime.Utils;
+import java.io.File;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
@@ -20,11 +21,12 @@ public ClasspathResourceLoader(ClassLoader classLoader) {
return new ClasspathIterable(classLoader, path, suffix);
}
- public Collection<Class<? extends Annotation>> getAnnotations(String packagePath) {
- return getDescendants(Annotation.class, packagePath);
+ public Collection<Class<? extends Annotation>> getAnnotations(String packageName) {
+ return getDescendants(Annotation.class, packageName);
}
- public <T> Collection<Class<? extends T>> getDescendants(Class<T> parentType, String packagePath) {
+ public <T> Collection<Class<? extends T>> getDescendants(Class<T> parentType, String packageName) {
+ String packagePath = packageName.replace('.', '/').replace(File.separatorChar, '/');
Collection<Class<? extends T>> result = new HashSet<Class<? extends T>>();
for (Resource classResource : resources(packagePath, ".class")) {
String className = classResource.getClassName();
@@ -36,8 +38,8 @@ public ClasspathResourceLoader(ClassLoader classLoader) {
return result;
}
- public <T> T instantiateExactlyOneSubclass(Class<T> parentType, String packagePath, Class[] constructorParams, Object[] constructorArgs) {
- Collection<? extends T> instances = instantiateSubclasses(parentType, packagePath, constructorParams, constructorArgs);
+ public <T> T instantiateExactlyOneSubclass(Class<T> parentType, String packageName, Class[] constructorParams, Object[] constructorArgs) {
+ Collection<? extends T> instances = instantiateSubclasses(parentType, packageName, constructorParams, constructorArgs);
if (instances.size() == 1) {
return instances.iterator().next();
} else if (instances.size() == 0) {
@@ -47,9 +49,9 @@ public ClasspathResourceLoader(ClassLoader classLoader) {
}
}
- public <T> Collection<? extends T> instantiateSubclasses(Class<T> parentType, String packagePath, Class[] constructorParams, Object[] constructorArgs) {
+ public <T> Collection<? extends T> instantiateSubclasses(Class<T> parentType, String packageName, Class[] constructorParams, Object[] constructorArgs) {
Collection<T> result = new HashSet<T>();
- for (Class<? extends T> clazz : getDescendants(parentType, packagePath)) {
+ for (Class<? extends T> clazz : getDescendants(parentType, packageName)) {
if (Utils.isInstantiable(clazz) && Utils.hasConstructor(clazz, constructorParams)) {
result.add(newInstance(constructorParams, constructorArgs, clazz));
}
8 core/src/main/java/cucumber/runtime/Runtime.java
View
@@ -65,7 +65,7 @@ public Runtime(ResourceLoader resourceLoader, List<String> gluePaths, ClassLoade
}
private static Collection<? extends Backend> loadBackends(ResourceLoader resourceLoader, ClassLoader classLoader) {
- return new ClasspathResourceLoader(classLoader).instantiateSubclasses(Backend.class, "cucumber/runtime", new Class[]{ResourceLoader.class}, new Object[]{resourceLoader});
+ return new ClasspathResourceLoader(classLoader).instantiateSubclasses(Backend.class, "cucumber.runtime", new Class[]{ResourceLoader.class}, new Object[]{resourceLoader});
}
public void addError(Throwable error) {
@@ -73,7 +73,7 @@ public void addError(Throwable error) {
}
/**
- * This is the main entry point.
+ * This is the main entry point. Used from CLI, but not from JUnit.
*
* @param featurePaths
* @param filters
@@ -87,7 +87,7 @@ public void run(List<String> featurePaths, final List<Object> filters, Formatter
}
/**
- * Runs an individual feature, not all the features
+ * Runs an individual feature, not all the features. Used from CLI, but not from JUnit.
*
* @param cucumberFeature
* @param formatter
@@ -98,7 +98,7 @@ public void run(CucumberFeature cucumberFeature, Formatter formatter, Reporter r
formatter.feature(cucumberFeature.getFeature());
for (CucumberTagStatement cucumberTagStatement : cucumberFeature.getFeatureElements()) {
//Run the scenario, it should handle before and after hooks
- cucumberTagStatement.run(formatter, reporter, this);
+ cucumberTagStatement.run(formatter, reporter, this, cucumberTagStatement);
}
formatter.eof();
}
14 core/src/main/java/cucumber/runtime/Utils.java
View
@@ -17,14 +17,14 @@
public static boolean isInstantiable(Class<?> clazz) {
return Modifier.isPublic(clazz.getModifiers()) && !Modifier.isAbstract(clazz.getModifiers());
}
-
+
public static boolean hasConstructor(Class<?> clazz, Class[] paramTypes) {
- try {
- clazz.getConstructor(paramTypes);
- return true;
- } catch (NoSuchMethodException e) {
- return false;
- }
+ try {
+ clazz.getConstructor(paramTypes);
+ return true;
+ } catch (NoSuchMethodException e) {
+ return false;
+ }
}
public static String packagePath(Class clazz) {
11 core/src/main/java/cucumber/runtime/model/CucumberScenario.java
View
@@ -23,21 +23,22 @@ public CucumberScenario(CucumberFeature cucumberFeature, CucumberBackground cucu
* This method is called when Cucumber is run from the CLI, but not when run from JUnit
*/
@Override
- public void run(Formatter formatter, Reporter reporter, Runtime runtime) {
- //TODO: figure out how to get the runtime to this point, so that the context and running happens from there, not glue
+ public void run(Formatter formatter, Reporter reporter, Runtime runtime, StepRunner stepRunner) {
runtime.buildBackendWorlds();
runtime.runBeforeHooks(reporter, tags());
runBackground(formatter, reporter, runtime);
- formatAndRunSteps(formatter, reporter, runtime);
+ format(formatter);
+ stepRunner.runSteps(reporter, runtime);
runtime.runAfterHooks(reporter, tags());
runtime.disposeBackendWorlds();
}
- public void runBackground(Formatter formatter, Reporter reporter, Runtime runtime) {
+ private void runBackground(Formatter formatter, Reporter reporter, Runtime runtime) {
if (cucumberBackground != null) {
- cucumberBackground.formatAndRunSteps(formatter, reporter, runtime);
+ cucumberBackground.format(formatter);
+ cucumberBackground.runSteps(reporter, runtime);
}
}
}
4 core/src/main/java/cucumber/runtime/model/CucumberScenarioOutline.java
View
@@ -36,13 +36,13 @@ public void examples(Examples examples) {
}
@Override
- public void run(Formatter formatter, Reporter reporter, Runtime runtime) {
+ public void run(Formatter formatter, Reporter reporter, Runtime runtime, StepRunner stepRunner) {
format(formatter);
for (CucumberExamples cucumberExamples : cucumberExamplesList) {
cucumberExamples.format(formatter);
List<CucumberScenario> exampleScenarios = cucumberExamples.createExampleScenarios();
for (CucumberScenario exampleScenario : exampleScenarios) {
- exampleScenario.run(formatter, reporter, runtime);
+ exampleScenario.run(formatter, reporter, runtime, stepRunner);
}
}
}
2  core/src/main/java/cucumber/runtime/model/CucumberTagStatement.java
View
@@ -44,5 +44,5 @@ public String getVisualName() {
}
- public abstract void run(Formatter formatter, Reporter reporter, Runtime runtime);
+ public abstract void run(Formatter formatter, Reporter reporter, Runtime runtime, StepRunner stepRunner);
}
8 core/src/main/java/cucumber/runtime/model/StepContainer.java
View
@@ -9,7 +9,7 @@
import java.util.ArrayList;
import java.util.List;
-public class StepContainer {
+public class StepContainer implements StepRunner {
private final List<Step> steps = new ArrayList<Step>();
private final BasicStatement statement;
protected final CucumberFeature cucumberFeature;
@@ -27,15 +27,15 @@ public void step(Step step) {
steps.add(step);
}
- public void format(Formatter formatter) {
+ protected void format(Formatter formatter) {
statement.replay(formatter);
for (Step step : getSteps()) {
formatter.step(step);
}
}
- public void formatAndRunSteps(Formatter formatter, Reporter reporter, Runtime runtime) {
- format(formatter);
+ @Override
+ public void runSteps(Reporter reporter, Runtime runtime) {
for (Step step : getSteps()) {
runStep(step, reporter, runtime);
}
8 core/src/main/java/cucumber/runtime/model/StepRunner.java
View
@@ -0,0 +1,8 @@
+package cucumber.runtime.model;
+
+import cucumber.runtime.Runtime;
+import gherkin.formatter.Reporter;
+
+public interface StepRunner {
+ void runSteps(Reporter reporter, Runtime runtime);
+}
39 core/src/test/java/cucumber/io/ClasspathIterableTest.java
View
@@ -0,0 +1,39 @@
+package cucumber.io;
+
+import org.junit.Test;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import static cucumber.io.ClasspathIterable.filePath;
+import static org.junit.Assert.assertEquals;
+
+public class ClasspathIterableTest {
+ @Test
+ public void computes_file_path_for_windows_path() throws UnsupportedEncodingException, MalformedURLException {
+ if (File.separatorChar == '\\') {
+ // Windows
+ URL url = new URL("jar:file:/C:/src/cucumber-jvm/core/target/cucumber-core-1.0.0.RC12-SNAPSHOT.jar!/cucumber/runtime");
+ assertEquals(new File("C:/src/cucumber-jvm/core/target/cucumber-core-1.0.0.RC12-SNAPSHOT.jar").getAbsolutePath(), filePath(url));
+ } else {
+ // POSIX
+ URL url = new URL("jar:file:/src/cucumber-jvm/core/target/cucumber-core-1.0.0.RC12-SNAPSHOT.jar!/cucumber/runtime");
+ assertEquals(new File("/src/cucumber-jvm/core/target/cucumber-core-1.0.0.RC12-SNAPSHOT.jar").getAbsolutePath(), filePath(url));
+ }
+ }
+
+ @Test
+ public void computes_file_path_for_windows_path_with_dots() throws UnsupportedEncodingException, MalformedURLException {
+ if (File.separatorChar == '\\') {
+ // Windows
+ URL url = new URL("jar:file:C:/src/cucumber-jvm/jruby/bin/../lib/cucumber-jruby-full.jar!/cucumber/runtime");
+ assertEquals(new File("C:/src/cucumber-jvm/jruby/bin/../lib/cucumber-jruby-full.jar").getAbsolutePath(), filePath(url));
+ } else {
+ // POSIX
+ URL url = new URL("jar:file:/src/cucumber-jvm/jruby/bin/../lib/cucumber-jruby-full.jar!/cucumber/runtime");
+ assertEquals(new File("/src/cucumber-jvm/jruby/bin/../lib/cucumber-jruby-full.jar").getAbsolutePath(), filePath(url));
+ }
+ }
+}
2  core/src/test/java/cucumber/runtime/HookTest.java
View
@@ -50,7 +50,7 @@ public void after_hooks_execute_before_objects_are_disposed() throws Throwable {
Runtime runtime = new Runtime(new ClasspathResourceLoader(classLoader), CODE_PATHS, classLoader, asList(backend), false);
runtime.getGlue().addAfterHook(hook);
- scenario.run(mock(Formatter.class), mock(Reporter.class), runtime);
+ scenario.run(mock(Formatter.class), mock(Reporter.class), runtime, scenario);
InOrder inOrder = inOrder(hook, backend);
inOrder.verify(hook).execute(Matchers.<ScenarioResult>any());
7 groovy/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-groovy</artifactId>
@@ -82,14 +82,13 @@
import groovy.text.SimpleTemplateEngine
import gherkin.I18n
-def _ = File.separator
def engine = new SimpleTemplateEngine()
-def templateSource = new File(project.baseDir, "src${_}main${_}code_generator${_}I18n.groovy.txt").getText()
+def templateSource = new File(project.baseDir, "src${File.separator}main${File.separator}code_generator${File.separator}I18n.groovy.txt").getText()
I18n.all.each { i18n ->
def binding = ["i18n":i18n]
template = engine.createTemplate(templateSource).make(binding)
- def file = new File(project.baseDir, "target${_}generated-sources${_}i18n${_}java${_}cucumber${_}runtime${_}groovy${_}${i18n.underscoredIsoCode.toUpperCase()}.java")
+ def file = new File(project.baseDir, "target${File.separator}generated-sources${File.separator}i18n${File.separator}java${File.separator}cucumber${File.separator}runtime${File.separator}groovy${File.separator}${i18n.underscoredIsoCode.toUpperCase()}.java")
file.parentFile.mkdirs()
file.write(template.toString(), "UTF-8")
}
46 groovy/src/main/java/cucumber/runtime/groovy/.gitignore
View
@@ -1,46 +0,0 @@
-AR.java
-BG.java
-CA.java
-CS.java
-CY_GB.java
-DA.java
-DE.java
-EN.java
-EN_AU.java
-EN_LOL.java
-EN_PIRATE.java
-EN_SCOUSE.java
-EN_TX.java
-EO.java
-ES.java
-ET.java
-FI.java
-FR.java
-HE.java
-HR.java
-HU.java
-ID.java
-IS.java
-IT.java
-JA.java
-KO.java
-LT.java
-LU.java
-LV.java
-NL.java
-NO.java
-PL.java
-PT.java
-RO.java
-RU.java
-SK.java
-SR_CYRL.java
-SR_LATN.java
-SV.java
-TR.java
-UK.java
-UZ.java
-VI.java
-ZH_CN.java
-ZH_TW.java
-
2  guice/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-guice</artifactId>
2  ioke/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-ioke</artifactId>
7 java/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-java</artifactId>
@@ -49,15 +49,14 @@
import groovy.text.SimpleTemplateEngine
import gherkin.I18n
-def _ = File.separator
def engine = new SimpleTemplateEngine()
-def templateSource = new File(project.baseDir, "src${_}main${_}code_generator${_}I18n.java.txt").getText()
+def templateSource = new File(project.baseDir, "src${File.separator}main${File.separator}code_generator${File.separator}I18n.java.txt").getText()
I18n.all.each { i18n ->
i18n.codeKeywords.each { kw ->
def binding = ["i18n":i18n, "kw":kw]
template = engine.createTemplate(templateSource).make(binding)
- def file = new File(project.baseDir, "target${_}generated-sources${_}i18n${_}java${_}cucumber${_}annotation${_}${i18n.underscoredIsoCode}${_}${kw}.java")
+ def file = new File(project.baseDir, "target${File.separator}generated-sources${File.separator}i18n${File.separator}java${File.separator}cucumber${File.separator}annotation${File.separator}${i18n.underscoredIsoCode}${File.separator}${kw}.java")
file.parentFile.mkdirs()
file.write(template.toString(), "UTF-8")
}
45 java/src/main/java/cucumber/annotation/.gitignore
View
@@ -1,45 +0,0 @@
-ar
-bg
-ca
-cs
-cy_gb
-da
-de
-en
-en_au
-en_lol
-en_pirate
-en_scouse
-en_tx
-eo
-es
-et
-fi
-fr
-he
-hr
-hu
-id
-is
-it
-ja
-ko
-lt
-lu
-lv
-nl
-no
-pl
-pt
-ro
-ru
-sk
-sr_cyrl
-sr_latn
-sv
-tr
-uk
-uz
-vi
-zh_cn
-zh_tw
14 java/src/main/java/cucumber/runtime/java/ClasspathMethodScanner.java
View
@@ -8,14 +8,11 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
public class ClasspathMethodScanner {
private final ClasspathResourceLoader resourceLoader;
- private final Set<String> loadedResourcePaths = new HashSet<String>();
public ClasspathMethodScanner(ClasspathResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
@@ -24,18 +21,17 @@ public ClasspathMethodScanner(ClasspathResourceLoader resourceLoader) {
public void scan(JavaBackend javaBackend, List<String> gluePaths) {
Collection<Class<? extends Annotation>> cucumberAnnotationClasses = findCucumberAnnotationClasses();
for (String gluePath : gluePaths) {
- if (loadedResourcePaths.add(gluePath)) {
- for (Class<?> candidateClass : resourceLoader.getDescendants(Object.class, gluePath)) {
- for (Method method : candidateClass.getMethods()) {
- scan(method, cucumberAnnotationClasses, javaBackend);
- }
+ String packageName = gluePath.replace('/', '.').replace('\\', '.'); // Sometimes the gluePath will be a path, not a package
+ for (Class<?> candidateClass : resourceLoader.getDescendants(Object.class, packageName)) {
+ for (Method method : candidateClass.getMethods()) {
+ scan(method, cucumberAnnotationClasses, javaBackend);
}
}
}
}
private Collection<Class<? extends Annotation>> findCucumberAnnotationClasses() {
- return resourceLoader.getAnnotations("cucumber/annotation");
+ return resourceLoader.getAnnotations("cucumber.annotation");
}
private void scan(Method method, Collection<Class<? extends Annotation>> cucumberAnnotationClasses, JavaBackend javaBackend) {
2  java/src/main/java/cucumber/runtime/java/JavaBackend.java
View
@@ -48,7 +48,7 @@ private ObjectFactory loadObjectFactory() {
foundOF = ObjectFactoryHolder.getFactory();
} else {
try {
- foundOF = classpathResourceLoader.instantiateExactlyOneSubclass(ObjectFactory.class, "cucumber/runtime", new Class[0], new Object[0]);
+ foundOF = classpathResourceLoader.instantiateExactlyOneSubclass(ObjectFactory.class, "cucumber.runtime", new Class[0], new Object[0]);
} catch (CucumberException ce) {
foundOF = new DefaultJavaObjectFactory();
}
2  jruby/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-jruby</artifactId>
12 jruby/src/main/java/cucumber/runtime/jruby/JRubyBackend.java
View
@@ -15,10 +15,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
-import java.util.List;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
+import java.util.*;
public class JRubyBackend implements Backend {
private static final String DSL = "/cucumber/runtime/jruby/dsl.rb";
@@ -27,6 +24,7 @@
private Glue glue;
private ResourceLoader resourceLoader;
private UnreportedStepExecutor unreportedStepExecutor;
+ private final Set<JRubyWorldBlock> worldBlocks = new HashSet<JRubyWorldBlock>();
public JRubyBackend(ResourceLoader resourceLoader) throws UnsupportedEncodingException {
this.resourceLoader = resourceLoader;
@@ -68,6 +66,10 @@ public void setUnreportedStepExecutor(UnreportedStepExecutor executor) {
@Override
public void buildWorld() {
jruby.put("$world", new Object());
+
+ for (JRubyWorldBlock block : worldBlocks) {
+ block.execute();
+ }
}
private void runScriptlet(Resource resource) {
@@ -113,6 +115,6 @@ public void addAfterHook(RubyObject body) {
}
public void addWorldBlock(RubyObject body) {
- new JRubyWorldBlock(body).execute();
+ worldBlocks.add(new JRubyWorldBlock(body));
}
}
2  junit/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-junit</artifactId>
6 junit/src/main/java/cucumber/junit/Cucumber.java
View
@@ -57,7 +57,7 @@ public Cucumber(Class clazz) throws InitializationError, IOException {
// TODO: Create formatter(s) based on Annotations. Use same technique as in cli.Main for MultiFormatter
jUnitReporter = new JUnitReporter(new NullReporter(), new NullReporter());
- addChildren(featurePaths, filters(clazz), gluePaths(clazz));
+ addChildren(featurePaths, filters(clazz));
}
@Override
@@ -137,10 +137,10 @@ private void assertNoDeclaredMethods(Class clazz) {
return asList(filters);
}
- private void addChildren(List<String> featurePaths, final List<Object> filters, List<String> gluePaths) throws InitializationError {
+ private void addChildren(List<String> featurePaths, final List<Object> filters) throws InitializationError {
List<CucumberFeature> cucumberFeatures = load(resourceLoader, featurePaths, filters);
for (CucumberFeature cucumberFeature : cucumberFeatures) {
- children.add(new FeatureRunner(cucumberFeature, gluePaths, runtime, jUnitReporter));
+ children.add(new FeatureRunner(cucumberFeature, runtime, jUnitReporter));
}
}
5 junit/src/main/java/cucumber/junit/ExamplesRunner.java
View
@@ -9,12 +9,13 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
class ExamplesRunner extends Suite {
private final CucumberExamples cucumberExamples;
- protected ExamplesRunner(Runtime runtime, List<String> gluePaths, CucumberExamples cucumberExamples, JUnitReporter jUnitReporter) throws InitializationError {
- super(null, new ArrayList<Runner>());
+ protected ExamplesRunner(Runtime runtime, CucumberExamples cucumberExamples, JUnitReporter jUnitReporter) throws InitializationError {
+ super(ExamplesRunner.class, new ArrayList<Runner>());
this.cucumberExamples = cucumberExamples;
List<CucumberScenario> exampleScenarios = cucumberExamples.createExampleScenarios();
28 junit/src/main/java/cucumber/junit/ExecutionUnitRunner.java
View
@@ -1,15 +1,15 @@
package cucumber.junit;
-import cucumber.runtime.Glue;
import cucumber.runtime.Runtime;
import cucumber.runtime.model.CucumberScenario;
+import cucumber.runtime.model.StepRunner;
+import gherkin.formatter.Reporter;
import gherkin.formatter.model.Step;
import org.junit.runner.Description;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.ParentRunner;
import org.junit.runners.model.InitializationError;
-import java.util.HashSet;
import java.util.List;
/**
@@ -19,15 +19,12 @@
private final Runtime runtime;
private final CucumberScenario cucumberScenario;
private final JUnitReporter jUnitReporter;
- private Glue glue;
public ExecutionUnitRunner(Runtime runtime, CucumberScenario cucumberScenario, JUnitReporter jUnitReporter) throws InitializationError {
super(ExecutionUnitRunner.class);
this.runtime = runtime;
this.cucumberScenario = cucumberScenario;
this.jUnitReporter = jUnitReporter;
-
- this.glue = runtime.getGlue();
}
@Override
@@ -46,21 +43,14 @@ protected Description describeChild(Step step) {
}
@Override
- public void run(RunNotifier notifier) {
+ public void run(final RunNotifier notifier) {
jUnitReporter.startExecutionUnit(this, notifier);
-
- //No tags from the junit side?
- runtime.buildBackendWorlds();
- runtime.runBeforeHooks(jUnitReporter, new HashSet<String>());
-
- cucumberScenario.runBackground(jUnitReporter.getFormatter(), jUnitReporter.getReporter(), runtime);
- cucumberScenario.format(jUnitReporter);
- // Run the steps (the children)
- super.run(notifier);
- runtime.runAfterHooks(jUnitReporter, new HashSet<String>());
-
- runtime.disposeBackendWorlds();
-
+ cucumberScenario.run(jUnitReporter, jUnitReporter, runtime, new StepRunner() {
+ @Override
+ public void runSteps(Reporter reporter, Runtime runtime) {
+ ExecutionUnitRunner.super.run(notifier);
+ }
+ });
jUnitReporter.finishExecutionUnit();
}
6 junit/src/main/java/cucumber/junit/FeatureRunner.java
View
@@ -18,14 +18,12 @@
private final List<ParentRunner> children = new ArrayList<ParentRunner>();
private final CucumberFeature cucumberFeature;
- private final List<String> gluePaths;
private final Runtime runtime;
private final JUnitReporter jUnitReporter;
- protected FeatureRunner(CucumberFeature cucumberFeature, List<String> gluePaths, Runtime runtime, JUnitReporter jUnitReporter) throws InitializationError {
+ protected FeatureRunner(CucumberFeature cucumberFeature, Runtime runtime, JUnitReporter jUnitReporter) throws InitializationError {
super(null);
this.cucumberFeature = cucumberFeature;
- this.gluePaths = gluePaths;
this.runtime = runtime;
this.jUnitReporter = jUnitReporter;
buildFeatureElementRunners();
@@ -67,7 +65,7 @@ private void buildFeatureElementRunners() {
if (cucumberTagStatement instanceof CucumberScenario) {
featureElementRunner = new ExecutionUnitRunner(runtime, (CucumberScenario) cucumberTagStatement, jUnitReporter);
} else {
- featureElementRunner = new ScenarioOutlineRunner(runtime, gluePaths, (CucumberScenarioOutline) cucumberTagStatement, jUnitReporter);
+ featureElementRunner = new ScenarioOutlineRunner(runtime, (CucumberScenarioOutline) cucumberTagStatement, jUnitReporter);
}
children.add(featureElementRunner);
} catch (InitializationError e) {
1  junit/src/main/java/cucumber/junit/JUnitReporter.java
View
@@ -33,7 +33,6 @@ public JUnitReporter(Reporter reporter, Formatter formatter) {
this.formatter = formatter;
}
- // TODO: Move to scenario
public void startExecutionUnit(ExecutionUnitRunner executionUnitRunner, RunNotifier runNotifier) {
this.executionUnitRunner = executionUnitRunner;
this.runNotifier = runNotifier;
5 junit/src/main/java/cucumber/junit/ScenarioOutlineRunner.java
View
@@ -8,16 +8,15 @@
import org.junit.runners.model.InitializationError;
import java.util.ArrayList;
-import java.util.List;
class ScenarioOutlineRunner extends Suite {
private final CucumberScenarioOutline cucumberScenarioOutline;
- public ScenarioOutlineRunner(Runtime runtime, List<String> gluePaths, CucumberScenarioOutline cucumberScenarioOutline, JUnitReporter jUnitReporter) throws InitializationError {
+ public ScenarioOutlineRunner(Runtime runtime, CucumberScenarioOutline cucumberScenarioOutline, JUnitReporter jUnitReporter) throws InitializationError {
super(null, new ArrayList<Runner>());
this.cucumberScenarioOutline = cucumberScenarioOutline;
for (CucumberExamples cucumberExamples : cucumberScenarioOutline.getCucumberExamplesList()) {
- getChildren().add(new ExamplesRunner(runtime, gluePaths, cucumberExamples, jUnitReporter));
+ getChildren().add(new ExamplesRunner(runtime, cucumberExamples, jUnitReporter));
}
}
2  jython/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-jython</artifactId>
18 picocontainer/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-picocontainer</artifactId>
@@ -38,6 +38,20 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package-full</id>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
@@ -55,7 +69,7 @@
<arg value="--format" />
<arg value="progress" />
<arg value="--glue" />
- <arg value="cucumber/runtime/java/picocontainer" />
+ <arg value="cucumber.runtime.java.picocontainer" />
<arg value="${basedir}/src/test/resources/cucumber/runtime/java/picocontainer" />
</java>
</target>
6 pom.xml
View
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
<packaging>pom</packaging>
<name>Cucumber-JVM</name>
<url>http://cukes.info/</url>
@@ -186,7 +186,7 @@
<dependency>
<groupId>org.webbitserver</groupId>
<artifactId>webbit</artifactId>
- <version>0.3.0</version>
+ <version>0.3.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
@@ -255,9 +255,9 @@
<modules>
<module>core</module>
<module>junit</module>
+ <module>jruby</module>
<module>scala</module>
<module>jython</module>
- <module>jruby</module>
<module>picocontainer</module>
<module>spring</module>
<module>guice</module>
2  rhino/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-rhino</artifactId>
31 scala/pom.xml
View
@@ -1,11 +1,11 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-scala</artifactId>
@@ -64,7 +64,7 @@
<goal>add-source</goal>
</goals>
<configuration>
- <sourceDir>${basedir}/target/i18n</sourceDir>
+ <sourceDir>${basedir}/target/generated-sources/i18n</sourceDir>
</configuration>
</execution>
</executions>
@@ -86,12 +86,11 @@
<groovy><![CDATA[
import groovy.text.SimpleTemplateEngine
-def _ = File.separator
def engine = new SimpleTemplateEngine()
-def templateSource = new File(project.baseDir, "src${_}main${_}code_generator${_}I18n.scala.txt").getText()
+def templateSource = new File(project.baseDir, "src${File.separator}main${File.separator}code_generator${File.separator}I18n.scala.txt").getText()
template = engine.createTemplate(templateSource).make(null)
-def file = new File(project.baseDir, "target${_}i18n${_}cucumber${_}runtime${_}I18n.scala")
+def file = new File(project.baseDir, "target${File.separator}generated-sources${File.separator}i18n${File.separator}cucumber${File.separator}runtime${File.separator}I18n.scala")
file.parentFile.mkdirs()
file.write(template.toString(), "UTF-8")
]]></groovy>
@@ -101,26 +100,6 @@ file.write(template.toString(), "UTF-8")
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${basedir}/target/i18n/java</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
</plugins>
</build>
</project>
1  scala/src/main/scala/cucumber/runtime/.gitignore
View
@@ -1 +0,0 @@
-I18n.scala
2  spring/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-spring</artifactId>
2  weld/pom.xml
View
@@ -5,7 +5,7 @@
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm</artifactId>
<relativePath>../pom.xml</relativePath>
- <version>1.0.0.RC11</version>
+ <version>1.0.0.RC12</version>
</parent>
<artifactId>cucumber-weld</artifactId>

No commit comments for this range

Something went wrong with that request. Please try again.