You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by puzz_1 <ma...@semanticbits.com> on 2010/09/10 16:47:25 UTC
Spring test support
Is there an example on how to use the CXF testing utilities for Spring
configured CXF services? I have looked at the systest module and the testing
utilities and I couldn't find anything that would instantiate a service
using Spring.
Is there any base classes that would take a spring configuration file and
instantiate the service in a JUnit test?
--
View this message in context: http://cxf.547215.n5.nabble.com/Spring-test-support-tp2835106p2835106.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Spring test support
Posted by Daniel Kulp <dk...@apache.org>.
On Friday 10 September 2010 10:47:25 am puzz_1 wrote:
> Is there an example on how to use the CXF testing utilities for Spring
> configured CXF services? I have looked at the systest module and the
> testing utilities and I couldn't find anything that would instantiate a
> service using Spring.
>
> Is there any base classes that would take a spring configuration file and
> instantiate the service in a JUnit test?
As Johan mentioned, the normal ClasspathXMLContext usually works very well.
Just create it with the config you want and start the context. Things pop up
quite easily.
Another option may be to look at the AbstractSpringServer.java thing in the
jax-rs system tests. It's quite interesting in that it doesn't startup
context, it actually starts up a directory that looks like an exploded war.
Thus, the web.xml and beans.xml and such that you would normally use would
"just work". If you look in systests/jaxrs/src/test/resources/, most of the
directories you see there are "war" things for that test class.
The AegisJaxWsTest in the systests/databinding section uses a different
approach. It subclasses the Spring AbstractJUnit4SpringContextTests class
and provides the @ContextConfiguration annotation to configure the context it
should start at startup.
Hopefully something above will help. :-)
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Re: Spring test support
Posted by Johan Edstrom <se...@gmail.com>.
Springs testrunners or ClasspathXMLContext work quite well.
On Sep 10, 2010, at 8:47 AM, puzz_1 wrote:
>
>
> Is there an example on how to use the CXF testing utilities for Spring
> configured CXF services? I have looked at the systest module and the testing
> utilities and I couldn't find anything that would instantiate a service
> using Spring.
>
> Is there any base classes that would take a spring configuration file and
> instantiate the service in a JUnit test?
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Spring-test-support-tp2835106p2835106.html
> Sent from the cxf-user mailing list archive at Nabble.com.
Johan Edstrom
joed@opennms.org
They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.
Benjamin Franklin, Historical Review of Pennsylvania, 1759