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 [23/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/targetting/server/ApplicationOctetStreamMessageBodyReader.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/server/ApplicationOctetStreamMessageBodyReader.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/server/ApplicationOctetStreamMessageBodyReader.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/server/ApplicationOctetStreamMessageBodyReader.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.targetting.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.Provider;
+
+import org.apache.cxf.helpers.IOUtils;
+
+@Provider
+@Consumes("application/octet-stream")
+public class ApplicationOctetStreamMessageBodyReader implements MessageBodyReader<Object> {
+
+    public boolean isReadable(Class<?> arg0, Type arg1, Annotation[] arg2, MediaType arg3) {
+        return arg3.equals(MediaType.APPLICATION_OCTET_STREAM_TYPE)
+                && byte[].class.equals(arg0);
+    }
+
+    public Object readFrom(Class<Object> arg0, Type arg1, Annotation[] arg2, MediaType arg3, MultivaluedMap<String, String> arg4, InputStream arg5)
+            throws IOException, WebApplicationException {
+        String input = new String(IOUtils.readBytesFromStream(arg5));
+        return ("userReader" + input).getBytes();
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/server/ExistingResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/server/ExistingResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/server/ExistingResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/server/ExistingResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,27 @@
+/*
+ * 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.targetting.server;
+
+import javax.ws.rs.Path;
+
+@Path("existingresource")
+public class ExistingResource {
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/server/NullResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/server/NullResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/server/NullResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/server/NullResource.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.targetting.server;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+@Path("targeting/nullresource")
+public class NullResource {
+
+    @POST
+    @Path("withconsumes")
+    @Consumes("text/plain")
+    public Response returnTextWithConsumes(byte[] echo) {
+        if (echo != null) {
+            return Response.ok(echo).build();
+        }
+        return Response.ok("calledWithConsumes").build();
+    }
+
+    @POST
+    @Path("withoutconsumes")
+    public Response returnTextWithoutConsumes(byte[] echo) {
+        if (echo != null) {
+            return Response.ok(echo).build();
+        }
+        return Response.ok("calledWithoutConsumes").build();
+    }
+
+    @POST
+    @Path("withproduces")
+    @Produces("custom/type")
+    public Response returnTextWithProduces() {
+        return Response.ok("calledWithProduces").build();
+    }
+
+    @POST
+    @Path("withoutproduces")
+    public Response returnTextWithoutProduces() {
+        return Response.ok("calledWithoutProduces").build();
+    }
+}

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

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

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

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/ExceptionsWhileTargettingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/ExceptionsWhileTargettingTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/ExceptionsWhileTargettingTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/ExceptionsWhileTargettingTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,213 @@
+/*
+ * 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.targetting.test;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+
+import framework.defaults.test.FVTTestCase;
+
+public class ExceptionsWhileTargettingTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(ExceptionsWhileTargettingTest.class,
+                "jaxrs.tests.targetting.server.Application");
+    }
+
+    /**
+     * Tests that a 404 error is thrown when no resource can be found for a
+     * path.
+     *
+     * @throws Exception
+     */
+    public void test404WhenNoResourceExists() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI() + "/doesnotexist");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(404, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a 405 error is thrown when no subresource can be found for a
+     * path.
+     *
+     * @throws Exception
+     */
+    public void test405WhenNoMethodExistsOnExistingResource() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI() + "/existingresource/");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(405, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a 404 error is thrown when no subresource can be found for a
+     * path.
+     *
+     * @throws Exception
+     */
+    public void test404WhenNoSubResourceExists() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/existingresource/noexistsub");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(404, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+
+            getMethod.setURI(new URI(getBaseURI()
+                    + "/targeting/resourcewithmethod", true));
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("Hello", getMethod.getResponseBodyAsString());
+
+            getMethod.setURI(new URI(getBaseURI()
+                    + "/targeting/resourcewithmethod/noexistsub", true));
+            client.executeMethod(getMethod);
+            assertEquals(404, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a 405 error is thrown when other http methods exist on a
+     * resource but not the one looking for.
+     *
+     * @throws Exception
+     */
+    public void test405WhenResourceMethodDoesNotExistButOthersDo()
+            throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/existingresource/noexistsub");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(404, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/resourcewithmethod");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(405, postMethod.getStatusCode());
+            assertEquals("", postMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a 415 error is thrown when request entity data sent is not
+     * acceptable by the resource.
+     *
+     * @throws Exception
+     */
+    public void test415WhenResourceMethodDoesNotAcceptRequestEntity()
+            throws Exception {
+        HttpClient client = new HttpClient();
+
+        PutMethod putMethod = new PutMethod(getBaseURI()
+                + "/targeting/resourcewithmethod");
+        try {
+            putMethod.setRequestEntity(new StringRequestEntity("some content",
+                    "text/plain", "UTF-8"));
+            client.executeMethod(putMethod);
+            assertEquals(200, putMethod.getStatusCode());
+            assertEquals("some content", putMethod.getResponseBodyAsString());
+        } finally {
+            putMethod.releaseConnection();
+        }
+
+        putMethod = new PutMethod(getBaseURI()
+                + "/targeting/resourcewithmethod");
+        try {
+            putMethod.setRequestEntity(new StringRequestEntity("some content",
+                    "customplain/something", "UTF-8"));
+            client.executeMethod(putMethod);
+            assertEquals(415, putMethod.getStatusCode());
+            assertEquals("", putMethod.getResponseBodyAsString());
+        } finally {
+            putMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a 406 error is produced if server side cannot produce any
+     * acceptable content type.
+     *
+     * @throws Exception
+     */
+    public void test406WhenResourceMethodDoesNotProduceResponseEntityType()
+            throws Exception {
+        HttpClient client = new HttpClient();
+
+        PutMethod putMethod = new PutMethod(getBaseURI()
+                + "/targeting/resourcewithmethod");
+
+        try {
+            putMethod.addRequestHeader("Accept", "text/plain");
+            putMethod.setRequestEntity(new StringRequestEntity("some content",
+                    "text/plain", "UTF-8"));
+            client.executeMethod(putMethod);
+
+            assertEquals(200, putMethod.getStatusCode());
+            assertEquals("some content", putMethod.getResponseBodyAsString());
+        } finally {
+            putMethod.releaseConnection();
+        }
+
+        putMethod = new PutMethod(getBaseURI()
+                + "/targeting/resourcewithmethod");
+        try {
+            putMethod.addRequestHeader("Accept", "text/customplain");
+            putMethod.setRequestEntity(new StringRequestEntity("some content",
+                    "text/plain", "UTF-8"));
+            client.executeMethod(putMethod);
+
+            assertEquals(406, putMethod.getStatusCode());
+            assertEquals("", putMethod.getResponseBodyAsString());
+        } finally {
+            putMethod.releaseConnection();
+        }
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/NullValuesDuringTargettingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/NullValuesDuringTargettingTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/NullValuesDuringTargettingTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/NullValuesDuringTargettingTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,335 @@
+/*
+ * 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.targetting.test;
+
+import java.io.IOException;
+
+import javax.ws.rs.Consumes;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.ByteArrayRequestEntity;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+import framework.defaults.test.FVTTestCase;
+
+public class NullValuesDuringTargettingTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(NullValuesDuringTargettingTest.class,
+                "jaxrs.tests.targetting.server.Application");
+    }
+
+    /**
+     * Tests that a request to a method with no content type, no request entity,
+     * but with a {@link Consumes} method results in a 415 error.
+     *
+     * @throws IOException
+     */
+    public void testNoContentTypeWithNoRequestEntityIncomingRequestWithConsumesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withconsumes");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(415, postMethod.getStatusCode());
+            assertEquals("", postMethod.getResponseBodyAsString());
+            assertNull(postMethod.getResponseHeader("Content-Type"));
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a request to a method with no content type, a request entity,
+     * but with a {@link Consumes} method results in a 415 error.
+     *
+     * @throws IOException
+     */
+    public void testNoContentTypeWithRequestEntityIncomingRequestWithConsumesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withconsumes");
+        postMethod.setRequestEntity(new ByteArrayRequestEntity(new byte[] { 0,
+                1, 2 }));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(415, postMethod.getStatusCode());
+            assertEquals("", postMethod.getResponseBodyAsString());
+            assertNull(postMethod.getResponseHeader("Content-Type"));
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a request to a method with no content type, a request entity,
+     * but without a {@link Consumes} method results in 200 successful method
+     * invocation.
+     *
+     * @throws IOException
+     */
+    public void testNoContentTypeWithRequestEntityIncomingRequestWithNoConsumesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withoutconsumes");
+        postMethod.setRequestEntity(new ByteArrayRequestEntity(
+                "calledWithString".getBytes()));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("userReadercalledWithString", postMethod
+                    .getResponseBodyAsString());
+            assertEquals("application/octet-stream", postMethod
+                    .getResponseHeader("Content-Type").getValue());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a request to a method with a content type, a request entity,
+     * but without a {@link Consumes} method results in 200 successful method
+     * invocation.
+     *
+     * @throws IOException
+     */
+    public void testContentTypeWithRequestEntityIncomingRequestWithNoConsumesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withoutconsumes");
+        postMethod.setRequestEntity(new ByteArrayRequestEntity("myString"
+                .getBytes(), "custom/type"));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("myString", postMethod.getResponseBodyAsString());
+            assertEquals("application/octet-stream", postMethod
+                    .getResponseHeader("Content-Type").getValue());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a request to a method with a content type, no request entity,
+     * but without a {@link Consumes} method results in 200 successful method
+     * invocation.
+     *
+     * @throws IOException
+     */
+    public void testContentTypeWithNoRequestEntityIncomingRequestWithNoConsumesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withoutconsumes");
+        postMethod.setRequestHeader("Content-Type", "text/plain");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("", postMethod.getResponseBodyAsString());
+            assertEquals("application/octet-stream", postMethod
+                    .getResponseHeader("Content-Type").getValue());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a request to a method with no content type, no request entity,
+     * but without a {@link Consumes} method results in 200 successful method
+     * invocation.
+     *
+     * @throws IOException
+     */
+    public void testNoContentTypeWithNoRequestEntityIncomingRequestWithNoConsumesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withoutconsumes");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("userReader", postMethod.getResponseBodyAsString());
+            assertEquals("application/octet-stream", postMethod
+                    .getResponseHeader("Content-Type").getValue());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a request to a method with a content type, no request entity,
+     * but with a {@link Consumes} method results in 200 successful method
+     * invocation.
+     *
+     * @throws IOException
+     */
+    public void testContentTypeWithNoRequestEntityIncomingRequestWithConsumesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withconsumes");
+        postMethod.setRequestHeader("Content-Type", "text/plain");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("", postMethod.getResponseBodyAsString());
+            assertEquals("application/octet-stream", postMethod
+                    .getResponseHeader("Content-Type").getValue());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a request to a method with a content type, a request entity,
+     * but with a {@link Consumes} method results in 200 successful method
+     * invocation.
+     *
+     * @throws IOException
+     */
+    public void testContentTypeWithRequestEntityIncomingRequestWithConsumesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withconsumes");
+        postMethod.setRequestEntity(new ByteArrayRequestEntity("mystring"
+                .getBytes(), "text/plain"));
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("mystring", postMethod.getResponseBodyAsString());
+            assertEquals("application/octet-stream", postMethod
+                    .getResponseHeader("Content-Type").getValue());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a request to a method with an Accept header with a
+     * {@link Produces} method results in 200 successful method invocation.
+     *
+     * @throws IOException
+     */
+    public void testAcceptHeaderIncomingRequestWithProducesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withproduces");
+        postMethod.setRequestHeader("Accept", "custom/type; q=0.8");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("calledWithProduces", postMethod
+                    .getResponseBodyAsString());
+            assertEquals("custom/type", postMethod.getResponseHeader(
+                    "Content-Type").getValue());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a request to a method with an Accept header with no
+     * {@link Produces} method results in 200 successful method invocation.
+     *
+     * @throws IOException
+     */
+    public void testAcceptHeaderIncomingRequestWithNoProducesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withoutproduces");
+        postMethod.setRequestHeader("Accept", "custom/type2; q=0.8");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("calledWithoutProduces", postMethod
+                    .getResponseBodyAsString());
+            assertEquals("custom/type2", postMethod.getResponseHeader(
+                    "Content-Type").getValue());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a request to a method with no Accept header with a
+     * {@link Produces} method results in 200 successful method invocation.
+     *
+     * @throws IOException
+     */
+    public void testNoAcceptHeaderIncomingRequestWithProducesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withproduces");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("calledWithProduces", postMethod
+                    .getResponseBodyAsString());
+            assertEquals("custom/type", postMethod.getResponseHeader(
+                    "Content-Type").getValue());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a request to a method with no Accept header with no
+     * {@link Produces} method results in 200 successful method invocation.
+     *
+     * @throws IOException
+     */
+    public void testNoAcceptHeaderIncomingRequestWithNoProducesMethod()
+            throws IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI()
+                + "/targeting/nullresource/withoutproduces");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("calledWithoutProduces", postMethod
+                    .getResponseBodyAsString());
+            assertEquals("application/octet-stream", postMethod
+                    .getResponseHeader("Content-Type").getValue());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/ValidationDuringTargettingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/ValidationDuringTargettingTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/ValidationDuringTargettingTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/targetting/test/ValidationDuringTargettingTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,247 @@
+/*
+ * 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.targetting.test;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+import framework.defaults.test.FVTAssert;
+import framework.defaults.test.FVTTestCase;
+
+public class ValidationDuringTargettingTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(ValidationDuringTargettingTest.class,
+                "jaxrs.tests.targetting.server.Application");
+    }
+
+    /**
+     * Tests that a GET method to various paths only differing by
+     * {@link Produces} works.
+     *
+     * @throws Exception
+     */
+    public void testGETOnlyDifferByProduces() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/targeting/resourceonlyproduces");
+        try {
+            getMethod.addRequestHeader("Accept", "application/json");
+            client.executeMethod(getMethod);
+
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("Hello JSON Produces", getMethod
+                    .getResponseBodyAsString());
+            assertEquals("application/json", getMethod.getResponseHeader(
+                    "Content-Type").getValue());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/targeting/resourceonlyproduces");
+
+        try {
+            getMethod.addRequestHeader("Accept", "application/xml");
+            client.executeMethod(getMethod);
+
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("Hello XML Produces", getMethod
+                    .getResponseBodyAsString());
+            assertEquals("application/xml", getMethod.getResponseHeader(
+                    "Content-Type").getValue());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/targeting/resourceonlyproduces");
+
+        try {
+            getMethod.addRequestHeader("Accept", "text/xml");
+            client.executeMethod(getMethod);
+
+            assertEquals(406, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        boolean isWarningThrown = true;
+        try {
+            FVTAssert.assertLogContainsException("WARN");
+            FVTAssert.assertInstallLogContainsException("WARN");
+        } catch (AssertionError e) {
+            isWarningThrown = false;
+        }
+
+        assertFalse("Warning should not be emitted", isWarningThrown);
+    }
+
+    /**
+     * Tests that a GET method to various paths only differing by
+     * {@link Consumes} works.
+     *
+     * @throws Exception
+     */
+    public void testGETOnlyDifferByConsumes() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/targeting/resourceonlyconsumes");
+        getMethod.setRequestHeader("Content-Type", "application/json");
+        try {
+            client.executeMethod(getMethod);
+
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("Hello JSON Consumes", getMethod
+                    .getResponseBodyAsString());
+            assertEquals("text/plain", getMethod.getResponseHeader(
+                    "Content-Type").getValue());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/targeting/resourceonlyconsumes");
+        getMethod.setRequestHeader("Content-Type", "text/xml");
+
+        try {
+            client.executeMethod(getMethod);
+
+            assertEquals(415, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        boolean isWarningThrown = true;
+        try {
+            FVTAssert.assertLogContainsException("WARN");
+            FVTAssert.assertInstallLogContainsException("WARN");
+        } catch (AssertionError e) {
+            isWarningThrown = false;
+        }
+
+        assertFalse("Warning should not be emitted", isWarningThrown);
+    }
+
+    /**
+     * Tests that a GET method to various paths only differing by
+     * {@link Consumes} works.
+     *
+     * @throws Exception
+     */
+    public void testGETOnlyDifferByConsumesAndProduces() throws Exception {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/targeting/resourceconsumesandproduces");
+        getMethod.setRequestHeader("Content-Type", "application/json");
+        getMethod.setRequestHeader("Accept", "application/json");
+        try {
+            client.executeMethod(getMethod);
+
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("Hello JSON Consumes And Produces", getMethod
+                    .getResponseBodyAsString());
+            assertEquals("application/json", getMethod.getResponseHeader(
+                    "Content-Type").getValue());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/targeting/resourceconsumesandproduces");
+        getMethod.setRequestHeader("Content-Type", "application/json");
+        try {
+            client.executeMethod(getMethod);
+
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("Hello JSON Consumes And Produces", getMethod
+                    .getResponseBodyAsString());
+            assertEquals("application/json", getMethod.getResponseHeader(
+                    "Content-Type").getValue());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/targeting/resourceconsumesandproduces");
+        getMethod.setRequestHeader("Content-Type", "application/xml");
+        try {
+            client.executeMethod(getMethod);
+
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("Hello XML Consumes And Produces", getMethod
+                    .getResponseBodyAsString());
+            assertEquals("application/xml", getMethod.getResponseHeader(
+                    "Content-Type").getValue());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/targeting/resourceconsumesandproduces");
+        getMethod.setRequestHeader("Content-Type", "application/xml");
+        getMethod.setRequestHeader("Accept", "application/xml");
+        try {
+            client.executeMethod(getMethod);
+
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("Hello XML Consumes And Produces", getMethod
+                    .getResponseBodyAsString());
+            assertEquals("application/xml", getMethod.getResponseHeader(
+                    "Content-Type").getValue());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        getMethod = new GetMethod(getBaseURI()
+                + "/targeting/resourceconsumesandproduces");
+        getMethod.setRequestHeader("Content-Type", "application/xml");
+        getMethod.setRequestHeader("Accept", "application/json");
+        try {
+            client.executeMethod(getMethod);
+
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals("Hello XML Consumes And JSON Produces", getMethod
+                    .getResponseBodyAsString());
+            assertEquals("application/json", getMethod.getResponseHeader(
+                    "Content-Type").getValue());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        boolean isWarningThrown = true;
+        try {
+            FVTAssert.assertLogContainsException("WARN");
+            FVTAssert.assertInstallLogContainsException("WARN");
+        } catch (AssertionError e) {
+            isWarningThrown = false;
+        }
+
+        assertFalse("Warning should not be emitted", isWarningThrown);
+    }
+}

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

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/server/DuplicateMethodResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/server/DuplicateMethodResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/server/DuplicateMethodResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/server/DuplicateMethodResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,80 @@
+/*
+ * 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.validation.methods.duplicate.server;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+@Path("validation/methods/duplicate")
+public class DuplicateMethodResource {
+
+    @GET
+    public String getSomething() {
+        return "Hello";
+    }
+
+    @GET
+    public String someOtherGetMethod() {
+        return "Bye";
+    }
+
+    @POST
+    @Consumes("text/plain")
+    @Produces("text/plain")
+    public String somePostMethod() {
+        return "Bye";
+    }
+
+    @POST
+    @Consumes("text/plain")
+    @Produces("text/plain")
+    public String someOtherPostMethod() {
+        return "Bye";
+    }
+
+    @PUT
+    @Consumes("text/plain")
+    public String somePutMethod() {
+        return "Bye";
+    }
+
+    @PUT
+    @Consumes("text/plain")
+    public String someOtherPutMethod() {
+        return "Bye";
+    }
+
+    @DELETE
+    @Produces("text/plain")
+    public String someDeleteMethod() {
+        return "Bye";
+    }
+
+    @DELETE
+    @Produces("text/plain")
+    public String someOtherDeleteMethod() {
+        return "Bye";
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/server/DuplicateMethodResourceCompatibleTypes.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/server/DuplicateMethodResourceCompatibleTypes.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/server/DuplicateMethodResourceCompatibleTypes.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/server/DuplicateMethodResourceCompatibleTypes.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package jaxrs.tests.validation.methods.duplicate.server;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+@Path("validation/methods/duplicatecompatibletypes")
+public class DuplicateMethodResourceCompatibleTypes {
+
+    @GET
+    @Consumes("application/json")
+    public String returnApplicationJSON() {
+        return "Hello";
+    }
+
+    @GET
+    @Consumes("application/*")
+    public String returnApplicationWildcard() {
+        return "Bye";
+    }
+
+    @POST
+    @Consumes(value = { "application/xml", "text/plain" })
+    public String updateInList() {
+        return "Bye";
+    }
+
+    @POST
+    @Consumes(value = { "text/plain", "application/xml" })
+    public String updateInOtherList() {
+        return "Bye";
+    }
+
+    @PUT
+    @Consumes(value = { "application/json", "text/xml" })
+    public String createInList() {
+        return "Bye";
+    }
+
+    @PUT
+    @Consumes(value = { "text/plain", "application/*" })
+    public String createInOtherList() {
+        return "Bye";
+    }
+
+    /*
+     * the delete method should not emit a warning since the Consumes are slightly different
+     */
+
+    @DELETE
+    @Consumes(value = { MediaType.APPLICATION_OCTET_STREAM, "text/xml" })
+    @Produces(value = { "application/json", "application/xml" })
+    public String puttInList() {
+        return "Bye";
+    }
+
+    @DELETE
+    @Consumes(value = { "text/plain", MediaType.APPLICATION_ATOM_XML })
+    @Produces(value = { "application/json", "application/xml" })
+    public String putInOtherList() {
+        return "Bye";
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/test/DuplicateMethodWarningTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/test/DuplicateMethodWarningTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/test/DuplicateMethodWarningTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/methods/duplicate/test/DuplicateMethodWarningTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,76 @@
+/*
+ * 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.validation.methods.duplicate.test;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+import framework.defaults.test.FVTAssert;
+import framework.defaults.test.FVTTestCase;
+
+public class DuplicateMethodWarningTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(DuplicateMethodWarningTest.class,
+                "jaxrs.tests.validation.methods.duplicate.server.Application");
+    }
+
+    /**
+     * Checks that a duplicate method warning is emitted when there is the same
+     * HttpMethod annotation and the same Produces and Consumes annotation
+     * values.
+     *
+     * @throws IOException
+     */
+    public void testDuplicateMethodWarning() throws IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI() + "/");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(404, getMethod.getStatusCode());
+            assertEquals("", getMethod.getResponseBodyAsString());
+        } finally {
+            getMethod.releaseConnection();
+        }
+
+        FVTAssert
+                .assertInstallLogContainsException("The annotation for the POST HTTP method was found on the  somePostMethod someOtherPostMethod methods in the jaxrs.tests.validation.methods.duplicate.server.DuplicateMethodResource class. The annotation should only appear on a single method within the class unless there are different @Path, @Consumes, or @Produces annotations on the methods.");
+        FVTAssert
+                .assertInstallLogContainsException("The annotation for the GET HTTP method was found on the  getSomething someOtherGetMethod methods in the jaxrs.tests.validation.methods.duplicate.server.DuplicateMethodResource class. The annotation should only appear on a single method within the class unless there are different @Path, @Consumes, or @Produces annotations on the methods.");
+        FVTAssert
+                .assertInstallLogContainsException("The annotation for the DELETE HTTP method was found on the  someDeleteMethod someOtherDeleteMethod methods in the jaxrs.tests.validation.methods.duplicate.server.DuplicateMethodResource class. The annotation should only appear on a single method within the class unless there are different @Path, @Consumes, or @Produces annotations on the methods.");
+        FVTAssert
+                .assertInstallLogContainsException("The annotation for the PUT HTTP method was found on the  somePutMethod someOtherPutMethod methods in the jaxrs.tests.validation.methods.duplicate.server.DuplicateMethodResource class. The annotation should only appear on a single method within the class unless there are different @Path, @Consumes, or @Produces annotations on the methods.");
+
+        FVTAssert
+                .assertInstallLogContainsException("The annotation for the POST HTTP method was found on the  updateInList updateInOtherList methods in the jaxrs.tests.validation.methods.duplicate.server.DuplicateMethodResourceCompatibleTypes class. The annotation should only appear on a single method within the class unless there are different @Path, @Consumes, or @Produces annotations on the methods.");
+        FVTAssert
+                .assertInstallLogContainsException("The annotation for the GET HTTP method was found on the  returnApplicationJSON returnApplicationWildcard methods in the jaxrs.tests.validation.methods.duplicate.server.DuplicateMethodResourceCompatibleTypes class. The annotation should only appear on a single method within the class unless there are different @Path, @Consumes, or @Produces annotations on the methods.");
+        FVTAssert
+                .assertInstallLogContainsException("The annotation for the PUT HTTP method was found on the  createInList createInOtherList methods in the jaxrs.tests.validation.methods.duplicate.server.DuplicateMethodResourceCompatibleTypes class. The annotation should only appear on a single method within the class unless there are different @Path, @Consumes, or @Produces annotations on the methods.");
+
+        /*
+         * the delete method should not emit a warning since the Consumes are slightly different
+         */
+    }
+}

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

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/entity/server/MultipleEntityParamsResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/entity/server/MultipleEntityParamsResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/entity/server/MultipleEntityParamsResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/entity/server/MultipleEntityParamsResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,32 @@
+/*
+ * 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.validation.param.entity.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+@Path("/params/multientity")
+public class MultipleEntityParamsResource {
+
+    @GET
+    public void getMultipleEntity(String s1, String s2) {
+        return;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/entity/test/EntityValidationTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/entity/test/EntityValidationTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/entity/test/EntityValidationTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/entity/test/EntityValidationTest.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.validation.param.entity.test;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+import framework.defaults.test.Environment;
+import framework.defaults.test.FVTTestCase;
+
+public class EntityValidationTest extends FVTTestCase {
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(EntityValidationTest.class,
+                jaxrs.tests.validation.param.entity.server.Application.class
+                        .getName());
+    }
+
+    public void testValidationMultipleEntities() throws Exception {
+        HttpClient httpclient = new HttpClient();
+
+        GetMethod httpMethod = new GetMethod(getBaseURI()
+                + "/params/multientity");
+        try {
+            httpclient.executeMethod(httpMethod);
+            assertEquals(500, httpMethod.getStatusCode());
+            framework.defaults.test.FVTAssert
+                    .assertInstallLogContainsException("ResourceValidationException");
+            if (Environment.getCurrentEnvironment() == Environment.GENERIC_WAS) {
+                framework.defaults.test.FVTAssert
+                        .assertInstallLogContainsException("Uncaught exception created in one of the service methods "
+                                + "of the servlet jaxrs.tests.validation.param.entity in "
+                                + "application jaxrs.tests.validation.param.entity. "
+                                + "Exception created : javax.servlet.ServletException: An error "
+                                + "occurred validating JAX-RS artifacts in the application.");
+            }
+        } finally {
+            httpMethod.releaseConnection();
+        }
+    }
+}

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

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

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/formfield/server/FormFieldValidationResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/formfield/server/FormFieldValidationResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/formfield/server/FormFieldValidationResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/formfield/server/FormFieldValidationResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,36 @@
+/*
+ * 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.validation.param.formfield.server;
+
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+@Path("params/form/validate/fieldnotmultivaluedmapparam")
+public class FormFieldValidationResource {
+
+    @FormParam("p1")
+    private String p1;
+
+    @POST
+    public String getSomething(String something) {
+        return "Should not see me" + p1;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/formfield/test/FormFieldValidationTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/formfield/test/FormFieldValidationTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/formfield/test/FormFieldValidationTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/validation/param/formfield/test/FormFieldValidationTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,75 @@
+/*
+ * 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.validation.param.formfield.test;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
+
+import framework.defaults.test.DefaultURIInfo;
+import framework.defaults.test.Environment;
+import framework.defaults.test.FVTTestCase;
+
+public class FormFieldValidationTest extends FVTTestCase {
+
+    public String getBaseURI() {
+        return DefaultURIInfo
+                .getClassDefaultBaseURI(FormFieldValidationTest.class)
+                + "/params/form";
+    }
+
+    public static Test suite() {
+        return FVTTestCase.getTestSuite(FormFieldValidationTest.class,
+                "jaxrs.tests.validation.param.formfield.server.Application");
+    }
+
+    public void testFormFieldNoMultivaluedMapEntityValidation()
+            throws Exception {
+        HttpClient httpclient = new HttpClient();
+
+        PostMethod httpMethod = new PostMethod(getBaseURI()
+                + "/validate/fieldnotmultivaluedmaparam");
+        try {
+            StringRequestEntity s = new StringRequestEntity(
+                    "firstkey=somevalue&someothervalue=somethingelse",
+                    "application/x-www-form-urlencoded", null);
+            httpMethod.setRequestEntity(s);
+            httpclient.executeMethod(httpMethod);
+            assertEquals(500, httpMethod.getStatusCode());
+            String resp = httpMethod.getResponseBodyAsString();
+            System.out.println(resp);
+            framework.defaults.test.FVTAssert
+                    .assertInstallLogContainsException("ResourceValidationException");
+            if (Environment.getCurrentEnvironment() == Environment.GENERIC_WAS) {
+                framework.defaults.test.FVTAssert
+                        .assertInstallLogContainsException("Uncaught exception created in one of the service methods "
+                                + "of the servlet jaxrs.tests.validation.param.formfield in "
+                                + "application jaxrs.tests.validation.param.formfield. "
+                                + "Exception created : javax.servlet.ServletException: An error "
+                                + "occurred validating JAX-RS artifacts in the application.");
+
+            }
+        } finally {
+            httpMethod.releaseConnection();
+        }
+    }
+}

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

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

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



Mime
View raw message