[ https://issues.apache.org/jira/browse/WICKET-702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540065 ]
mrmean edited comment on WICKET-702 at 11/4/07 5:56 AM: ----------------------------------------------------------------- Thanks Johan.... I now have 22 failing junit tests. caused by a nullpointer on line 534 of MockHttpServletRequest: RequestCycle.get() returns null, because it is already detached. The difference in my junit test and the intercept tests seems to lie in the fact that somehow i get a BufferedWebResponse where the wicket junit test gets a regular WebResponse. The BWR does not call HttpServletResponse.sendRedirect(url) where the regular WR does. this causes this call to be executed later after the RC detach. Maurice was (Author: mrmean): En bedankt Johan...... 22 failing junit tests vanwege een nullpointer op regel 534 in MockHttpServletRequest: RequestCycle.get() leverd null op, want die is al gedetached. Ik ben nog aan het uitzoeken hoe ik dit kan omzeilen in mn junit tests. Maurice > MockWebApplication doesn't redirect properly to mounted pages under > RestartResponseAtInterceptPageException > ------------------------------------------------------------------------------------------------------------ > > Key: WICKET-702 > URL: https://issues.apache.org/jira/browse/WICKET-702 > Project: Wicket > Issue Type: Bug > Components: wicket > Affects Versions: 1.3.0-beta1 > Reporter: Mark Sandori > Fix For: 1.3.0-rc1 > > Attachments: 20070703-WICKET-702.txt, LoginPage.html, LoginPage.java, > ProtectedPage.html, ProtectedPage.java, RestartWithMountedPageTest.java > > > The MockWebApplication doesn't decode the redirect request properly when > redirecting to a mounted page due to a > RestartResponseAtInterceptPageException. > This is the test: > @Test > public void testPageRender() > { > WicketTest tester = new WicketTester(new MyApplication()); > //must be logged in to get to the Profile page > tester.startPage(Profile.class); > //should redirect to the Login page > tester.assertRenderedPage(Login.class); > } > The application mounts pages via: > mount("/main", PackageName.forPackage(Profile.class.getPackage())); > Running the test results in this exception: > org.apache.wicket.WicketRuntimeException: Already redirecting to > 'main/Login'. Cannot redirect more than once > at > org.apache.wicket.protocol.http.BufferedWebResponse.redirect(BufferedWebResponse.java:100) > at > org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:219) > at > org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:103) > at > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:981) > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1048) > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1127) > at org.apache.wicket.RequestCycle.request(RequestCycle.java:489) > at > org.apache.wicket.protocol.http.MockWebApplication.postProcessRequestCycle(MockWebApplication.java:426) > at > org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:372) > at > org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:237) > What is happening is that the redirect URL "main/Login" is not getting > resolved to a bookmarkable page and the RequestParameters is therefore not > setup correctly. Then in WebRequestCycleProcessor.resolve(final RequestCycle > requestCycle, final RequestParameters requestParameters) the > bookmarkablePageClass of the requestParameters is null and the method > resolves to the Home page instead of the page that is intended to redirect > to. This causes an attempt to redirect again thereby causing the exception. > If the mount() is removed then the unit test passes. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.