You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wink.apache.org by bl...@apache.org on 2009/07/01 02:57:24 UTC
svn commit: r790010 - in /incubator/wink/trunk/wink-integration-test: ./
wink-server-integration-test-support/
wink-server-integration-test-support/src/
wink-server-integration-test-support/src/main/
wink-server-integration-test-support/src/main/java/ ...
Author: bluk
Date: Wed Jul 1 00:57:23 2009
New Revision: 790010
URL: http://svn.apache.org/viewvc?rev=790010&view=rev
Log:
test framework with geronimo and jetty for WINK-16
wink-integration-test module not currently
included in main pom.xml but can be added later.
By default, geronimo-jetty version is used
which will install Geronimo (if available
on your system), and then go through all
submodules and deploy the applications.
Providers test is just a dummy one for now
mvn install should be called from main
wink-integration-test/pom.xml to do everything.
Based off Geronimo test suite setup as suggested
by Jason.
Added:
incubator/wink/trunk/wink-integration-test/
incubator/wink/trunk/wink-integration-test/pom.xml (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/pom.xml (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/org/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/integration/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/integration/ServerEnvironmentInfo.java (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/pom.xml (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/pom.xml (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/Application.java (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/HttpHeadersMethodsResource.java (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/WEB-INF/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/WEB-INF/web.xml (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/index.jsp (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/httpheaders/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/httpheaders/JAXRSHttpHeadersTest.java (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/pom.xml (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/WEB-INF/
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/WEB-INF/web.xml (with props)
incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/index.jsp (with props)
Added: incubator/wink/trunk/wink-integration-test/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/pom.xml?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/pom.xml (added)
+++ incubator/wink/trunk/wink-integration-test/pom.xml Wed Jul 1 00:57:23 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or
+ more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding
+ copyright ownership. The ASF licenses this file to you under the
+ Apache License, Version 2.0 (the "License"); you may not use
+ this file except in compliance with the License. You may obtain
+ a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed
+ under the License is distributed on an "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+ -->
+<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>
+ <artifactId>wink</artifactId>
+ <groupId>org.apache.wink</groupId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.wink</groupId>
+ <artifactId>wink-integration-test</artifactId>
+ <packaging>pom</packaging>
+ <name>Wink Integration Tests</name>
+ <version>0.1-SNAPSHOT</version>
+ <modules>
+ <module>wink-server-integration-test-support</module>
+ <module>wink-server-integration-test</module>
+ </modules>
+</project>
Propchange: incubator/wink/trunk/wink-integration-test/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/pom.xml?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/pom.xml (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/pom.xml Wed Jul 1 00:57:23 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<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>
+ <artifactId>wink-integration-test</artifactId>
+ <groupId>org.apache.wink</groupId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.wink</groupId>
+ <artifactId>wink-server-integration-test-support</artifactId>
+ <name>Wink Server Integration Test Support</name>
+ <version>0.1-SNAPSHOT</version>
+ <properties>
+ <wink-test-context-root>fdsfdsfds</wink-test-context-root>
+ </properties>
+</project>
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/integration/ServerEnvironmentInfo.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/integration/ServerEnvironmentInfo.java?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/integration/ServerEnvironmentInfo.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/integration/ServerEnvironmentInfo.java Wed Jul 1 00:57:23 2009
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.test.integration;
+
+/**
+ * This class provides some basic information for clients about the server.
+ */
+final public class ServerEnvironmentInfo {
+
+ public static String getHostname() {
+ return System.getProperty("wink-test-hostname");
+ }
+
+ public static String getPort() {
+ return System.getProperty("wink-test-port");
+ }
+
+ public static String getContextRoot() {
+ return System.getProperty("wink-test-context-root");
+ }
+
+ public static String getBaseURI() {
+ String contextRoot = getContextRoot();
+ if (contextRoot == null) {
+ return "http://" + getHostname() + ":" + getPort();
+ }
+ return "http://" + getHostname() + ":" + getPort() + "/" + contextRoot;
+ }
+}
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test-support/src/main/java/org/apache/wink/test/integration/ServerEnvironmentInfo.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/pom.xml?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/pom.xml (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/pom.xml Wed Jul 1 00:57:23 2009
@@ -0,0 +1,472 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or
+ more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information regarding
+ copyright ownership. The ASF licenses this file to you under the
+ Apache License, Version 2.0 (the "License"); you may not use
+ this file except in compliance with the License. You may obtain
+ a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed
+ under the License is distributed on an "AS IS" BASIS, WITHOUT
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions
+ and limitations under the License.
+ -->
+<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>
+ <artifactId>wink-integration-test</artifactId>
+ <groupId>org.apache.wink</groupId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.wink</groupId>
+ <artifactId>wink-server-integration-test</artifactId>
+ <packaging>pom</packaging>
+ <name>Wink Server Integration Test</name>
+ <version>0.1-SNAPSHOT</version>
+ <description>This is the base module for wink-server integration
+ tests.</description>
+ <modules>
+ <module>wink-jaxrs-test-context</module>
+ <module>wink-jaxrs-test-providers</module>
+ </modules>
+
+ <properties>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee_1.4_spec</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.wink</groupId>
+ <artifactId>wink-server</artifactId>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.wink</groupId>
+ <artifactId>wink-server-integration-test-support</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <type>jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${project.basedir}/src/main/resources
+ </directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <configuration>
+ <resourcesDir>${project.build.outputDirectory}
+ </resourcesDir>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webXml>${project.basedir}/src/main/webapp/WEB-INF/web.xml
+ </webXml>
+ <webResources>
+ <resource>
+ <directory>${project.basedir}/src/main/webapp
+ </directory>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>${project.build.outputDirectory}
+ </directory>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+
+ <!--
+ NOTE: This horrible looking configuration sets up
+ the surefire plugin to not run tests during the
+ 'test' phase, but instead during the
+ 'integration-test' phase.
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </execution>
+ <execution>
+ <id>integration</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <systemProperties>
+ <property>
+ <name>wink-test-context-root</name>
+ <value>${artifactId}</value>
+ </property>
+ <property>
+ <name>wink-test-hostname</name>
+ <value>localhost</value>
+ </property>
+ <property>
+ <name>wink-test-port</name>
+ <value>8080</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.geronimo.buildsupport</groupId>
+ <artifactId>geronimo-maven-plugin</artifactId>
+ <configuration>
+ <reporters>
+ <reporter
+ implementation="org.apache.geronimo.mavenplugins.geronimo.reporting.SurefireReporter">
+ <reportsDirectory>${project.build.directory}/surefire-reports
+ </reportsDirectory>
+ </reporter>
+ </reporters>
+
+ <assemblies>
+ <assembly>
+ <id>jetty</id>
+ <groupId>org.apache.geronimo.assemblies</groupId>
+ <artifactId>geronimo-jetty6-javaee5</artifactId>
+ <version>2.1.4</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </assembly>
+
+ <assembly>
+ <id>jetty-minimal</id>
+ <groupId>org.apache.geronimo.assemblies</groupId>
+ <artifactId>geronimo-jetty6-minimal</artifactId>
+ <version>2.1.4</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </assembly>
+
+ <assembly>
+ <id>tomcat</id>
+ <groupId>org.apache.geronimo.assemblies</groupId>
+ <artifactId>geronimo-tomcat6-javaee5</artifactId>
+ <version>2.1.4</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </assembly>
+
+ <assembly>
+ <id>tomcat-minimal</id>
+ <groupId>org.apache.geronimo.assemblies</groupId>
+ <artifactId>geronimo-tomcat6-minimal</artifactId>
+ <version>2.1.4</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </assembly>
+
+ <assembly>
+ <id>framework</id>
+ <groupId>org.apache.geronimo.assemblies</groupId>
+ <artifactId>geronimo-framework</artifactId>
+ <version>2.1.4</version>
+ <classifier>bin</classifier>
+ <type>zip</type>
+ </assembly>
+ </assemblies>
+
+ <defaultAssemblyId>jetty</defaultAssemblyId>
+
+ <optionSets>
+ <optionSet>
+ <id>morememory</id>
+ <options>
+ <option>-Xmx512m</option>
+ <option>-XX:MaxPermSize=128m</option>
+ </options>
+ </optionSet>
+
+ <optionSet>
+ <id>debug</id>
+ <options>
+ <option>-Xdebug</option>
+ <option>-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n</option>
+ </options>
+ </optionSet>
+ </optionSets>
+ </configuration>
+ <executions>
+ <execution>
+ <id>deploy-wars</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>deploy-module</goal>
+ </goals>
+ <configuration>
+ <moduleArchive>${project.build.directory}/${artifactId}.war
+ </moduleArchive>
+ </configuration>
+ </execution>
+ <execution>
+ <id>undeploy-war-as-moduleId</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>undeploy-module</goal>
+ </goals>
+ <configuration>
+ <moduleId>${groupId}/${artifactId}/${version}/car
+ </moduleId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0</version>
+ <configuration>
+ <container>
+ <containerId>jetty6x</containerId>
+ <type>embedded</type>
+ </container>
+ </configuration>
+ <executions>
+ <execution>
+ <id>cargo-start</id>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <wait>false</wait>
+ <deployables />
+ </configuration>
+ </execution>
+ <execution>
+ <id>cargo-stop</id>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ <phase>post-integration-test</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>testsuite-with-geronimo-jetty</id>
+ <activation>
+ <property>
+ <name>assemblyId</name>
+ <value>jetty</value>
+ </property>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.geronimo.buildsupport</groupId>
+ <artifactId>geronimo-maven-plugin</artifactId>
+ <inherited>false</inherited>
+ <executions>
+ <execution>
+ <id>start</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start-server</goal>
+ </goals>
+ <configuration>
+ <logOutput>true</logOutput>
+ <background>true</background>
+ <verifyTimeout>300</verifyTimeout>
+ <refresh>true</refresh>
+ <optionSets>
+ <optionSet>
+ <id>default</id>
+ <options>
+ <option>-XX:MaxPermSize=160m
+ </option>
+ </options>
+ </optionSet>
+ </optionSets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.geronimo.buildsupport</groupId>
+ <artifactId>geronimo-maven-plugin</artifactId>
+ <inherited>true</inherited>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>testsuite-with-geronimo-tomcat</id>
+ <activation>
+ <property>
+ <name>assemblyId</name>
+ <value>tomcat</value>
+ </property>
+ </activation>
+ <properties>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.geronimo.buildsupport</groupId>
+ <artifactId>geronimo-maven-plugin</artifactId>
+ <inherited>false</inherited>
+ <executions>
+ <execution>
+ <id>start</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start-server</goal>
+ </goals>
+ <configuration>
+ <logOutput>true</logOutput>
+ <background>true</background>
+ <verifyTimeout>300</verifyTimeout>
+ <refresh>true</refresh>
+ <optionSets>
+ <optionSet>
+ <id>default</id>
+ <options>
+ <option>-XX:MaxPermSize=160m
+ </option>
+ </options>
+ </optionSet>
+ </optionSets>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.geronimo.buildsupport</groupId>
+ <artifactId>geronimo-maven-plugin</artifactId>
+ <inherited>true</inherited>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>testsuite-with-cargo-jetty-embedded</id>
+ <activation>
+ <property>
+ <name>assemblyId</name>
+ <value>cargo-jetty</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!--
+ <profile> <id>testsuite-with-jetty-standalone</id>
+ <activation> <property> <name>assemblyId</name>
+ <value>jetty-standalone</value> </property> </activation>
+
+ <build> <plugins> <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.10</version> <inherited>false</inherited>
+ <configuration>
+ <scanIntervalSeconds>10</scanIntervalSeconds>
+ <stopKey>foo</stopKey> <stopPort>9999</stopPort>
+ </configuration> <executions> <execution>
+ <id>jetty-do-nothing-pre-integration</id>
+ <phase>pre-integration-test</phase> </execution> <execution>
+ <id>jetty-do-nothing-post-integration</id>
+ <phase>post-integration-test</phase> </execution>
+ </executions> </plugin> <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1.10</version> <inherited>true</inherited>
+ <configuration>
+ <scanIntervalSeconds>10</scanIntervalSeconds>
+ <stopKey>foo</stopKey> <stopPort>9999</stopPort>
+ </configuration> <executions> <execution>
+ <id>start-jetty</id> <phase>pre-integration-test</phase>
+ <goals> <goal>run</goal> </goals> <configuration>
+ <scanIntervalSeconds>0</scanIntervalSeconds>
+ <daemon>true</daemon> </configuration> </execution>
+ <execution> <id>stop-jetty</id>
+ <phase>post-integration-test</phase> <goals>
+ <goal>stop</goal> </goals> </execution> </executions>
+ </plugin> </plugins> </build> </profile>
+ -->
+
+ </profiles>
+</project>
+
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/pom.xml?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/pom.xml (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/pom.xml Wed Jul 1 00:57:23 2009
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project>
+ <parent>
+ <artifactId>wink-server-integration-test</artifactId>
+ <groupId>org.apache.wink</groupId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.wink</groupId>
+ <artifactId>wink-jaxrs-test-context</artifactId>
+ <packaging>war</packaging>
+ <name>wink-jaxrs-test-context Maven Webapp</name>
+ <version>0.1-SNAPSHOT</version>
+ <url>http://maven.apache.org</url>
+ <build>
+ <finalName>wink-jaxrs-test-context</finalName>
+ </build>
+</project>
\ No newline at end of file
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/Application.java?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/Application.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/Application.java Wed Jul 1 00:57:23 2009
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.context.httpheaders;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Application to test the HTTP headers
+ */
+public class Application extends javax.ws.rs.core.Application {
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ Set<Class<?>> clazzes = new HashSet<Class<?>>();
+ clazzes.add(HttpHeadersMethodsResource.class);
+ return clazzes;
+ }
+
+}
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/Application.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/HttpHeadersMethodsResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/HttpHeadersMethodsResource.java?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/HttpHeadersMethodsResource.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/HttpHeadersMethodsResource.java Wed Jul 1 00:57:23 2009
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.wink.jaxrs.test.context.httpheaders;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Cookie;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+
+@Path("context/httpheaders")
+public class HttpHeadersMethodsResource {
+
+ @Context
+ private HttpHeaders headersfield;
+
+ @GET
+ @Path("acceptablelanguages")
+ public String getLanguages() {
+ List<Locale> languages = headersfield.getAcceptableLanguages();
+ StringBuilder sb = new StringBuilder("acceptablelanguages:");
+ for (Locale l : languages) {
+ sb.append(l.getLanguage() + ":");
+ }
+ return sb.toString();
+ }
+
+ @GET
+ @Path("acceptablemediatypes")
+ public String getAcceptableMediaTypes() {
+ List<MediaType> mediatypes = headersfield.getAcceptableMediaTypes();
+ StringBuilder sb = new StringBuilder("acceptablemediatypes:");
+ for (MediaType mt : mediatypes) {
+ sb.append(mt.getType() + "/" + mt.getSubtype() + ":");
+ }
+ return sb.toString();
+ }
+
+ @POST
+ @Path("requestmediatype")
+ public String getRequestMediaType() {
+ MediaType mt = headersfield.getMediaType();
+ StringBuilder sb = new StringBuilder("mediatype:");
+ if (mt != null) {
+ sb.append(mt.getType() + "/" + mt.getSubtype() + ":");
+ } else {
+ sb.append("null:");
+ }
+ return sb.toString();
+ }
+
+ @POST
+ @Path("language")
+ public String getLanguage() {
+ Locale l = headersfield.getLanguage();
+ StringBuilder sb = new StringBuilder("language:");
+ if (l != null) {
+ sb.append(l.getLanguage() + ":");
+ } else {
+ sb.append("null:");
+ }
+ return sb.toString();
+ }
+
+ @POST
+ @Path("cookies")
+ public String getCookies() {
+ Map<String, Cookie> cookies = headersfield.getCookies();
+ StringBuilder sb = new StringBuilder("cookies:");
+ if (cookies == null) {
+ sb.append("null:");
+ } else {
+ List<String> cookieNames = new ArrayList<String>(cookies.keySet());
+ Collections.sort(cookieNames);
+ for (String c : cookieNames) {
+ sb.append(c + "=" + cookies.get(c).getValue() + ":");
+ }
+ }
+ return sb.toString();
+ }
+
+ @GET
+ public String getHeader(@Context HttpHeaders headers, @QueryParam("name") String headerName) {
+ try {
+ List<String> values = headers.getRequestHeader(headerName);
+ if (values == null) {
+ return "requestheader:null:";
+ } else {
+ values = new ArrayList<String>(values);
+ }
+ Collections.sort(values);
+ return "requestheader:" + values.toString();
+ } catch (IllegalArgumentException e) {
+ return "requestheader:illegalarg:";
+ }
+ }
+
+ @GET
+ @Path("/requestheaders")
+ public String getHeaders(@Context HttpHeaders headers, @QueryParam("name") String headerName) {
+ MultivaluedMap<String, String> requestHeaders = headers.getRequestHeaders();
+ List<String> keys = new ArrayList<String>(requestHeaders.keySet());
+ Collections.sort(keys);
+ StringBuilder sb = new StringBuilder("requestheaders:");
+ for (String k : keys) {
+ sb.append(k + "=");
+ List<String> values = requestHeaders.get(k);
+ if (values != null) {
+ values = new ArrayList<String>(values);
+ Collections.sort(values);
+ sb.append(values + ":");
+ }
+ }
+ return sb.toString();
+ }
+}
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/java/org/apache/wink/jaxrs/test/context/httpheaders/HttpHeadersMethodsResource.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/WEB-INF/web.xml?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/WEB-INF/web.xml Wed Jul 1 00:57:23 2009
@@ -0,0 +1,37 @@
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<web-app>
+ <display-name>Archetype Created Web Application</display-name>
+ <servlet>
+ <servlet-name>HttpHeadersApp</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.wink.jaxrs.test.context.httpheaders.Application</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>HttpHeadersApp</servlet-name>
+ <url-pattern>/httpheaders/*</url-pattern>
+ </servlet-mapping>
+</web-app>
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/index.jsp?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/index.jsp (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/index.jsp Wed Jul 1 00:57:23 2009
@@ -0,0 +1,23 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/main/webapp/index.jsp
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/httpheaders/JAXRSHttpHeadersTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/httpheaders/JAXRSHttpHeadersTest.java?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/httpheaders/JAXRSHttpHeadersTest.java (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/httpheaders/JAXRSHttpHeadersTest.java Wed Jul 1 00:57:23 2009
@@ -0,0 +1,554 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.jaxrs.test.context.httpheaders;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.HttpHeaders;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+/**
+ * Tests the {@link HttpHeaders} methods.
+ */
+public class JAXRSHttpHeadersTest extends TestCase {
+
+ public String getBaseURI() {
+ return ServerEnvironmentInfo.getBaseURI() + "/httpheaders";
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getAcceptableLanguages()} that if given no
+ * acceptable languages, that it will return the server default locale back.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testAcceptableLanguagesNoneGiven() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/acceptablelanguages");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ assertEquals("acceptablelanguages:", getMethod.getResponseBodyAsString());
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getAcceptableLanguages()} that if given a
+ * language, it will be the only language in the list.
+ *
+ * @throws HttpException
+ * @throws IOException
+ */
+ public void testAcceptableLanguagesOneGiven() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/acceptablelanguages");
+ getMethod.setRequestHeader("Accept-Language", "de");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ assertEquals("acceptablelanguages:de:", getMethod.getResponseBodyAsString());
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getAcceptableLanguages()} that if given multiple
+ * languages, all will be returned in the list.
+ *
+ * @throws HttpException
+ * @throws IOException
+ */
+ public void testAcceptableLanguagesManyGiven() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/acceptablelanguages");
+ getMethod.setRequestHeader("Accept-Language", "de, en, zh");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertTrue(responseBody, responseBody.startsWith("acceptablelanguages:"));
+ assertTrue(responseBody, responseBody.contains(":de:"));
+ assertTrue(responseBody, responseBody.contains(":en:"));
+ assertTrue(responseBody, responseBody.contains(":zh:"));
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getAcceptableLanguages()} that if given multiple
+ * languages, all will be returned in the list sorted by their quality
+ * value.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testAcceptableLanguagesManyGivenQSort() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/acceptablelanguages");
+ getMethod.setRequestHeader("Accept-Language", "de;q=0.6, en;q=0.8, zh;q=0.7");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertEquals("acceptablelanguages:en:zh:de:", responseBody);
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getAcceptableMediaTypes()} that if given no
+ * Accept header, wildcard/wildcard is returned.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testAcceptableMediaTypesNoneGiven() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/acceptablemediatypes");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertEquals("acceptablemediatypes:*/*:", responseBody);
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getAcceptableMediaTypes()} that if given a
+ * single Accept header value, it is returned.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testAcceptableMediaTypesOneGiven() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/acceptablemediatypes");
+ getMethod.setRequestHeader("Accept", "text/plain");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertEquals("acceptablemediatypes:text/plain:", responseBody);
+ assertEquals("text/plain", getMethod.getResponseHeader("Content-Type").getValue());
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getAcceptableMediaTypes()} that if given
+ * multiple Accept header values, the values are sorted by q-value.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testAcceptableMediaTypesManyGiven() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/acceptablemediatypes");
+ getMethod.addRequestHeader("Accept", "text/plain;q=1.0,*/*;q=0.6, application/json;q=0.7,text/xml;q=0.8");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertEquals("acceptablemediatypes:text/plain:text/xml:application/json:*/*:", responseBody);
+ assertEquals("text/plain;q=1.0", getMethod.getResponseHeader("Content-Type").getValue());
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getMediaType()} that if given a text/plain, the
+ * method will return text/plain.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testMediaTypesRequestTextPlain() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ PostMethod postMethod = new PostMethod(getBaseURI() + "/context/httpheaders/requestmediatype");
+ postMethod.setRequestEntity(new StringRequestEntity("Hello world!", "text/plain", "UTF-8"));
+ try {
+ client.executeMethod(postMethod);
+ assertEquals(200, postMethod.getStatusCode());
+ String responseBody = postMethod.getResponseBodyAsString();
+ assertEquals("mediatype:text/plain:", responseBody);
+ // assertEquals("application/xml",
+ // postMethod.getResponseHeader("Content-Type").getValue());
+ } finally {
+ postMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getMediaType()} when a non-standard content type
+ * is sent in.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testMediaTypesRequestJSON() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ PostMethod postMethod = new PostMethod(getBaseURI() + "/context/httpheaders/requestmediatype");
+ postMethod.setRequestEntity(new StringRequestEntity("Hello world!", "defg/abcd", "UTF-8"));
+ try {
+ client.executeMethod(postMethod);
+ assertEquals(200, postMethod.getStatusCode());
+ String responseBody = postMethod.getResponseBodyAsString();
+ assertEquals("mediatype:defg/abcd:", responseBody);
+ } finally {
+ postMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getMediaType()} when no request entity is given.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testMediaTypesRequestNoRequestEntity() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ PostMethod postMethod = new PostMethod(getBaseURI() + "/context/httpheaders/requestmediatype");
+ try {
+ client.executeMethod(postMethod);
+ assertEquals(200, postMethod.getStatusCode());
+ String responseBody = postMethod.getResponseBodyAsString();
+ assertEquals("mediatype:null:", responseBody);
+ } finally {
+ postMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getLanguage()} when no language is given in the
+ * request.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testLanguageNoneGiven() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ PostMethod postMethod = new PostMethod(getBaseURI() + "/context/httpheaders/language");
+ postMethod.setRequestEntity(new StringRequestEntity("Hello world!", "text/plain", "UTF-8"));
+ try {
+ client.executeMethod(postMethod);
+ assertEquals(200, postMethod.getStatusCode());
+ String responseBody = postMethod.getResponseBodyAsString();
+ assertEquals("language:null:", responseBody);
+ } finally {
+ postMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getLanguage()} when English language is given in
+ * the request.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testLanguageEnglishGiven() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ PostMethod postMethod = new PostMethod(getBaseURI() + "/context/httpheaders/language");
+ postMethod.setRequestEntity(new StringRequestEntity("Hello world!", "text/plain", "UTF-8"));
+ postMethod.setRequestHeader("Content-Language", "en");
+ try {
+ client.executeMethod(postMethod);
+ assertEquals(200, postMethod.getStatusCode());
+ String responseBody = postMethod.getResponseBodyAsString();
+ assertEquals("language:en:", responseBody);
+ } finally {
+ postMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getLanguage()} when Chinese language is given in
+ * the request.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testLanguageChineseGiven() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ PostMethod postMethod = new PostMethod(getBaseURI() + "/context/httpheaders/language");
+ postMethod.setRequestEntity(new StringRequestEntity("Hello world!", "text/plain", "UTF-8"));
+ postMethod.setRequestHeader("Content-Language", "zh");
+ try {
+ client.executeMethod(postMethod);
+ assertEquals(200, postMethod.getStatusCode());
+ String responseBody = postMethod.getResponseBodyAsString();
+ assertEquals("language:zh:", responseBody);
+ } finally {
+ postMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getCookies()} when no cookies are given.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testCookiesNone() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ PostMethod postMethod = new PostMethod(getBaseURI() + "/context/httpheaders/cookies");
+ try {
+ client.executeMethod(postMethod);
+ assertEquals(200, postMethod.getStatusCode());
+ String responseBody = postMethod.getResponseBodyAsString();
+ assertEquals("cookies:", responseBody);
+ } finally {
+ postMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getCookies()} when given a single cookie.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testCookiesOneGiven() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ PostMethod postMethod = new PostMethod(getBaseURI() + "/context/httpheaders/cookies");
+ postMethod.addRequestHeader("Cookie", "foo=bar");
+ try {
+ client.executeMethod(postMethod);
+ assertEquals(200, postMethod.getStatusCode());
+ String responseBody = postMethod.getResponseBodyAsString();
+ assertEquals("cookies:foo=bar:", responseBody);
+ } finally {
+ postMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getCookies()} when given multiple cookies.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testCookiesManyGiven() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ PostMethod postMethod = new PostMethod(getBaseURI() + "/context/httpheaders/cookies");
+ postMethod.addRequestHeader("Cookie", "foo=bar");
+ postMethod.addRequestHeader("Cookie", "foo2=bar2");
+ try {
+ client.executeMethod(postMethod);
+ assertEquals(200, postMethod.getStatusCode());
+ String responseBody = postMethod.getResponseBodyAsString();
+ assertEquals("cookies:foo=bar:foo2=bar2:", responseBody);
+ } finally {
+ postMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getRequestHeader(String)} when given a null
+ * value.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testRequestHeaderNoneGivenIllegalArgument() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertEquals("requestheader:null:", responseBody);
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getRequestHeader(String)} when requesting header
+ * values for a non-existent header name.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testRequestHeaderNonexistentHeader() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/?name=foo");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertEquals("requestheader:null:", responseBody);
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getRequestHeader(String)} when requesting header
+ * value for a single header name.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testRequestHeaderSingleValue() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/?name=foo");
+ getMethod.setRequestHeader("foo", "bar");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertEquals("requestheader:[bar]", responseBody);
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getRequestHeader(String)} when requesting
+ * multiple header value for a single header name.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testRequestHeaderMultipleValue() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/?name=foo");
+ getMethod.addRequestHeader("foo", "bar");
+ getMethod.addRequestHeader("foo", "bar2");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertEquals("requestheader:[bar, bar2]", responseBody);
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getRequestHeader(String)} when requesting
+ * multiple header value for a single header name when using
+ * case-insensitive names.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testRequestHeaderCaseInsensitive() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/?name=foo");
+ getMethod.addRequestHeader("FOO", "bar");
+ getMethod.addRequestHeader("FoO", "bar2");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertEquals("requestheader:[bar, bar2]", responseBody);
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getRequestHeaders()} when making a basic
+ * HttpClient request.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testRequestHeadersBasicHeader() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/requestheaders");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertTrue(responseBody, responseBody.contains("requestheaders:"));
+ assertTrue(responseBody, responseBody.contains(":host=") || responseBody.contains(":Host="));
+ assertTrue(responseBody, responseBody.contains(":user-agent=") || responseBody.contains(":User-Agent="));
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getRequestHeaders()} when having a custom
+ * header.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testRequestHeadersSingleValue() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/requestheaders");
+ getMethod.addRequestHeader("fOo", "bAr");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertTrue(responseBody, responseBody.contains("requestheaders:"));
+ assertTrue(responseBody, responseBody.contains(":fOo=[bAr]"));
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+
+ /**
+ * Tests {@link HttpHeaders#getRequestHeaders()} when having multiple values
+ * and multiple custom headers.
+ *
+ * @throws IOException
+ * @throws HttpException
+ */
+ public void testRequestHeadersMultipleValues() throws HttpException, IOException {
+ HttpClient client = new HttpClient();
+ GetMethod getMethod = new GetMethod(getBaseURI() + "/context/httpheaders/requestheaders");
+ getMethod.addRequestHeader("fOo", "bAr");
+ getMethod.addRequestHeader("abc", "xyz");
+ getMethod.addRequestHeader("fOo", "2bAr");
+ try {
+ client.executeMethod(getMethod);
+ assertEquals(200, getMethod.getStatusCode());
+ String responseBody = getMethod.getResponseBodyAsString();
+ assertTrue(responseBody, responseBody.contains("requestheaders:"));
+ assertTrue(responseBody, responseBody.contains(":fOo=[2bAr, bAr]"));
+ assertTrue(responseBody, responseBody.contains(":abc=[xyz]"));
+ } finally {
+ getMethod.releaseConnection();
+ }
+ }
+}
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-context/src/test/java/org/apache/wink/jaxrs/test/context/httpheaders/JAXRSHttpHeadersTest.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/pom.xml?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/pom.xml (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/pom.xml Wed Jul 1 00:57:23 2009
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project>
+ <parent>
+ <artifactId>wink-server-integration-test</artifactId>
+ <groupId>org.apache.wink</groupId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.wink</groupId>
+ <artifactId>wink-jaxrs-test-providers</artifactId>
+ <packaging>war</packaging>
+ <name>wink-jaxrs-test-providers Maven Webapp</name>
+ <version>0.1-SNAPSHOT</version>
+ <url>http://maven.apache.org</url>
+ <build>
+ <finalName>wink-jaxrs-test-providers</finalName>
+ </build>
+</project>
\ No newline at end of file
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/pom.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/WEB-INF/web.xml?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/WEB-INF/web.xml Wed Jul 1 00:57:23 2009
@@ -0,0 +1,24 @@
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<web-app>
+ <display-name>Archetype Created Web Application</display-name>
+</web-app>
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/index.jsp?rev=790010&view=auto
==============================================================================
--- incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/index.jsp (added)
+++ incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/index.jsp Wed Jul 1 00:57:23 2009
@@ -0,0 +1,23 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<html>
+<body>
+<h2>Hello World!</h2>
+</body>
+</html>
Propchange: incubator/wink/trunk/wink-integration-test/wink-server-integration-test/wink-jaxrs-test-providers/src/main/webapp/index.jsp
------------------------------------------------------------------------------
svn:executable = *