Title: [1368] trunk/core/examples/trader: JBEHAVE-198: ResourceBundle needs the caller's classloader when run via Ant.
Revision
1368
Author
mauro
Date
2009-10-29 21:03:28 -0500 (Thu, 29 Oct 2009)

Log Message

JBEHAVE-198:  ResourceBundle needs the caller's classloader when run via Ant. Ensured the regression tests are activated via -Pant profile.

Modified Paths

Diff

Modified: trunk/core/examples/trader/pom.xml (1367 => 1368)

--- trunk/core/examples/trader/pom.xml	2009-10-29 20:55:56 UTC (rev 1367)
+++ trunk/core/examples/trader/pom.xml	2009-10-30 02:03:28 UTC (rev 1368)
@@ -52,7 +52,7 @@
               <scenarioExcludes>
                 <scenarioExclude>**/scenarios/None.java</scenarioExclude>
               </scenarioExcludes>
-              <skip>true</skip>
+              <skip>${skip.stepdoc}</skip>
             </configuration>
             <goals>
               <goal>stepdoc</goal>
@@ -69,9 +69,12 @@
             <phase>integration-test</phase>
             <configuration>
               <tasks>
-                <taskdef name="scenarioRunner" classname="org.jbehave.ant.ScenarioRunnerTask" classpathref="maven.runtime.classpath" />
-                <scenarioRunner scenarioIncludes="org/jbehave/examples/trader/scenarios/*.java"
-                  scenarioExcludes="**/*Steps.java" skip="true" />
+                <taskdef name="scenarioRunner"
+                  classname="org.jbehave.ant.ScenarioRunnerTask"
+                  classpathref="maven.runtime.classpath" />
+                <scenarioRunner
+                  scenarioIncludes="org/jbehave/examples/trader/scenarios/*.java"
+                  scenarioExcludes="**/*Steps.java" skip="${skip.ant.scenarios}" />
               </tasks>
             </configuration>
             <goals>
@@ -83,9 +86,10 @@
             <phase>integration-test</phase>
             <configuration>
               <tasks>
-                <taskdef name="stepdoc" classname="org.jbehave.ant.StepdocTask" classpathref="maven.runtime.classpath" />
+                <taskdef name="stepdoc" classname="org.jbehave.ant.StepdocTask"
+                  classpathref="maven.runtime.classpath" />
                 <stepdoc scenarioIncludes="org/jbehave/examples/trader/scenarios/*.java"
-                  scenarioExcludes="**/*Steps.java" skip="true" />
+                  scenarioExcludes="**/*Steps.java" skip="${skip.ant.stepdoc}" />
               </tasks>
             </configuration>
             <goals>
@@ -96,4 +100,24 @@
       </plugin>
     </plugins>
   </build>
+  <profiles>
+    <profile>
+      <id>ant</id>
+      <properties>
+        <skip.ant.scenarios>false</skip.ant.scenarios>
+        <skip.ant.stepdoc>false</skip.ant.stepdoc>
+      </properties>
+    </profile>
+    <profile>
+      <id>stepdoc</id>
+      <properties>
+        <skip.stepdoc>false</skip.stepdoc>
+      </properties>
+    </profile>
+  </profiles>
+  <properties>
+    <skip.ant.scenarios>true</skip.ant.scenarios>
+    <skip.ant.stepdoc>true</skip.ant.stepdoc>
+    <skip.stepdoc>true</skip.stepdoc>
+  </properties>
 </project>
\ No newline at end of file

Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/i18n/I18nKeyWords.java (1367 => 1368)

--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/i18n/I18nKeyWords.java	2009-10-29 20:55:56 UTC (rev 1367)
+++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/i18n/I18nKeyWords.java	2009-10-30 02:03:28 UTC (rev 1368)
@@ -6,10 +6,12 @@
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
+import org.jbehave.scenario.ScenarioClassLoader;
 import org.jbehave.scenario.definition.KeyWords;
 
 /**
- * Add i18n support to Keywords, allowing to read the keywords from resource bundles for a given locale.
+ * Add i18n support to Keywords, allowing to read the keywords from resource
+ * bundles for a given locale.
  */
 public class I18nKeyWords extends KeyWords {
 
@@ -61,7 +63,11 @@
 	private static ResourceBundle lookupBunde(String bundleName, Locale locale,
 			ClassLoader classLoader) {
 		try {
-			return ResourceBundle.getBundle(bundleName, locale, classLoader);
+			if (classLoader instanceof ScenarioClassLoader) {
+				return ResourceBundle
+						.getBundle(bundleName, locale, classLoader);
+			}
+			return ResourceBundle.getBundle(bundleName, locale);
 		} catch (MissingResourceException e) {
 			throw new ResourceBundleNotFoundExcepion(bundleName, locale,
 					classLoader, e);


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to