users@jersey.java.net

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

From: Pavel Bucek <Pavel.Bucek_at_Sun.COM>
Date: Wed, 03 Mar 2010 09:17:54 +0100

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)

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.

If you are using older version of jersey, take a look at
http://blogs.sun.com/naresh/entry/jersey_test_framework_re_visited


Regards,
Pavel



NBW wrote:
> Many of my Jersey Resource classes use injected EJBs. I was wondering
> if it is possible to use the Jersey Test Framework to test these
> resource classes. I thought perhaps I might be able to use the
> ExternalContainerFactory and -DJERSEY_HTTP_PORT=8080 (my GFv3
> http-listener-1 port). If this is possible how do you instruct the JTF
> to deploy to the container or do you have to do that manually prior to
> running your JTF test? Any samples using JTF to an external GFv3
> container would be nice (assuming I can go that route to do in
> container tests with my EJBs). Thanks.
>
> -Noah
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>