This is how WicketTestCase does it and it is used in hundreds of tests
application = new WicketTester(null);
application.setHomePage(pageClass);
// Do the processing
application.setupRequestAndResponse();
application.processRequestCycle();
assertEquals(pageClass,
application.getLastRenderedPage().getClass());
// Validate the document
String document =
application.getServletResponse().getDocument();
Juergen
On 8/8/06, David Hansen <[EMAIL PROTECTED]> wrote:
> For the last little while, we've been doing just fine under 1.1 with
> the following( for generation of email, the text of which is pulled
> from the response ):
>
> WicketTester tester = new WicketTester( );
>
> StringResponse response = new StringResponse( );
> RequestCycle cycle = tester.createRequestCycle( );
>
> tester.getWicketSession( ).setRequestCycle
> ( cycle );
> cycle.setResponse( response );
>
> Page page = tester.startPage( new
> OrderPlaced.XPageSource( order ) );
> page.getSession( ).setRequestCycle( cycle );
> page.render( );
>
> As part of our effort to migrate to 1.2, however,
> Session#setRequestCycle( ) no longer exists, so we tried assuming
> that WicketTester would create a RequestCycle and put it into
> threadlocal where the result of tester.startPage( ) would have access
> to it, but no dice. page.getRequestCycle( ) returns null and
> page.render( ) results in an NPE thrown in Page#configureResponse( )
>
> Any ways around this? Bear in mind this is being run inside a worker
> thread completely outside the main wicket app, so pushing and popping
> sessions won't work here. Thanks.
>
> - Dave
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user