You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Craig Lenzen <le...@visi.com> on 2007/09/17 19:27:51 UTC

MockWebApplication.generateLastRenderedPage(WebRequestCycle cycle)

Just noticed this was originally posting in the user forum, it is probably
better suited for the developers.

I'm looking at the following block of code in the MockWebApplication within
the method that is listed in the subject of this post;

                                else if (target instanceof
IBookmarkablePageRequestTarget)
                                {
                                        // create a new request cycle for
the newPage call
                                        createRequestCycle();
                                        IBookmarkablePageRequestTarget
pageClassRequestTarget = (IBookmarkablePageRequestTarget)target;
                                        Class pageClass =
pageClassRequestTarget.getPageClass();
                                        PageParameters parameters =
pageClassRequestTarget.getPageParameters();
                                        if (parameters == null ||
parameters.size() == 0)
                                        {
                                                newLastRenderedPage = new
DefaultPageFactory().newPage(pageClass);
                                        }
                                        else
                                        {
                                                newLastRenderedPage = new
DefaultPageFactory().newPage(pageClass,
                                                                parameters);
                                        }
                                }

I'm wondering if there is a good reason a new instance of DefaultPageFactory
is being used here instead of the one that is configure on the
WebApplication given to the WicketTester?

The problem I'm having is that I create my own extended version of
DefaultPageFactory for the purpose of being able to mock up the response
page when unit testing and rely on that version when testing.

-Craig
-- 
View this message in context: http://www.nabble.com/MockWebApplication.generateLastRenderedPage%28WebRequestCycle-cycle%29-tf4468351.html#a12740690
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: MockWebApplication.generateLastRenderedPage(WebRequestCycle cycle)

Posted by Craig Lenzen <le...@visi.com>.
Created the following issue in JIRA for this problem;

https://issues.apache.org/jira/browse/WICKET-984


Juergen Donnerstag wrote:
> 
> yes, please. It looks like you are right, but changing it causes a
> junit test to fail.
> 
> Juergen
> 
> On 9/18/07, Craig Lenzen <le...@visi.com> wrote:
>>
>> Really, still no response?  Should I just log a JIRA bug?
>>
>> -Craig
>>
>>
>> Craig Lenzen wrote:
>> >
>> > Just noticed this was originally posting in the user forum, it is
>> probably
>> > better suited for the developers.
>> >
>> > I'm looking at the following block of code in the MockWebApplication
>> > within the method that is listed in the subject of this post;
>> >
>> >                                 else if (target instanceof
>> > IBookmarkablePageRequestTarget)
>> >                                 {
>> >                                         // create a new request cycle
>> for
>> > the newPage call
>> >                                         createRequestCycle();
>> >                                         IBookmarkablePageRequestTarget
>> > pageClassRequestTarget = (IBookmarkablePageRequestTarget)target;
>> >                                         Class pageClass =
>> > pageClassRequestTarget.getPageClass();
>> >                                         PageParameters parameters =
>> > pageClassRequestTarget.getPageParameters();
>> >                                         if (parameters == null ||
>> > parameters.size() == 0)
>> >                                         {
>> >                                                 newLastRenderedPage =
>> new
>> > DefaultPageFactory().newPage(pageClass);
>> >                                         }
>> >                                         else
>> >                                         {
>> >                                                 newLastRenderedPage =
>> new
>> > DefaultPageFactory().newPage(pageClass,
>> >
>> > parameters);
>> >                                         }
>> >                                 }
>> >
>> > I'm wondering if there is a good reason a new instance of
>> > DefaultPageFactory is being used here instead of the one that is
>> configure
>> > on the WebApplication given to the WicketTester?
>> >
>> > The problem I'm having is that I create my own extended version of
>> > DefaultPageFactory for the purpose of being able to mock up the
>> response
>> > page when unit testing and rely on that version when testing.
>> >
>> > -Craig
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/MockWebApplication.generateLastRenderedPage%28WebRequestCycle-cycle%29-tf4468351.html#a12748359
>> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/MockWebApplication.generateLastRenderedPage%28WebRequestCycle-cycle%29-tf4468351.html#a12764598
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: MockWebApplication.generateLastRenderedPage(WebRequestCycle cycle)

Posted by Juergen Donnerstag <ju...@gmail.com>.
yes, please. It looks like you are right, but changing it causes a
junit test to fail.

Juergen

On 9/18/07, Craig Lenzen <le...@visi.com> wrote:
>
> Really, still no response?  Should I just log a JIRA bug?
>
> -Craig
>
>
> Craig Lenzen wrote:
> >
> > Just noticed this was originally posting in the user forum, it is probably
> > better suited for the developers.
> >
> > I'm looking at the following block of code in the MockWebApplication
> > within the method that is listed in the subject of this post;
> >
> >                                 else if (target instanceof
> > IBookmarkablePageRequestTarget)
> >                                 {
> >                                         // create a new request cycle for
> > the newPage call
> >                                         createRequestCycle();
> >                                         IBookmarkablePageRequestTarget
> > pageClassRequestTarget = (IBookmarkablePageRequestTarget)target;
> >                                         Class pageClass =
> > pageClassRequestTarget.getPageClass();
> >                                         PageParameters parameters =
> > pageClassRequestTarget.getPageParameters();
> >                                         if (parameters == null ||
> > parameters.size() == 0)
> >                                         {
> >                                                 newLastRenderedPage = new
> > DefaultPageFactory().newPage(pageClass);
> >                                         }
> >                                         else
> >                                         {
> >                                                 newLastRenderedPage = new
> > DefaultPageFactory().newPage(pageClass,
> >
> > parameters);
> >                                         }
> >                                 }
> >
> > I'm wondering if there is a good reason a new instance of
> > DefaultPageFactory is being used here instead of the one that is configure
> > on the WebApplication given to the WicketTester?
> >
> > The problem I'm having is that I create my own extended version of
> > DefaultPageFactory for the purpose of being able to mock up the response
> > page when unit testing and rely on that version when testing.
> >
> > -Craig
> >
>
> --
> View this message in context: http://www.nabble.com/MockWebApplication.generateLastRenderedPage%28WebRequestCycle-cycle%29-tf4468351.html#a12748359
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>
>

Re: MockWebApplication.generateLastRenderedPage(WebRequestCycle cycle)

Posted by Craig Lenzen <le...@visi.com>.
Really, still no response?  Should I just log a JIRA bug?

-Craig


Craig Lenzen wrote:
> 
> Just noticed this was originally posting in the user forum, it is probably
> better suited for the developers.
> 
> I'm looking at the following block of code in the MockWebApplication
> within the method that is listed in the subject of this post;
> 
>                                 else if (target instanceof
> IBookmarkablePageRequestTarget)
>                                 {
>                                         // create a new request cycle for
> the newPage call
>                                         createRequestCycle();
>                                         IBookmarkablePageRequestTarget
> pageClassRequestTarget = (IBookmarkablePageRequestTarget)target;
>                                         Class pageClass =
> pageClassRequestTarget.getPageClass();
>                                         PageParameters parameters =
> pageClassRequestTarget.getPageParameters();
>                                         if (parameters == null ||
> parameters.size() == 0)
>                                         {
>                                                 newLastRenderedPage = new
> DefaultPageFactory().newPage(pageClass);
>                                         }
>                                         else
>                                         {
>                                                 newLastRenderedPage = new
> DefaultPageFactory().newPage(pageClass,
>                                                                
> parameters);
>                                         }
>                                 }
> 
> I'm wondering if there is a good reason a new instance of
> DefaultPageFactory is being used here instead of the one that is configure
> on the WebApplication given to the WicketTester?
> 
> The problem I'm having is that I create my own extended version of
> DefaultPageFactory for the purpose of being able to mock up the response
> page when unit testing and rely on that version when testing.
> 
> -Craig
> 

-- 
View this message in context: http://www.nabble.com/MockWebApplication.generateLastRenderedPage%28WebRequestCycle-cycle%29-tf4468351.html#a12748359
Sent from the Wicket - Dev mailing list archive at Nabble.com.