Hi Mike,
nice catch. This is a bug ;) (I was able to reproduce), can you please
file new issue at
http://java.net/jira/browse/JERSEY?
But, fortunately for you (and others), it is easily workaroundable.
Override configure() method to set package names:
@Override
protected AppDescriptor configure() {
return new LowLevelAppDescriptor.Builder("testpackage1",
"testpackage2").build();
}
and it should work (at least it works for me with 1.13-SNAPSHOT).
Regards,
Pavel
On 6/5/12 3:58 PM, Mike Summers wrote:
> I'm getting odd behavior in my JUnit tests which extend JerseyTest.
>
> Calling super with a single package name in a single string finds
> endpoints:
> Jun 5, 2012 8:54:07 AM com.sun.jersey.api.core.PackagesResourceConfig init
> INFO: Scanning for root resource and provider classes in the packages:
> com.mobitv.dt.eons.codi.adapter.rest
> Jun 5, 2012 8:54:07 AM com.sun.jersey.api.core.ScanningResourceConfig
> logClasses
> INFO: Root resource classes found:
> class com.mobitv.dt.eons.codi.adapter.rest.Guide
> class com.mobitv.dt.eons.codi.adapter.rest.Watchlist
> class com.mobitv.dt.eons.codi.adapter.rest.Authenticate
> class com.mobitv.dt.eons.codi.adapter.rest.Recordings
> Jun 5, 2012 8:54:07 AM com.sun.jersey.api.core.ScanningResourceConfig
> logClasses
> INFO: Provider classes found:
> class com.mobitv.dt.eons.codi.adapter.rest.TestContextProvider
> class
> com.mobitv.dt.eons.codi.adapter.rest.IllegalArgumentExceptionMapper
> class com.mobitv.dt.eons.codi.adapter.rest.WebApplicationExceptionMapper
> class com.mobitv.dt.eons.codi.adapter.rest.ExceptionMapper
> Jun 5, 2012 8:54:07 AM
> com.sun.jersey.test.framework.spi.container.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer
> <init>
> INFO: Creating low level InMemory test container configured at the
> base URI http://localhost:9998/
> Jun 5, 2012 8:54:07 AM
> com.sun.jersey.test.framework.spi.container.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer
> start
> INFO: Starting low level InMemory test container
>
> However my endpoints are in 2 packages :-(
>
> Calling super with a String[] fails to find the endpoints:
> Jun 5, 2012 8:44:06 AM com.sun.jersey.api.core.PackagesResourceConfig init
> INFO: Scanning for root resource and provider classes in the packages:
> com.mobitv.dt.eons.codi.adapter.rest;com.mobitv.dt.eons.codi.client.api
> Jun 5, 2012 8:44:06 AM
> com.sun.jersey.test.framework.spi.container.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer
> <init>
> INFO: Creating low level InMemory test container configured at the
> base URI http://localhost:9998/
> Jun 5, 2012 8:44:06 AM
> com.sun.jersey.test.framework.spi.container.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer
> start
> INFO: Starting low level InMemory test container
> Jun 5, 2012 8:44:06 AM
> com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
> INFO: Initiating Jersey application, version 'Jersey: 1.5 01/14/2011
> 12:36 PM'
> Jun 5, 2012 8:44:07 AM
> com.sun.jersey.server.impl.application.RootResourceUriRules <init>
> SEVERE: The ResourceConfig instance does not contain any root resource
> classes.
> Jun 5, 2012 8:44:07 AM
> com.sun.jersey.test.framework.spi.container.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer
> stop
> INFO: Stopping low level InMemory test container
>
> Calling Super with two Strings fails identically:
> Jun 5, 2012 8:50:49 AM com.sun.jersey.api.core.PackagesResourceConfig init
> INFO: Scanning for root resource and provider classes in the packages:
> com.mobitv.dt.eons.codi.adapter.rest;com.mobitv.dt.eons.codi.client.api
> Jun 5, 2012 8:50:49 AM
> com.sun.jersey.test.framework.spi.container.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer
> <init>
> INFO: Creating low level InMemory test container configured at the
> base URI http://localhost:9998/
> Jun 5, 2012 8:50:49 AM
> com.sun.jersey.test.framework.spi.container.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer
> start
> INFO: Starting low level InMemory test container
> Jun 5, 2012 8:50:49 AM
> com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
> INFO: Initiating Jersey application, version 'Jersey: 1.5 01/14/2011
> 12:36 PM'
> Jun 5, 2012 8:50:50 AM
> com.sun.jersey.server.impl.application.RootResourceUriRules <init>
> SEVERE: The ResourceConfig instance does not contain any root resource
> classes.
> Jun 5, 2012 8:50:50 AM
> com.sun.jersey.test.framework.spi.container.inmemory.InMemoryTestContainerFactory$InMemoryTestContainer
> stop
> INFO: Stopping low level InMemory test container
>
> Same results with a single string, both package names, and either a
> colon or semi-colon separator.
>
> I'm running on Windows and see that the path separator is semi-colon
> in the INFO string, is this a platform problem? I'm using Jersey Test
> Framework 1.12
>
> Thanks-- Mike