users@jersey.java.net

Re: [Jersey] Jersey Test Framework and Glassfish v3 question

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 03 Mar 2010 09:35:47 +0100

On Mar 3, 2010, at 9:17 AM, Pavel Bucek wrote:

> Hello Noah,
>
> Embedded GFv3 is supported but not final version so I recommend
> using external container as you proposed.
>
> If you are using latest (1.2-SNAPSHOT) jersey, you can do it by
>
> 1) adding dependency on
> <dependency>
> <groupId>com.sun.jersey.jersey-test-framework</groupId>
> <artifactId>jersey-test-framework-external</artifactId>
> <version>${project.version}</version>
> <scope>test</scope>
> </dependency>
>
> 3) deploying your app (manually, test framework doesn't know how to
> deploy on external container automatically)
>

I am sure there is a way in maven to to deploy and un-deploy to app
servers using various plugins at the appropriate phases in the test
process. But it is something we have not tried.


> 2) running
> mvn clean install -
> Djersey
> .test
> .containerFactory
> =
> com
> .sun
> .jersey
> .test.framework.spi.container.external.ExternalTestContainerFactory -
> DJERSEY_HTTP_PORT=8080
>
> And tests should run against your container.
>

And for an EJB example see:

   http://download.java.net/maven/2/com/sun/jersey/samples/jersey-ejb/1.1.5/jersey-ejb-1.1.5-gf-project.zip

notice that testing is enabled by the profile "test".

Paul.