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 [3/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/demo/jaxrs/injection/uriinfo/server/Teachers.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/Teachers.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/Teachers.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/server/Teachers.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,72 @@
+/*
+ * 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.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+@Path(value = "/teachers")
+public class Teachers {
+
+    @Context
+    private UriInfo uriInfo;
+
+    @GET
+    @Produces(value = "text/xml")
+    @Consumes(value = "text/xml")
+    public Response get() {
+        Response resp = null;
+        ResponseBuilder rb = Response.ok();
+        TeacherList list = new TeacherList();
+        list.getTeachers().addAll(TeacherDatabase.getTeachers());
+        rb.entity(list);
+        resp = rb.build();
+        return resp;
+    }
+
+    @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;
+    }
+
+    @Path("/studenthd")
+    public Students studentHead() {
+        return new Students(uriInfo);
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/test/TeachersTests.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/test/TeachersTests.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/test/TeachersTests.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/injection/uriinfo/test/TeachersTests.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,196 @@
+/*
+ * 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.test;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.HeadMethod;
+
+import demo.jaxrs.injection.uriinfo.server.Students;
+import demo.jaxrs.injection.uriinfo.server.Teachers;
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+public class TeachersTests extends FVTTestCase {
+
+    final private static String BASE_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(TeachersTests.class)
+            + "/teachers";
+
+    public static Test suite() {
+        return FVTTestCase
+                .getTestSuite(TeachersTests.class,
+                        demo.jaxrs.injection.uriinfo.server.Application.class
+                                .getName());
+    }
+
+    /**
+     * This will verify that the UriInfo.getMatchedUris() and UriInfo.getMatchedResources()
+     * return the correct values.
+     *
+     */
+    public void testUriInfoInjection() {
+        HeadMethod headMethod = null;
+        try {
+            headMethod = new HeadMethod(BASE_URI);
+            HttpClient client = new HttpClient();
+            client.executeMethod(headMethod);
+            Header header = headMethod.getResponseHeader("matched-uris");
+            assertNotNull(header);
+            assertEquals("teachers", header.getValue());
+            header = headMethod.getResponseHeader("matched-resources");
+            assertNotNull(header);
+            assertEquals(Teachers.class.toString(), header.getValue());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally {
+            if (headMethod != null) {
+                headMethod.releaseConnection();
+            }
+        }
+    }
+
+    /**
+     * This will verify that the UriInfo.getMatchedUris() and UriInfo.getMatchedResources()
+     * return the correct values. Specifically, this will test the case when the request
+     * flows through a resource and resource method.
+     *
+     */
+    public void testUriInfoInjectionSubResource() {
+        HeadMethod headMethod = null;
+        try {
+            headMethod = new HeadMethod(BASE_URI + "/studenthd");
+            HttpClient client = new HttpClient();
+            client.executeMethod(headMethod);
+            Header[] headers = headMethod.getResponseHeaders("matched-uris");
+            assertNotNull(headers);
+            assertEquals(2, headers.length);
+            assertEquals("teachers/studenthd", headers[0].getValue());
+            assertEquals("teachers", headers[1].getValue());
+            headers = headMethod.getResponseHeaders("matched-resources");
+            assertNotNull(headers);
+            assertEquals(2, headers.length);
+            assertEquals(Students.class.toString(), headers[0].getValue());
+            assertEquals(Teachers.class.toString(), headers[1].getValue());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally {
+            if (headMethod != null) {
+                headMethod.releaseConnection();
+            }
+        }
+    }
+
+    /**
+     * This will verify that the UriInfo.getMatchedUris() and UriInfo.getMatchedResources()
+     * return the correct values. Specifically, this will test the case when the request
+     * flows through a resource, subresource locator, and resource method.
+     *
+     */
+    public void testUriInfoInjectionSubResourceNested() {
+        HeadMethod headMethod = null;
+        try {
+            headMethod = new HeadMethod(BASE_URI + "/studenthd/nestedhd/1");
+            HttpClient client = new HttpClient();
+            client.executeMethod(headMethod);
+            Header[] headers = headMethod.getResponseHeaders("matched-uris");
+            assertNotNull(headers);
+            assertEquals(3, headers.length);
+            assertEquals("teachers/studenthd/nestedhd/1", headers[0].getValue());
+            assertEquals("teachers/studenthd", headers[1].getValue());
+            assertEquals("teachers", headers[2].getValue());
+            headers = headMethod.getResponseHeaders("matched-resources");
+            assertNotNull(headers);
+            assertEquals(2, headers.length);
+            assertEquals(Students.class.toString(), headers[0].getValue());
+            assertEquals(Teachers.class.toString(), headers[1].getValue());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally {
+            if (headMethod != null) {
+                headMethod.releaseConnection();
+            }
+        }
+    }
+
+    /**
+     * This will various function from the UriInfo that returns path information.
+     *
+     */
+    public void testUriInfoInjectionPaths() {
+        HeadMethod headMethod = null;
+        try {
+            headMethod = new HeadMethod(BASE_URI
+                    + "/studenthd/nestedhd/1?id=007" + "&name=james&name=bond");
+            HttpClient client = new HttpClient();
+            client.executeMethod(headMethod);
+            String prefix = DefaultURIInfo
+                    .getClassDefaultBaseURI(TeachersTests.class);
+            Header header = headMethod.getResponseHeader("absolute-path");
+            assertNotNull(header);
+            assertEquals(BASE_URI + "/studenthd/nestedhd/1", header.getValue());
+            header = headMethod.getResponseHeader("base-uri");
+            assertNotNull(header);
+            assertEquals(prefix, header.getValue());
+            header = headMethod.getResponseHeader("path");
+            assertNotNull(header);
+            assertEquals("/teachers/studenthd/nestedhd/1", header.getValue());
+            Header[] headers = headMethod.getResponseHeaders("path-segments");
+            assertNotNull(headers);
+            assertEquals(4, headers.length);
+            assertEquals("teachers", headers[0].getValue());
+            assertEquals("studenthd", headers[1].getValue());
+            assertEquals("nestedhd", headers[2].getValue());
+            assertEquals("1", headers[3].getValue());
+            header = headMethod.getResponseHeader("request-uri");
+            assertNotNull(header);
+            assertEquals(
+                    prefix
+                            + "/teachers/studenthd/nestedhd/1?id=007&name=james&name=bond",
+                    header.getValue());
+            headers = headMethod.getResponseHeaders("qp-id");
+            assertNotNull(headers);
+            assertEquals(1, headers.length);
+            assertEquals("007", headers[0].getValue());
+            headers = headMethod.getResponseHeaders("qp-name");
+            assertNotNull(headers);
+            assertEquals(2, headers.length);
+            assertEquals("james", headers[0].getValue());
+            assertEquals("bond", headers[1].getValue());
+            headers = headMethod.getResponseHeaders("pp-id");
+            assertNotNull(headers);
+            assertEquals(1, headers.length);
+            assertEquals("1", headers[0].getValue());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally {
+            if (headMethod != null) {
+                headMethod.releaseConnection();
+            }
+        }
+    }
+
+}

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

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/Department.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/Department.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/Department.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/Department.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.jaxb.server;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class Department {
+
+    private String departmentId;
+
+    private String departmentName;
+
+    public String getDepartmentId() {
+        return departmentId;
+    }
+
+    public void setDepartmentId(String departmentId) {
+        this.departmentId = departmentId;
+    }
+
+    public String getDepartmentName() {
+        return departmentName;
+    }
+
+    public void setDepartmentName(String departmentName) {
+        this.departmentName = departmentName;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/DepartmentDatabase.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/DepartmentDatabase.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/DepartmentDatabase.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/DepartmentDatabase.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,50 @@
+/*
+ * 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.jaxb.server;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class DepartmentDatabase {
+
+    private static Map<String, Department> departmentDB = new HashMap<String, Department>();
+
+    public static Collection<Department> getDepartments() {
+        return departmentDB.values();
+    }
+
+    public static void addDepartment(Department department) {
+        departmentDB.put(department.getDepartmentId(), department);
+    }
+
+    public static Department getDepartment(String departmentId) {
+        return departmentDB.get(departmentId);
+    }
+
+    public static Department removeDepartment(String departmentId) {
+        return departmentDB.remove(departmentId);
+    }
+
+    public static void clearEntries() {
+        departmentDB.clear();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/DepartmentListWrapper.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/DepartmentListWrapper.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/DepartmentListWrapper.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/DepartmentListWrapper.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,50 @@
+/*
+ * 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.jaxb.server;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class DepartmentListWrapper {
+
+    @XmlElement
+    private List<Department> departmentList = new LinkedList<Department>();
+
+    public List<Department> getDepartmentList() {
+        return departmentList;
+    }
+
+    public String toString() {
+        StringBuffer sb = new StringBuffer();
+        for (Department dept : departmentList) {
+            sb.append("ID: " + dept.getDepartmentId());
+            sb.append("\n");
+            sb.append("NAME: " + dept.getDepartmentName());
+            sb.append("\n");
+        }
+
+        return sb.toString();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/Departments.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/Departments.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/Departments.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/server/Departments.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,99 @@
+/*
+ * 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.jaxb.server;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.HEAD;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+@Path(value = "/departments")
+public class Departments {
+
+    @GET
+    @Produces(value = "text/xml")
+    public DepartmentListWrapper getDepartments() {
+        Iterator<Department> dptIter = DepartmentDatabase.getDepartments()
+                .iterator();
+        DepartmentListWrapper wrapper = new DepartmentListWrapper();
+        List<Department> dptList = wrapper.getDepartmentList();
+        while (dptIter.hasNext()) {
+            dptList.add(dptIter.next());
+        }
+        return wrapper;
+    }
+
+    @GET
+    @Path(value = "/{departmentId}")
+    @Produces(value = { "text/xml" })
+    public Response getDepartment(@PathParam(value = "departmentId") String departmentId, @QueryParam(value = "type") String type, @Context Request req) {
+        Department dept = DepartmentDatabase.getDepartment(departmentId);
+        return Response.ok(dept).build();
+    }
+
+    @DELETE
+    @Path(value = "/{departmentId}")
+    public Response deleteDepartment(@PathParam(value = "departmentId") String departmentId) {
+        Department dept = DepartmentDatabase.removeDepartment(departmentId);
+        if (dept == null) {
+            return Response.status(404).build();
+        }
+        return Response.status(204).build();
+    }
+
+    @POST
+    @Consumes(value = "text/xml")
+    public void addDepartment(Department department) {
+        DepartmentDatabase.addDepartment(department);
+    }
+
+    @HEAD
+    @Produces(value = "text/xml")
+    @Path(value = "/{departmentId}")
+    public Response exists(@PathParam(value = "departmentId") String departmentId) {
+        Department dpt = DepartmentDatabase.getDepartment(departmentId);
+        Response resp = null;
+        if (dpt != null) {
+            ResponseBuilder rb = Response.ok();
+            rb.entity(dpt);
+            resp = rb.build();
+            resp.getMetadata().add("resolved-id", departmentId);
+        } else {
+            ResponseBuilder rb = Response.noContent();
+            rb.entity(null);
+            resp = rb.build();
+            resp.getMetadata().add("unresolved-id", departmentId);
+        }
+        return resp;
+    }
+
+}

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/test/DepartmentTests.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/test/DepartmentTests.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/test/DepartmentTests.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jaxb/test/DepartmentTests.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,178 @@
+/*
+ * 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.jaxb.test;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.HeadMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
+
+import demo.jaxrs.jaxb.server.Department;
+import demo.jaxrs.jaxb.server.DepartmentDatabase;
+import demo.jaxrs.jaxb.server.DepartmentListWrapper;
+import framework.defaults.test.FVTTestCase;
+
+public class DepartmentTests extends FVTTestCase {
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(DepartmentTests.class,
+                demo.jaxrs.jaxb.server.Application.class.getName());
+    }
+
+    public String getBaseURI() {
+        return super.getBaseURI() + "/departments";
+    }
+
+    /**
+     * This will drive several different requests that interact with the
+     * Departments resource class.
+     *
+     */
+    public void testDepartmentsResourceJAXB() throws Exception {
+        PostMethod postMethod = null;
+        GetMethod getAllMethod = null;
+        GetMethod getOneMethod = null;
+        HeadMethod headMethod = null;
+        DeleteMethod deleteMethod = null;
+        try {
+
+            // make sure everything is clear before testing
+            DepartmentDatabase.clearEntries();
+
+            // create a new Department
+            Department newDepartment = new Department();
+            newDepartment.setDepartmentId("1");
+            newDepartment.setDepartmentName("Marketing");
+            JAXBContext context = JAXBContext.newInstance(new Class<?>[] {
+                    Department.class, DepartmentListWrapper.class });
+            Marshaller marshaller = context.createMarshaller();
+            StringWriter sw = new StringWriter();
+            marshaller.marshal(newDepartment, sw);
+            HttpClient client = new HttpClient();
+            postMethod = new PostMethod(getBaseURI());
+            RequestEntity reqEntity = new ByteArrayRequestEntity(sw.toString()
+                    .getBytes(), "text/xml");
+            postMethod.setRequestEntity(reqEntity);
+            client.executeMethod(postMethod);
+
+            newDepartment = new Department();
+            newDepartment.setDepartmentId("2");
+            newDepartment.setDepartmentName("Sales");
+            sw = new StringWriter();
+            marshaller.marshal(newDepartment, sw);
+            client = new HttpClient();
+            postMethod = new PostMethod(getBaseURI());
+            reqEntity = new ByteArrayRequestEntity(sw.toString().getBytes(),
+                    "text/xml");
+            postMethod.setRequestEntity(reqEntity);
+            client.executeMethod(postMethod);
+
+            // now let's get the list of Departments that we just created (should be 2)
+            client = new HttpClient();
+            getAllMethod = new GetMethod(getBaseURI());
+            client.executeMethod(getAllMethod);
+            byte[] bytes = getAllMethod.getResponseBody();
+            assertNotNull(bytes);
+            InputStream bais = new ByteArrayInputStream(bytes);
+            Unmarshaller unmarshaller = context.createUnmarshaller();
+            Object obj = unmarshaller.unmarshal(bais);
+            assertTrue(obj instanceof DepartmentListWrapper);
+            DepartmentListWrapper wrapper = (DepartmentListWrapper) obj;
+            List<Department> dptList = wrapper.getDepartmentList();
+            assertNotNull(dptList);
+            assertEquals(2, dptList.size());
+
+            // now get a specific Department that was created
+            client = new HttpClient();
+            getOneMethod = new GetMethod(getBaseURI() + "/1");
+            client.executeMethod(getOneMethod);
+            bytes = getOneMethod.getResponseBody();
+            assertNotNull(bytes);
+            bais = new ByteArrayInputStream(bytes);
+            obj = unmarshaller.unmarshal(bais);
+            assertTrue(obj instanceof Department);
+            Department dept = (Department) obj;
+            assertEquals("1", dept.getDepartmentId());
+            assertEquals("Marketing", dept.getDepartmentName());
+
+            // let's send a Head request for both an existent and non-existent resource
+            // we are testing to see if header values being set in the resource implementation
+            // are sent back appropriately
+            client = new HttpClient();
+            headMethod = new HeadMethod(getBaseURI() + "/3");
+            client.executeMethod(headMethod);
+            assertNotNull(headMethod.getResponseHeaders());
+            Header header = headMethod.getResponseHeader("unresolved-id");
+            assertNotNull(header);
+            assertEquals("3", header.getValue());
+            headMethod.releaseConnection();
+
+            // now the resource that should exist
+            headMethod = new HeadMethod(getBaseURI() + "/1");
+            client.executeMethod(headMethod);
+            assertNotNull(headMethod.getResponseHeaders());
+            header = headMethod.getResponseHeader("resolved-id");
+            assertNotNull(header);
+            assertEquals("1", header.getValue());
+
+            deleteMethod = new DeleteMethod(getBaseURI() + "/1");
+            client.executeMethod(deleteMethod);
+            assertEquals(204, deleteMethod.getStatusCode());
+
+            deleteMethod = new DeleteMethod(getBaseURI() + "/2");
+            client.executeMethod(deleteMethod);
+            assertEquals(204, deleteMethod.getStatusCode());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally {
+            if (postMethod != null) {
+                postMethod.releaseConnection();
+            }
+            if (getAllMethod != null) {
+                getAllMethod.releaseConnection();
+            }
+            if (getOneMethod != null) {
+                getOneMethod.releaseConnection();
+            }
+            if (headMethod != null) {
+                headMethod.releaseConnection();
+            }
+            if (deleteMethod != null) {
+                deleteMethod.releaseConnection();
+            }
+        }
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/Application.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/Application.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/Application.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,15 @@
+package demo.jaxrs.jdbc.endtoend;
+
+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(BookResource.class);
+        return classes;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/Book.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/Book.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/Book.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/Book.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 demo.jaxrs.jdbc.endtoend;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class Book {
+
+    public Book() {
+        /* do nothing */
+    }
+
+    private String title;
+
+    private String author;
+
+    private String id;
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/BookResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/BookResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/BookResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/BookResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,113 @@
+/*
+ * 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.jdbc.endtoend;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+
+@Path("books")
+public class BookResource {
+
+    private static final String DB_NAME = "build/db/books";
+    private static final String JDBC_DERBY = "jdbc:derby:";
+    private static final String DERBY_EMBEDDED_DRIVER = "org.apache.derby.jdbc.EmbeddedDriver";
+
+    @GET
+    @Path("{id}")
+    @Produces("text/xml")
+    @Consumes("text/xml")
+    public Book getBook(@PathParam("id") String bookId) {
+        Connection conn = null;
+        try {
+            Class.forName(DERBY_EMBEDDED_DRIVER).newInstance();
+            conn = DriverManager.getConnection(JDBC_DERBY + DB_NAME, null);
+            PreparedStatement ps = conn
+                    .prepareStatement("select * from books where id=?");
+            ps.setString(1, bookId);
+            ps.execute();
+            ResultSet rs = ps.getResultSet();
+            if (!rs.next()) {
+                return null;
+            }
+            Book b = new Book();
+            b.setId(rs.getString("id"));
+            b.setAuthor(rs.getString("author"));
+            b.setTitle(rs.getString("title"));
+            return b;
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (SQLException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                conn.close();
+            } catch (SQLException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+    @POST
+    @Produces("text/xml")
+    @Consumes("text/xml")
+    public Book postBook(@QueryParam("id") String id, @QueryParam("title") String title, @QueryParam("author") String author) {
+        try {
+            Class.forName(DERBY_EMBEDDED_DRIVER).newInstance();
+            Connection conn = DriverManager.getConnection(JDBC_DERBY + DB_NAME,
+                    null);
+            PreparedStatement ps = conn
+                    .prepareStatement("insert into books (id, author, title) values (?, ?, ?)");
+            ps.setString(1, id);
+            ps.setString(2, author);
+            ps.setString(3, title);
+            ps.execute();
+            conn.close();
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        Book b = new Book();
+        b.setId(id);
+        b.setTitle(title);
+        b.setAuthor(author);
+        return b;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/BookTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/BookTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/BookTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/BookTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,151 @@
+/*
+ * 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.jdbc.endtoend;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import junit.framework.Test;
+
+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 framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+public class BookTest extends FVTTestCase {
+
+    private static Boolean isDatabaseCreated = false;
+
+    final private static String BASE_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(BookTest.class)
+            + "/books";
+
+    public void setUp() throws Exception {
+        super.setUp();
+        createDatabase();
+    }
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(BookTest.class, Application.class
+                .getName());
+    }
+
+    public void createDatabase() {
+        synchronized (isDatabaseCreated) {
+            if (!isDatabaseCreated) {
+            }
+            try {
+                Class.forName("org.apache.derby.jdbc.EmbeddedDriver")
+                        .newInstance();
+                Connection conn = DriverManager.getConnection("jdbc:derby:"
+                        + "build/db/books;create=true", null);
+                Statement s = conn.createStatement();
+                try {
+                    s.execute("drop table books");
+                } catch (SQLException e) {
+                    /* dropping just in case it exists */
+                }
+                s
+                        .execute("create table books(id varchar(255), author varchar(255), title varchar(255))");
+                s.close();
+                conn.close();
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            } catch (InstantiationException e) {
+                e.printStackTrace();
+            } catch (ClassNotFoundException e) {
+                e.printStackTrace();
+            } catch (SQLException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * Post a book to the database and then retrieve.
+     */
+    public void testBooksDatabase() {
+        PostMethod postMethod = null;
+        GetMethod getMethod = null;
+        try {
+            /*
+             * Create the book in the database
+             */
+            HttpClient client = new HttpClient();
+            postMethod = new PostMethod(BASE_URI
+                    + "?id=HP001&author=J.K.Rowling&title=HarryPotter");
+            client.executeMethod(postMethod);
+            assertEquals(postMethod.getStatusCode(), 200);
+
+            JAXBContext context = JAXBContext
+                    .newInstance(new Class<?>[] { Book.class });
+            Unmarshaller unmarshaller = context.createUnmarshaller();
+            Object obj = unmarshaller.unmarshal(postMethod
+                    .getResponseBodyAsStream());
+            assertTrue(obj instanceof Book);
+
+            Book b = (Book) obj;
+            assertEquals("J.K.Rowling", b.getAuthor());
+            assertEquals("HarryPotter", b.getTitle());
+            assertEquals("HP001", b.getId());
+
+            /*
+             * Get book info
+             */
+            getMethod = new GetMethod(BASE_URI + "/HP001");
+            client.executeMethod(getMethod);
+            assertEquals(getMethod.getStatusCode(), 200);
+
+            obj = unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());
+            assertTrue(obj instanceof Book);
+
+            b = (Book) obj;
+            assertEquals("J.K.Rowling", b.getAuthor());
+            assertEquals("HarryPotter", b.getTitle());
+            assertEquals("HP001", b.getId());
+        } catch (HttpException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } catch (IOException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } catch (JAXBException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } finally {
+            if (postMethod != null) {
+                postMethod.releaseConnection();
+            }
+            if (getMethod != null) {
+                getMethod.releaseConnection();
+            }
+        }
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/ObjectFactory.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/ObjectFactory.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/jdbc/endtoend/ObjectFactory.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.jdbc.endtoend;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    public ObjectFactory() {
+        /* do nothing */
+    }
+
+    public Book createBook() {
+        return new Book();
+    }
+}

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/Application.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/Application.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/Application.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,43 @@
+/*
+ * 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.multiservletmultiapp.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(ResourceOne.class);
+        clazzes.add(ResourceTwoInApp1.class);
+        return clazzes;
+    }
+
+    @Override
+    public Set<Object> getSingletons() {
+        Set<Object> objs = new HashSet<Object>();
+        objs.add(new MyMessageBodyReaderString());
+        objs.add(new JAXBContextProviderInAppOne());
+        return objs;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/Application2.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/Application2.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/Application2.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/Application2.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.multiservletmultiapp.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class Application2 extends javax.ws.rs.core.Application {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> clazzes = new HashSet<Class<?>>();
+        clazzes.add(ResourceOneInApp2.class);
+        clazzes.add(ResourceTwo.class);
+        return clazzes;
+    }
+
+    @Override
+    public Set<Object> getSingletons() {
+        Set<Object> objs = new HashSet<Object>();
+        objs.add(new MyMessageBodyWriterString());
+        objs.add(new ExceptionMapperInAppTwo());
+        return objs;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ExceptionMapperInAppTwo.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ExceptionMapperInAppTwo.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ExceptionMapperInAppTwo.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ExceptionMapperInAppTwo.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,35 @@
+/*
+ * 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.multiservletmultiapp.server;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+public class ExceptionMapperInAppTwo implements ExceptionMapper<IOException> {
+
+    public Response toResponse(IOException arg0) {
+        return Response.status(508).build();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/JAXBContextProviderInAppOne.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/JAXBContextProviderInAppOne.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/JAXBContextProviderInAppOne.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/JAXBContextProviderInAppOne.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,44 @@
+/*
+ * 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.multiservletmultiapp.server;
+
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+import demo.jaxrs.multiservletmultiapp.server.xml.Person;
+
+@Provider
+public class JAXBContextProviderInAppOne implements ContextResolver<JAXBContext> {
+
+    public JAXBContext getContext(Class<?> arg0) {
+        if (arg0.equals(Person.class)) {
+            try {
+                return JAXBContext.newInstance(ObjectFactory.class.getPackage()
+                        .getName());
+            } catch (JAXBException e) {
+                return null;
+            }
+        }
+        return null;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/MyMessageBodyReaderString.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/MyMessageBodyReaderString.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/MyMessageBodyReaderString.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/MyMessageBodyReaderString.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,49 @@
+/*
+ * 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.multiservletmultiapp.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+
+import org.apache.cxf.helpers.IOUtils;
+
+@Provider
+@Consumes("text/plain")
+public class MyMessageBodyReaderString implements MessageBodyReader<String> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return String.class.equals(arg0);
+    }
+
+    public String readFrom(Class<String> arg0, Type arg1, Annotation[] arg2, MediaType arg3, MultivaluedMap<String, String> arg4, InputStream arg5)
+            throws IOException, WebApplicationException {
+        return "invokedmyreader:" + IOUtils.readStringFromStream(arg5);
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/MyMessageBodyWriterString.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/MyMessageBodyWriterString.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/MyMessageBodyWriterString.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/MyMessageBodyWriterString.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,52 @@
+/*
+ * 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.multiservletmultiapp.server;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Produces("text/plain")
+public class MyMessageBodyWriterString implements MessageBodyWriter<String> {
+
+    public long getSize(String arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4) {
+        return -1;
+    }
+
+    public boolean isWriteable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return String.class.equals(arg0);
+    }
+
+    public void writeTo(String arg0, Class<?> arg1, Type arg2, Annotation[] arg3, MediaType arg4, MultivaluedMap<String, Object> arg5, OutputStream arg6)
+            throws IOException, WebApplicationException {
+        arg6.write("invokedmywriter:".getBytes());
+        arg6.write(arg0.getBytes());
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ObjectFactory.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ObjectFactory.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ObjectFactory.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.multiservletmultiapp.server;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+import demo.jaxrs.multiservletmultiapp.server.xml.Person;
+
+@XmlRegistry
+public class ObjectFactory {
+
+    public Person createPerson() {
+        return new Person();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceOne.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceOne.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceOne.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceOne.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.multiservletmultiapp.server;
+
+import java.io.IOException;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.xml.bind.JAXBElement;
+import javax.xml.ws.Response;
+
+import demo.jaxrs.multiservletmultiapp.server.xml.Person;
+
+@Path("/app1/hello")
+public class ResourceOne {
+
+    @GET
+    public String helloWorld() {
+        return "hello world";
+    }
+
+    @POST
+    @Consumes("text/plain")
+    public String invokedString(String echo) {
+        return echo;
+    }
+
+    @PUT
+    public JAXBElement invoke(JAXBElement<Person> p) {
+        p.getValue().setName("invoked:" + p.getName());
+        return p;
+    }
+
+    @DELETE
+    public Response throwIO() throws IOException {
+        throw new IOException();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceOneInApp2.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceOneInApp2.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceOneInApp2.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceOneInApp2.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,35 @@
+/*
+ * 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.multiservletmultiapp.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+@Path("/app1/hello")
+public class ResourceOneInApp2 {
+
+    @GET
+    public String helloWorld() {
+        /*
+         * never invoked but just to make sure it won't get invoked
+         */
+        return "foo bar";
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceTwo.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceTwo.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceTwo.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceTwo.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.multiservletmultiapp.server;
+
+import java.io.IOException;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.xml.bind.JAXBElement;
+import javax.xml.ws.Response;
+
+import demo.jaxrs.multiservletmultiapp.server.xml.Person;
+
+@Path("/app2/hello")
+public class ResourceTwo {
+
+    @GET
+    public String helloWorld() {
+        return "foo bar";
+    }
+
+    @POST
+    @Consumes("text/plain")
+    public String invokedString(String echo) {
+        return echo;
+    }
+
+    @PUT
+    public JAXBElement invoke(JAXBElement<Person> p) {
+        p.getValue().setName("invoked:" + p.getName());
+        return p;
+    }
+
+    @DELETE
+    public Response throwIO() throws IOException {
+        throw new IOException();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceTwoInApp1.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceTwoInApp1.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceTwoInApp1.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/ResourceTwoInApp1.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,35 @@
+/*
+ * 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.multiservletmultiapp.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+@Path("/app2/hello")
+public class ResourceTwoInApp1 {
+
+    @GET
+    public String helloWorld() {
+        /*
+         * never invoked but just to make sure it won't get invoked
+         */
+        return "hello world";
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/WEB-INF/web.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/WEB-INF/web.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/WEB-INF/web.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,45 @@
+<?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>Application1</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.multiservletmultiapp.server.Application</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet>
+		<servlet-name>Application2</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.multiservletmultiapp.server.Application2</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Application1</servlet-name>
+		<url-pattern>/app1/*</url-pattern>
+	</servlet-mapping>
+	<servlet-mapping>
+		<servlet-name>Application2</servlet-name>
+		<url-pattern>/app2/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/xml/Person.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/xml/Person.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/xml/Person.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/server/xml/Person.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package demo.jaxrs.multiservletmultiapp.server.xml;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class Person {
+    
+    private String name;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/test/SeparationOfResourcesAndProvidersTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/test/SeparationOfResourcesAndProvidersTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/test/SeparationOfResourcesAndProvidersTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/demo/jaxrs/multiservletmultiapp/test/SeparationOfResourcesAndProvidersTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,200 @@
+/*
+ * 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.multiservletmultiapp.test;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+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.GetMethod;
+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;
+
+public class SeparationOfResourcesAndProvidersTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        Map<String, Set<String>> appToContextRootMap = new HashMap<String, Set<String>>();
+        appToContextRootMap.put(
+                "demo.jaxrs.multiservletmultiapp.server.Application",
+                Collections.singleton("/app1/*"));
+        appToContextRootMap.put(
+                "demo.jaxrs.multiservletmultiapp.server.Application2",
+                Collections.singleton("/app2/*"));
+        return FVTTestCase.getTestSuite(
+                SeparationOfResourcesAndProvidersTest.class,
+                appToContextRootMap);
+    }
+
+    /**
+     * Test basic resource gets.
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testMultiApplicationNoInterferenceWriter()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI() + "/app1/hello");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("hello world", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        /*
+         * application 2 has a message body writer
+         */
+        getMethod = new GetMethod(getBaseURI() + "/app2/hello");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("invokedmywriter:foo bar", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Test basic resource POSTs.
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testMultiApplicationNoInterferenceReader()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        /*
+         * application 1 has a message body reader
+         */
+        PostMethod postMethod = new PostMethod(getBaseURI() + "/app1/hello");
+        postMethod.setRequestEntity(new StringRequestEntity("my input",
+                "text/plain", "UTF-8"));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("invokedmyreader:my input", postMethod
+                    .getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+
+        /*
+         * application 2 has a message body writer so output is slightly different
+         */
+        postMethod = new PostMethod(getBaseURI() + "/app2/hello");
+        postMethod.setRequestEntity(new StringRequestEntity("my input",
+                "text/plain", "UTF-8"));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("invokedmywriter:my input", postMethod
+                    .getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Test basic resource PUTs.
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testMultiApplicationNoInterferenceContextResolver()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        /*
+         * application 1 should resolve
+         */
+        PutMethod putMethod = new PutMethod(getBaseURI() + "/app1/hello");
+        putMethod.setRequestEntity(new StringRequestEntity(
+                "<person><name>John Doe</name></person>", "application/xml",
+                "UTF-8"));
+        try {
+            client.executeMethod(putMethod);
+            assertEquals(200, putMethod.getStatusCode());
+            assertEquals(
+                    "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><person><name>invoked:person</name></person>",
+                    putMethod.getResponseBodyAsString());
+        } finally {
+            putMethod.releaseConnection();
+        }
+
+        /*
+         * application 2 does not have the ContextResolver
+         */
+        putMethod = new PutMethod(getBaseURI() + "/app2/hello");
+        putMethod.setRequestEntity(new StringRequestEntity(
+                "<person><name>John Doe</name></person>", "application/xml",
+                "UTF-8"));
+        try {
+            client.executeMethod(putMethod);
+            assertEquals(500, putMethod.getStatusCode());
+            assertEquals("", putMethod.getResponseBodyAsString());
+        } finally {
+            putMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Test basic resource DELETEs.
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testMultiApplicationNoInterferenceExceptionMappers()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        /*
+         * application 1 should resolve
+         */
+        DeleteMethod deleteMethod = new DeleteMethod(getBaseURI()
+                + "/app1/hello");
+        try {
+            client.executeMethod(deleteMethod);
+            assertEquals(500, deleteMethod.getStatusCode());
+        } finally {
+            deleteMethod.releaseConnection();
+        }
+
+        /*
+         * application 2 does not have the ContextResolver
+         */
+        deleteMethod = new DeleteMethod(getBaseURI() + "/app2/hello");
+        try {
+            client.executeMethod(deleteMethod);
+            assertEquals(508, deleteMethod.getStatusCode());
+            assertEquals("", deleteMethod.getResponseBodyAsString());
+        } finally {
+            deleteMethod.releaseConnection();
+        }
+    }
+}

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



Mime
View raw message