Created
May 4, 2011 14:53
-
-
Save gmoore/955347 to your computer and use it in GitHub Desktop.
Jersey 1.6 with Grizzly 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AthenaWebConfig extends PackagesResourceConfig { | |
public AthenaWebConfig() { | |
super ("org.fracturedatlas.athena"); | |
getMediaTypeMappings().put("json", MediaType.APPLICATION_JSON_TYPE); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
May 4, 2011 10:47:24 AM com.sun.jersey.test.framework.spi.container.grizzly.web.GrizzlyWebTestContainerFactory$GrizzlyWebTestContainer <init> | |
INFO: Creating Grizzly Web Container configured at the base URI http://localhost:9998/tix | |
May 4, 2011 10:47:25 AM com.sun.jersey.test.framework.spi.container.grizzly.web.GrizzlyWebTestContainerFactory$GrizzlyWebTestContainer start | |
INFO: Starting the Grizzly Web Container... | |
May 4, 2011 10:47:25 AM com.sun.grizzly.http.servlet.ServletContextImpl log | |
INFO: Initializing Spring root WebApplicationContext | |
May 4, 2011 10:47:26 AM com.sun.jersey.api.client.filter.LoggingFilter log | |
INFO: 1 * Client out-bound request | |
1 > POST http://localhost:9998/tix/tickets/ | |
1 > Content-Type: application/json | |
{"id":null} | |
May 4, 2011 10:47:26 AM com.sun.jersey.spi.spring.container.servlet.SpringServlet getContext | |
INFO: Creating new child context from classpath:testApplicationContext.xml | |
May 4, 2011 10:47:26 AM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans | |
INFO: Registering Spring bean, recordResource, of type org.fracturedatlas.athena.web.resource.RecordResource as a root resource class | |
May 4, 2011 10:47:26 AM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans | |
INFO: Registering Spring bean, fieldResource, of type org.fracturedatlas.athena.web.resource.FieldResource as a root resource class | |
May 4, 2011 10:47:26 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate | |
INFO: Initiating Jersey application, version 'Jersey: 1.6 03/25/2011 01:14 PM' | |
May 4, 2011 10:47:26 AM com.sun.jersey.api.core.PackagesResourceConfig init | |
INFO: Scanning for root resource and provider classes in the packages: | |
org.fracturedatlas.athena | |
May 4, 2011 10:47:26 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses | |
INFO: Root resource classes found: | |
class org.fracturedatlas.athena.web.resource.FieldResource | |
class org.fracturedatlas.athena.web.resource.RecordResource | |
May 4, 2011 10:47:26 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses | |
INFO: Provider classes found: | |
class org.fracturedatlas.athena.web.exception.AthenaException | |
class org.fracturedatlas.athena.web.serialization.JsonPropsSerializer | |
class org.fracturedatlas.athena.web.exception.InvalidFieldNameExceptionMapper | |
class org.fracturedatlas.athena.web.exception.ObjectNotFoundExceptionMapper | |
class org.fracturedatlas.athena.web.exception.AthenaConflictExceptionMapper | |
class org.fracturedatlas.athena.web.exception.ObjectNotFoundException | |
class org.fracturedatlas.athena.web.exception.TicketNotFoundException | |
class org.fracturedatlas.athena.web.serialization.JsonPropFieldSerializer | |
class org.fracturedatlas.athena.web.serialization.JsonPropValueSerializer | |
class org.fracturedatlas.athena.web.serialization.JsonPropValueArraySerializer | |
class org.fracturedatlas.athena.web.exception.NumberFormatExceptionMapper | |
class org.fracturedatlas.athena.web.serialization.JsonPropFieldArraySerializer | |
class org.fracturedatlas.athena.web.serialization.JsonTicketCollectionSerializer | |
class org.fracturedatlas.athena.web.serialization.JsonTicketSerializer | |
class org.fracturedatlas.athena.web.exception.ApaExceptionMapper | |
class org.fracturedatlas.athena.web.exception.JsonMappingExceptionMapper | |
class org.fracturedatlas.athena.web.exception.TicketNotFoundExceptionMapper | |
class org.fracturedatlas.athena.web.exception.InvalidFieldNameException | |
class org.fracturedatlas.athena.web.exception.AthenaExceptionMapper | |
May 4, 2011 10:47:26 AM com.sun.jersey.server.impl.application.DeferredResourceConfig$ApplicationHolder <init> | |
INFO: Instantiated the Application class org.fracturedatlas.athena.web.config.AthenaWebConfig | |
May 4, 2011 10:47:26 AM com.sun.jersey.api.client.filter.LoggingFilter log | |
INFO: 1 * Client in-bound response | |
1 < 200 | |
1 < Date: Wed, 04 May 2011 14:47:26 GMT | |
1 < Content-Length: 10 | |
1 < server: grizzly/1.9.8 | |
1 < Content-Type: application/json | |
1 < | |
{"id":"2"} | |
... | |
Results : | |
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0 | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] BUILD SUCCESSFUL | |
[INFO] ------------------------------------------------------------------------ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<properties> | |
<spring-version>3.0.5.RELEASE</spring-version> | |
<hibernate-version>3.3.2.GA</hibernate-version> | |
<athena-version>${project.version}</athena-version> | |
<jersey-version>1.6</jersey-version> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |
</properties> | |
<dependencies> | |
<dependency> | |
<groupId>com.sun.jersey</groupId> | |
<artifactId>jersey-server</artifactId> | |
<version>${jersey-version}</version> | |
</dependency> | |
<dependency> | |
<groupId>com.sun.jersey</groupId> | |
<artifactId>jersey-json</artifactId> | |
<version>${jersey-version}</version> | |
</dependency> | |
<dependency> | |
<groupId>com.sun.jersey</groupId> | |
<artifactId>jersey-client</artifactId> | |
<version>${jersey-version}</version> | |
</dependency> | |
<dependency> | |
<groupId>com.sun.jersey</groupId> | |
<artifactId>jersey-bundle</artifactId> | |
<version>${jersey-version}</version> | |
</dependency> | |
<dependency> | |
<groupId>com.sun.jersey.contribs</groupId> | |
<artifactId>jersey-spring</artifactId> | |
<version>${jersey-version}</version> | |
<exclusions> | |
<exclusion> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-core</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-web</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-beans</artifactId> | |
</exclusion> | |
<exclusion> | |
<groupId>org.springframework</groupId> | |
<artifactId>spring-context</artifactId> | |
</exclusion> | |
</exclusions> | |
</dependency> | |
<dependency> | |
<groupId>com.sun.jersey.jersey-test-framework</groupId> | |
<artifactId>jersey-test-framework-grizzly</artifactId> | |
<version>${jersey-version}</version> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public BaseTixContainerTest() { | |
super(new WebAppDescriptor.Builder("org.fracturedatlas.athena.web.resource") | |
.contextPath("tix") | |
.contextParam("contextConfigLocation", "classpath:testApplicationContext.xml") | |
.servletClass(SpringServlet.class) | |
.contextListenerClass(ContextLoaderListener.class) | |
.contextParam("javax.ws.rs.Application", "org.fracturedatlas.athena.web.config.AthenaWebConfig") | |
.build()); | |
ClientConfig cc = new DefaultClientConfig(); | |
Client c = Client.create(cc); | |
tix = c.resource(TIX_URI); | |
tix.addFilter(new LoggingFilter()); | |
ApplicationContext context = new ClassPathXmlApplicationContext("testApplicationContext.xml"); | |
apa = (ApaAdapter)context.getBean("apa"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment