Author: jbq
Date: Wed Feb 21 06:41:11 2007
New Revision: 510039

URL: http://svn.apache.org/viewvc?view=rev&rev=510039
Log:
WICKET-284 Cannot execute tests from within wicket-parent

Use "basedir" system property if available to know the path of the module being
currently tested.  Fall back to current directory if the property is not set.

See http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html

Modified:
    
incubator/wicket/branches/wicket-1.x/wicket-examples/src/test/java/wicket/examples/WicketWebTestCase.java

Modified: 
incubator/wicket/branches/wicket-1.x/wicket-examples/src/test/java/wicket/examples/WicketWebTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-examples/src/test/java/wicket/examples/WicketWebTestCase.java?view=diff&rev=510039&r1=510038&r2=510039
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/wicket-examples/src/test/java/wicket/examples/WicketWebTestCase.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/wicket-examples/src/test/java/wicket/examples/WicketWebTestCase.java
 Wed Feb 21 06:41:11 2007
@@ -22,6 +22,8 @@
 import net.sourceforge.jwebunit.junit.WebTestCase;
 import nl.openedge.util.jetty.JettyDecorator;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.dom4j.Attribute;
 import org.dom4j.Document;
 import org.dom4j.DocumentHelper;
@@ -36,6 +38,8 @@
  */
 public abstract class WicketWebTestCase extends WebTestCase
 {
+       private static final Log logger = 
LogFactory.getLog(WicketWebTestCase.class);
+
        /**
         * Suite method.
         * 
@@ -55,7 +59,13 @@
                suite.addTestSuite(clazz);
                JettyDecorator deco = new JettyDecorator(suite);
                deco.setPort(8098);
-               deco.setWebappContextRoot("src/main/webapp");
+               String basedir = System.getProperty("basedir");
+               logger.debug("basedir="+basedir);
+               String path = "";
+               if (basedir != null)
+                       path = basedir + "/";
+               path += "src/main/webapp";
+               deco.setWebappContextRoot(path);
                deco.setContextPath("/wicket-examples");
 
                return deco;


Reply via email to