You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alexander Gubin <ag...@greatergood.net> on 2011/08/24 18:06:20 UTC

wicket include in test

I saw similar post about 2 years ago, but seems that the question was
left unaswered.

http://wicket-users.markmail.org/message/o6ub7gjxrheevlo4?q=test+include

I have a page with Include, works fine, however when testing I get:

org.apache.wicket.util.resource.ResourceStreamNotFoundException:
Resource http://localhost/BasePageTestCase$1/static/footer.html could
not be opened


Maurice Marrick mentioned setting correct path to WicketTester, so it
can resolve static resources. How would one do that?

I tried "/" or "/static" with no luck - same error

please advise

Sincerely,

Alexander

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: wicket include in test

Posted by Alexander Gubin <ag...@greatergood.net>.
Igor,

thanks a lot!

I was thinking of putting some check whether it's a test code into 
production code, but that idea seems a bit whacky :)

Will play with MockServletRequest...

thanks again

Alexander


On 08/25/2011 10:48 AM, Igor Vaynberg wrote:
> the include component tries to construct a url from pieces in your
> servlet request such as servletrequest.getprotocol,
> servletrequest.getservername, etc
>
> what you have to do is trick it into constructing a url that looks
> like this: file:///some/dir/static/footer.html
>
> you have to play around with setters on mockservletrequest and looking
> at the source of Include component to see how it uses them.
>
> if you cannot get it to do what you want then this component may not
> work in the test environment. as the last resort you can toggle its
> visibility if its running in a testcase.
>
> -igor
>
>
> On Wed, Aug 24, 2011 at 9:06 AM, Alexander Gubin<ag...@greatergood.net>  wrote:
>> I saw similar post about 2 years ago, but seems that the question was
>> left unaswered.
>>
>> http://wicket-users.markmail.org/message/o6ub7gjxrheevlo4?q=test+include
>>
>> I have a page with Include, works fine, however when testing I get:
>>
>> org.apache.wicket.util.resource.ResourceStreamNotFoundException:
>> Resource http://localhost/BasePageTestCase$1/static/footer.html could
>> not be opened
>>
>>
>> Maurice Marrick mentioned setting correct path to WicketTester, so it
>> can resolve static resources. How would one do that?
>>
>> I tried "/" or "/static" with no luck - same error
>>
>> please advise
>>
>> Sincerely,
>>
>> Alexander
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: wicket include in test

Posted by Igor Vaynberg <ig...@gmail.com>.
the include component tries to construct a url from pieces in your
servlet request such as servletrequest.getprotocol,
servletrequest.getservername, etc

what you have to do is trick it into constructing a url that looks
like this: file:///some/dir/static/footer.html

you have to play around with setters on mockservletrequest and looking
at the source of Include component to see how it uses them.

if you cannot get it to do what you want then this component may not
work in the test environment. as the last resort you can toggle its
visibility if its running in a testcase.

-igor


On Wed, Aug 24, 2011 at 9:06 AM, Alexander Gubin <ag...@greatergood.net> wrote:
> I saw similar post about 2 years ago, but seems that the question was
> left unaswered.
>
> http://wicket-users.markmail.org/message/o6ub7gjxrheevlo4?q=test+include
>
> I have a page with Include, works fine, however when testing I get:
>
> org.apache.wicket.util.resource.ResourceStreamNotFoundException:
> Resource http://localhost/BasePageTestCase$1/static/footer.html could
> not be opened
>
>
> Maurice Marrick mentioned setting correct path to WicketTester, so it
> can resolve static resources. How would one do that?
>
> I tried "/" or "/static" with no luck - same error
>
> please advise
>
> Sincerely,
>
> Alexander
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org