From 84f87832f55dac6d53eb1c4d13582220ccc4587d Mon Sep 17 00:00:00 2001 From: Frank Seidinger Date: Wed, 5 Jul 2017 22:32:52 +0200 Subject: [PATCH 1/3] Using Weld SE with version 2.4.4.Final breaks cucumber-weld --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 958c122aba..ba2e3eb247 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ 0.4.15 0.3.0 9.1.5.0 - 2.3.5.Final + 2.4.4.Final 1.2 4.7.4 2.2 From e3aa683d7ec330ff97b241c919d6071693b4c732 Mon Sep 17 00:00:00 2001 From: Frank Seidinger Date: Wed, 5 Jul 2017 22:52:35 +0200 Subject: [PATCH 2/3] Fixed WeldFactory by: - using weld builder to create container instance - closing only if running (maybe unnecessary) - resolving class types directly via container instance --- .../java/cucumber/runtime/java/weld/WeldFactory.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/weld/src/main/java/cucumber/runtime/java/weld/WeldFactory.java b/weld/src/main/java/cucumber/runtime/java/weld/WeldFactory.java index fa963e5449..723993110a 100644 --- a/weld/src/main/java/cucumber/runtime/java/weld/WeldFactory.java +++ b/weld/src/main/java/cucumber/runtime/java/weld/WeldFactory.java @@ -5,14 +5,14 @@ import org.jboss.weld.environment.se.Weld; import org.jboss.weld.environment.se.WeldContainer; -public class WeldFactory extends Weld implements ObjectFactory { +public class WeldFactory implements ObjectFactory { - private WeldContainer weld; + private WeldContainer containerInstance; @Override public void start() { try { - weld = super.initialize(); + containerInstance = new Weld().initialize(); } catch (IllegalArgumentException e) { throw new CucumberException("" + "\n" + @@ -31,7 +31,9 @@ public void start() { @Override public void stop() { try { - this.shutdown(); + if (containerInstance.isRunning()) { + containerInstance.close(); + } } catch (NullPointerException npe) { System.err.println("" + "\nIf you have set enabled=false in org.jboss.weld.executor.properties and you are seeing\n" + @@ -49,6 +51,6 @@ public boolean addClass(Class clazz) { @Override public T getInstance(Class type) { - return weld.instance().select(type).get(); + return containerInstance.select(type).get(); } } From 10943f7dd4a2c4fc1fa48d697a7ed905d52d31cd Mon Sep 17 00:00:00 2001 From: Frank Seidinger Date: Thu, 6 Jul 2017 00:11:16 +0200 Subject: [PATCH 3/3] Duplicated scenario in cukes.feature --- .../test/resources/cucumber/runtime/java/weld/cukes.feature | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/weld/src/test/resources/cucumber/runtime/java/weld/cukes.feature b/weld/src/test/resources/cucumber/runtime/java/weld/cukes.feature index c6aa1d8814..385e001c89 100644 --- a/weld/src/test/resources/cucumber/runtime/java/weld/cukes.feature +++ b/weld/src/test/resources/cucumber/runtime/java/weld/cukes.feature @@ -2,4 +2,8 @@ Feature: Cukes Scenario: Eat some cukes Given I have 4 cukes in my belly - Then there are 4 cukes in my belly \ No newline at end of file + Then there are 4 cukes in my belly + + Scenario: Eat some more cukes + Given I have 6 cukes in my belly + Then there are 6 cukes in my belly \ No newline at end of file