incubator-wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ngalla...@apache.org
Subject svn commit: r787553 [7/34] - in /incubator/wink/contrib/ibm-jaxrs/tests: ./ fvt/ fvt/demo/ fvt/demo/jaxrs/ fvt/demo/jaxrs/cache/ fvt/demo/jaxrs/cache/server/ fvt/demo/jaxrs/cache/test/ fvt/demo/jaxrs/datasource/ fvt/demo/jaxrs/datasource/server/ fvt/de...
Date Tue, 23 Jun 2009 05:38:19 GMT
Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/monitor/StandaloneMonitor.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/monitor/StandaloneMonitor.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/monitor/StandaloneMonitor.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/defaults/test/monitor/StandaloneMonitor.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,255 @@
+/*
+ * 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 framework.defaults.test.monitor;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.text.MessageFormat;
+import java.util.Locale;
+
+public class StandaloneMonitor implements Monitor {
+    private PrintStreamDelegate psDelegate;
+
+    public StandaloneMonitor() {
+        /* do nothing */
+        //LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log",
+        // "org.apache.commons.logging.impl.Jdk14Logger");
+        // handler.setLevel(Level.FINEST);
+        // Logger.getLogger("httpclient.wire").addHandler(handler);
+        // Logger.getLogger("httpclient.wire").setLevel(Level.FINEST);
+        psDelegate = new PrintStreamDelegate(System.err);
+        System.setErr(psDelegate);
+    }
+
+    public static class PrintStreamDelegate extends PrintStream {
+        private PrintStream ps;
+
+        private StringBuffer sb = new StringBuffer();
+
+        final private static String lineSep = System
+                .getProperty("line.separator");
+
+        public PrintStreamDelegate(PrintStream out) {
+            super(out);
+            this.ps = out;
+        }
+
+        public PrintStream append(char c) {
+            sb.append(c);
+            return ps.append(c);
+        }
+
+        public PrintStream append(CharSequence csq, int start, int end) {
+            sb.append(csq, start, end);
+            return ps.append(csq, start, end);
+        }
+
+        public PrintStream append(CharSequence csq) {
+            sb.append(csq);
+            return ps.append(csq);
+        }
+
+        public boolean checkError() {
+            return ps.checkError();
+        }
+
+        public void close() {
+            ps.close();
+        }
+
+        public boolean equals(Object o) {
+            return ps.equals(o);
+        }
+
+        public void flush() {
+            ps.flush();
+        }
+
+        public PrintStream format(Locale l, String format, Object... args) {
+            /* XXX doesn't use locale */
+            sb.append(MessageFormat.format(format, args));
+            return ps.format(l, format, args);
+        }
+
+        public PrintStream format(String format, Object... args) {
+            sb.append(MessageFormat.format(format, args));
+            return ps.format(format, args);
+        }
+
+        public int hashCode() {
+            return ps.hashCode();
+        }
+
+        public void print(boolean b) {
+            sb.append(b);
+            ps.print(b);
+        }
+
+        public void print(char c) {
+            sb.append(c);
+            ps.print(c);
+        }
+
+        public void print(char[] s) {
+            sb.append(s);
+            ps.print(s);
+        }
+
+        public void print(double d) {
+            sb.append(d);
+            ps.print(d);
+        }
+
+        public void print(float f) {
+            sb.append(f);
+            ps.print(f);
+        }
+
+        public void print(int i) {
+            sb.append(i);
+            ps.print(i);
+        }
+
+        public void print(long l) {
+            sb.append(l);
+            ps.print(l);
+        }
+
+        public void print(Object obj) {
+            sb.append(obj);
+            ps.print(obj);
+        }
+
+        public void print(String s) {
+            sb.append(s);
+            ps.print(s);
+        }
+
+        public PrintStream printf(Locale l, String format, Object... args) {
+            /* XXX doesn't use locale */
+            sb.append(MessageFormat.format(format, args));
+            return ps.printf(l, format, args);
+        }
+
+        public PrintStream printf(String format, Object... args) {
+            sb.append(MessageFormat.format(format, args));
+            return ps.printf(format, args);
+        }
+
+        public void println() {
+            sb.append(lineSep);
+            ps.println();
+        }
+
+        public void println(boolean x) {
+            sb.append(x + lineSep);
+            ps.println(x);
+        }
+
+        public void println(char x) {
+            sb.append(x + lineSep);
+            ps.println(x);
+        }
+
+        public void println(char[] x) {
+            sb.append(x);
+            sb.append(lineSep);
+            ps.println(x);
+        }
+
+        public void println(double x) {
+            sb.append(x + lineSep);
+            ps.println(x);
+        }
+
+        public void println(float x) {
+            sb.append(x + lineSep);
+            ps.println(x);
+        }
+
+        public void println(int x) {
+            sb.append(x + lineSep);
+            ps.println(x);
+        }
+
+        public void println(long x) {
+            sb.append(x + lineSep);
+            ps.println(x);
+        }
+
+        public void println(Object x) {
+            sb.append(x + lineSep);
+            ps.println(x);
+        }
+
+        public void println(String x) {
+            sb.append(x + lineSep);
+            ps.println(x);
+        }
+
+        public String toString() {
+            return ps.toString();
+        }
+
+        public void write(byte[] buf, int off, int len) {
+            sb.append(new String(buf, off, len));
+            ps.write(buf, off, len);
+        }
+
+        public void write(byte[] b) throws IOException {
+            sb.append(b);
+            ps.write(b);
+        }
+
+        public void write(int b) {
+            sb.append(b);
+            ps.write(b);
+        }
+
+        public String getOutput() {
+            return sb.toString();
+        }
+
+        public void reset() {
+            sb.delete(0, sb.length());
+        }
+    }
+
+    public String getClientOutput() {
+        return "";
+    }
+
+    public void resetMonitor() {
+        // handler.reset();
+        psDelegate.reset();
+    }
+
+    public String getServerError() {
+        return psDelegate.getOutput();
+    }
+
+    public String getServerOutput() {
+        return psDelegate.getOutput();
+    }
+
+    public boolean isStringInServerOutput(String str) {
+        return getServerOutput().contains(str);
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/environments/standalone/build.properties
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/environments/standalone/build.properties?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/environments/standalone/build.properties (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/environments/standalone/build.properties Tue Jun 23 05:37:57 2009
@@ -0,0 +1,5 @@
+# This file could contain some global properties
+# that need to be set.  This file is otherwise
+# empty.
+
+

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/environments/standalone/build.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/environments/standalone/build.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/environments/standalone/build.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/framework/environments/standalone/build.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,289 @@
+<?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 name="standalone" basedir="." default="initEnv">
+	<target name="initEnv">
+	</target>
+
+	<target name="cleanEnv" depends="initEnv">
+		<echo>===Cleaning ${fvt.package.path}===</echo>
+		<delete dir="${fvt.build.classes.dir}/${fvt.package.path}" includeemptydirs="true" failonerror="false" />
+		<delete dir="${fvt.build.work.dir}/${fvt.package.path}" includeemptydirs="true" failonerror="false" />
+		<echo>===Done cleaning ${fvt.package.path}===</echo>
+	</target>
+
+	<!--
+	      Compiles the tests
+	-->
+	<target name="compileEnv" depends="initEnv">
+		<echo>===Compiling ${fvt.package.path}===</echo>
+
+		<condition property="fvt.package.run.extra.jvmargs" value="-Dfoojvm=bar">
+			<not>
+				<isset property="fvt.package.run.extra.jvmargs" />
+			</not>
+		</condition>
+
+		<condition property="fvt.environment.run.extra.jvmargs" value="-Dfoojvm=bar">
+			<not>
+				<isset property="fvt.environment.run.extra.jvmargs" />
+			</not>
+		</condition>
+
+		<condition property="fvt.package.classpath" value=":">
+			<not>
+				<isset property="fvt.package.classpath" />
+			</not>
+		</condition>
+
+		<!-- let this be defined if the environment did not define it -->
+		<condition property="is.fvt.environment.classpath.defined" value="fvt.environment.run.classpath" else="classpath.that.is.not.used">
+			<isreference refid="fvt.environment.run.classpath" />
+		</condition>
+
+		<condition property="is.fvt.package.classpath.defined" value="fvt.package.classpath" else="classpath.that.is.not.used">
+			<isreference refid="fvt.package.classpath" />
+		</condition>
+
+		<!-- use this additional classpath if the test package did not define a custom one -->
+		<path id="classpath.that.is.not.used">
+		</path>
+
+		<javac srcdir="${fvt.base.dir}/${fvt.package.path}" destdir="${fvt.build.classes.dir}" debug="true" failonerror="true">
+			<classpath refid="${is.fvt.package.classpath.defined}" />
+			<classpath refid="${is.fvt.environment.classpath.defined}" />
+			<classpath refid="fvt.classpath" />
+		</javac>
+		<echo>===Done compiling ${fvt.package.path}===</echo>
+	</target>
+
+	<target name="distEnv" depends="initEnv">
+		<echo>===Distributing ${fvt.package.path}===</echo>
+
+		<available file="${fvt.build.classes.dir}/${fvt.package.path}/server" type="dir" property="package.server.dir.exists" />
+		<antcall target="internal.makeear" />
+		<echo>===Done distributing ${fvt.package.path}===</echo>
+	</target>
+
+	<target name="internal.makeear" if="package.server.dir.exists">
+		<copy todir="${fvt.build.work.dir}/${fvt.package.path}/server/" overwrite="true" failonerror="false">
+			<fileset dir="${fvt.base.dir}/${fvt.package.path}/server/">
+				<include name="**" />
+			</fileset>
+		</copy>
+		<copy todir="${fvt.build.work.dir}/${fvt.package.path}/server/" overwrite="false" failonerror="false">
+			<fileset dir="${fvt.base.dir}/framework/defaults/server/">
+				<include name="**" />
+				<exclude name="WEB-INF/ibm-component.properties" />
+			</fileset>
+		</copy>
+
+		<replace file="${fvt.build.work.dir}/${fvt.package.path}/server/META-INF/application.xml">
+			<replacefilter token="@REPLACE_APPLICATION_NAME@" value="${fvt.package.app.name}" />
+			<replacefilter token="@REPLACE_WAR_FILE_NAME@" value="${fvt.package.app.name}.war" />
+			<replacefilter token="@REPLACE_CONTEXT_ROOT@" value="${fvt.package.path}" />
+		</replace>
+
+		<antcall target="internal.makewar.without.runtime">
+		</antcall>
+		<antcall target="internal.makewar.with.runtime">
+		</antcall>
+
+		<ear destfile="${fvt.build.apps.dir}/${fvt.package.app.name}.ear" appxml="${fvt.build.work.dir}/${fvt.package.path}/server/META-INF/application.xml">
+			<fileset dir="${fvt.build.apps.dir}">
+				<include name="${fvt.package.app.name}.war" />
+			</fileset>
+		</ear>
+	</target>
+
+	<target name="internal.makewar.without.runtime" unless="fvt.dist.package.runtime">
+		<replace file="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web-no-runtime.xml">
+			<replacefilter token="@REPLACE_SERVLET_NAME@" value="${fvt.package.app.name}" />
+			<replacefilter token="@REPLACE_APPLICATION_NAME@" value="${fvt.package.app.name}.server.Application" />
+			<replacefilter token="@REPLACE_PATH@" value="/*" />
+		</replace>
+		<move file="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web-no-runtime.xml" tofile="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web.xml" />
+
+		<war destfile="${fvt.build.apps.dir}/${fvt.package.app.name}.war" webxml="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web.xml">
+			<classes dir="${fvt.build.classes.dir}">
+				<include name="${fvt.package.path}/server/**" />
+				<exclude name="${fvt.package.path}/server/META-INF/application.xml" />
+			</classes>
+			<fileset dir="${fvt.build.work.dir}">
+				<include name="${fvt.package.path}/server/**/*.java" />
+				<exclude name="${fvt.package.path}/server/WEB-INF/web.xml" />
+				<exclude name="${fvt.package.path}/server/WEB-INF/web-no-runtime.xml" />
+			</fileset>
+		</war>
+	</target>
+
+	<target name="internal.makewar.with.runtime" if="fvt.dist.package.runtime">
+		<copy todir="${fvt.build.work.dir}/${fvt.package.path}/server/" overwrite="false" failonerror="false">
+			<fileset dir="${fvt.base.dir}/framework/defaults/server/">
+				<include name="WEB-INF/ibm-component.properties" />
+			</fileset>
+		</copy>
+		<replace file="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web.xml">
+			<replacefilter token="@REPLACE_SERVLET_NAME@" value="${fvt.package.app.name}" />
+			<replacefilter token="@REPLACE_APPLICATION_NAME@" value="${fvt.package.app.name}.server.Application" />
+			<replacefilter token="@REPLACE_PATH@" value="/*" />
+		</replace>
+
+		<war destfile="${fvt.build.apps.dir}/${fvt.package.app.name}.war" webxml="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF/web.xml">
+			<classes dir="${fvt.build.classes.dir}">
+				<include name="${fvt.package.path}/server/**" />
+				<exclude name="${fvt.package.path}/server/META-INF/application.xml" />
+			</classes>
+			<fileset dir="${fvt.build.work.dir}">
+				<include name="${fvt.package.path}/server/**/*.java" />
+				<exclude name="${fvt.package.path}/server/WEB-INF/web.xml" />
+				<exclude name="${fvt.package.path}/server/WEB-INF/web-no-runtime.xml" />
+			</fileset>
+			<lib dir="${ibmjaxrs.base.dir}/dist/standalone">
+				<include name="ibmjaxrs-*.jar" />
+			</lib>
+			<lib dir="${ibmjaxrs.base.dir}/lib">
+				<!-- Included for Abdera Provider -->
+				<include name="abdera-0.4.0-incubating.jar" />
+				<include name="abdera-core-0.4.0-incubating.jar" />
+				<include name="axiom-api-1.2.5.jar" />
+				<include name="axiom-impl-1.2.5.jar" />
+				<include name="jaxen-1.1.1.jar" />
+				<include name="commons-codec-1.3.jar" />
+
+				<!-- Included for XML Beans Provider -->
+				<include name="xmlbeans-2.3.0.jar" />
+			</lib>
+			<webinf dir="${fvt.build.work.dir}/${fvt.package.path}/server/WEB-INF">
+				<include name="ibm-component.properties" />
+			</webinf>
+		</war>
+	</target>
+
+	<target name="installEnv" depends="initEnv">
+		<echo>===Installing ${fvt.package.path}===</echo>
+		<echo>===Done installing ${fvt.package.path}===</echo>
+	</target>
+
+	<target name="runEnv" depends="initEnv">
+		<echo>===Running ${fvt.package.path}===</echo>
+		<condition property="fvt.trace.property1" value="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog" else="-Dfoo1=bar">
+			<isset property="fvt.option.trace.enabled" />
+		</condition>
+		<condition property="fvt.trace.property2" value="-Dorg.apache.commons.logging.simplelog.showdatetime=true" else="-Dfoo2=bar">
+			<isset property="fvt.option.trace.enabled" />
+		</condition>
+		<condition property="fvt.trace.property3" value="-Dorg.apache.commons.logging.simplelog.log.httpclient.wire.header=debug" else="-Dfoo3=bar">
+			<isset property="fvt.option.trace.enabled" />
+		</condition>
+		<condition property="fvt.trace.property4" value="-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.httpclient=debug" else="-Dfoo4=bar">
+			<isset property="fvt.option.trace.enabled" />
+		</condition>
+		<condition property="fvt.trace.property5" value="-Dorg.apache.commons.logging.simplelog.log.com.ibm.ws.jaxrs=debug" else="-Dfoo5=bar">
+			<isset property="fvt.option.trace.enabled" />
+		</condition>
+		<condition property="fvt.trace.property6" value="-Dorg.apache.commons.logging.simplelog.log.org.apache.cxf=debug" else="-Dfoo6=bar">
+			<isset property="fvt.option.trace.enabled" />
+		</condition>
+
+		<condition property="fvt.package.run.extra.jvmargs" value="-Dfoojvm=bar">
+			<not>
+				<isset property="fvt.package.run.extra.jvmargs" />
+			</not>
+		</condition>
+
+		<condition property="fvt.environment.run.extra.jvmargs" value="-Dfoojvm=bar">
+			<not>
+				<isset property="fvt.environment.run.extra.jvmargs" />
+			</not>
+		</condition>
+
+		<condition property="fvt.package.classpath" value=":">
+			<not>
+				<isset property="fvt.package.classpath" />
+			</not>
+		</condition>
+
+		<!-- let this be defined if the environment did not define it -->
+		<condition property="is.fvt.environment.classpath.defined" value="fvt.environment.run.classpath" else="classpath.that.is.not.used">
+			<isreference refid="fvt.environment.run.classpath" />
+		</condition>
+
+		<condition property="is.fvt.package.classpath.defined" value="fvt.package.classpath" else="classpath.that.is.not.used">
+			<isreference refid="fvt.package.classpath" />
+		</condition>
+
+		<!-- use this additional classpath if the test package did not define a custom one -->
+		<path id="classpath.that.is.not.used">
+		</path>
+
+		<junit printsummary="on" dir="${ibmjaxrs.base.dir}" fork="yes">
+			<classpath refid="${is.fvt.package.classpath.defined}" />
+			<classpath refid="${is.fvt.environment.classpath.defined}" />
+			<classpath>
+				<pathelement location="${fvt.build.classes.dir}" />
+				<path refid="fvt.classpath" />
+
+				<fileset dir="${ibmjaxrs.base.dir}/lib">
+					<!-- Necessary to compile and work -->
+					<include name="commons-logging-1.1.1.jar" />
+					<include name="asm-all-3.1.jar" />
+					<include name="serp-1.13.1.jar" />
+					<include name="jetty-6.1.9.jar" />
+					<include name="jetty-util-6.1.9.jar" />
+
+					<include name="abdera-core-0.4.0-incubating.jar" />
+					<include name="axiom-api-1.2.5.jar" />
+					<include name="axiom-impl-1.2.5.jar" />
+					<include name="jaxen-1.1.1.jar" />
+					<include name="commons-codec-1.3.jar" />
+				</fileset>
+			</classpath>
+
+			<jvmarg value="-Dfvt.framework.environment=${fvt.framework.environment}" />
+			<jvmarg value="${fvt.trace.property1}" />
+			<jvmarg value="${fvt.trace.property2}" />
+			<jvmarg value="${fvt.trace.property3}" />
+			<jvmarg value="${fvt.trace.property4}" />
+			<jvmarg value="${fvt.trace.property5}" />
+			<jvmarg value="${fvt.trace.property6}" />
+
+			<jvmarg line="${fvt.package.run.extra.jvmargs}" />
+			<jvmarg line="${fvt.environment.run.extra.jvmargs}" />
+
+			<formatter type="xml" />
+
+			<batchtest fork="yes" todir="${fvt.build.reports.dir}">
+				<fileset dir="${fvt.build.classes.dir}">
+					<include name="${fvt.package.path}/**/*Test.class" />
+					<include name="${fvt.package.path}/**/*Tests.class" />
+				</fileset>
+			</batchtest>
+		</junit>
+
+		<echo>===Done running ${fvt.package.path}===</echo>
+	</target>
+
+	<target name="uninstallEnv" depends="initEnv">
+		<echo>===Uninstalling ${fvt.package.path}===</echo>
+		<echo>===Done uninstalling ${fvt.package.path}===</echo>
+	</target>
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/buildTest.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,24 @@
+<?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 name="jaxrs.tests.constructors" default="all">
+	<import file="../../../buildCommon.xml" />
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/Application.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/Application.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/Application.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,38 @@
+/*
+ * 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 jaxrs.tests.constructors.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class Application extends javax.ws.rs.core.Application {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> clazzes = new HashSet<Class<?>>();
+        clazzes.add(MultiConstructorResource.class);
+        clazzes.add(MultiConstructorResource2.class);
+        clazzes.add(SameNumParamConstructorResource.class);
+        clazzes.add(SameNumParamConstructorResource2.class);
+        clazzes.add(SubResourcesConstructorResource.class);
+        return clazzes;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/MultiConstructorResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/MultiConstructorResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/MultiConstructorResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/MultiConstructorResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,67 @@
+/*
+ * 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 jaxrs.tests.constructors.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.MatrixParam;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/constructors/multi")
+public class MultiConstructorResource {
+
+    /*
+     * determines the number of times the constructors have been called in total
+     */
+    private static int constructorCallCount = 0;
+
+    final private String whichConstructor;
+
+    public MultiConstructorResource() {
+        ++constructorCallCount;
+        whichConstructor = "Default" + constructorCallCount;
+    }
+
+    public MultiConstructorResource(@QueryParam("q") String query) {
+        ++constructorCallCount;
+        whichConstructor = "query" + constructorCallCount;
+    }
+
+    public MultiConstructorResource(@MatrixParam("m") String matrix, @QueryParam("q") String query) {
+        ++constructorCallCount;
+        whichConstructor = "matrixAndQuery" + constructorCallCount;
+    }
+
+    public MultiConstructorResource(@MatrixParam("m") String matrix, @QueryParam("q") String query, @Context UriInfo uriinfo) {
+        ++constructorCallCount;
+        /*
+         * this should be the called constructor
+         */
+        whichConstructor = "matrixAndQueryAndContext" + constructorCallCount;
+    }
+
+    @GET
+    public String getInfo() {
+        return whichConstructor;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/MultiConstructorResource2.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/MultiConstructorResource2.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/MultiConstructorResource2.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/MultiConstructorResource2.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,64 @@
+/*
+ * 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 jaxrs.tests.constructors.server;
+
+import javax.ws.rs.CookieParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/constructors/multi2/{path}")
+public class MultiConstructorResource2 {
+
+    /**
+     * counts the number of times the constructor has been called
+     */
+    private static int constructorCallCount = 0;
+
+    final private String whichConstructor;
+
+    public MultiConstructorResource2(@HeaderParam("header1") String header1, @CookieParam("cookie1") String cookie1) {
+        ++constructorCallCount;
+        whichConstructor = "headerAndCookieAndPath" + constructorCallCount;
+    }
+
+    public MultiConstructorResource2(@HeaderParam("header1") int header1, @PathParam("cookie1") String cookie1) {
+        ++constructorCallCount;
+        whichConstructor = "headerAndCookieAndPath" + constructorCallCount;
+    }
+
+    public MultiConstructorResource2(@Context UriInfo uriInfo, @HeaderParam("header1") String header1, @CookieParam("cookie1") String cookie1, @PathParam("path") String path1) {
+        /*
+         * this should be the called constructor
+         */
+        ++constructorCallCount;
+        whichConstructor = "contextAndHeaderAndCookieAndPath"
+                + constructorCallCount;
+    }
+
+    @GET
+    public String getInfo() {
+        return whichConstructor;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SameNumParamConstructorResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SameNumParamConstructorResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SameNumParamConstructorResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SameNumParamConstructorResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,63 @@
+/*
+ * 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 jaxrs.tests.constructors.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
+
+@Path("constructors/samenumparam")
+public class SameNumParamConstructorResource {
+
+    /*
+     * determines the number of times the constructors have been called in total
+     */
+    private static int constructorCallCount = 0;
+
+    final private String whichConstructor;
+
+    public SameNumParamConstructorResource() {
+        ++constructorCallCount;
+        whichConstructor = "default" + constructorCallCount;
+    }
+
+    public SameNumParamConstructorResource(@Context UriInfo uriInfo) {
+        /*
+         * this constructor may be called
+         */
+        ++constructorCallCount;
+        whichConstructor = "context" + constructorCallCount;
+    }
+
+    public SameNumParamConstructorResource(@QueryParam("q") String q) {
+        /*
+         * this constructor may be called
+         */
+        ++constructorCallCount;
+        whichConstructor = "query" + constructorCallCount;
+    }
+
+    @GET
+    public String getInfo() {
+        return whichConstructor;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SameNumParamConstructorResource2.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SameNumParamConstructorResource2.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SameNumParamConstructorResource2.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SameNumParamConstructorResource2.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,61 @@
+/*
+ * 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 jaxrs.tests.constructors.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+
+@Path("constructors/samenumparam2")
+public class SameNumParamConstructorResource2 {
+
+    /*
+     * determines the number of times the constructors have been called in total
+     */
+    private static int constructorCallCount = 0;
+
+    final private String whichConstructor;
+
+    public SameNumParamConstructorResource2() {
+        ++constructorCallCount;
+        whichConstructor = "default" + constructorCallCount;
+    }
+
+    public SameNumParamConstructorResource2(@QueryParam("q") int q) {
+        /*
+         * this constructor may be called
+         */
+        ++constructorCallCount;
+        whichConstructor = "queryInt" + constructorCallCount;
+    }
+
+    public SameNumParamConstructorResource2(@QueryParam("q") String q) {
+        /*
+         * this constructor may be called
+         */
+        ++constructorCallCount;
+        whichConstructor = "queryString" + constructorCallCount;
+    }
+
+    @GET
+    public String getInfo() {
+        return whichConstructor;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcePackageConstructor.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcePackageConstructor.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcePackageConstructor.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcePackageConstructor.java Tue Jun 23 05:37:57 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 jaxrs.tests.constructors.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+public class SubResourcePackageConstructor {
+
+    final private String whichConstructor;
+
+    SubResourcePackageConstructor() {
+        whichConstructor = "package";
+    }
+
+    SubResourcePackageConstructor(String s) {
+        whichConstructor = s;
+    }
+
+    @GET
+    public String getInfo() {
+        return whichConstructor;
+    }
+
+    @Path("/other")
+    public SubResourcePublicConstructor other() {
+        return new SubResourcePublicConstructor();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcePublicConstructor.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcePublicConstructor.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcePublicConstructor.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcePublicConstructor.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,47 @@
+/*
+ * 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 jaxrs.tests.constructors.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+public class SubResourcePublicConstructor {
+
+    final private String whichConstructor;
+
+    public SubResourcePublicConstructor() {
+        whichConstructor = "public";
+    }
+
+    public SubResourcePublicConstructor(String s) {
+        whichConstructor = s;
+    }
+
+    @GET
+    public String info() {
+        return whichConstructor;
+    }
+
+    @Path("other")
+    public SubResourcePackageConstructor other() {
+        return new SubResourcePackageConstructor("subpackage");
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcesConstructorResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcesConstructorResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcesConstructorResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/server/SubResourcesConstructorResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,58 @@
+/*
+ * 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 jaxrs.tests.constructors.server;
+
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+
+@Path("constructors/subresource")
+public class SubResourcesConstructorResource {
+
+    @Path("emptypackage")
+    public SubResourcePackageConstructor packageEmptyConstructor() {
+        return new SubResourcePackageConstructor();
+    }
+
+    @Path("stringpackage")
+    public SubResourcePackageConstructor packageStringConstructor() {
+        return new SubResourcePackageConstructor("packageString");
+    }
+
+    @Path("emptypublic")
+    public SubResourcePublicConstructor publicEmptyConstructor() {
+        return new SubResourcePublicConstructor();
+    }
+
+    @Path("stringpublic")
+    public SubResourcePublicConstructor publicStringConstructor(@QueryParam("q") String s) {
+        return new SubResourcePublicConstructor(s);
+    }
+
+    @Path("sub")
+    public Object subconstructor(@QueryParam("which") String which) {
+        if ("package".equals(which)) {
+            return new SubResourcePackageConstructor();
+        } else if ("public".equals(which)) {
+            return new SubResourcePublicConstructor();
+        }
+        return null;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/test/ConstructorTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/test/ConstructorTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/test/ConstructorTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/constructors/test/ConstructorTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,316 @@
+/*
+ * 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 jaxrs.tests.constructors.test;
+
+import java.io.IOException;
+
+import javax.xml.ws.http.HTTPException;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+import framework.defaults.test.FVTAssert;
+import framework.defaults.test.FVTTestCase;
+
+/**
+ * Tests the runtime for the specification regarding Constructors.
+ */
+public class ConstructorTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(ConstructorTest.class,
+                "jaxrs.tests.constructors.server.Application");
+    }
+
+    /**
+     * Tests that the runtime will use the correct constructor with a resource
+     * that has multiple constructors. The resource has multiple constructors
+     * with different number of parameters in each constructor.
+     *
+     * @throws IOException
+     * @throws HTTPException
+     */
+    public void testConstructorWithMostParams() throws IOException,
+            HTTPException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/constructors/multi");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("matrixAndQueryAndContext1", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the runtime will use the correct constructor with a resource
+     * that has multiple constructors. The resource has multiple constructors
+     * with different number of parameters in each constructor.
+     *
+     * @throws IOException
+     * @throws HTTPException
+     */
+    public void testConstructorWithMostParams2() throws IOException,
+            HTTPException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/constructors/multi2/somepath");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("contextAndHeaderAndCookieAndPath1", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the runtime will randomly choose a constructor between two
+     * constructors with the same number of parameters. A warning should be
+     * issued.
+     *
+     * @throws IOException
+     * @throws HTTPException
+     */
+    public void testConstructorWithSameParamWarning() throws IOException,
+            HTTPException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/constructors/samenumparam");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String c = getMethod.getResponseBodyAsString();
+            boolean foundConstructor = false;
+            if ("context1".equals(c)) {
+                foundConstructor = true;
+            } else if ("query1".equals(c)) {
+                foundConstructor = true;
+            }
+            assertTrue("Returned message body was: " + c, foundConstructor);
+            FVTAssert
+                    .assertInstallLogContainsException("Multiple suitable constructors were found for the "
+                            + "jaxrs.tests.constructors.server.SameNumParamConstructorResource "
+                            + "JAX-RS resource class");
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the runtime will randomly choose a constructor between two
+     * constructors with the same parameters except different types. A warning
+     * should be issued.
+     *
+     * @throws IOException
+     * @throws HTTPException
+     */
+    public void testConstructorWithSameParamWarning2() throws IOException,
+            HTTPException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/constructors/samenumparam2?q=15");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String c = getMethod.getResponseBodyAsString();
+            boolean foundConstructor = false;
+            if ("queryInt1".equals(c)) {
+                foundConstructor = true;
+            } else if ("queryString1".equals(c)) {
+                foundConstructor = true;
+            }
+            assertTrue("Returned message body was: " + c, foundConstructor);
+            FVTAssert
+                    .assertInstallLogContainsException("Multiple suitable constructors were found for the "
+                            + "jaxrs.tests.constructors.server.SameNumParamConstructorResource2 "
+                            + "JAX-RS resource class");
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the sub-resources can use a package default constructor.
+     *
+     * @throws IOException
+     * @throws HTTPException
+     */
+    public void testSubResourceLocatorPackageEmptyConstructor()
+            throws IOException, HTTPException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/constructors/subresource/emptypackage");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("package", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the sub-resources can use a package constructor with a String
+     * parameter.
+     *
+     * @throws IOException
+     * @throws HTTPException
+     */
+    public void testSubResourceLocatorPackageStringConstructor()
+            throws IOException, HTTPException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/constructors/subresource/stringpackage");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("packageString", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the sub-resources can use a public constructor.
+     *
+     * @throws IOException
+     * @throws HTTPException
+     */
+    public void testSubResourceLocatorPublicDefaultConstructor()
+            throws IOException, HTTPException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/constructors/subresource/emptypublic");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("public", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the sub-resources can use a public constructor with a String
+     * parameter.
+     *
+     * @throws IOException
+     * @throws HTTPException
+     */
+    public void testSubResourceLocatorPublicStringConstructor()
+            throws IOException, HTTPException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/constructors/subresource/stringpublic?q=Hello");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("Hello", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the sub-resources will eventually find the right resource.
+     *
+     * @throws IOException
+     * @throws HTTPException
+     */
+    public void testSubResourceOtherSubPublicToPackage() throws IOException,
+            HTTPException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/constructors/subresource/stringpublic/other");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("subpackage", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the sub-resources will eventually find the right resource.
+     *
+     * @throws IOException
+     * @throws HTTPException
+     */
+    public void testSubResourceOtherSubPackageToPublic() throws IOException,
+            HTTPException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/constructors/subresource/stringpackage/other");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("public", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the sub-resources will eventually return the right resource.
+     *
+     * @throws IOException
+     * @throws HTTPException
+     */
+    public void testSubResourceDecideSubDynamic() throws IOException,
+            HTTPException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/constructors/subresource/sub?which=public");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("public", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/constructors/subresource/sub?which=package");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("package", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/buildTest.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,24 @@
+<?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 name="jaxrs.tests.context.httpheaders" default="all">
+	<import file="../../../../buildCommon.xml" />
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/server/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/server/Application.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/server/Application.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/server/Application.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,34 @@
+/*
+ * 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 jaxrs.tests.context.httpheaders.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+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;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/server/HttpHeadersMethodsResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/server/HttpHeadersMethodsResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/server/HttpHeadersMethodsResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/server/HttpHeadersMethodsResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,144 @@
+/*
+ * 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 jaxrs.tests.context.httpheaders.server;
+
+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();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/test/HttpHeadersDetailedMethodsTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/test/HttpHeadersDetailedMethodsTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/test/HttpHeadersDetailedMethodsTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/httpheaders/test/HttpHeadersDetailedMethodsTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,615 @@
+/*
+ * 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 jaxrs.tests.context.httpheaders.test;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.HttpHeaders;
+
+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 framework.defaults.test.FVTTestCase;
+
+public class HttpHeadersDetailedMethodsTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(HttpHeadersDetailedMethodsTest.class,
+                "jaxrs.tests.context.httpheaders.server.Application");
+    }
+
+    /**
+     * 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());
+            /*
+             * [en] is the default locale for the standalone server.
+             */
+            assertEquals("acceptablelanguages:en:", 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", 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/octet-stream", 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:null:", 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:illegalarg:", 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="));
+            assertTrue(responseBody, 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(":host="));
+            assertTrue(responseBody, responseBody.contains(":user-agent="));
+            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(":host="));
+            assertTrue(responseBody, responseBody.contains(":user-agent="));
+            assertTrue(responseBody, responseBody.contains(":foo=[2bAr, bAr]"));
+            assertTrue(responseBody, responseBody.contains(":abc=[xyz]"));
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+}



Mime
View raw message