users@jersey.java.net

Re: Jersey, Spring and UT

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 06 Mar 2008 15:18:45 +0100

Hi Jean,

Jean Aurambault wrote:
> Hil,
>
> I try to use spring with jersey 0.6 as described in Paul's article. I
> would like to make Unit tests following this pattern: http call -->
> jersey (use of spring to inject dao) --> dao (use of spring to manage
> transaction and entity manager) --> hsqldb
> Before using spring I was doing these tests with an in memory HTTP
> server, here is an extract of the code:
>
> String[] packageNames = {...};
> ResourceConfig rc = new PackagesResourceConfig(packageNames);
>
> HttpHandler handler =
> ContainerFactory.createContainer(HttpHandler.class, rc);
> server = HttpServerFactory.create(serverUrl + ":0/", handler);
>
> So it doesn't work anymore with spring.

Sorry :-( i have not connected ComponentProvider initiation to work with
the LW HTTP server or Grizzly. I will do that for 0.7.

I think what i need to do is specify a ComponentProvider property whose
value is an instance of a ComponentProvider and such a property can be
added to the ResourceConfig instance.


> I try to use jetty to run the
> whole web application but it seams there is a problem when loading
> resources:
> com.sun.ws.rest.api.container.ContainerException: The ResourceConfig
> instance does not contain any root resource classes.
>
> Any advice on how to implement these tests? Have you some tips about
> jetty resource loading (by the way I use maven)?
>


Maybe the following will help solve your problem with Jetty:

https://jersey.dev.java.net/servlets/ReadMsg?list=users&msgNo=751

? However, i am not sure if you will need to do something slightly
different for the spring configuration that is currently presented in
the blog.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109