Bart Geluykens created WICKET-4943:
--------------------------------------

             Summary: WicketTester (Spring + hibernate) / 
BaseWicketTest.lastRenderedPage is empty
                 Key: WICKET-4943
                 URL: https://issues.apache.org/jira/browse/WICKET-4943
             Project: Wicket
          Issue Type: Bug
          Components: wicket
         Environment: Linux / Java 7 using wicket-sping and hibernate
            Reporter: Bart Geluykens
            Priority: Critical


I have a sample application here: https://github.com/bartgeluykens/Whiskey

Tests fails because BaseWicketTest.lastRenderedPage is empty.

The reason is that in the RenderPageRequestHandler we execute the following 
statement Application.get().getPageRendererProvider().get(this) which depends 
on an other BaseWicketTest instance than the current one. Afterwards the 
lastRenderedPage gets filled on the wrong class instance.

I temporary solved it by adding the following statements in the processRequest 
procedure underneath the if "if (!requestCycle.processRequestAndDetach())" 
block:

      if (Application.get().getPageRendererProvider() instanceof 
LastPageRecordingPageRendererProvider)  {
        LastPageRecordingPageRendererProvider 
lastPageRecordingPageRendererProvider =  
(LastPageRecordingPageRendererProvider) 
Application.get().getPageRendererProvider();
        lastRenderedPage = lastPageRecordingPageRendererProvider.getLastPage();
      }



Probably the best solution is to make the lastRenderedPage variable static, but 
I did not test this.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to