cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Spring test support
Date Fri, 10 Sep 2010 19:11:31 GMT
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

Mime
View raw message