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 [15/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/d...
Date Tue, 23 Jun 2009 05:38:19 GMT
Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/Application.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/Application.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/Application.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 jaxrs.tests.headers.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class Application extends javax.ws.rs.core.Application {
+
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        classes.add(HeadersResource.class);
+        classes.add(HeadersAllowResource.class);
+        classes.add(HeadersAllowResource2.class);
+        return classes;
+    }
+
+}

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/HeadersAllowResource2.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/HeadersAllowResource2.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/HeadersAllowResource2.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/HeadersAllowResource2.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.headers.server;
+
+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.ws.rs.core.Response;
+
+@Path("headersallow2")
+public class HeadersAllowResource2 {
+
+    @GET
+    public Response getAllow2() {
+        return Response.ok().build();
+    }
+
+    @POST
+    public Response postAllow2() {
+        return Response.ok().build();
+    }
+
+    @PUT
+    public Response putAllow2() {
+        return Response.ok().build();
+    }
+
+    @DELETE
+    public Response deleteAllow3() {
+        return Response.ok().build();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/HeadersResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/HeadersResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/HeadersResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/server/HeadersResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.headers.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+
+@Path(value = "/headers")
+public class HeadersResource {
+
+    @Context
+    HttpHeaders headers;
+
+    @GET
+    @Path(value = "/cookie")
+    public Response get() {
+        Response resp = Response.ok().build();
+        resp.getMetadata().putSingle("login",
+                headers.getCookies().get("login").getValue());
+        return resp;
+    }
+
+    @GET
+    @Path(value = "/language")
+    public Response getLanguage() {
+        Response resp = Response.ok().build();
+        resp.getMetadata().putSingle("language",
+                headers.getLanguage().getLanguage());
+        return resp;
+    }
+
+    @GET
+    @Path(value = "/content")
+    public Response getContent() {
+        Response resp = Response.ok().build();
+        resp.getMetadata().putSingle("content",
+                headers.getMediaType().toString());
+        return resp;
+    }
+
+    @GET
+    @Path(value = "/accept")
+    public Response getAccept() {
+        Response resp = Response.ok().build();
+        StringBuffer sb = new StringBuffer();
+        for (MediaType mediaType : headers.getAcceptableMediaTypes()) {
+            sb.append(mediaType.toString() + " ");
+        }
+        resp.getMetadata().putSingle("test-accept", sb.toString().trim());
+        return resp;
+    }
+
+    @GET
+    @Path(value = "/acceptlang")
+    public Response getAcceptLanguage() {
+        Response resp = Response.ok().build();
+        resp.getMetadata().putSingle("acceptlang",
+                headers.getAcceptableLanguages().get(0).toString());
+        return resp;
+    }
+
+    @GET
+    @Path(value = "/headercase")
+    public Response getHeaderCase(@HeaderParam(value = "custom-header") String param) {
+        Response resp = Response.ok().build();
+        resp.getMetadata().putSingle("Custom-Header", param);
+        return resp;
+    }
+
+    @GET
+    @Path(value = "/headeraccept")
+    public Response getHeaderAccept(@HeaderParam(value = "Accept") String param) {
+        Response resp = Response.ok().build();
+        resp.getMetadata().putSingle("test-accept", param);
+        return resp;
+    }
+
+    @GET
+    @Path(value = "/headersasarg")
+    public Response getHeadersAsArg() {
+        Response resp = Response.ok().build();
+        StringBuffer sb = new StringBuffer();
+        MultivaluedMap<String, String> hdrMap = headers.getRequestHeaders();
+        for (String accept : hdrMap.get("ACCEPT")) {
+            sb.append(accept + " ");
+        }
+        String hdr = sb.toString().trim();
+        resp.getMetadata().putSingle("test-accept", hdr);
+        sb = new StringBuffer();
+        for (String ct : hdrMap.get("CONTENT-TYPE")) {
+            sb.append(ct + " ");
+        }
+        hdr = sb.toString().trim();
+        resp.getMetadata().putSingle("test-content-type", hdr);
+        return resp;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/test/HeadersTests.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/test/HeadersTests.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/test/HeadersTests.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/headers/test/HeadersTests.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,318 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.headers.test;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.OptionsMethod;
+
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+public class HeadersTests extends FVTTestCase {
+
+    private HttpClient httpClient;
+
+    final private static String BASE_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(HeadersTests.class)
+            + "/headers";
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(HeadersTests.class,
+                jaxrs.tests.headers.server.Application.class.getName());
+    }
+
+    public void testGetWithCookies() throws Exception {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "/cookie", false));
+            httpClient = new HttpClient();
+            httpMethod.setRequestHeader("Cookie",
+                    "$Version=\"1\";login=\"jdoe\"");
+            try {
+                int result = httpClient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                assertEquals(200, result);
+                assertNotNull(httpMethod.getResponseHeader("login"));
+                assertEquals("jdoe", httpMethod.getResponseHeader("login")
+                        .getValue());
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testGetWithLanguage() throws Exception {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "/language", false));
+            httpClient = new HttpClient();
+            httpMethod.setRequestHeader("Content-Language", "en-us");
+            try {
+                int result = httpClient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                assertEquals(200, result);
+                assertNotNull(httpMethod.getResponseHeader("language"));
+                assertEquals("en-us", httpMethod.getResponseHeader("language")
+                        .getValue());
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testGetWithContent() throws Exception {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "/content", false));
+            httpClient = new HttpClient();
+            httpMethod.setRequestHeader("Content-Type", "application/html");
+            try {
+                int result = httpClient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                assertEquals(200, result);
+                assertNotNull(httpMethod.getResponseHeader("content"));
+                assertEquals("application/html", httpMethod.getResponseHeader(
+                        "content").getValue());
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testGetWithAccept() throws Exception {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "/accept", false));
+            httpClient = new HttpClient();
+            httpMethod.setRequestHeader("Accept",
+                    "text/*, text/html, text/html;level=1, */*");
+            try {
+                int result = httpClient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                assertEquals(200, result);
+                assertNotNull(httpMethod.getResponseHeader("test-accept"));
+
+                // all q-values = 1, should come back like it was sent
+                assertEquals("text/* text/html text/html;level=1 */*",
+                        httpMethod.getResponseHeader("test-accept").getValue());
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testGetWithAcceptLanguage() throws Exception {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "/acceptlang", false));
+            httpClient = new HttpClient();
+            httpMethod.setRequestHeader("Accept-Language", "fr");
+            try {
+                int result = httpClient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                assertEquals(200, result);
+                assertNotNull(httpMethod.getResponseHeader("acceptlang"));
+                assertEquals("fr", httpMethod.getResponseHeader("acceptlang")
+                        .getValue());
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testGetHeadersWithCase() throws Exception {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "/headercase", false));
+            httpClient = new HttpClient();
+            httpMethod.setRequestHeader("Custom-Header", "MyValue");
+            try {
+                int result = httpClient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                assertEquals(200, result);
+                assertNotNull(httpMethod.getResponseHeader("Custom-Header"));
+                assertEquals("MyValue", httpMethod.getResponseHeader(
+                        "Custom-Header").getValue());
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testGetHeadersAcceptAsParam() throws Exception {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "/headeraccept", false));
+            httpClient = new HttpClient();
+            httpMethod.setRequestHeader("Accept", "text/xml");
+            try {
+                int result = httpClient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                assertEquals(200, result);
+                assertNotNull(httpMethod.getResponseHeader("test-accept"));
+                assertEquals("text/xml", httpMethod.getResponseHeader(
+                        "test-accept").getValue());
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testGetHeadersAcceptAsArg() throws Exception {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "/headersasarg", false));
+            httpClient = new HttpClient();
+            httpMethod.setRequestHeader("Accept", "text/xml application/xml");
+            httpMethod.setRequestHeader("Content-Type", "application/xml");
+            try {
+                int result = httpClient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                assertEquals(200, result);
+                assertNotNull(httpMethod.getResponseHeader("test-accept"));
+                assertEquals("text/xml application/xml", httpMethod
+                        .getResponseHeader("test-accept").getValue());
+                assertNotNull(httpMethod.getResponseHeader("test-content-type"));
+                assertEquals("application/xml", httpMethod.getResponseHeader(
+                        "test-content-type").getValue());
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    public void testAllowHeaders() throws Exception {
+        try {
+            OptionsMethod httpMethod = new OptionsMethod();
+            httpMethod.setURI(new URI(DefaultURIInfo
+                    .getClassDefaultBaseURI(HeadersTests.class)
+                    + "/headersallow1/allow1", false));
+            httpClient = new HttpClient();
+            try {
+                int result = httpClient.executeMethod(httpMethod);
+                assertEquals(200, result);
+                assertNotNull(httpMethod.getResponseHeader("Allow"));
+                List<String> allowedMethods = Arrays.asList(httpMethod
+                        .getResponseHeader("Allow").getValue().split(", "));
+                System.out.println(allowedMethods);
+                assertEquals(3, allowedMethods.size());
+                assertTrue(allowedMethods.contains("HEAD"));
+                assertTrue(allowedMethods.contains("OPTIONS"));
+                assertTrue(allowedMethods.contains("GET"));
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+
+        try {
+            OptionsMethod httpMethod = new OptionsMethod();
+            httpMethod.setURI(new URI(DefaultURIInfo
+                    .getClassDefaultBaseURI(HeadersTests.class)
+                    + "/headersallow2", false));
+            httpClient = new HttpClient();
+            try {
+                int result = httpClient.executeMethod(httpMethod);
+                assertEquals(200, result);
+                assertNotNull(httpMethod.getResponseHeader("Allow"));
+                List<String> allowedMethods = Arrays.asList(httpMethod
+                        .getResponseHeader("Allow").getValue().split(", "));
+                System.out.println(allowedMethods);
+                assertEquals(6, allowedMethods.size());
+                assertTrue(allowedMethods.contains("HEAD"));
+                assertTrue(allowedMethods.contains("OPTIONS"));
+                assertTrue(allowedMethods.contains("GET"));
+                assertTrue(allowedMethods.contains("PUT"));
+                assertTrue(allowedMethods.contains("POST"));
+                assertTrue(allowedMethods.contains("DELETE"));
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/buildTest.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project name="jaxrs.tests.httpmethod" default="all">
+	<import file="../../../buildCommon.xml" />
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/Application.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/Application.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/Application.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 jaxrs.tests.httpmethod.server;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * <code>HTTPMethod</code> annotation test application.
+ */
+public class Application extends javax.ws.rs.core.Application {
+
+    Set<Class<?>> classes = new HashSet<Class<?>>();
+
+    public Application() {
+        classes = new HashSet<Class<?>>();
+        classes.add(HttpMethodWarningResource.class);
+        classes.add(HttpMethodResource.class);
+        classes.add(CustomHttpMethodResource.class);
+        classes = Collections.unmodifiableSet(classes);
+    }
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        return classes;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/CustomHttpMethodResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/CustomHttpMethodResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/CustomHttpMethodResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/CustomHttpMethodResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.httpmethod.server;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+
+@Path(value = "/customhttpmethod")
+public class CustomHttpMethodResource {
+
+    @GET
+    public Response get() {
+        Response resp = Response.ok().build();
+        resp.getMetadata().putSingle("GET", "TRUE");
+        return resp;
+    }
+
+    @MyHttpOPTIONSAnnotation
+    public Response options() {
+        Response resp = Response.ok().build();
+        List<Object> allowList = new ArrayList<Object>();
+        allowList.add("HEAD");
+        allowList.add("OPTIONS");
+        allowList.add("GET");
+        resp.getMetadata().put("Allow", allowList);
+        return resp;
+    }
+
+    @MyHttpHEADAnnotation
+    public Response head() {
+        Response resp = Response.ok().build();
+        resp.getMetadata().putSingle("HEAD", "TRUE");
+        return resp;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/HttpMethodResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/HttpMethodResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/HttpMethodResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/HttpMethodResource.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 jaxrs.tests.httpmethod.server;
+
+import javax.ws.rs.Path;
+
+@Path("httpmethod")
+public class HttpMethodResource {
+
+    @MyHttpGETAnnotation
+    public String myGetMethod() {
+        return "You found my GET method!";
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/HttpMethodWarningResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/HttpMethodWarningResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/HttpMethodWarningResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/server/HttpMethodWarningResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.httpmethod.server;
+
+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.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+
+/**
+ * Resource with several different type of warnings.
+ */
+@Path("httpmethodwarning")
+public class HttpMethodWarningResource {
+
+    public HttpMethodWarningResource() {
+
+    }
+
+    @POST
+    @PUT
+    public String multiHttpMethodBadBehavior() {
+        /*
+         * This should not be allowed and violates RESTful principles even if
+         * some browsers can't do a PUT.
+         */
+        return "Should not see me";
+    }
+
+    @SuppressWarnings("unused")
+    @GET
+    @Path("/{id}")
+    private String nonPublicGETMethod(@PathParam("id") String id, @QueryParam("detailed") String isDetailed) {
+        return "Should not be able to GET me.";
+    }
+
+    @DELETE
+    protected String nonPublicDeleteMethod() {
+        return "Should not be able to DELETE me.";
+    }
+
+}

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

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

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/test/HttpMethodTests.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/test/HttpMethodTests.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/test/HttpMethodTests.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/test/HttpMethodTests.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.httpmethod.test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.HeadMethod;
+import org.apache.commons.httpclient.methods.OptionsMethod;
+
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+/**
+ * Tests various <code>@HttpMethod</code> scenarios.
+ */
+public class HttpMethodTests extends FVTTestCase {
+
+    protected HttpClient httpclient = new HttpClient();
+
+    final private static String BASE_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(HttpMethodTests.class)
+            + "/httpmethod";
+
+    final private static String ALT_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(HttpMethodTests.class)
+            + "/customhttpmethod";
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(HttpMethodTests.class,
+                jaxrs.tests.httpmethod.server.Application.class.getName());
+    }
+
+    /**
+     * Tests that it can find a custom GET HttpMethod annotation.
+     */
+    public void testUserDefinedGETAnnotation() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI, false));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("You found my GET method!", responseBody);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    /**
+    * Tests that an OPTIONS request can be sent to resource containing
+    * only a GET method.
+    */
+    public void testOPTIONSRequest() {
+        try {
+            OptionsMethod httpMethod = new OptionsMethod();
+            httpMethod.setURI(new URI(BASE_URI, false));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                Enumeration<?> allowedMethods = httpMethod.getAllowedMethods();
+                assertNotNull(allowedMethods);
+                assertTrue(allowedMethods.hasMoreElements());
+                List<String> methods = new ArrayList<String>();
+                while (allowedMethods.hasMoreElements()) {
+                    methods.add((String) allowedMethods.nextElement());
+                }
+                assertTrue(methods.contains("HEAD"));
+                assertTrue(methods.contains("GET"));
+                assertTrue(methods.contains("OPTIONS"));
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    /**
+     * Tests that a HEAD request can be sent to resource containing
+     * only a GET method.
+     */
+    public void testHEADRequest() {
+        try {
+            HeadMethod httpMethod = new HeadMethod();
+            httpMethod.setURI(new URI(BASE_URI, false));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals(null, responseBody);
+                Header[] headers = httpMethod.getResponseHeaders();
+                assertNotNull(headers);
+                assertTrue("Response for HEAD request contained no headers",
+                        headers.length > 0);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    /**
+     * Tests that a HEAD request can be sent to resource annotated
+     * with a custom HEAD annotation.
+     */
+    public void testCustomHEADRequest() {
+        try {
+            HeadMethod httpMethod = new HeadMethod();
+            httpMethod.setURI(new URI(ALT_URI, false));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals(null, responseBody);
+                Header header = httpMethod.getResponseHeader("HEAD");
+                assertNotNull(header);
+                assertEquals("TRUE", header.getValue());
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    /**
+     * Tests that a OPTIONS request can be sent to resource annotated
+     * with a custom OPTIONS annotation.
+     */
+    public void testCustomOPTIONSRequest() {
+        try {
+            OptionsMethod httpMethod = new OptionsMethod();
+            httpMethod.setURI(new URI(ALT_URI, false));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(200, result);
+                assertEquals("", responseBody);
+                Header header = httpMethod.getResponseHeader("Allow");
+                assertNotNull(header);
+                String value = header.getValue();
+                assertTrue(value.contains("HEAD"));
+                assertTrue(value.contains("OPTIONS"));
+                assertTrue(value.contains("GET"));
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    /*
+     * TODO: Add more tests.
+     *
+     * - Test custom (non-standard) HTTP Method. - Test OPTIONS method.
+     */
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/test/HttpMethodWarningsTests.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/test/HttpMethodWarningsTests.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/test/HttpMethodWarningsTests.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/httpmethod/test/HttpMethodWarningsTests.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.httpmethod.test;
+
+import java.io.IOException;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.URIException;
+import org.apache.commons.httpclient.methods.DeleteMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+/**
+ * Tests various errors and warnings in <code>@HTTPMethod</code> conditions.
+ */
+public class HttpMethodWarningsTests extends FVTTestCase {
+
+    protected HttpClient httpclient = new HttpClient();
+
+    final private static String BASE_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(HttpMethodWarningsTests.class)
+            + "/httpmethodwarning";
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(HttpMethodWarningsTests.class,
+                jaxrs.tests.httpmethod.server.Application.class.getName());
+    }
+
+    /**
+     * Tests that two or more <code>@HttpMethod</code> annotated annotations on
+     * a method generates an error.
+     *
+     * Vague on specification but it seems to be an error if two or more
+     * annotations (which each have a HttpMethod annotation on them) are on the
+     * same resource method. Based on error, it is probably expected that the
+     * resource is unavailable.
+     *
+     * TODO: So this test could be that two custom annotations which are
+     * annotated each with <code>@HttpMethod</code> are annotated on the same
+     * method.
+     */
+    public void testTwoOrMoreAnnotationsOnMethodError() {
+        try {
+            PostMethod httpMethod = new PostMethod();
+            httpMethod.setURI(new URI(BASE_URI, false));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(404, result);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    /**
+     * Tests that non-public HttpMethod annotations generate a warning.
+     */
+    public void testNonPublicMethodsWarning() {
+        try {
+            GetMethod httpMethod = new GetMethod();
+            httpMethod.setURI(new URI(BASE_URI + "/abcd", false));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(404, result);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+
+        try {
+            DeleteMethod httpMethod = new DeleteMethod();
+            httpMethod.setURI(new URI(BASE_URI, false));
+            httpclient = new HttpClient();
+
+            try {
+                int result = httpclient.executeMethod(httpMethod);
+                System.out.println("Response status code: " + result);
+                System.out.println("Response body: ");
+                String responseBody = httpMethod.getResponseBodyAsString();
+                System.out.println(responseBody);
+                assertEquals(404, result);
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                fail(ioe.getMessage());
+            } finally {
+                httpMethod.releaseConnection();
+            }
+        } catch (URIException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/buildTest.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project name="jaxrs.tests.inheritance" default="all">
+	<import file="../../../buildCommon.xml" />
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/CarFerry.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/CarFerry.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/CarFerry.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/CarFerry.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.inheritance.server;
+
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path(value = "/carferry")
+public class CarFerry extends ParkingGarage {
+
+    @Context
+    protected UriInfo uriInfo;
+
+    public Response addCar(String licenseNum) {
+        super.setURIInfo(uriInfo);
+        Response resp = super.addCar(licenseNum);
+        resp.getMetadata().putSingle("Invoked", "CarFerry.addCar");
+        return resp;
+    }
+
+    public Response getCars() {
+        super.setURIInfo(uriInfo);
+        Response resp = super.getCars();
+        resp.getMetadata().putSingle("Invoked", "CarFerry.getCars");
+        return resp;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/CarStorage.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/CarStorage.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/CarStorage.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/CarStorage.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 jaxrs.tests.inheritance.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+
+public interface CarStorage {
+
+    @GET
+    @Path(value = "/carstorage")
+    public Response getCars();
+
+    @POST
+    @Path(value = "/carstorage")
+    public Response addCar(String licenseNum);
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/Carport.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/Carport.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/Carport.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/Carport.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.inheritance.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+
+@Path(value = "/carport")
+public class Carport implements CarStorage {
+
+    private static Set<String> cars = new HashSet<String>();
+
+    public Response addCar(String licenseNum) {
+        cars.add(licenseNum);
+        Response resp = Response.ok().build();
+        resp.getMetadata().putSingle("Invoked", "Carport.addCar");
+        return resp;
+    }
+
+    public Response getCars() {
+        StringBuffer sb = new StringBuffer();
+        for (String car : cars) {
+            sb.append(car).append(";");
+        }
+        Response resp = Response.ok(sb.toString()).build();
+        resp.getMetadata().putSingle("Invoked", "Carport.getCars");
+        return resp;
+    }
+
+    public static void clear() {
+        cars.clear();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingApplication.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingApplication.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingApplication.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingApplication.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.inheritance.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+public class ParkingApplication extends Application {
+
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        classes.add(CarFerry.class);
+        classes.add(Carport.class);
+        classes.add(ParkingGarage.class);
+        classes.add(ParkingLot.class);
+        return classes;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingGarage.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingGarage.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingGarage.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingGarage.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.inheritance.server;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path(value = "/parkinggarage")
+public class ParkingGarage extends ParkingLot {
+
+    private static Map<Integer, List<String>> cars = new HashMap<Integer, List<String>>();
+
+    @Context
+    protected UriInfo uriInfo;
+
+    @GET
+    @Path("/cars/{id}")
+    public Response getCars() {
+        StringBuffer sb = new StringBuffer();
+        String id = uriInfo.getPathParameters().getFirst("id");
+        if (id != null) {
+            List<String> carList = cars.get(Integer.valueOf(id));
+            for (String car : carList) {
+                sb.append(car).append(";");
+            }
+        }
+        Response resp = Response.ok(sb.toString()).build();
+        resp.getMetadata().putSingle("Invoked", "ParkingGarage.getCars");
+        return resp;
+    }
+
+    public Response addCar(String licenseNum) {
+        List<String> licenseNums = cars.get(1);
+        if (licenseNums == null) {
+            licenseNums = new ArrayList<String>();
+            cars.put(1, licenseNums);
+        }
+        licenseNums.add(licenseNum);
+        Response resp = Response.ok().build();
+        resp.getMetadata().putSingle("Invoked", "ParkingGarage.addCar");
+        return resp;
+    }
+
+    public static void clear() {
+        cars.clear();
+    }
+
+    void setURIInfo(UriInfo uriInfo) {
+        this.uriInfo = uriInfo;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingLot.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingLot.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingLot.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/ParkingLot.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.inheritance.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+
+@Path(value = "/parkinglot")
+public class ParkingLot implements CarStorage {
+
+    private static Set<String> cars = new HashSet<String>();
+
+    @GET
+    @Path(value = "/cars")
+    public Response getCars() {
+        StringBuffer sb = new StringBuffer();
+        for (String car : cars) {
+            sb.append(car).append(";");
+        }
+        Response resp = Response.ok(sb.toString()).build();
+        resp.getMetadata().putSingle("Invoked", "ParkingLot.getCars");
+        return resp;
+    }
+
+    @POST
+    @Path(value = "/cars")
+    public Response addCar(String licenseNum) {
+        cars.add(licenseNum);
+        Response resp = Response.ok().build();
+        resp.getMetadata().putSingle("Invoked", "ParkingLot.addCar");
+        return resp;
+    }
+
+    public static void clear() {
+        cars.clear();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/WEB-INF/web-no-runtime.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/WEB-INF/web-no-runtime.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/WEB-INF/web-no-runtime.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/WEB-INF/web-no-runtime.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,34 @@
+<?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>Parking</servlet-name>
+		<servlet-class>jaxrs.tests.inheritance.server.ParkingApplication</servlet-class>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Parking</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/WEB-INF/web.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/WEB-INF/web.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/server/WEB-INF/web.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>Parking</servlet-name>
+		<servlet-class>com.ibm.ws.jaxrs.web.RESTServlet</servlet-class>
+		<init-param>
+			<param-name>javax.ws.rs.Application</param-name>
+			<param-value>jaxrs.tests.inheritance.server.ParkingApplication</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Parking</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>
\ No newline at end of file

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/test/ParkingTests.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/test/ParkingTests.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/test/ParkingTests.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/inheritance/test/ParkingTests.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.inheritance.test;
+
+import jaxrs.tests.inheritance.server.ParkingApplication;
+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.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+public class ParkingTests extends FVTTestCase {
+
+    protected HttpClient httpClient = new HttpClient();
+
+    final private static String PARKING_LOT_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(ParkingTests.class)
+            + "/parkinglot";
+
+    final private static String PARKING_GARAGE_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(ParkingTests.class)
+            + "/parkinggarage";
+
+    final private static String CARPORT_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(ParkingTests.class)
+            + "/carport";
+
+    final private static String CARFERRY_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(ParkingTests.class)
+            + "/carferry";
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(ParkingTests.class,
+                ParkingApplication.class.getName());
+    }
+
+    public void testParkingLot() throws Exception {
+        PostMethod postMethod = new PostMethod(PARKING_LOT_URI + "/cars");
+        GetMethod getMethod = new GetMethod(PARKING_LOT_URI + "/cars");
+        try {
+            String licenseNum = "103DIY";
+            postMethod.setRequestEntity(new ByteArrayRequestEntity(licenseNum
+                    .getBytes(), "text/xml"));
+            httpClient.executeMethod(postMethod);
+            Header header = postMethod.getResponseHeader("Invoked");
+            assertNotNull(header);
+            assertEquals("ParkingLot.addCar", header.getValue());
+            httpClient.executeMethod(getMethod);
+            String resp = getMethod.getResponseBodyAsString();
+            assertTrue(resp.contains(licenseNum));
+            header = getMethod.getResponseHeader("Invoked");
+            assertNotNull(header);
+            assertEquals("ParkingLot.getCars", header.getValue());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.toString());
+        } finally {
+            postMethod.releaseConnection();
+            getMethod.releaseConnection();
+        }
+    }
+
+    public void testParkingGarage() throws Exception {
+        PostMethod postMethod = new PostMethod(PARKING_GARAGE_URI + "/cars");
+        GetMethod getMethod = new GetMethod(PARKING_GARAGE_URI + "/cars/1");
+        try {
+            String licenseNum = "103DIY";
+            postMethod.setRequestEntity(new ByteArrayRequestEntity(licenseNum
+                    .getBytes(), "text/xml"));
+            httpClient.executeMethod(postMethod);
+            Header header = postMethod.getResponseHeader("Invoked");
+            assertNotNull(header);
+            assertEquals("ParkingGarage.addCar", header.getValue());
+            httpClient.executeMethod(getMethod);
+            String resp = getMethod.getResponseBodyAsString();
+            assertTrue(resp.contains(licenseNum));
+            header = getMethod.getResponseHeader("Invoked");
+            assertNotNull(header);
+            assertEquals("ParkingGarage.getCars", header.getValue());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.toString());
+        } finally {
+            postMethod.releaseConnection();
+            getMethod.releaseConnection();
+        }
+    }
+
+    public void testCarport() throws Exception {
+        PostMethod postMethod = new PostMethod(CARPORT_URI + "/carstorage");
+        GetMethod getMethod = new GetMethod(CARPORT_URI + "/carstorage");
+        try {
+            String licenseNum = "103DIY";
+            postMethod.setRequestEntity(new ByteArrayRequestEntity(licenseNum
+                    .getBytes(), "text/xml"));
+            httpClient.executeMethod(postMethod);
+            Header header = postMethod.getResponseHeader("Invoked");
+            assertNotNull(header);
+            assertEquals("Carport.addCar", header.getValue());
+            httpClient.executeMethod(getMethod);
+            String resp = getMethod.getResponseBodyAsString();
+            assertTrue(resp.contains(licenseNum));
+            header = getMethod.getResponseHeader("Invoked");
+            assertNotNull(header);
+            assertEquals("Carport.getCars", header.getValue());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.toString());
+        } finally {
+            postMethod.releaseConnection();
+            getMethod.releaseConnection();
+        }
+    }
+
+    public void testCarFerry() throws Exception {
+        PostMethod postMethod = new PostMethod(CARFERRY_URI + "/cars");
+        GetMethod getMethod = new GetMethod(CARFERRY_URI + "/cars/1");
+        try {
+            String licenseNum = "103DIY";
+            postMethod.setRequestEntity(new ByteArrayRequestEntity(licenseNum
+                    .getBytes(), "text/xml"));
+            httpClient.executeMethod(postMethod);
+            Header header = postMethod.getResponseHeader("Invoked");
+            assertNotNull(header);
+            assertEquals("CarFerry.addCar", header.getValue());
+            httpClient.executeMethod(getMethod);
+            String resp = getMethod.getResponseBodyAsString();
+            assertTrue(resp.contains(licenseNum));
+            header = getMethod.getResponseHeader("Invoked");
+            assertNotNull(header);
+            assertEquals("CarFerry.getCars", header.getValue());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.toString());
+        } finally {
+            postMethod.releaseConnection();
+            getMethod.releaseConnection();
+        }
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/jaxb/context/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/jaxb/context/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/jaxb/context/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/jaxb/context/buildTest.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<project name="jaxrs.tests.jaxb.context" default="all">
+	<import file="../../../../buildCommon.xml" />
+</project>

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

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/jaxb/context/server/UserAccount.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/jaxb/context/server/UserAccount.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/jaxb/context/server/UserAccount.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/jaxb/context/server/UserAccount.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.jaxb.context.server;
+
+import java.util.HashMap;
+import java.util.Map;
+
+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.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+@Path(value = "/user")
+public class UserAccount {
+
+    private static Map<String, User> users = new HashMap<String, User>();
+
+    @POST
+    @Consumes(value = "text/xml")
+    public void createUser(JAXBElement<User> element) {
+        User user = element.getValue();
+        users.put(user.getUserName(), user);
+    }
+
+    @GET
+    @Path(value = "/{userName}")
+    @Produces(value = "text/xml")
+    public JAXBElement<User> getUser(@PathParam(value = "userName") String userName) {
+        User user = users.get(userName);
+        return new JAXBElement<User>(new QName("http://jaxb.context.tests",
+                "user"), User.class, user);
+    }
+
+}



Mime
View raw message