users@jersey.java.net

Problem using the JerseyTest class

From: tarjei <tarjei_at_nu.no>
Date: Tue, 14 Jul 2009 14:29:01 +0200

Hi, I'm trying to use the JerseyTest class with a resource that contains
some spring loaded resources.

I set up the class like this:

@TestExecutionListeners( { DependencyInjectionTestExecutionListener.class })
@ContextConfiguration(locations = { "/applicationContext-HSQLdb.xml" })
@RunWith(SpringJUnit4ClassRunner.class)
public class SourceResourceJerseyTest extends JerseyTest {

        public SourceResourceJerseyTest() throws Exception {
                super("my.path.");
        }


}


My problem starts in my testmethod where both webResource and
jerseyClient are null.

Jersey reports that if finds and loads the resourceclasses, but that
somehow they are not created.

When I run the tests with Grizzly I get:

Jul 14, 2009 2:26:25 PM
com.sun.jersey.test.framework.impl.container.grizzly.web.GrizzlyWebContainer
start
INFO: Starting grizzly...
Jul 14, 2009 2:26:25 PM com.sun.grizzly.http.servlet.ServletContextImpl
initListeners WARNING: Unable to load listener: null



Jul 14, 2009 2:24:29 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
...
Jul 14, 2009 2:24:29 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Root resource classes found:
   ...
Jul 14, 2009 2:24:29 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Provider classes found:
Jul 14, 2009 2:24:29 PM
com.sun.jersey.server.impl.application.WebApplicationImpl initiate
INFO: Initiating Jersey application, version 'Jersey: 1.1.0-ea
04/30/2009 05:54 PM'
Jul 14, 2009 2:24:30 PM
com.sun.jersey.server.impl.application.WebApplicationImpl newResourceClass
WARNING: A sub-resource method, public java.util.List
my.path.web.SourceResource.list(java.lang.String,boolean,long,int), with
URI template, "", is treated as a resource method
Jul 14, 2009 2:24:30 PM
com.sun.jersey.server.impl.application.WebApplicationImpl newResourceClass
WARNING: A sub-resource method, public my.path.web.SourceView
my-path.web.SourceResource.create(my.path.web.SourceView), with URI
template, "/", is treated as a resource method


Any tips to what I'm doing wrong?

Kind regards,
Tarjei

-- 
Tarjei Huse
Mobil: 920 63 413