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 [12/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/context/uriinfo/test/URIInfoDetailedMethodTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/test/URIInfoDetailedMethodTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/test/URIInfoDetailedMethodTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/test/URIInfoDetailedMethodTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,968 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.context.uriinfo.test;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.UriInfo;
+
+import jaxrs.tests.context.uriinfo.server.MatchedResourcesSubResource;
+import jaxrs.tests.context.uriinfo.server.UriInfoDetailedMethods;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+/**
+ * Tests that various {@link UriInfo} methods work as expected.
+ */
+public class URIInfoDetailedMethodTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(URIInfoDetailedMethodTest.class,
+                "jaxrs.tests.context.uriinfo.server.Application");
+    }
+
+    /**
+     * Tests the {@link UriInfo#getAbsolutePath()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetAbsolutePath() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getAbsolutePath");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(getBaseURI() + "/context/uriinfo/detailed", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getAbsolutePathBuilder()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetAbsoluteBuilder() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getAbsolutePathBuilder");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(getBaseURI().replace(
+                    DefaultURIInfo.getServerHostname(), "abcd")
+                    + "/context/uriinfo/detailed", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getBaseUri()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetBaseUri() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getBaseUri");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String contextRoot = DefaultURIInfo
+                    .getClassDefaultContextRoot(URIInfoDetailedMethodTest.class);
+            if (!"".equals(contextRoot)) {
+                contextRoot = "/" + contextRoot;
+            }
+            String baseUri = "http://" + DefaultURIInfo.getServerHostname()
+                    + ":" + DefaultURIInfo.getServerPort() + contextRoot;
+            assertEquals(baseUri, getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getBaseUriBuilder()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetBaseUriBuilder() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getBaseUriBuilder");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String contextRoot = DefaultURIInfo
+                    .getClassDefaultContextRoot(URIInfoDetailedMethodTest.class);
+            if (!"".equals(contextRoot)) {
+                contextRoot = "/" + contextRoot;
+            }
+            String baseUri = "http://" + "abcd" + ":"
+                    + DefaultURIInfo.getServerPort() + contextRoot;
+            assertEquals(baseUri, getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPath()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPath() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getPath");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/context/uriinfo/detailed", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPath(boolean)}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathDecoded() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getPathDecodedTrue");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/context/uriinfo/detailed", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getPathDecodedFalse");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/context/uriinfo/detailed", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/decoded/!%40%23%24%25%5E%26*()?decoded=false");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(
+                    "/context/uriinfo/detailed/decoded/!%40%23%24%25%5E%26*()",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/decoded/!%40%23%24%25%5E%26*()?decoded=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/context/uriinfo/detailed/decoded/!@#$%^&*()",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+    }
+
+    /**
+     * Tests the {@link UriInfo#getMatchedResources()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetMatchedResourcesSimple() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getMatchedResources");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(UriInfoDetailedMethods.class.getName() + ":",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getMatchedResources()} in a sub resource method.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetMatchedResourcesSubresource()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/matchedresources");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(UriInfoDetailedMethods.class.getName() + ":" + "-"
+                    + MatchedResourcesSubResource.class.getName() + ":"
+                    + UriInfoDetailedMethods.class.getName() + ":", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getMatchedURIs()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetMatchedURIs() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getMatchedURIs");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("context/uriinfo/detailed" + ":", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getMatchedURIs()} in a sub-resource method.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetMatchedURIsSubresource() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/matcheduris");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("context/uriinfo/detailed/matcheduris" + ":"
+                    + "context/uriinfo/detailed" + ":" + "-"
+                    + "context/uriinfo/detailed/matcheduris" + ":"
+                    + "context/uriinfo/detailed" + ":", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getMatchedURIs(boolean)}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetMatchedURIsDecodeTrue() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getMatchedURIsDecodedTrue");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("context/uriinfo/detailed" + ":", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getMatchedURIs(boolean)}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetMatchedURIsDecodeFalse() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed?reqInfo=getMatchedURIsDecodedFalse");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("context/uriinfo/detailed" + ":", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getMatchedURIs(boolean)} in a sub-locator.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetMatchedURIsSublocatorDecodeTrue()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/matchedurisdecoded/!%40%23%24%25%5E%26*()?decoded=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(
+                    "/context/uriinfo/detailed/matchedurisdecoded/!@#$%^&*()",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getMatchedURIs(boolean)} in a sub-locator.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetMatchedURIsSublocatorDecodeFalse()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/matchedurisdecoded/!%40%23%24%25%5E%26*()?decoded=false");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(
+                    "/context/uriinfo/detailed/matchedurisdecoded/!%40%23%24%25%5E%26*()",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPathParameters()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathParametersZero() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getPathParameters");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPathParameters()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathParametersOne() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/pathparamsone/");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=/:", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/pathparamsone");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=:", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/pathparamsone/foo");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=/foo:", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/pathparamsone/foo/bar");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=/foo/bar:", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPathParameters()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathParametersMany() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/pathparamsmany/foo/bar/xyz");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=foo:p2=b:p3=ar/xyz:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/pathparamsmany/foo/bar");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=foo:p2=b:p3=ar:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPathParameters(boolean)}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathParametersZeroDecodedFalse()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed?reqInfo=getPathParametersDecodedFalse");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPathParameters(boolean)}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathParametersOneDecodedFalse()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/pathparamsone/?decoded=false");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=/:", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/pathparamsone?decoded=false");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=:", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/pathparamsone/!%40%23%24%25%5E%26*()?decoded=false");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=/!%40%23%24%25%5E%26*():", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/pathparamsone/!%40%23%24%25%5E%26*()/!%40%23%24%25%5E%26*()?decoded=false");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=/!%40%23%24%25%5E%26*()/!%40%23%24%25%5E%26*():",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPathParameters(boolean)}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathParametersManyDecodedFalse()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/pathparamsmany/foo/bar/xyz?decoded=false");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=foo:p2=b:p3=ar/xyz:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/pathparamsmany/foo/bar?decoded=false");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=foo:p2=b:p3=ar:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPathParameters(boolean)}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathParametersZeroDecodedTrue()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed?reqInfo=getPathParametersDecodedTrue");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPathParameters(boolean)}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathParametersOneDecodedTrue()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/pathparamsone/?decoded=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=/:", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/pathparamsone?decoded=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=:", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/pathparamsone/!%40%23%24%25%5E%26*()?decoded=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=/!@#$%^&*():", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/pathparamsone/!%40%23%24%25%5E%26*()/!%40%23%24%25%5E%26*()?decoded=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=/!@#$%^&*()/!@#$%^&*():", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPathParameters(boolean)}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathParametersManyDecodedTrue()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/pathparamsmany/!%40%23%24%25%5E%26*()/bar/xyz?decoded=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=!@#$%^&*():p2=b:p3=ar/xyz:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/pathparamsmany/!%40%23%24%25%5E%26*()/bar?decoded=true");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("p1=!@#$%^&*():p2=b:p3=ar:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPathSegments()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathSegments() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getPathSegments");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("context#:uriinfo#:detailed#:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context;matrixp1=value1;matrixp2=value2;foo=bar/uriinfo/detailed?reqInfo=getPathSegments");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(
+                    "context#foo=bar:matrixp1=value1:matrixp2=value2::uriinfo#:detailed#:",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context;matrixp1=!%40%23%24%25%5E%26*();matrixp2=value2;foo=bar/uriinfo/detailed?reqInfo=getPathSegments");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(
+                    "context#foo=bar:matrixp1=!@#$%^&*():matrixp2=value2::uriinfo#:detailed#:",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getPathSegments(boolean)}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetPathSegmentsDecodedFalse() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed?reqInfo=getPathSegmentsDecodedFalse");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("context#:uriinfo#:detailed#:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context;matrixp1=value1;matrixp2=value2;foo=bar/uriinfo/detailed?reqInfo=getPathSegmentsDecodedFalse");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(
+                    "context#foo=bar:matrixp1=value1:matrixp2=value2::uriinfo#:detailed#:",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context;matrixp1=!%40%23%24%25%5E%26*();matrixp2=value2;foo=bar/uriinfo/detailed?reqInfo=getPathSegmentsDecodedFalse");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(
+                    "context#foo=bar:matrixp1=!%40%23%24%25%5E%26*():matrixp2=value2::uriinfo#:detailed#:",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getQueryParameters()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetQueryParametersZero() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/queryparams");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getQueryParameters()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetQueryParametersOne() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getQueryParameters");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("reqInfo=getQueryParameters:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/queryparams?q1=value1&q1=value2");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("q1=value1:value2:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+        getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/queryparams?q1=value1&q1=value2");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("q1=value1:value2:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getQueryParameters()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetQueryParametersMany() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed/queryparams?q1=value1&q2=value2");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("q1=value1:q2=value2:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/queryparams?q1=!%40%23%24%25%5E%26*()&q2=value2");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("q1=!@#$%^&*():q2=value2:", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getQueryParameters(boolean)}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetQueryParametersManyDecodedFalse()
+            throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(
+                getBaseURI()
+                        + "/context/uriinfo/detailed/queryparams?q1=!%40%23%24%25%5E%26*()&q2=value2&decoded=false");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("decoded=false:q1=!%40%23%24%25%5E%26*():q2=value2:",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getRequestUri()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetRequestUri() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getRequestUri");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(getBaseURI()
+                    + "/context/uriinfo/detailed?reqInfo=getRequestUri",
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests the {@link UriInfo#getRequestUriBuilder()}.
+     *
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testURIInfoGetRequestUriBuilder() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/detailed?reqInfo=getRequestUriBuilder");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            String expected = (getBaseURI() + "/context/uriinfo/detailed?reqInfo=getRequestUriBuilder")
+                    .replace(DefaultURIInfo.getServerHostname(), "abcd");
+            assertEquals(expected, getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/test/URIInfoInjectionTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/test/URIInfoInjectionTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/test/URIInfoInjectionTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/test/URIInfoInjectionTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.context.uriinfo.test;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+import framework.defaults.test.FVTTestCase;
+
+/**
+ * Tests that the UriInfo can be injected via various means.
+ */
+public class URIInfoInjectionTest extends FVTTestCase {
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(URIInfoInjectionTest.class,
+                "jaxrs.tests.context.uriinfo.server.Application");
+    }
+
+    /**
+     * Tests that a URIInfo object is injected into method parameters.
+     *
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testURIInfoParamInjection() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/param");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(204, getMethod.getStatusCode());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a URIInfo object is injected via a bean method.
+     *
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testURIInfoBeanMethodInjection() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/bean");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(204, getMethod.getStatusCode());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a URIInfo object is injected via a constructor parameter.
+     *
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testURIInfoConstructorInjection() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/constructor");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(204, getMethod.getStatusCode());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a URIInfo object is injected via a field member.
+     *
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testURIInfoFieldMemberInjection() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/field");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(204, getMethod.getStatusCode());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a URIInfo object is not injected via non bean methods.
+     *
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testURIInfoNotBeanMethod() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/uriinfo/notbeanmethod");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(204, getMethod.getStatusCode());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/test/URIInfoNormalizationTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/test/URIInfoNormalizationTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/test/URIInfoNormalizationTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/test/URIInfoNormalizationTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,324 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.context.uriinfo.test;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+public class URIInfoNormalizationTest extends FVTTestCase {
+
+    @Override
+    public String getBaseURI() {
+        return super.getBaseURI() + "/uriinfo/";
+    }
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(URIInfoNormalizationTest.class,
+                "jaxrs.tests.context.uriinfo.server.Application");
+    }
+
+    /**
+     * Tests that a normal "good" path is returned.
+     *
+     * @throws Exception
+     */
+    public void testPathNormal() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI() + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo/", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a path which removes the initial path to the resource class
+     * but adds it back in is okay.
+     *
+     * @throws Exception
+     */
+    public void testRemoveResourcePathThenAddItBack() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(super.getBaseURI()
+                + "/uriinfo/../uriinfo" + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(super.getBaseURI() + "/uriinfo/."
+                + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo/", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(super.getBaseURI() + "/uriinfo/./"
+                + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo/", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(super.getBaseURI()
+                + "/uriinfo/./.././uriinfo/./" + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo/", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(super.getBaseURI() + "/uriinfo/../uriinfo/"
+                + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo/", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(super.getBaseURI()
+                + "/uriinfo/sub/../uriinfo/../sub" + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo/sub", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(super.getBaseURI()
+                + "/uriinfo/sub/../uriinfo/../sub/" + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo/sub/", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests adding some extra paths to resource paths and then removing them.
+     *
+     * @throws Exception
+     */
+    public void testAddPathThenRemoveIt() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(super.getBaseURI()
+                + "/uriinfo/something/../" + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo/", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(super.getBaseURI() + "/uriinfo/something/.."
+                + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo/", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(super.getBaseURI()
+                + "/uriinfo/sub/../uriinfo/../sub/something/../" + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo/sub/", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(super.getBaseURI()
+                + "/uriinfo/sub/../uriinfo/../sub/something/.." + "?info=path");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("/uriinfo/sub/", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the capitalization is correct.
+     *
+     * @throws Exception
+     */
+    public void testCapitalization() throws Exception {
+        HttpClient client = new HttpClient();
+        String contextRoot = DefaultURIInfo
+                .getClassDefaultContextRoot(URIInfoNormalizationTest.class);
+        if (!"".equals(contextRoot)) {
+            contextRoot = "/" + contextRoot;
+        }
+
+        GetMethod getMethod = new GetMethod(super.getBaseURI()
+                + "/uriinfo/something/../" + "?info=host");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(DefaultURIInfo.getServerHostname().toLowerCase(),
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        /*
+         * should be the same as first test above
+         */
+        getMethod = new GetMethod("http://"
+                + DefaultURIInfo.getServerHostname() + ":"
+                + DefaultURIInfo.getServerPort() + contextRoot
+                + "/uriinfo/something/../" + "?info=host");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(DefaultURIInfo.getServerHostname().toLowerCase(),
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        /*
+         * uppercased
+         */
+        getMethod = new GetMethod("http://"
+                + DefaultURIInfo.getServerHostname().toUpperCase() + ":"
+                + DefaultURIInfo.getServerPort() + contextRoot
+                + "/uriinfo/something/../" + "?info=host");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(DefaultURIInfo.getServerHostname().toLowerCase(),
+                    getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        /*
+         * uppercased
+         */
+        getMethod = new GetMethod("HTTP://"
+                + DefaultURIInfo.getServerHostname().toUpperCase() + ":"
+                + DefaultURIInfo.getServerPort() + contextRoot
+                + "/uriinfo/something/../" + "?info=protocol");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("http", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that the capitalization is correct.
+     *
+     * @throws Exception
+     */
+    public void testPercentEncoding() throws Exception {
+        HttpClient client = new HttpClient();
+
+        /*
+         * regular query
+         */
+        GetMethod getMethod = new GetMethod(super.getBaseURI()
+                + "/uriinfo/something/../" + "?info=query&hello1=%3F");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("info=query&hello1=?", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        /*
+         * raw query
+         */
+        getMethod = new GetMethod(super.getBaseURI() + "/uriinfo/something/../"
+                + "?info=rawquery&hello1=%3F");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("info=rawquery&hello1=%3F", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(super.getBaseURI() + "/uriinfo/something/../"
+                + "?info=query&hello%31=%3F");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("info=query&hello1=?", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        /*
+         * %75 should eventually be normalized to /uriinfo/something %31 should
+         * be normalized to 1
+         */
+        getMethod = new GetMethod(super.getBaseURI()
+                + "/%75riinfo/something/../" + "?info=rawquery&hello%31=%3F");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            /*
+             * in this case, the %31 should remain encoded
+             */
+            assertEquals("info=rawquery&hello%31=%3F", getMethod
+                    .getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+}

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

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/cookies/server/CookieResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/cookies/server/CookieResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/cookies/server/CookieResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/cookies/server/CookieResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,114 @@
+/*
+ * 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.cookies.server;
+
+import java.util.Map;
+
+import javax.ws.rs.CookieParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Cookie;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.NewCookie;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.Response.Status;
+
+@Path("cookiestests")
+public class CookieResource {
+
+    @Context
+    private UriInfo uri;
+
+    private String value3;
+
+    // @CookieParam("name2")
+    // private String value2;
+    //
+    // @CookieParam("name")
+    // public static String value = null;
+
+    @GET
+    @Produces("text/plain")
+    @Path("getAll")
+    public Response getCookie(@Context HttpHeaders headers) {
+        Map<String, Cookie> cookies = headers.getCookies();
+        String ret = "";
+        if (cookies != null) {
+            for (String s : cookies.keySet()) {
+                Cookie c = cookies.get(s);
+                ret += c.getName() + "," + c.getValue() + "," + c.getPath()
+                        + "," + c.getDomain() + "\r";
+            }
+        }
+        return Response.ok(ret).build();
+    }
+
+    @GET
+    @Produces("text/plain")
+    @Path("getValue2")
+    public Response getValue2() {
+        return Response.status(Status.BAD_REQUEST).entity("value2").build();
+        // return
+        // Response.status(Status.BAD_REQUEST).entity(this.value2).build();
+        // return Response.ok(this.value2).build();
+    }
+
+    @GET
+    @Produces("text/plain")
+    @Path("getStaticValue")
+    public Response getStaticValue() {
+        return null;
+        // return Response.ok(value).build();
+    }
+
+    @GET
+    @Produces("text/plain")
+    @Path("getValue3")
+    public Response getValue3() {
+        return Response.status(Status.BAD_REQUEST).entity(this.value3).build();
+        // return Response.ok(this.value3).build();
+    }
+
+    @PUT
+    @Produces("text/plain")
+    public Response setCookies() {
+        ResponseBuilder rb = Response.ok();
+        rb.cookie(new NewCookie("name", "value", uri.getBaseUri().getPath()
+                + uri.getPath(), uri.getBaseUri().getHost(), "comment", 10,
+                false));
+        rb.cookie(new NewCookie("name2", "value2", uri.getBaseUri().getPath()
+                + uri.getPath(), uri.getBaseUri().getHost(), "comment2", 10,
+                false));
+        rb.cookie(new NewCookie("name3", "value3", uri.getBaseUri().getPath()
+                + uri.getPath(), uri.getBaseUri().getHost(), "comment2", 10,
+                false));
+        return rb.build();
+    }
+
+    @CookieParam("name3")
+    public void setValue3(String value3) {
+        this.value3 = value3;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/cookies/test/CookieFieldsTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/cookies/test/CookieFieldsTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/cookies/test/CookieFieldsTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/cookies/test/CookieFieldsTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,226 @@
+/*
+ * 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.cookies.test;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.cookie.CookiePolicy;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.FVTTestCase;
+
+/**
+ * Test that all the possible cookie fields can be sent
+ * by the runtime
+ */
+public class CookieFieldsTest extends FVTTestCase {
+
+    protected HttpClient httpclient = new HttpClient();
+
+    final private static String BASE_URI = DefaultURIInfo
+            .getClassDefaultBaseURI(CookieFieldsTest.class)
+            + "/cookiestests";
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(CookieFieldsTest.class,
+                "jaxrs.tests.cookies.server.Application");
+    }
+
+    /**
+     * Test that the HttpHeaders.getCookies() method returns
+     * correct cookies and information
+     *
+     * @throws Exception
+     */
+    public void testHttpHeadersGetCookie() throws Exception {
+        httpclient = new HttpClient();
+        setCookies();
+        // call get to exercise HttpHeaders.getCookies()
+        GetMethod getHttpMethod = new GetMethod();
+        getHttpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+        getHttpMethod.setURI(new URI(BASE_URI + "/getAll", false));
+        System.out.println("Request headers:");
+        System.out.println(Arrays.asList(getHttpMethod.getRequestHeaders()));
+        try {
+            int result = httpclient.executeMethod(getHttpMethod);
+            System.out.println("Response status code: " + result);
+            System.out.println("Response body: ");
+            String responseBody = getHttpMethod.getResponseBodyAsString();
+            System.out.println(responseBody);
+            System.out.println("Response headers:");
+            List<Header> headers = Arrays.asList(getHttpMethod
+                    .getResponseHeaders());
+            System.out.println(headers);
+            assertEquals(200, result);
+
+            StringTokenizer t = new StringTokenizer(responseBody, "\r\n\t\f");
+            String next = null;
+            boolean name3Found = false;
+            boolean name2Found = false;
+            boolean nameFound = false;
+            String contextRoot = DefaultURIInfo
+                    .getClassDefaultContextRoot(CookieFieldsTest.class);
+            if (!"".equals(contextRoot)) {
+                contextRoot = "/" + contextRoot;
+            }
+            while (t.hasMoreTokens()) {
+                next = t.nextToken();
+                if (next.startsWith("name3")) {
+                    assertEquals("name3,value3," + contextRoot
+                            + "/cookiestests,"
+                            + DefaultURIInfo.getServerHostname(), next);
+                    name3Found = true;
+                } else if (next.startsWith("name2")) {
+                    assertEquals("name2,value2," + contextRoot
+                            + "/cookiestests,"
+                            + DefaultURIInfo.getServerHostname(), next);
+                    name2Found = true;
+                } else if (next.startsWith("name")) {
+                    assertEquals("name,value," + contextRoot + "/cookiestests,"
+                            + DefaultURIInfo.getServerHostname(), next);
+                    nameFound = true;
+                } else
+                    fail("Received an unexpected cookie: " + next);
+            }
+            if (!nameFound || !name2Found || !name3Found)
+                fail("Did not receive all the expected cookies." + nameFound
+                        + name2Found + name3Found);
+        } finally {
+            getHttpMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Test the @CookieParameter annotation on a private class field
+     *
+     * @throws Exception
+     */
+    public void testCookieParamPrivateVar() throws Exception {
+        httpclient = new HttpClient();
+        setCookies();
+        GetMethod getHttpMethod = new GetMethod();
+        getHttpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+        getHttpMethod.setURI(new URI(BASE_URI + "/getValue2", false));
+        System.out.println("Request headers:");
+        System.out.println(Arrays.asList(getHttpMethod.getRequestHeaders()));
+        try {
+            int result = httpclient.executeMethod(getHttpMethod);
+            System.out.println("Response status code: " + result);
+            System.out.println("Response body: ");
+            String responseBody = getHttpMethod.getResponseBodyAsString();
+            System.out.println(responseBody);
+            System.out.println("Response headers:");
+            List<Header> headers = Arrays.asList(getHttpMethod
+                    .getResponseHeaders());
+            System.out.println(headers);
+            assertEquals(400, result);
+            assertEquals("value2", responseBody.trim());
+        } finally {
+            getHttpMethod.releaseConnection();
+        }
+    }
+
+    //    /**
+    //     * Test the @CookieParameter annotation on a static class field
+    //     *
+    //     * @throws Exception
+    //     */
+    //    public void testCookieParamStaticField() throws Exception {
+    //        httpclient = new HttpClient();
+    //        setCookies();
+    //        GetMethod getHttpMethod = new GetMethod();
+    //        getHttpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+    //        getHttpMethod.setURI(new URI(BASE_URI+"/getStaticValue", false));
+    //        System.out.println("Request headers:");
+    //        System.out.println(Arrays.asList(getHttpMethod.getRequestHeaders()));
+    //        try {
+    //            int result = httpclient.executeMethod(getHttpMethod);
+    //            System.out.println("Response status code: " + result);
+    //            System.out.println("Response body: ");
+    //            String responseBody = getHttpMethod.getResponseBodyAsString();
+    //            System.out.println(responseBody);
+    //            System.out.println("Response headers:");
+    //            List<Header> headers = Arrays.asList(getHttpMethod.getResponseHeaders());
+    //            System.out.println(headers);
+    //            assertEquals(400, result);
+    //            assertEquals("value", responseBody.trim());
+    //        } finally {
+    //            getHttpMethod.releaseConnection();
+    //        }
+    //    }
+
+    /**
+     * Test the @CookieParameter annotation bean property
+     *
+     * @throws Exception
+     */
+    //    public void testCookieParamBeanProp() throws Exception {
+    //        httpclient = new HttpClient();
+    //        setCookies();
+    //        GetMethod getHttpMethod = new GetMethod();
+    //        getHttpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+    //        getHttpMethod.setURI(new URI(BASE_URI+"/getValue3", false));
+    //        System.out.println("Request headers:");
+    //        System.out.println(Arrays.asList(getHttpMethod.getRequestHeaders()));
+    //        try {
+    //            int result = httpclient.executeMethod(getHttpMethod);
+    //            System.out.println("Response status code: " + result);
+    //            System.out.println("Response body: ");
+    //            String responseBody = getHttpMethod.getResponseBodyAsString();
+    //            System.out.println(responseBody);
+    //            System.out.println("Response headers:");
+    //            List<Header> headers = Arrays.asList(getHttpMethod.getResponseHeaders());
+    //            System.out.println(headers);
+    //            assertEquals(400, result);
+    //            assertEquals("value3", responseBody.trim());
+    //        } finally {
+    //            getHttpMethod.releaseConnection();
+    //        }
+    //    }
+    private void setCookies() throws Exception {
+        // call put to set the cookies
+        PutMethod putHttpMethod = new PutMethod();
+        putHttpMethod.getParams().setCookiePolicy(CookiePolicy.RFC_2965);
+        putHttpMethod.setURI(new URI(BASE_URI, false));
+        System.out.println("Request headers:");
+        System.out.println(Arrays.asList(putHttpMethod.getRequestHeaders()));
+        try {
+            int result = httpclient.executeMethod(putHttpMethod);
+            System.out.println("Response status code: " + result);
+            System.out.println("Response body: ");
+            String responseBody = putHttpMethod.getResponseBodyAsString();
+            System.out.println(responseBody);
+            System.out.println("Response headers:");
+            List<Header> headers = Arrays.asList(putHttpMethod
+                    .getResponseHeaders());
+            System.out.println(headers);
+            assertEquals(200, result);
+        } finally {
+            putHttpMethod.releaseConnection();
+        }
+    }
+}

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

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/environment/web/server/WebContainerContextInjectionResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/environment/web/server/WebContainerContextInjectionResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/environment/web/server/WebContainerContextInjectionResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/environment/web/server/WebContainerContextInjectionResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,98 @@
+/*
+ * 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.environment.web.server;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+
+@Path("environment/webcontainer/context/")
+public class WebContainerContextInjectionResource {
+
+    @Context
+    private HttpServletRequest httpServletRequest;
+
+    @Context
+    private HttpServletResponse httpServletResponse;
+
+    @Context
+    private ServletConfig servletConfig;
+
+    @Context
+    private ServletContext servletContext;
+
+    @GET
+    public String getHTTPRequestPathInfo() {
+        return httpServletRequest.getPathInfo();
+    }
+
+    @POST
+    public String getHTTPResponse() {
+        httpServletResponse.addHeader("responseheadername",
+                "responseheadervalue");
+        httpServletResponse.setStatus(HttpServletResponse.SC_OK);
+
+        try {
+            PrintWriter pw = new PrintWriter(new OutputStreamWriter(
+                    httpServletResponse.getOutputStream()));
+            /*
+             * PrintWriter does not automatically flush so going to flush pw
+             * manually. Reminder, cannot just flush HttpServletResponse
+             * OutputStream either since decorated class has no idea about
+             * PrintWriter.
+             */
+            pw.write("Hello World");
+            pw.flush();
+            /*
+             * this should always be committed now
+             */
+            if (httpServletResponse.isCommitted()) {
+                pw.write(" -- I was committted");
+            }
+            pw.flush();
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new RuntimeException("Could not output the servlet response.");
+        }
+
+        return "Shouldn't see me";
+    }
+
+    @GET
+    @Path("servletcontext")
+    public String getServletContext() {
+        return servletContext.getContextPath();
+    }
+
+    @GET
+    @Path("servletconfig")
+    public String getServletConfig() {
+        return servletConfig.getServletContext().getContextPath();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/environment/web/test/WebContainerTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/environment/web/test/WebContainerTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/environment/web/test/WebContainerTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/environment/web/test/WebContainerTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,149 @@
+/*
+ * 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.environment.web.test;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.Environment;
+import framework.defaults.test.FVTTestCase;
+
+/**
+ * Simple tests for web container spec compliance.
+ */
+public class WebContainerTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(WebContainerTest.class,
+                "jaxrs.tests.environment.web.server.Application");
+    }
+
+    @Override
+    public String getBaseURI() {
+        return super.getBaseURI() + "/environment/webcontainer/context/";
+    }
+
+    /**
+     * Tests that a HTTPServletRequest can be injected.
+     *
+     * @throws Exception
+     */
+    public void testHTTPServletRequestInjection() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI());
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertTrue(getBaseURI().endsWith(
+                    getMethod.getResponseBodyAsString()));
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that an injected HTTPServletResponse can take over the response
+     * instead of further processing by the runtime engine.
+     *
+     * @throws Exception
+     */
+    public void testHTTPServletResponseInjection() throws Exception {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI());
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("responseheadervalue", postMethod.getResponseHeader(
+                    "responseheadername").getValue());
+            assertEquals("Hello World -- I was committted", postMethod
+                    .getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a ServletContext can be injected.
+     *
+     * @throws Exception
+     */
+    public void testServletContextInjection() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI() + "/servletcontext");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            System.out.println(getMethod.getResponseBodyAsString());
+            if (Environment.STANDALONE.equals(Environment
+                    .getCurrentEnvironment())) {
+                assertEquals(
+                        ""
+                                + DefaultURIInfo
+                                        .getClassDefaultContextRoot(WebContainerTest.class),
+                        getMethod.getResponseBodyAsString());
+            } else {
+                assertEquals(
+                        "/"
+                                + DefaultURIInfo
+                                        .getClassDefaultContextRoot(WebContainerTest.class),
+                        getMethod.getResponseBodyAsString());
+            }
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a ServletConfig can be injected.
+     *
+     * @throws Exception
+     */
+    public void testServletConfigInjection() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI() + "/servletconfig");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            System.out.println(getMethod.getResponseBodyAsString());
+            if (Environment.STANDALONE.equals(Environment
+                    .getCurrentEnvironment())) {
+                assertEquals(
+                        ""
+                                + DefaultURIInfo
+                                        .getClassDefaultContextRoot(WebContainerTest.class),
+                        getMethod.getResponseBodyAsString());
+            } else {
+                assertEquals(
+                        "/"
+                                + DefaultURIInfo
+                                        .getClassDefaultContextRoot(WebContainerTest.class),
+                        getMethod.getResponseBodyAsString());
+            }
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+}

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



Mime
View raw message