I've just upgraded from beta1 to beta2 and have encountered a problem getting
any tests to run.  My configuration in web/xml is pretty standard:

--------------------------------------------------------------------------------------------
<filter>
        <filter-name>WicketEntryPoint</filter-name>
       
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
        <init-param>
            <param-name>applicationClassName</param-name>
            <param-value>MyApplication</param-value>
        </init-param>
        <init-param>
            <param-name>configuration</param-name>
            <param-value>development</param-value>
        </init-param>
    </filter>
    
    <filter-mapping>
        <filter-name>WicketEntryPoint</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
---------------------------------------------------------------------------------------------

And I set up a WicketTester instance in a fairly standard manner, which
correctly picks up web.xml:
---------------------------------------------------------------------------------------------
tester = new WicketTester(myAppInstance, System.getProperty("user.dir") +
"/src/main/webapp");
---------------------------------------------------------------------------------------------

But, with beta 2, I get the following exception:
---------------------------------------------------------------------------------------------
java.lang.IllegalArgumentException: Error initialising WicketServlet - you
have no <servlet-mapping> element with a url-pattern that uses servlet:
WicketMockServlet
    at
org.apache.wicket.protocol.http.WicketFilter.getFilterPath(WicketFilter.java:497)
    at
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:370)
    at
org.apache.wicket.protocol.http.MockWebApplication.<init>(MockWebApplication.java:158)
    at
org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:180)
    at
org.apache.wicket.util.tester.WicketTester.<init>(WicketTester.java:241)
    at
com.MyStuff.AbstractControllerTest.initWicketTester(AbstractControllerTest.java:67)
    at com.MyStuff.MyTest.setUp(BananaActionCreateTest.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
    at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
    at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
    at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
    at
org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
    at
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
    at
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
    at
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
    at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
    at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
    at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
---------------------------------------------------------------------------------------------

As I'm using a filter and not a servlet, I was surprised by this error
message.  Stepping through the code reveals the difference between beta1 and
beta2 is in WicketFilter.init().
The beta1 code looks something like:
---------------------------------------------------------------------------------------------
...
String filterMapping = 
if (filterConfig.getInitParameter(WicketFilter.FILTER_MAPPING_PARAM) ==
null)
{
...
---------------------------------------------------------------------------------------------

The beta2 code looks something like:
---------------------------------------------------------------------------------------------
...
String filterMapping =
filterConfig.getInitParameter(WicketFilter.FILTER_MAPPING_PARAM);
if (filterMapping == null ||
filterMapping.equals(WicketFilter.SERVLET_PATH_HOLDER))
{
...
---------------------------------------------------------------------------------------------

The new 2nd clause in the "if" statement causes the problem.  This clause is
triggered and quickly results in the exception.  Do I need to change my
configuration?  Am I missing something else?  Or is this a bug?

Severian.
-- 
View this message in context: 
http://www.nabble.com/Wicket-1.3.0-beta2---WicketFilter-Problem-tf4069331.html#a11563997
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to