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 [2/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/build.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/build.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/build.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/build.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,157 @@
+<?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="jaxrsfvt" default="allFVT">
+
+	<description>
+            Runs the JAX-RS FVT tests.
+    </description>
+
+	<import file="framework/buildOptions.xml" />
+	<import file="framework/buildProperties.xml" />
+	<import file="framework/buildSpecialTasks.xml" />
+
+	<!--
+	"FVT" targets are performed on all subdirectory buildTests.xml.
+	-->
+
+	<!--  Default targets -->
+
+	<target name="cleanFVT">
+		<delete dir="${fvt.build.classes.dir}" includeemptydirs="true" failonerror="false" />
+		<mkdir dir="${fvt.build.classes.dir}" />
+		<delete dir="${ibmjaxrs.db.dir}" includeemptydirs="true" failonerror="false" />
+		<mkdir dir="${ibmjaxrs.db.dir}" />
+		<delete dir="${fvt.build.reports.dir}" includeemptydirs="true" failonerror="false" />
+		<mkdir dir="${fvt.build.reports.dir}" />
+		<delete dir="${fvt.build.apps.dir}" includeemptydirs="true" failonerror="false" />
+		<mkdir dir="${fvt.build.apps.dir}" />
+		<delete dir="${fvt.build.work.dir}" includeemptydirs="true" failonerror="false" />
+		<mkdir dir="${fvt.build.work.dir}" />
+		<subant genericantfile="buildTest.xml" target="clean">
+			<propertyset>
+				<propertyref prefix="fvt" />
+			</propertyset>
+			<fileset dir="${fvt.base.dir}" includes="**/buildTest.xml" />
+		</subant>
+	</target>
+
+	<target name="compileFVT" depends="compileFVTFramework">
+		<subant genericantfile="buildTest.xml" target="compile">
+			<propertyset>
+				<propertyref prefix="fvt" />
+			</propertyset>
+			<fileset dir="${fvt.base.dir}" includes="**/buildTest.xml" />
+		</subant>
+	</target>
+
+	<target name="compileFVTFramework">
+		<echo>===Compiling Framework===</echo>
+		<javac srcdir="${fvt.base.dir}/framework" destdir="${fvt.build.classes.dir}" debug="true" failonerror="true">
+			<classpath refid="fvt.classpath" />
+			<classpath>
+				<fileset dir="${fvt.base.dir}">
+					<filename name="framework/environments/*/lib/**" />
+				</fileset>
+				<fileset dir="${ibmjaxrs.base.dir}/lib">
+					<include name="jetty-6.1.9.jar" />
+					<include name="jetty-util-6.1.9.jar" />
+				</fileset>
+			</classpath>
+		</javac>
+		<echo>===Done compiling Framework===</echo>
+	</target>
+
+	<target name="compileFramework" depends="compileFVTFramework">
+		<!--
+		alias for compileFVTFramework
+		-->
+	</target>
+
+	<target name="distFVT">
+		<subant genericantfile="buildTest.xml" target="dist">
+			<propertyset>
+				<propertyref prefix="fvt" />
+			</propertyset>
+			<fileset dir="${fvt.base.dir}" includes="**/buildTest.xml" />
+		</subant>
+	</target>
+
+	<target name="installFVT">
+		<subant genericantfile="buildTest.xml" target="install">
+			<propertyset>
+				<propertyref prefix="fvt" />
+			</propertyset>
+			<fileset dir="${fvt.base.dir}" includes="**/buildTest.xml" />
+		</subant>
+	</target>
+
+	<target name="runFVT">
+		<subant genericantfile="buildTest.xml" target="run">
+			<propertyset>
+				<propertyref prefix="fvt" />
+			</propertyset>
+			<fileset dir="${fvt.base.dir}" includes="**/buildTest.xml" />
+		</subant>
+	</target>
+
+	<target name="uninstallFVT">
+		<subant genericantfile="buildTest.xml" target="uninstall">
+			<propertyset>
+				<propertyref prefix="fvt" />
+			</propertyset>
+			<fileset dir="${fvt.base.dir}" includes="**/buildTest.xml" />
+		</subant>
+	</target>
+
+	<target name="reportFVT">
+		<delete dir="${fvt.build.dir}/results" />
+		<mkdir dir="${fvt.build.dir}/results" />
+
+		<junitreport todir="${fvt.build.dir}/results">
+			<fileset dir="${fvt.build.reports.dir}">
+				<include name="TEST-*.xml" />
+			</fileset>
+			<report format="frames" todir="${fvt.build.dir}/results" />
+		</junitreport>
+	</target>
+
+	<target name="allFVT" depends="cleanFVT">
+		<!--
+		Replace target contents with the following for hot install:
+		<subant genericantfile="buildTest.xml" target="all">
+			<fileset dir="${fvt.base.dir}" includes="**/buildTest.xml" />
+		</subant>
+		-->
+		<antcall target="compileFVT" />
+		<antcall target="distFVT" />
+		<antcall target="installFVT" />
+		<antcall target="runFVT" />
+		<antcall target="uninstallFVT" />
+		<antcall target="reportFVT" />
+	</target>
+
+	<target name="complete">
+		<antcall target="allFVT">
+		</antcall>
+	</target>
+
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/buildCommon.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/buildCommon.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/buildCommon.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/buildCommon.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,107 @@
+<?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="buildCommons" basedir="." default="all">
+	<dirname file="${ant.file.buildCommons}" property="fvt.buildCommon.dir" />
+
+	<import file="${fvt.buildCommon.dir}/framework/buildOptions.xml" />
+	<import file="${fvt.buildCommon.dir}/framework/buildProperties.xml" />
+	<import file="${fvt.buildCommon.dir}/framework/buildSpecialTasks.xml" />
+
+	<pathconvert property="fvt.package.path" dirsep="/">
+		<path location="." />
+		<map from="${fvt.base.dir}${file.separator}" to="" />
+	</pathconvert>
+
+	<pathconvert property="fvt.package.app.name" dirsep=".">
+		<path location="." />
+		<map from="${fvt.base.dir}${file.separator}" to="" />
+	</pathconvert>
+
+	<!--  Initializes the global properties (for all environments) -->
+	<target name="init">
+		<condition property="fvt.framework.environment" value="standalone">
+			<not>
+				<isset property="fvt.framework.environment" />
+			</not>
+		</condition>
+		<property file="${fvt.base.dir}/framework/environments/${fvt.framework.environment}/build.properties">
+		</property>
+
+		<condition property="fvt.command.extension" value=".bat">
+			<os family="windows" />
+		</condition>
+		<condition property="fvt.command.extension" value=".sh">
+			<or>
+				<os family="unix" />
+				<os family="mac" />
+				<os family="z/os" />
+			</or>
+		</condition>
+		<condition property="fvt.command.extension" value="">
+			<os family="os/400" />
+		</condition>
+		<condition property="fvt.is64bit" value="true" else="false">
+			<or>
+				<equals arg1="${sun.arch.data.model}" arg2="64" />
+				<equals arg1="${com.ibm.vm.bitmode}}" arg2="64" />
+			</or>
+		</condition>
+	</target>
+
+	<!--  Cleans the directory -->
+	<target name="clean" depends="init">
+		<subant target="cleanEnv" buildpath="${fvt.buildCommon.dir}/framework/environments/${fvt.framework.environment}/build.xml" inheritall="true" inheritrefs="true">
+		</subant>
+	</target>
+
+	<!--  Compiles the artifacts -->
+	<target name="compile" depends="init">
+		<subant target="compileEnv" buildpath="${fvt.buildCommon.dir}/framework/environments/${fvt.framework.environment}/build.xml" inheritall="true" inheritrefs="true">
+		</subant>
+	</target>
+
+	<!--  Distributes the artifacts -->
+	<target name="dist" depends="init">
+		<subant target="distEnv" buildpath="${fvt.buildCommon.dir}/framework/environments/${fvt.framework.environment}/build.xml" inheritall="true" inheritrefs="true">
+		</subant>
+	</target>
+
+	<!--  Installs any artifacts generated -->
+	<target name="install" depends="init">
+		<subant target="installEnv" buildpath="${fvt.buildCommon.dir}/framework/environments/${fvt.framework.environment}/build.xml" inheritall="true" inheritrefs="true">
+		</subant>
+	</target>
+
+	<!--  Runs any tests -->
+	<target name="run" depends="init">
+		<subant target="runEnv" buildpath="${fvt.buildCommon.dir}/framework/environments/${fvt.framework.environment}/build.xml" inheritall="true" inheritrefs="true">
+		</subant>
+	</target>
+
+	<!--  Uninstalls any artifacts generated -->
+	<target name="uninstall" depends="init">
+		<subant target="uninstallEnv" buildpath="${fvt.buildCommon.dir}/framework/environments/${fvt.framework.environment}/build.xml" inheritall="true" inheritrefs="true">
+		</subant>
+	</target>
+
+	<target name="all" depends="clean, compile, dist, install, run, uninstall" />
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/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="demo.jaxrs.cache" default="all">
+	<import file="../../../buildCommon.xml" />
+</project>

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/NewsResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/NewsResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/NewsResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/NewsResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,136 @@
+/*
+ * 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 demo.jaxrs.cache.server;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.EntityTag;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+import com.ibm.wsspi.jaxrs.http.DateHandler;
+
+@Path("/news")
+public class NewsResource {
+
+    @Context
+    private Request request;
+
+    private static Map<String, StoryRecord> stories = new HashMap<String, StoryRecord>();
+
+    @GET
+    @Produces(value = "text/xml")
+    @Path(value = "/{title}")
+    public Response getNewsStory(@PathParam(value = "title") String title) {
+        StoryRecord record = stories.get(title);
+
+        // if no record, return 404
+        if (record == null) {
+            return Response.status(404).build();
+        }
+        NewsStory story = record.getStory();
+
+        EntityTag recordETag = EntityTag.valueOf("\""
+                + String.valueOf(record.getRevision().hashCode()) + "\"");
+
+        String lastModified = story.getUpdatedDate();
+        Date date = null;
+
+        try {
+            date = DateHandler.formatStringToDateInRFC1123Only(lastModified);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+        ResponseBuilder builder = null;
+        if (date != null) {
+            builder = request.evaluatePreconditions(date, recordETag);
+        } else {
+            builder = request.evaluatePreconditions(recordETag);
+        }
+
+        if (builder != null) {
+            Response response = builder.build();
+            response.getMetadata().putSingle("Content-Length", 0);
+            return response;
+        }
+
+        // otherwise return the entity
+        builder = Response.ok();
+        builder.entity(story);
+        return builder.build();
+    }
+
+    @POST
+    public Response addNewsStory(NewsStory story) {
+        String date = DateHandler.getCurrentDateAsStringInRFC1123Format("America/Austin");
+        story.setPostedDate(date);
+        story.setUpdatedDate(date);
+        StoryRecord record = new StoryRecord(story);
+        stories.put(record.getKey(), record);
+        ResponseBuilder builder = Response.ok();
+
+        // let's put an ETag in here so clients can send an 'If-Match'
+        EntityTag eTag = EntityTag.valueOf("\""
+                + String.valueOf(record.getRevision().hashCode()) + "\"");
+        builder.tag(eTag);
+        Response resp = builder.build();
+        resp.getMetadata().putSingle("Location", "/" + story.getTitle());
+        resp.getMetadata().putSingle("Last-Modified", story.getUpdatedDate());
+        return resp;
+    }
+
+    @PUT
+    public Response updateNewsStory(NewsStory story) {
+        StoryRecord record = stories.get(story.getTitle());
+        if (record == null) {
+            record = new StoryRecord(story);
+        } else {
+            record.updateStory(story);
+        }
+        ResponseBuilder builder = Response.ok();
+
+        // let's put an ETag in here so clients can send an 'If-Match'
+        EntityTag eTag = EntityTag.valueOf("\""
+                + String.valueOf(record.getRevision().hashCode()) + "\"");
+        builder.tag(eTag);
+        Response response = builder.build();
+        response.getMetadata().putSingle("Last-Modified",
+                record.getStory().getUpdatedDate());
+        return response;
+    }
+
+    @POST
+    @Path("/clear")
+    public void clearRecords() {
+        stories.clear();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/NewsStory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/NewsStory.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/NewsStory.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/NewsStory.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 demo.jaxrs.cache.server;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "story", namespace = "http://com.ibm.jaxrs.sample.cache")
+public class NewsStory {
+
+    private String title;
+
+    private String content;
+
+    private String postedDate;
+
+    private String updatedDate;
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getPostedDate() {
+        return postedDate;
+    }
+
+    public void setPostedDate(String postedDate) {
+        this.postedDate = postedDate;
+    }
+
+    public String getUpdatedDate() {
+        return updatedDate;
+    }
+
+    public void setUpdatedDate(String updatedDate) {
+        this.updatedDate = updatedDate;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/ObjectFactory.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/ObjectFactory.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/ObjectFactory.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,31 @@
+/*
+ * 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 demo.jaxrs.cache.server;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    public NewsStory createNewsStory() {
+        return new NewsStory();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/StoryRecord.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/StoryRecord.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/StoryRecord.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/server/StoryRecord.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,59 @@
+/*
+ * 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 demo.jaxrs.cache.server;
+
+import com.ibm.wsspi.jaxrs.http.DateHandler;
+
+public class StoryRecord {
+
+    private NewsStory story;
+
+    private int revision;
+
+    public StoryRecord(NewsStory story) {
+        this.story = story;
+        revision = 100;
+    }
+
+    public NewsStory getStory() {
+        return story;
+    }
+
+    public Integer getRevision() {
+        return revision;
+    }
+
+    public void updateRevision() {
+        revision++;
+    }
+
+    public String getKey() {
+        return story.getTitle();
+    }
+
+    public void updateStory(NewsStory story) {
+        this.story.setContent(story.getContent());
+        this.story.setTitle(story.getTitle());
+        String date = DateHandler.getCurrentDateAsStringInRFC1123Format("America/Austin");
+        this.story.setUpdatedDate(date);
+        revision++;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/ClientTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/ClientTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/ClientTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/ClientTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,168 @@
+/*
+ * 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 demo.jaxrs.cache.test;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.core.Response;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+import com.ibm.wsspi.jaxrs.http.DateHandler;
+
+import demo.jaxrs.cache.server.NewsStory;
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+public class ClientTest extends TestCase {
+
+    final private static String NEWS_BASE_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(demo.jaxrs.cache.test.ClientTest.class)
+            + "/news";
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(ClientTest.class,
+                demo.jaxrs.cache.server.Application.class.getName());
+    }
+
+    @Override
+    public void setUp() {
+        /*
+         * clear the database entries
+         */
+        HttpClient client = new HttpClient();
+        HttpMethod method = null;
+        try {
+            System.out.println(NEWS_BASE_URI + "/clear");
+            method = new PostMethod(NEWS_BASE_URI + "/clear");
+            client.executeMethod(method);
+            assertEquals(204, method.getStatusCode());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally {
+            if (method != null) {
+                method.releaseConnection();
+            }
+        }
+    }
+
+    /**
+     * This test will demonstrate various usages of the ETag and 'If-Match'
+     * headers. It will show how different scenarios result in different
+     * HTTP status codes and different response entities.
+     */
+    public void testNewsResourceWithETag() throws Exception {
+        // always start with a fresh set of resources for testing purposes
+        // first create the resource
+        NewsStory story = new NewsStory();
+        story.setContent("This is a breaking news story");
+        story.setTitle("Local Hero Saves Kid");
+        NewsHttpClient client = new NewsHttpClient(NEWS_BASE_URI, null);
+        Response response = client.addNewsStory(story);
+        assertNotNull(response);
+        String location = (String) response.getMetadata().getFirst("Location");
+        String etag = (String) response.getMetadata().getFirst("ETag");
+
+        // now send a request with an 'If-Match' with a matching value,
+        // we should get back a 304
+        Map<String, String> reqHdrs = new HashMap<String, String>();
+        reqHdrs.put("If-Match", etag);
+        client = new NewsHttpClient(NEWS_BASE_URI, reqHdrs);
+        location = location.startsWith("/") ? location.substring(1) : location;
+        response = client.getNewsStory("Local%20Hero%20Saves%20Kid");
+        assertNotNull(response);
+        assertEquals("Expected 200 not returned", response.getStatus(), 200);
+
+        // update the content of the story
+        client = new NewsHttpClient(NEWS_BASE_URI, null);
+        String newContent = "A local man rescued a kid from a burning building";
+        story.setContent(newContent);
+        response = client.updateNewsStory(story);
+        String updatedETag = (String) response.getMetadata().getFirst("ETag");
+        assertNotNull(updatedETag);
+
+        // now try to get with the old ETag value, we should get a 412
+        // back indicating our precondition failed
+        client = new NewsHttpClient(NEWS_BASE_URI, reqHdrs);
+        location = location.startsWith("/") ? location.substring(1) : location;
+        response = client.getNewsStory("Local%20Hero%20Saves%20Kid");
+        assertNotNull(response);
+        assertNull(response.getEntity());
+        assertEquals("Expected 412 not returned", response.getStatus(), 412);
+
+        // now ensure that using the ETag we got back on the PUT results
+        // in a 304 status
+        reqHdrs.put("If-Match", updatedETag);
+        client = new NewsHttpClient(NEWS_BASE_URI, reqHdrs);
+        location = location.startsWith("/") ? location.substring(1) : location;
+        response = client.getNewsStory("Local%20Hero%20Saves%20Kid");
+        assertNotNull(response);
+        assertEquals("Expected 200 not returned", response.getStatus(), 200);
+    }
+
+    /**
+     * This test will demonstrate various usages of the Last-Modified
+     * header. It will show how different scenarios result in different
+     * HTTP status codes and different response entities.
+     */
+    public void testNewsResourceWithLastModified() throws Exception {
+
+        // first create the resource
+        NewsStory story = new NewsStory();
+        story.setContent("This is a breaking news story");
+        story.setTitle("Local Hero Saves Kid");
+        NewsHttpClient client = new NewsHttpClient(NEWS_BASE_URI, null);
+        Response response = client.addNewsStory(story);
+        assertNotNull(response);
+        String lastModified = (String) response.getMetadata().getFirst(
+                "Last-Modified");
+
+        Date date = DateHandler.formatStringToDateInRFC1123Only(lastModified);
+
+        Map<String, String> reqHdrs = new HashMap<String, String>();
+        reqHdrs.put("If-Modified-Since", lastModified);
+        client = new NewsHttpClient(NEWS_BASE_URI, reqHdrs);
+        response = client.getNewsStory("Local%20Hero%20Saves%20Kid");
+        assertNotNull(response);
+        assertEquals("Expected 304 not returned", 304, response.getStatus());
+
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.set(Calendar.YEAR, 2006);
+
+        lastModified = DateHandler.formatDateInRFC1123Format(calendar.getTime());
+        reqHdrs.put("If-Modified-Since", lastModified);
+        client = new NewsHttpClient(NEWS_BASE_URI, reqHdrs);
+        response = client.getNewsStory("Local%20Hero%20Saves%20Kid");
+        assertNotNull(response);
+        story = (NewsStory) response.getEntity();
+        assertNotNull(story);
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/NewsHttpClient.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/NewsHttpClient.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/NewsHttpClient.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/NewsHttpClient.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,172 @@
+/*
+ * 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 demo.jaxrs.cache.test;
+
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+
+import demo.jaxrs.cache.server.NewsStory;
+
+public class NewsHttpClient implements NewsResource {
+
+    private String baseURI;
+
+    private Header[] requestHeaders;
+
+    public NewsHttpClient(String baseURI, Map<String, String> reqHdrs) {
+        this.baseURI = baseURI;
+        requestHeaders = createRequestHeaders(reqHdrs);
+    }
+
+    public Response addNewsStory(NewsStory story) throws Exception {
+        PostMethod post = new PostMethod(this.baseURI);
+        try {
+            HttpClient client = new HttpClient();
+            setRequestHeaders(post);
+            JAXBContext context = JAXBContext.newInstance(NewsStory.class);
+            StringWriter sw = new StringWriter();
+            context.createMarshaller().marshal(story, sw);
+            RequestEntity entity = new ByteArrayRequestEntity(sw.toString()
+                    .getBytes(), "text/xml");
+            post.setRequestEntity(entity);
+            int status = client.executeMethod(post);
+            Map<String, List<Object>> headers = getResponseHeaders(post
+                    .getResponseHeaders());
+            Response resp = Response.status(status).build();
+            resp.getMetadata().putAll(headers);
+            return resp;
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            if (post != null) {
+                post.releaseConnection();
+            }
+        }
+    }
+
+    public Response updateNewsStory(NewsStory story) throws Exception {
+        PutMethod put = new PutMethod(this.baseURI);
+        try {
+            HttpClient client = new HttpClient();
+            setRequestHeaders(put);
+            JAXBContext context = JAXBContext.newInstance(NewsStory.class);
+            StringWriter sw = new StringWriter();
+            context.createMarshaller().marshal(story, sw);
+            RequestEntity entity = new ByteArrayRequestEntity(sw.toString()
+                    .getBytes(), "text/xml");
+            put.setRequestEntity(entity);
+            int status = client.executeMethod(put);
+            Map<String, List<Object>> headers = getResponseHeaders(put
+                    .getResponseHeaders());
+            Response resp = Response.status(status).build();
+            resp.getMetadata().putAll(headers);
+            return resp;
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            if (put != null) {
+                put.releaseConnection();
+            }
+        }
+    }
+
+    public Response getNewsStory(String title) throws Exception {
+        GetMethod get = new GetMethod(this.baseURI + "/" + title);
+        try {
+            HttpClient client = new HttpClient();
+            setRequestHeaders(get);
+            int status = client.executeMethod(get);
+            InputStream is = get.getResponseBodyAsStream();
+            NewsStory newsStory = null;
+            long cl = get.getResponseContentLength();
+            if (is != null && cl != 0) {
+                JAXBContext context = JAXBContext.newInstance(NewsStory.class);
+                newsStory = (NewsStory) context.createUnmarshaller().unmarshal(
+                        is);
+            }
+            Map<String, List<Object>> headers = getResponseHeaders(get
+                    .getResponseHeaders());
+            Response resp = Response.status(status).entity(newsStory).build();
+            resp.getMetadata().putAll(headers);
+            return resp;
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            if (get != null) {
+                get.releaseConnection();
+            }
+        }
+    }
+
+    Map<String, List<Object>> getResponseHeaders(Header[] headers) {
+        Map<String, List<Object>> respHeaders = new HashMap<String, List<Object>>();
+        if (headers != null) {
+            for (Header header : headers) {
+                String headerName = header.getName();
+                List<Object> values = new ArrayList<Object>();
+                values.add(header.getValue());
+                respHeaders.put(headerName, values);
+            }
+        }
+        return respHeaders;
+    }
+
+    Header[] createRequestHeaders(Map<String, String> reqHdrs) {
+        Header[] headers = null;
+        if (reqHdrs != null) {
+            headers = new Header[reqHdrs.size()];
+            int i = 0;
+            Set<Entry<String, String>> entries = reqHdrs.entrySet();
+            for (Entry<String, String> entry : entries) {
+                Header header = new Header(entry.getKey(), entry.getValue());
+                headers[i] = header;
+                i++;
+            }
+        }
+        return headers;
+    }
+
+    void setRequestHeaders(HttpMethod method) {
+        if (requestHeaders != null) {
+            for (Header header : requestHeaders) {
+                method.addRequestHeader(header);
+            }
+        }
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/NewsResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/NewsResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/NewsResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/cache/test/NewsResource.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 demo.jaxrs.cache.test;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import demo.jaxrs.cache.server.NewsStory;
+
+@Path("/news")
+public interface NewsResource {
+
+    @GET
+    @Produces(value = "text/xml")
+    @Path(value = "/{title}")
+    public Response getNewsStory(@PathParam(value = "title") String title)
+            throws Exception;
+
+    @POST
+    public Response addNewsStory(NewsStory story) throws Exception;
+
+    @PUT
+    public Response updateNewsStory(NewsStory story) throws Exception;
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/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="demo.jaxrs.datasource" default="all">
+	<import file="../../../buildCommon.xml" />
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/server/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/server/Application.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/server/Application.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/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 demo.jaxrs.datasource.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<?>> classes = new HashSet<Class<?>>();
+        classes.add(DSResource.class);
+        return classes;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/server/DSResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/server/DSResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/server/DSResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/server/DSResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,97 @@
+/*
+ * 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 demo.jaxrs.datasource.server;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+
+import javax.activation.DataSource;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+@Path(value = "/dstest")
+public class DSResource {
+
+    @POST
+    public Response post(DataSource dataSource) {
+        Response resp = null;
+        try {
+            InputStream inputStream = dataSource.getInputStream();
+            byte[] inputBytes = new byte[inputStream.available()];
+            int next = inputStream.read();
+            int i = 0;
+            while (next != -1) {
+                if (i == inputBytes.length) {
+                    inputBytes = Arrays.copyOf(inputBytes, 2 * i);
+                }
+                inputBytes[i] = (byte) next;
+                next = inputStream.read();
+                i++;
+            }
+            TestDataSource entity = new TestDataSource(inputBytes, dataSource
+                    .getName(), dataSource.getContentType());
+            ResponseBuilder rb = Response.ok();
+            rb.entity(entity);
+            resp = rb.build();
+        } catch (Exception e) {
+            ResponseBuilder rb = Response.serverError();
+            resp = rb.build();
+        }
+        return resp;
+    }
+
+    public class TestDataSource implements DataSource {
+
+        private byte[] inputBytes;
+
+        private String name;
+
+        private String contentType;
+
+        public TestDataSource(byte[] inputBytes, String name, String contentType) {
+            this.inputBytes = inputBytes;
+            this.name = name;
+            this.contentType = contentType;
+        }
+
+        public String getContentType() {
+            return contentType;
+        }
+
+        public InputStream getInputStream() throws IOException {
+            return new ByteArrayInputStream(inputBytes);
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public OutputStream getOutputStream() throws IOException {
+            return null;
+        }
+
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/test/DataSourceTests.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/test/DataSourceTests.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/test/DataSourceTests.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/datasource/test/DataSourceTests.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,87 @@
+/*
+ * 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 demo.jaxrs.datasource.test;
+
+import javax.activation.DataSource;
+import javax.ws.rs.core.MediaType;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+
+import com.ibm.ws.jaxrs.provider.DataSourceProvider;
+
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+/**
+ * End-to-end tests for DataSource input/return types
+ *
+ */
+public class DataSourceTests extends FVTTestCase {
+
+    final private static String BASE_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(DataSourceTests.class)
+            + "/dstest";
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(DataSourceTests.class,
+                demo.jaxrs.datasource.server.Application.class.getName());
+    }
+
+    /**
+     * Verify that we can send a DataSource and receive a DataSource. The 'POST'
+     * method on the resource we are calling is a simple echo.
+     *
+     */
+    public void testPOSTDataSource() throws Exception {
+        PostMethod postMethod = null;
+        try {
+            postMethod = new PostMethod(BASE_URI);
+            String input = "This is some test input";
+            RequestEntity requestEntity = new ByteArrayRequestEntity(input
+                    .getBytes(), "application/datasource");
+            postMethod.setRequestEntity(requestEntity);
+            HttpClient client = new HttpClient();
+            client.executeMethod(postMethod);
+
+            // just use our provider to read the response
+            DataSourceProvider provider = new DataSourceProvider();
+            DataSource returnedData = provider.readFrom(DataSource.class, null,
+                    null, new MediaType("application", "datasource"), null,
+                    postMethod.getResponseBodyAsStream());
+            assertNotNull(returnedData);
+            assertNotNull(returnedData.getInputStream());
+            byte[] responseBytes = new byte[input.getBytes().length];
+            returnedData.getInputStream().read(responseBytes);
+            assertNotNull(responseBytes);
+            String response = new String(responseBytes);
+            assertEquals("This is some test input", response);
+        } finally {
+            if (postMethod != null) {
+                postMethod.releaseConnection();
+            }
+        }
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/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="demo.jaxrs.httpmethodoverride" default="all">
+	<import file="../../../buildCommon.xml" />
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/Application.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/Application.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/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 demo.jaxrs.httpmethodoverride.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(MethodOverrideResource.class);
+        return clazzes;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/MethodOverrideResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/MethodOverrideResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/MethodOverrideResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/MethodOverrideResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,45 @@
+/*
+ * 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 demo.jaxrs.httpmethodoverride.server;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+
+@Path("httpmethodoverride")
+public class MethodOverrideResource {
+
+    @POST
+    public String postSomething(byte[] echo) {
+        return "invoked post:" + new String(echo);
+    }
+
+    @PUT
+    public String putSomething(byte[] echo) {
+        return "invoked put:" + new String(echo);
+    }
+
+    @DELETE
+    public String deleteSomething(byte[] echo) {
+        return "invoked delete:" + new String(echo);
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/WEB-INF/web-no-runtime.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/WEB-INF/web-no-runtime.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/WEB-INF/web-no-runtime.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/WEB-INF/web-no-runtime.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,38 @@
+<?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.
+  -->
+
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>HTTPMethodOverride</servlet-name>
+		<servlet-class>demo.jaxrs.httpmethodoverride.server.Application</servlet-class>		
+		<init-param>
+			<param-name>com.ibm.ws.jaxrs.httpmethodoverride.enable</param-name>
+			<param-value>true</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>HTTPMethodOverride</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/WEB-INF/web.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/WEB-INF/web.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/server/WEB-INF/web.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,42 @@
+<?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.
+  -->
+
+<web-app id="WebApp_ID" version="2.5"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+	<servlet>
+		<servlet-name>HTTPMethodOverride</servlet-name>
+		<servlet-class>com.ibm.ws.jaxrs.web.RESTServlet</servlet-class>
+		<init-param>
+			<param-name>javax.ws.rs.Application</param-name>
+			<param-value>demo.jaxrs.httpmethodoverride.server.Application</param-value>
+		</init-param>
+		<init-param>
+			<param-name>com.ibm.ws.jaxrs.httpmethodoverride.enable</param-name>
+			<param-value>true</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>HTTPMethodOverride</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/test/HTTPMethodOverrideTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/test/HTTPMethodOverrideTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/test/HTTPMethodOverrideTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/httpmethodoverride/test/HTTPMethodOverrideTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,276 @@
+/*
+ * 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 demo.jaxrs.httpmethodoverride.test;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+
+import framework.defaults.test.FVTTestCase;
+
+/**
+ * When the configuration property is set to enable the X-HTTP-Method-Override
+ * and X-Method-Override support, verify that the correct methods are called.
+ */
+public class HTTPMethodOverrideTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(HTTPMethodOverrideTest.class,
+                "demo.jaxrs.httpmethodoverride.server.Application");
+    }
+
+    /**
+     * Tests that a request with a X-HTTP-Method-Override in it will invoke the
+     * correct method.
+     *
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testXHTTPMethodOverride() throws HttpException, IOException {
+        System
+                .setProperty("com.ibm.ws.jaxrs.httpmethodoverride.enable",
+                        "true");
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/httpmethodoverride");
+        try {
+            postMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("invoked post:hello world", postMethod
+                    .getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+
+        PutMethod putMethod = new PutMethod(getBaseURI()
+                + "/httpmethodoverride");
+        try {
+            putMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(putMethod);
+            assertEquals(200, putMethod.getStatusCode());
+            assertEquals("invoked put:hello world", putMethod
+                    .getResponseBodyAsString());
+        } finally {
+            putMethod.releaseConnection();
+        }
+
+        postMethod = new PostMethod(getBaseURI() + "/httpmethodoverride");
+        postMethod.setRequestHeader("X-HTTP-Method-Override", "pUt");
+        try {
+            postMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("invoked put:hello world", postMethod
+                    .getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+
+        DeleteMethod deleteMethod = new DeleteMethod(getBaseURI()
+                + "/httpmethodoverride");
+        try {
+            client.executeMethod(deleteMethod);
+            assertEquals(200, deleteMethod.getStatusCode());
+            assertEquals("invoked delete:", deleteMethod
+                    .getResponseBodyAsString());
+        } finally {
+            deleteMethod.releaseConnection();
+        }
+
+        postMethod = new PostMethod(getBaseURI() + "/httpmethodoverride");
+        postMethod.setRequestHeader("X-HTTP-Method-Override", "dELETE");
+        try {
+            postMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("invoked delete:hello world", postMethod
+                    .getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+
+        postMethod = new PostMethod(getBaseURI() + "/httpmethodoverride");
+        postMethod.setRequestHeader("X-HTTP-Method-Override", "GeT");
+        try {
+            postMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(postMethod);
+            assertEquals(405, postMethod.getStatusCode());
+            assertEquals("", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+        System.setProperty("com.ibm.ws.jaxrs.httpmethodoverride.enable", "");
+    }
+
+    /**
+     * Tests that a request with a X-Method-Override in it will invoke the
+     * correct method.
+     *
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testXMethodOverride() throws HttpException, IOException {
+        System
+                .setProperty("com.ibm.ws.jaxrs.httpmethodoverride.enable",
+                        "true");
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/httpmethodoverride");
+        try {
+            postMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("invoked post:hello world", postMethod
+                    .getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+
+        PutMethod putMethod = new PutMethod(getBaseURI()
+                + "/httpmethodoverride");
+        try {
+            putMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(putMethod);
+            assertEquals(200, putMethod.getStatusCode());
+            assertEquals("invoked put:hello world", putMethod
+                    .getResponseBodyAsString());
+        } finally {
+            putMethod.releaseConnection();
+        }
+
+        postMethod = new PostMethod(getBaseURI() + "/httpmethodoverride");
+        postMethod.setRequestHeader("X-Method-Override", "pUt");
+        try {
+            postMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("invoked put:hello world", postMethod
+                    .getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+
+        DeleteMethod deleteMethod = new DeleteMethod(getBaseURI()
+                + "/httpmethodoverride");
+        try {
+            client.executeMethod(deleteMethod);
+            assertEquals(200, deleteMethod.getStatusCode());
+            assertEquals("invoked delete:", deleteMethod
+                    .getResponseBodyAsString());
+        } finally {
+            deleteMethod.releaseConnection();
+        }
+
+        postMethod = new PostMethod(getBaseURI() + "/httpmethodoverride");
+        postMethod.setRequestHeader("X-Method-Override", "dELETE");
+        try {
+            postMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("invoked delete:hello world", postMethod
+                    .getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+
+        postMethod = new PostMethod(getBaseURI() + "/httpmethodoverride");
+        postMethod.setRequestHeader("X-Method-Override", "GET");
+        try {
+            postMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(postMethod);
+            assertEquals(405, postMethod.getStatusCode());
+            assertEquals("", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+        System.setProperty("com.ibm.ws.jaxrs.httpmethodoverride.enable", "");
+    }
+
+    /**
+     * Tests that a request with a X-HTTP-Method-Override or X-Method-Override
+     * that changes to an unknown HTTP Method is also treated like a 405.
+     *
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testXMethodOverrideChangeToUnknownMethod()
+            throws HttpException, IOException {
+        System
+                .setProperty("com.ibm.ws.jaxrs.httpmethodoverride.enable",
+                        "true");
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/httpmethodoverride");
+        try {
+            postMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("invoked post:hello world", postMethod
+                    .getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+
+        postMethod = new PostMethod(getBaseURI() + "/httpmethodoverride");
+        postMethod.setRequestHeader("X-HTTP-Method-Override", "MYMETHOD");
+        try {
+            postMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(postMethod);
+            assertEquals(405, postMethod.getStatusCode());
+            assertEquals("", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+
+        postMethod = new PostMethod(getBaseURI() + "/httpmethodoverride");
+        postMethod.setRequestHeader("X-Method-Override", "DELETE2");
+        try {
+            postMethod.setRequestEntity(new StringRequestEntity("hello world",
+                    "text/plain", null));
+            client.executeMethod(postMethod);
+            assertEquals(405, postMethod.getStatusCode());
+            assertEquals("", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+        System.setProperty("com.ibm.ws.jaxrs.httpmethodoverride.enable", "");
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/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="demo.jaxrs.injection.uriinfo" default="all">
+	<import file="../../../../buildCommon.xml" />
+</project>

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/Students.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/Students.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/Students.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/Students.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,102 @@
+/*
+ * 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 demo.jaxrs.injection.uriinfo.server;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.ws.rs.HEAD;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.PathSegment;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+public class Students {
+
+    private UriInfo uriInfo;
+
+    Students(UriInfo uriInfo) {
+        this.uriInfo = uriInfo;
+    }
+
+    @HEAD
+    public Response head() {
+        Response resp = null;
+        ResponseBuilder rb = Response.ok();
+        resp = rb.build();
+        List<String> uris = uriInfo.getMatchedURIs();
+        List<Object> objectUris = new LinkedList<Object>(uris);
+        resp.getMetadata().put("matched-uris", objectUris);
+        resp.getMetadata().put("matched-resources",
+                uriInfo.getMatchedResources());
+        return resp;
+    }
+
+    @HEAD
+    @Path(value = "/nestedhd/{id}")
+    public Response headNested() {
+        Response resp = null;
+        ResponseBuilder rb = Response.ok();
+        resp = rb.build();
+        List<String> uris = uriInfo.getMatchedURIs();
+        List<Object> objectUris = new LinkedList<Object>(uris);
+        resp.getMetadata()
+                .putSingle("absolute-path", uriInfo.getAbsolutePath());
+        for (PathSegment seg : uriInfo.getPathSegments()) {
+            resp.getMetadata().add("path-segments", seg.getPath());
+        }
+        resp.getMetadata().putSingle("request-uri", uriInfo.getRequestUri());
+        resp.getMetadata().putSingle("base-uri", uriInfo.getBaseUri());
+        resp.getMetadata().putSingle("path", uriInfo.getPath());
+        resp.getMetadata().put("matched-uris", objectUris);
+        resp.getMetadata().put("matched-resources",
+                uriInfo.getMatchedResources());
+        MultivaluedMap<String, String> queryParams = uriInfo
+                .getQueryParameters();
+        Iterator<String> ids = queryParams.keySet().iterator();
+        while (ids.hasNext()) {
+            String id = ids.next();
+            List<String> values = queryParams.get(id);
+            id = "qp-" + id;
+            if (values != null) {
+                for (String value : values) {
+                    resp.getMetadata().add(id, value);
+                }
+            }
+        }
+        MultivaluedMap<String, String> pathParams = uriInfo.getPathParameters();
+        Iterator<String> pathIds = pathParams.keySet().iterator();
+        while (pathIds.hasNext()) {
+            String id = pathIds.next();
+            List<String> values = pathParams.get(id);
+            id = "pp-" + id;
+            if (values != null) {
+                for (String value : values) {
+                    resp.getMetadata().add(id, value);
+                }
+            }
+        }
+        return resp;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/Teacher.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/Teacher.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/Teacher.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/Teacher.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 demo.jaxrs.injection.uriinfo.server;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class Teacher {
+
+    private String id;
+
+    private String name;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/TeacherDatabase.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/TeacherDatabase.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/TeacherDatabase.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/TeacherDatabase.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,42 @@
+/*
+ * 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 demo.jaxrs.injection.uriinfo.server;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class TeacherDatabase {
+
+    private static Map<String, Teacher> teachers = new HashMap<String, Teacher>();
+
+    public static Collection<Teacher> getTeachers() {
+        return teachers.values();
+    }
+
+    public static Teacher getTeacher(String id) {
+        return teachers.get(id);
+    }
+
+    public static void addTeacher(String id, Teacher teacher) {
+        teachers.put(id, teacher);
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/TeacherList.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/TeacherList.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/TeacherList.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/TeacherList.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,41 @@
+/*
+ * 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 demo.jaxrs.injection.uriinfo.server;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class TeacherList {
+
+    public TeacherList() {
+    }
+
+    @XmlElement
+    private List<Teacher> teachers = new LinkedList<Teacher>();
+
+    public List<Teacher> getTeachers() {
+        return teachers;
+    }
+
+}



Mime
View raw message