[jboss-cvs] JBossAS SVN: r106603 - in trunk/resteasy-int/test: application-scanned-war and 64 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 12 13:48:40 EDT 2010
Author: bill.burke at jboss.com
Date: 2010-07-12 13:48:39 -0400 (Mon, 12 Jul 2010)
New Revision: 106603
Added:
trunk/resteasy-int/test/application-scanned-war/
trunk/resteasy-int/test/application-scanned-war/pom.xml
trunk/resteasy-int/test/application-scanned-war/src/
trunk/resteasy-int/test/application-scanned-war/src/main/
trunk/resteasy-int/test/application-scanned-war/src/main/java/
trunk/resteasy-int/test/application-scanned-war/src/main/java/org/
trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/
trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/resteasy/
trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/resteasy/test/
trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/resteasy/test/smoke/
trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/resteasy/test/smoke/AppConfig.java
trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/resteasy/test/smoke/MyApplicationConfig.java
trunk/resteasy-int/test/application-scanned-war/src/main/resources/
trunk/resteasy-int/test/application-scanned-war/src/main/webapp/
trunk/resteasy-int/test/application-scanned-war/src/main/webapp/WEB-INF/
trunk/resteasy-int/test/application-scanned-war/src/main/webapp/WEB-INF/web.xml
trunk/resteasy-int/test/application-scanned-war/src/main/webapp/index.jsp
trunk/resteasy-int/test/application-scanned-war/src/test/
trunk/resteasy-int/test/application-scanned-war/src/test/java/
trunk/resteasy-int/test/application-scanned-war/src/test/java/org/
trunk/resteasy-int/test/application-scanned-war/src/test/java/org/jboss/
trunk/resteasy-int/test/application-scanned-war/src/test/java/org/jboss/resteasy/
trunk/resteasy-int/test/application-scanned-war/src/test/java/org/jboss/resteasy/test/
trunk/resteasy-int/test/application-scanned-war/src/test/java/org/jboss/resteasy/test/jboss/
trunk/resteasy-int/test/application-scanned-war/src/test/java/org/jboss/resteasy/test/jboss/AppConfigTest.java
trunk/resteasy-int/test/application-scanned-war/src/test/resources/
trunk/resteasy-int/test/application-scanned-war/src/test/resources/jndi.properties
trunk/resteasy-int/test/application-scanned-war/src/test/resources/log4j.xml
trunk/resteasy-int/test/async-http-servlet-3.0-test/
trunk/resteasy-int/test/async-http-servlet-3.0-test/async-http-servlet-3.0-test.iml
trunk/resteasy-int/test/async-http-servlet-3.0-test/pom.xml
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/smoke/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/smoke/Customer.java
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/smoke/SimpleResource.java
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/resources/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/resources/roles.properties
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/resources/users.properties
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/WEB-INF/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/WEB-INF/jboss-web.xml
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/WEB-INF/web.xml
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/index.jsp
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/java/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/java/org/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/java/org/jboss/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/test/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/test/jboss/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/test/jboss/SmokeTest.java
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/resources/
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/resources/jndi.properties
trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/resources/log4j.xml
trunk/resteasy-int/test/ejb-jar-war/
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/pom.xml
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyException.java
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyExceptionMapper.java
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyResource.java
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyResourceBean.java
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/webapp/
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/webapp/WEB-INF/
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/webapp/WEB-INF/web.xml
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/webapp/index.jsp
trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/test/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/pom.xml
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/java/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/webapp/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/webapp/WEB-INF/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/webapp/WEB-INF/web.xml
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/webapp/index.jsp
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/java/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/java/org/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/java/org/jboss/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/java/org/jboss/resteasy/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/java/org/jboss/resteasy/test/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/java/org/jboss/resteasy/test/jboss/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/java/org/jboss/resteasy/test/jboss/EjbTest.java
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/resources/
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/resources/jndi.properties
trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/resources/log4j.xml
trunk/resteasy-int/test/ejb-jar-war/pom.xml
trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyException.java
trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyExceptionMapper.java
Modified:
trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyResource.java
trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyResourceBean.java
trunk/resteasy-int/test/ejb-war/src/test/java/org/jboss/resteasy/test/jboss/EjbTest.java
trunk/resteasy-int/test/pom.xml
Log:
Added: trunk/resteasy-int/test/application-scanned-war/pom.xml
===================================================================
--- trunk/resteasy-int/test/application-scanned-war/pom.xml (rev 0)
+++ trunk/resteasy-int/test/application-scanned-war/pom.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,90 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-parent</artifactId>
+ <version>6.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.jbossas.resteasy.test</groupId>
+ <artifactId>application-scan-test</artifactId>
+ <packaging>war</packaging>
+ <name>Basic Integration Test</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>${version.org.jboss.resteasy}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>application-scan-test</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-maven-plugin</artifactId>
+ <version>1.3.1</version>
+ <configuration>
+ <jbossHome>${jboss.home}</jbossHome>
+ </configuration>
+ <executions>
+ <execution>
+ <id>jboss-deploy</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>deploy</goal>
+ </goals>
+ <configuration>
+ <fileName>${basedir}/target/application-scan-test.war</fileName>
+ </configuration>
+ </execution>
+ <execution>
+ <id>jboss-undeploy</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>undeploy</goal>
+ </goals>
+ <configuration>
+ <fileName>${basedir}/target/application-scan-test.war</fileName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/resteasy/test/smoke/AppConfig.java
===================================================================
--- trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/resteasy/test/smoke/AppConfig.java (rev 0)
+++ trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/resteasy/test/smoke/AppConfig.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,109 @@
+package org.jboss.resteasy.test.smoke;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class AppConfig
+{
+ @Path("/my")
+ public static class MyResource
+ {
+ public static int instantiationCount = 0;
+
+ public MyResource()
+ {
+ instantiationCount++;
+ }
+
+ @GET
+ @Produces("text/quoted")
+ public String get()
+ {
+ if (MyApplicationConfig.created == false || instantiationCount > 1)
+ {
+ throw new WebApplicationException(500);
+ }
+ return "hello";
+ }
+
+ @GET
+ @Path("exception")
+ public String getException()
+ {
+ throw new FooException();
+ }
+
+ @GET
+ @Path("exception/count")
+ @Produces("text/plain")
+ public String getCount()
+ {
+ return Integer.toString(FooExceptionMapper.num_instantiations);
+ }
+ }
+
+ public static class FooException extends RuntimeException
+ {
+ }
+
+ @Provider
+ public static class FooExceptionMapper implements ExceptionMapper<FooException>
+ {
+ public static int num_instantiations = 0;
+
+ public FooExceptionMapper()
+ {
+ num_instantiations++;
+ }
+
+ public Response toResponse(FooException exception)
+ {
+ return Response.status(412).build();
+ }
+ }
+
+ @Provider
+ @Produces("text/quoted")
+ public static class QuotedTextWriter implements MessageBodyWriter<String>
+ {
+ public static int num_instantiations = 0;
+
+ public QuotedTextWriter()
+ {
+ num_instantiations++;
+ }
+
+ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
+ {
+ return type.equals(String.class);
+ }
+
+ public long getSize(String s, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
+ {
+ return -1;
+ }
+
+ public void writeTo(String s, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException
+ {
+ s = "\"" + s + "\"";
+ entityStream.write(s.getBytes());
+ }
+ }
+
+}
\ No newline at end of file
Added: trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/resteasy/test/smoke/MyApplicationConfig.java
===================================================================
--- trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/resteasy/test/smoke/MyApplicationConfig.java (rev 0)
+++ trunk/resteasy-int/test/application-scanned-war/src/main/java/org/jboss/resteasy/test/smoke/MyApplicationConfig.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,37 @@
+package org.jboss.resteasy.test.smoke;
+
+import javax.ws.rs.core.Application;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class MyApplicationConfig extends Application
+{
+ private Set<Class<?>> classes = new HashSet<Class<?>>();
+ private Set<Object> singletons = new HashSet<Object>();
+
+ public static boolean created = false;
+
+ public MyApplicationConfig()
+ {
+ created = true;
+ singletons.add(new AppConfig.MyResource());
+ singletons.add(new AppConfig.QuotedTextWriter());
+ singletons.add(new AppConfig.FooExceptionMapper());
+ }
+
+ public Set<Class<?>> getClasses()
+ {
+ return classes;
+ }
+
+ @Override
+ public Set<Object> getSingletons()
+ {
+ return singletons;
+ }
+
+}
Added: trunk/resteasy-int/test/application-scanned-war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/resteasy-int/test/application-scanned-war/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/resteasy-int/test/application-scanned-war/src/main/webapp/WEB-INF/web.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,6 @@
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+ <display-name>Archetype Created Web Application</display-name>
+
+</web-app>
Added: trunk/resteasy-int/test/application-scanned-war/src/main/webapp/index.jsp
===================================================================
--- trunk/resteasy-int/test/application-scanned-war/src/main/webapp/index.jsp (rev 0)
+++ trunk/resteasy-int/test/application-scanned-war/src/main/webapp/index.jsp 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>
Added: trunk/resteasy-int/test/application-scanned-war/src/test/java/org/jboss/resteasy/test/jboss/AppConfigTest.java
===================================================================
--- trunk/resteasy-int/test/application-scanned-war/src/test/java/org/jboss/resteasy/test/jboss/AppConfigTest.java (rev 0)
+++ trunk/resteasy-int/test/application-scanned-war/src/test/java/org/jboss/resteasy/test/jboss/AppConfigTest.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,67 @@
+package org.jboss.resteasy.test.jboss;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.util.HttpResponseCodes;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class AppConfigTest
+{
+ private void _test(HttpClient client, String uri, String body)
+ {
+ {
+ GetMethod method = new GetMethod(uri);
+ try
+ {
+ method.addRequestHeader("Accept", "text/quoted");
+ int status = client.executeMethod(method);
+ Assert.assertEquals(status, HttpResponseCodes.SC_OK);
+ Assert.assertEquals(body, method.getResponseBodyAsString());
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+
+
+ @Test
+ public void testIt()
+ {
+ HttpClient client = new HttpClient();
+ _test(client, "http://localhost:8080/application-scan-test/my", "\"hello\"");
+ _test(client, "http://localhost:8080/application-scan-test/my", "\"hello\"");
+ _test(client, "http://localhost:8080/application-scan-test/my", "\"hello\"");
+ }
+
+ @Test
+ public void testSingletons() throws Exception
+ {
+ ClientRequest request = new ClientRequest("http://localhost:8080/application-scan-test/my/exception");
+ ClientResponse response = request.get();
+ Assert.assertEquals(412, response.getStatus());
+
+ ClientRequest countRequest = new ClientRequest("http://localhost:8080/application-scan-test/my/exception/count");
+ String res = countRequest.getTarget(String.class);
+ Assert.assertEquals("1", res);
+
+ request.clear();
+ response = request.get();
+ Assert.assertEquals(412, response.getStatus());
+
+ countRequest.clear();
+ res = countRequest.getTarget(String.class);
+ Assert.assertEquals("1", res);
+ }
+}
Added: trunk/resteasy-int/test/application-scanned-war/src/test/resources/jndi.properties
===================================================================
--- trunk/resteasy-int/test/application-scanned-war/src/test/resources/jndi.properties (rev 0)
+++ trunk/resteasy-int/test/application-scanned-war/src/test/resources/jndi.properties 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
\ No newline at end of file
Added: trunk/resteasy-int/test/application-scanned-war/src/test/resources/log4j.xml
===================================================================
--- trunk/resteasy-int/test/application-scanned-war/src/test/resources/log4j.xml (rev 0)
+++ trunk/resteasy-int/test/application-scanned-war/src/test/resources/log4j.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 64736 2007-08-21 15:49:48Z anil.saldhana at jboss.com $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <param name="File" value="${build.testlog}/test.log"/>
+ <param name="Append" value="true"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Threshold" value="DEBUG"/>
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/async-http-servlet-3.0-test.iml
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/async-http-servlet-3.0-test.iml (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/async-http-servlet-3.0-test.iml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/resources" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: org.jboss.resteasy:resteasy-jaxrs:2.0-rc1-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: org.jboss.resteasy:jaxrs-api:2.0-rc1-SNAPSHOT" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-api:1.5.8" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:slf4j-simple:1.5.8" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:jcl-over-slf4j:1.5.8" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: org.scannotation:scannotation:1.0.2" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: javassist:javassist:3.8.0.GA" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: javax.annotation:jsr250-api:1.0" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: javax.activation:activation:1.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-httpclient:commons-httpclient:3.1" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: commons-codec:commons-codec:1.2" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpclient:4.0" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpcore:4.0.1" level="project" />
+ <orderEntry type="library" scope="PROVIDED" name="Maven: net.jcip:jcip-annotations:1.0" level="project" />
+ <orderEntry type="library" exported="" name="Maven: junit:junit:4.1" level="project" />
+ </component>
+</module>
+
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/pom.xml
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/pom.xml (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/pom.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,91 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs-all</artifactId>
+ <version>2.0-rc1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>async-http-servlet-3.0-test</artifactId>
+ <packaging>war</packaging>
+ <name>Async Http Servlet 3.0 Test</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>async-test</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-maven-plugin</artifactId>
+ <version>1.3.1</version>
+ <configuration>
+ <jbossHome>${jboss.home}</jbossHome>
+ </configuration>
+ <executions>
+ <execution>
+ <id>jboss-deploy</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>deploy</goal>
+ </goals>
+ <configuration>
+ <fileName>${basedir}/target/async-test.war</fileName>
+ </configuration>
+ </execution>
+ <execution>
+ <id>jboss-undeploy</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>undeploy</goal>
+ </goals>
+ <configuration>
+ <fileName>${basedir}/target/async-test.war</fileName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/smoke/Customer.java
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/smoke/Customer.java (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/smoke/Customer.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,34 @@
+package org.jboss.resteasy.test.smoke;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+ at XmlRootElement
+public class Customer
+{
+ private String name;
+
+ public Customer()
+ {
+ }
+
+ public Customer(String name)
+ {
+ this.name = name;
+ }
+
+ @XmlElement
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/smoke/SimpleResource.java
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/smoke/SimpleResource.java (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/java/org/jboss/resteasy/test/smoke/SimpleResource.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,85 @@
+package org.jboss.resteasy.test.smoke;
+
+import org.jboss.resteasy.annotations.Suspend;
+import org.jboss.resteasy.spi.AsynchronousResponse;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+ at Path("/")
+public class SimpleResource
+{
+
+ @GET
+ @Path("basic")
+ @Produces("text/plain")
+ public void getBasic(final @Suspend(100000) AsynchronousResponse response) throws Exception
+ {
+ Thread t = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ System.out.println("STARTED!!!!");
+ Thread.sleep(5000);
+ Response jaxrs = Response.ok("basic").type(MediaType.TEXT_PLAIN).build();
+ response.setResponse(jaxrs);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ };
+ t.start();
+
+ }
+
+ @GET
+ @Path("gzip")
+ @Produces("text/plain")
+ public void getGzip(final @Suspend(100000) AsynchronousResponse response) throws Exception
+ {
+ Thread t = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ System.out.println("STARTED Gzip !!!!");
+ Thread.sleep(5000);
+ Response jaxrs = Response.ok("HELLO WORLD").type(MediaType.TEXT_PLAIN).header("Content-Encoding", "gzip").build();
+ response.setResponse(jaxrs);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ };
+ t.start();
+
+ }
+
+
+ @GET
+ @Path("xml")
+ @Produces("application/xml")
+ public Customer getCustomer()
+ {
+ return new Customer("Bill Burke");
+ }
+
+
+}
\ No newline at end of file
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/resources/roles.properties
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/resources/roles.properties (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/resources/roles.properties 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1 @@
+bill=admin
\ No newline at end of file
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/resources/users.properties
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/resources/users.properties (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/resources/users.properties 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1 @@
+bill=password
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/WEB-INF/jboss-web.xml
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/WEB-INF/jboss-web.xml (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/WEB-INF/jboss-web.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,5 @@
+<jboss-web>
+ <security-domain>java:/jaas/other</security-domain>
+ <context-root>resteasy</context-root>
+
+</jboss-web>
\ No newline at end of file
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/WEB-INF/web.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,5 @@
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+</web-app>
+
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/index.jsp
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/index.jsp (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/src/main/webapp/index.jsp 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/test/jboss/SmokeTest.java
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/test/jboss/SmokeTest.java (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/java/org/jboss/resteasy/test/jboss/SmokeTest.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,91 @@
+package org.jboss.resteasy.test.jboss;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.jboss.resteasy.test.smoke.Customer;
+import org.jboss.resteasy.util.HttpResponseCodes;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.xml.bind.JAXBContext;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.util.zip.GZIPInputStream;
+
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class SmokeTest
+{
+ @Test
+ public void testNoDefaultsResource() throws Exception
+ {
+ HttpClient client = new HttpClient();
+
+ {
+ GetMethod method = new GetMethod("http://localhost:8080/resteasy/basic");
+ int status = client.executeMethod(method);
+ Assert.assertEquals(HttpResponseCodes.SC_OK, status);
+ Assert.assertEquals("basic", method.getResponseBodyAsString());
+ method.releaseConnection();
+ }
+ {
+ // I'm testing unknown content-length here
+ GetMethod method = new GetMethod("http://localhost:8080/resteasy/xml");
+ int status = client.executeMethod(method);
+ Assert.assertEquals(HttpResponseCodes.SC_OK, status);
+ String result = method.getResponseBodyAsString();
+ JAXBContext ctx = JAXBContext.newInstance(Customer.class);
+ Customer cust = (Customer) ctx.createUnmarshaller().unmarshal(new StringReader(result));
+ Assert.assertEquals("Bill Burke", cust.getName());
+ method.releaseConnection();
+ }
+
+ }
+
+ public String readString(InputStream in) throws IOException
+ {
+ char[] buffer = new char[1024];
+ StringBuilder builder = new StringBuilder();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ int wasRead = 0;
+ do
+ {
+ wasRead = reader.read(buffer, 0, 1024);
+ if (wasRead > 0)
+ {
+ builder.append(buffer, 0, wasRead);
+ }
+ }
+ while (wasRead > -1);
+
+ return builder.toString();
+ }
+
+
+ @Test
+ public void testGzip() throws Exception
+ {
+ HttpClient client = new HttpClient();
+ {
+ GetMethod get = new GetMethod("http://localhost:8080/resteasy/gzip");
+ get.addRequestHeader("Accept-Encoding", "gzip, deflate");
+ int status = client.executeMethod(get);
+ Assert.assertEquals(200, status);
+ Assert.assertEquals("gzip", get.getResponseHeader("Content-Encoding").getValue());
+ GZIPInputStream gzip = new GZIPInputStream(get.getResponseBodyAsStream());
+ String response = readString(gzip);
+
+
+ // test that it is actually zipped
+ Assert.assertEquals(response, "HELLO WORLD");
+ }
+
+ }
+
+}
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/resources/jndi.properties
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/resources/jndi.properties (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/resources/jndi.properties 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
\ No newline at end of file
Added: trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/resources/log4j.xml
===================================================================
--- trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/resources/log4j.xml (rev 0)
+++ trunk/resteasy-int/test/async-http-servlet-3.0-test/src/test/resources/log4j.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 64736 2007-08-21 15:49:48Z anil.saldhana at jboss.com $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <param name="File" value="${build.testlog}/test.log"/>
+ <param name="Append" value="true"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Threshold" value="DEBUG"/>
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-jar/pom.xml
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-jar/pom.xml (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-jar/pom.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,39 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-parent</artifactId>
+ <version>6.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.jbossas.resteasy.test</groupId>
+ <artifactId>ejb-jar</artifactId>
+ <packaging>jar</packaging>
+ <name>Basic Integration Test</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>${version.org.jboss.resteasy}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.ejb</groupId>
+ <artifactId>jboss-ejb-api_3.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyException.java
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyException.java (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyException.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,9 @@
+package org.jboss.resteasy.test;
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class MyException extends RuntimeException
+{
+}
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyExceptionMapper.java
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyExceptionMapper.java (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyExceptionMapper.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,18 @@
+package org.jboss.resteasy.test;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+ at Provider
+public class MyExceptionMapper implements ExceptionMapper<MyException>
+{
+ public Response toResponse(MyException e)
+ {
+ return Response.status(412).type("text/plain").entity("MyException thrown").build();
+ }
+}
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyResource.java
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyResource.java (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyResource.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,30 @@
+package org.jboss.resteasy.test;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+ at Path("/scan")
+public interface MyResource
+{
+ @GET
+ @Produces("text/plain")
+ String get();
+
+ @GET
+ @Produces("text/plain")
+ @Path("exception")
+ public String testException();
+
+ @Path("/custom-exception")
+ @GET
+ String throwException();
+
+ @Path("/ejb-exception")
+ @GET
+ String throwEjbException();
+}
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyResourceBean.java
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyResourceBean.java (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/java/org/jboss/resteasy/test/MyResourceBean.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,58 @@
+package org.jboss.resteasy.test;
+
+import javax.ejb.EJBException;
+import javax.ws.rs.Path;
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ejb.Stateless;
+import javax.ejb.EJBContext;
+import javax.annotation.Resource;
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+ at Path("/scan")
+ at Stateless
+public class MyResourceBean implements MyResource
+{
+ @Resource
+ private EJBContext ctx;
+
+ @GET
+ @Produces("text/plain")
+ public String get()
+ {
+ if (ctx == null)
+ {
+ System.out.println("NO CONTEXT!!!!!");
+ throw new WebApplicationException(500);
+ }
+ System.out.println("CONTEXT WAS THERE!");
+ return "hello world";
+ }
+
+ @GET
+ @Produces("text/plain")
+ @Path("exception")
+ public String testException()
+ {
+ throw new WebApplicationException(412);
+ }
+
+ @Path("/custom-exception")
+ @GET
+ public String throwException()
+ {
+ throw new MyException();
+ }
+
+
+ @Path("/ejb-exception")
+ @GET
+ public String throwEjbException()
+ {
+ throw new EJBException(new MyException());
+ }
+}
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/webapp/WEB-INF/web.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,4 @@
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+</web-app>
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/webapp/index.jsp
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/webapp/index.jsp (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-jar/src/main/webapp/index.jsp 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-war/pom.xml
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-war/pom.xml (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-war/pom.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,95 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-parent</artifactId>
+ <version>6.0.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.jbossas.resteasy.test</groupId>
+ <artifactId>ejb-jar-test</artifactId>
+ <packaging>war</packaging>
+ <name>Basic Integration Test</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>${version.org.jboss.resteasy}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas.resteasy.test</groupId>
+ <artifactId>ejb-jar</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>ejb-test</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-maven-plugin</artifactId>
+ <version>1.3.1</version>
+ <configuration>
+ <jbossHome>${jboss.home}</jbossHome>
+ </configuration>
+ <executions>
+ <execution>
+ <id>jboss-deploy</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>deploy</goal>
+ </goals>
+ <configuration>
+ <fileName>${basedir}/target/ejb-test.war</fileName>
+ </configuration>
+ </execution>
+ <execution>
+ <id>jboss-undeploy</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>undeploy</goal>
+ </goals>
+ <configuration>
+ <fileName>${basedir}/target/ejb-test.war</fileName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>surefire-it</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/webapp/WEB-INF/web.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,4 @@
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+</web-app>
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/webapp/index.jsp
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/webapp/index.jsp (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/main/webapp/index.jsp 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/java/org/jboss/resteasy/test/jboss/EjbTest.java
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/java/org/jboss/resteasy/test/jboss/EjbTest.java (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/java/org/jboss/resteasy/test/jboss/EjbTest.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,38 @@
+package org.jboss.resteasy.test.jboss;
+
+import org.jboss.resteasy.client.ClientRequest;
+import org.jboss.resteasy.client.ClientResponse;
+import org.junit.Test;
+import org.junit.Assert;
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class EjbTest
+{
+ @Test
+ public void testIt() throws Exception
+ {
+ ClientRequest request = new ClientRequest("http://localhost:8080/ejb-test/scan");
+ ClientResponse<String> response = request.get(String.class);
+ Assert.assertEquals(200, response.getStatus());
+ Assert.assertEquals("hello world", response.getEntity());
+
+ }
+
+ @Test
+ public void testException() throws Exception
+ {
+ ClientRequest request = new ClientRequest("http://localhost:8080/ejb-test/scan/exception");
+ ClientResponse<String> response = request.get(String.class);
+ Assert.assertEquals(412, response.getStatus());
+
+ request = new ClientRequest("http://localhost:8080/ejb-test/scan/custom-exception");
+ response = request.get(String.class);
+ Assert.assertEquals(412, response.getStatus());
+
+ request = new ClientRequest("http://localhost:8080/ejb-test/scan/ejb-exception");
+ response = request.get(String.class);
+ Assert.assertEquals(412, response.getStatus());
+ }}
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/resources/jndi.properties
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/resources/jndi.properties (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/resources/jndi.properties 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
\ No newline at end of file
Added: trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/resources/log4j.xml
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/resources/log4j.xml (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/ejb-war/src/test/resources/log4j.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 64736 2007-08-21 15:49:48Z anil.saldhana at jboss.com $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <param name="File" value="${build.testlog}/test.log"/>
+ <param name="Append" value="true"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Threshold" value="DEBUG"/>
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: trunk/resteasy-int/test/ejb-jar-war/pom.xml
===================================================================
--- trunk/resteasy-int/test/ejb-jar-war/pom.xml (rev 0)
+++ trunk/resteasy-int/test/ejb-jar-war/pom.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-parent</artifactId>
+ <version>6.0.0-SNAPSHOT</version>
+ </parent>
+ <name>Resteasy JBoss AS Integration Testing EJB + JAR + WAR</name>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>resteasy-ejb-jar-war-testing-pom</artifactId>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>ejb-jar</module>
+ <module>ejb-war</module>
+ </modules>
+</project>
Added: trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyException.java
===================================================================
--- trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyException.java (rev 0)
+++ trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyException.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,9 @@
+package org.jboss.resteasy.test;
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+public class MyException extends RuntimeException
+{
+}
Added: trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyExceptionMapper.java
===================================================================
--- trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyExceptionMapper.java (rev 0)
+++ trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyExceptionMapper.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -0,0 +1,18 @@
+package org.jboss.resteasy.test;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+/**
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Revision: 1 $
+ */
+ at Provider
+public class MyExceptionMapper implements ExceptionMapper<MyException>
+{
+ public Response toResponse(MyException e)
+ {
+ return Response.status(412).type("text/plain").entity("MyException thrown").build();
+ }
+}
Modified: trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyResource.java
===================================================================
--- trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyResource.java 2010-07-12 17:40:22 UTC (rev 106602)
+++ trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyResource.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -20,4 +20,11 @@
@Path("exception")
public String testException();
+ @Path("/custom-exception")
+ @GET
+ String throwException();
+
+ @Path("/ejb-exception")
+ @GET
+ String throwEjbException();
}
Modified: trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyResourceBean.java
===================================================================
--- trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyResourceBean.java 2010-07-12 17:40:22 UTC (rev 106602)
+++ trunk/resteasy-int/test/ejb-war/src/main/java/org/jboss/resteasy/test/MyResourceBean.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -1,5 +1,6 @@
package org.jboss.resteasy.test;
+import javax.ejb.EJBException;
import javax.ws.rs.Path;
import javax.ws.rs.GET;
import javax.ws.rs.Produces;
@@ -39,4 +40,19 @@
{
throw new WebApplicationException(412);
}
+
+ @Path("/custom-exception")
+ @GET
+ public String throwException()
+ {
+ throw new MyException();
+ }
+
+
+ @Path("/ejb-exception")
+ @GET
+ public String throwEjbException()
+ {
+ throw new EJBException(new MyException());
+ }
}
Modified: trunk/resteasy-int/test/ejb-war/src/test/java/org/jboss/resteasy/test/jboss/EjbTest.java
===================================================================
--- trunk/resteasy-int/test/ejb-war/src/test/java/org/jboss/resteasy/test/jboss/EjbTest.java 2010-07-12 17:40:22 UTC (rev 106602)
+++ trunk/resteasy-int/test/ejb-war/src/test/java/org/jboss/resteasy/test/jboss/EjbTest.java 2010-07-12 17:48:39 UTC (rev 106603)
@@ -28,4 +28,11 @@
ClientResponse<String> response = request.get(String.class);
Assert.assertEquals(412, response.getStatus());
+ request = new ClientRequest("http://localhost:8080/ejb-test/scan/custom-exception");
+ response = request.get(String.class);
+ Assert.assertEquals(412, response.getStatus());
+
+ request = new ClientRequest("http://localhost:8080/ejb-test/scan/ejb-exception");
+ response = request.get(String.class);
+ Assert.assertEquals(412, response.getStatus());
}}
Modified: trunk/resteasy-int/test/pom.xml
===================================================================
--- trunk/resteasy-int/test/pom.xml 2010-07-12 17:40:22 UTC (rev 106602)
+++ trunk/resteasy-int/test/pom.xml 2010-07-12 17:48:39 UTC (rev 106603)
@@ -14,8 +14,11 @@
<modules>
<module>application-war</module>
+ <module>application-scanned-war</module>
<module>scanned-war</module>
<module>ejb-war</module>
+ <module>ejb-jar-war</module>
+ <module>async-http-servlet-3.0-test</module>
<module>cdi-test-2</module>
</modules>
</project>
More information about the jboss-cvs-commits
mailing list