You are correct. I'm not sure what your solution should be, but can't you do one of the following:

1) create your own ServletContext implementation and tell ServletUnit to use it

2) explicitly set ServletContext attributes during test initialization

3) Submit a patch to ServletUnit to let you do one of the above.

David

Graham Klyne wrote:
I seem to have run into a limitation of ServletUnit for testing Pluto code.  It
appears that when the portal driver attempts to retrieve a ServerContext value
for the target portlet, ServletUnit simply returns a hard-coded null, which
(unsurprisingly) results in portlet invocation failure.  Also, it is not clear
to me that ServletUnit has the ability to deal with more than one servlet and/or
context in a single run (i.e. it reads a single application's web.xml file,
without any obvious provision for dealing with more).

I may take a little while longer to look at the ServletUnit code, but it is
looking as if I may have to fall back on using HTTPUnit to test via a running
Tomcat instance, which will make the tests slower to run than I would have 
liked.

Does anyone have any edifying thoughts, comments or pointers?

#g


Reply via email to