You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by "Weinstein, Eugene" <Eu...@ustrust.com> on 2006/07/27 16:57:10 UTC

In-container bean testing with Cactus

Hi,



Perhaps I am trying to re-invent the wheel and there are better tools
for my purposes out there. I generated the test suites for some web
services using Axis WSDL2Java with -t option and now I just pass the
names of those generated classes as parameters to ServletTestRunner.
I've also modified cactus-report.xsl mark slow-running tests. So,
essentially I am using Cactus just as Web interface for "pinging" these
web services.



I have to rebuild the project for each environment every time I make any
change because the service endpoint locations are hard-coded in their
corresponding ServiceLocator classes. I wish I could externalize this
configuration to JNDI and set these properties with something like
Spring. I created non-singleton beans for the ServerLocator classes in
applicationContext.xml and I can get a hold of ApplicationContext
through ServletContext if I extend ServletTestRunner. But the TestSuite
classes are not instantiated by the servlet, their names are just passed
to WebappTestRunner, which constructs them using Reflection API. So, for
now I just have the ServiceLocators read things like endpoint locations
from a properties file. I am wondering, though, if others would find
ServletBeanTestRunner that takes bean names rather than class names as
parameters useful and how I could implement it.



Thanks,



Eugene Weinstein





---------------------------------------------------------------------
The message contains confidential and/or legally privileged
information and is intended for use by the indicated addressee.
If you are not the intended addressee: (a) any disclosure,
reproduction, distribution or action you take because of it is
strictly prohibited; (b) please return the complete message to the
sender; and (c) this message is not a solicitation for purchase or
sale or an agreement of any kind whatsoever that binds the sender.
---------------------------------------------------------------------

Re: In-container bean testing with Cactus

Posted by Eric Walker <eq...@yahoo.com>.
Use easymock and MockEjb. With these tools you can simulate a J2EE environment without the need to run a server. 

Eric

"Weinstein, Eugene" <Eu...@ustrust.com> wrote: 
Hi,



Perhaps I am trying to re-invent the wheel and there are better tools
for my purposes out there. I generated the test suites for some web
services using Axis WSDL2Java with -t option and now I just pass the
names of those generated classes as parameters to ServletTestRunner.
I've also modified cactus-report.xsl mark slow-running tests. So,
essentially I am using Cactus just as Web interface for "pinging" these
web services.



I have to rebuild the project for each environment every time I make any
change because the service endpoint locations are hard-coded in their
corresponding ServiceLocator classes. I wish I could externalize this
configuration to JNDI and set these properties with something like
Spring. I created non-singleton beans for the ServerLocator classes in
applicationContext.xml and I can get a hold of ApplicationContext
through ServletContext if I extend ServletTestRunner. But the TestSuite
classes are not instantiated by the servlet, their names are just passed
to WebappTestRunner, which constructs them using Reflection API. So, for
now I just have the ServiceLocators read things like endpoint locations
from a properties file. I am wondering, though, if others would find
ServletBeanTestRunner that takes bean names rather than class names as
parameters useful and how I could implement it.



Thanks,



Eugene Weinstein





---------------------------------------------------------------------
The message contains confidential and/or legally privileged
information and is intended for use by the indicated addressee.
If you are not the intended addressee: (a) any disclosure,
reproduction, distribution or action you take because of it is
strictly prohibited; (b) please return the complete message to the
sender; and (c) this message is not a solicitation for purchase or
sale or an agreement of any kind whatsoever that binds the sender.
---------------------------------------------------------------------