wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r812694 - in /incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src: main/java/org/apache/wink/itest/standard/ main/java/org/apache/wink/itest/standard/jaxb/ test/java/org/apache/wink/itest/standard/
Date Tue, 08 Sep 2009 21:09:44 GMT
Author: bluk
Date: Tue Sep  8 21:09:43 2009
New Revision: 812694

URL: http://svn.apache.org/viewvc?rev=812694&view=rev
Log:
Add integration tests for empty body content

See [WINK-86]

Added:
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/JAXBResource.java
      - copied, changed from r812684, incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/StringResource.java
      - copied, changed from r812684, incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/jaxb/
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/jaxb/ObjectFactory.java
      - copied, changed from r812684, incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/jaxb/Person.java
      - copied, changed from r812684, incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSJAXBTest.java
  (with props)
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSStringTest.java
  (with props)
Modified:
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/Application.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/DSResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/InputStreamResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/MultiValuedMapResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/ReaderResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/SourceResource.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSBytesArrayTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSDataSourceTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSFileTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSInputStreamTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSMultivaluedMapTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSReaderTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSSourceTest.java

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/Application.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/Application.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/Application.java
Tue Sep  8 21:09:43 2009
@@ -42,6 +42,8 @@
         objs.add(new SourceResource());
         objs.add(new DataSourceResource());
         objs.add(new DSResource());
+        objs.add(new StringResource());
+        objs.add(new JAXBResource());
         return objs;
     }
 

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java
Tue Sep  8 21:09:43 2009
@@ -23,6 +23,7 @@
 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.Response;
 
 @Path("providers/standard/bytesarray")
@@ -45,4 +46,14 @@
         barr = bytearray;
     }
 
+    @POST
+    @Path("/empty")
+    @Produces("text/plain")
+    public Response postEmptyByteArray(byte[] bytearray) {
+        if (bytearray != null && bytearray.length == 0) {
+            return Response.ok("expected").build();
+        }
+        return Response.serverError().build();
+    }
+
 }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/DSResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/DSResource.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/DSResource.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/DSResource.java
Tue Sep  8 21:09:43 2009
@@ -27,6 +27,7 @@
 import javax.activation.DataSource;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
+import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 
@@ -93,4 +94,19 @@
 
     }
 
+    @POST
+    @Path("/empty")
+    public Response postEmpty(DataSource dataSource) {
+        InputStream inputStream;
+        try {
+            inputStream = dataSource.getInputStream();
+            if (inputStream.read() == -1) {
+                return Response.ok("expected").build();
+            }
+        } catch (IOException e) {
+            throw new WebApplicationException(e);
+        }
+        return Response.serverError().build();
+    }
+
 }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java
Tue Sep  8 21:09:43 2009
@@ -47,4 +47,13 @@
     public void putFile(File f) throws IOException {
         FileResource.f = f;
     }
+
+    @POST
+    @Path("/empty")
+    public Response postEmptyFile(File f) {
+        if (f.exists() && f.length() == 0) {
+            return Response.ok("expected").build();
+        }
+        return Response.serverError().build();
+    }
 }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/InputStreamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/InputStreamResource.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/InputStreamResource.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/InputStreamResource.java
Tue Sep  8 21:09:43 2009
@@ -63,4 +63,14 @@
         }
         barr = ArrayUtils.copyOf(buffer, offset);
     }
+
+    @POST
+    @Path("/empty")
+    public Response postEmptyInputStream(InputStream is) throws IOException {
+        if (is != null && is.read() == -1) {
+            return Response.ok("expected").build();
+        }
+        return Response.serverError().build();
+    }
+
 }

Copied: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/JAXBResource.java
(from r812684, incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/JAXBResource.java?p2=incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/JAXBResource.java&p1=incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java&r1=812684&r2=812694&rev=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/JAXBResource.java
Tue Sep  8 21:09:43 2009
@@ -16,35 +16,25 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.wink.itest.standard;
 
-import java.io.File;
 import java.io.IOException;
 
-import javax.ws.rs.GET;
 import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.core.Response;
 
-@Path("providers/standard/file")
-public class FileResource {
+import org.apache.wink.itest.standard.jaxb.Person;
 
-    private static File f;
+@Path("providers/standard/jaxb")
+public class JAXBResource {
 
     @POST
-    public File postFile(File f) {
-        return f;
-    }
-
-    @GET
-    public Response getFile() {
-        return Response.ok(FileResource.f).build();
-    }
-
-    @PUT
-    public void putFile(File f) throws IOException {
-        FileResource.f = f;
+    @Path("/empty")
+    public Response postEmptyJAXB(Person p) throws IOException {
+        /*
+         * this method should never be executed
+         */
+        return Response.serverError().build();
     }
 }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/MultiValuedMapResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/MultiValuedMapResource.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/MultiValuedMapResource.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/MultiValuedMapResource.java
Tue Sep  8 21:09:43 2009
@@ -61,4 +61,14 @@
     public void putMultivaluedMap(MultivaluedMap<String, String> map) throws IOException
{
         formData = map;
     }
+
+    @POST
+    @Produces("text/plain")
+    @Path("/empty")
+    public Response postEmptyMultivaluedMap(MultivaluedMap<String, String> map) {
+        if (map != null && map.isEmpty()) {
+            return Response.ok("expected").build();
+        }
+        return Response.serverError().build();
+    }
 }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/ReaderResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/ReaderResource.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/ReaderResource.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/ReaderResource.java
Tue Sep  8 21:09:43 2009
@@ -64,4 +64,14 @@
         }
         carr = ArrayUtils.copyOf(buffer, offset);
     }
+
+    @POST
+    @Path("empty")
+    public Response postEmptyReader(Reader reader) throws IOException {
+        if (reader != null && reader.read() == -1) {
+            return Response.ok("expected").build();
+        }
+        return Response.serverError().build();
+    }
+
 }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/SourceResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/SourceResource.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/SourceResource.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/SourceResource.java
Tue Sep  8 21:09:43 2009
@@ -29,6 +29,7 @@
 import javax.ws.rs.core.Response;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
 
 @Path("providers/standard/source")
 public class SourceResource {
@@ -68,6 +69,18 @@
 
     @PUT
     public void putSource(DOMSource source) throws IOException {
-        this.source = source;
+        SourceResource.source = source;
+    }
+
+    @POST
+    @Path("/empty")
+    public Response postReader(Source source) throws IOException {
+        if (source != null && source instanceof StreamSource) {
+            StreamSource s = (StreamSource)source;
+            if (s.getInputStream().read() == -1) {
+                return Response.ok("expected").build();
+            }
+        }
+        return Response.serverError().build();
     }
 }

Copied: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/StringResource.java
(from r812684, incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/StringResource.java?p2=incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/StringResource.java&p1=incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java&r1=812684&r2=812694&rev=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/FileResource.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/StringResource.java
Tue Sep  8 21:09:43 2009
@@ -16,35 +16,23 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.wink.itest.standard;
 
-import java.io.File;
 import java.io.IOException;
 
-import javax.ws.rs.GET;
 import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.core.Response;
 
-@Path("providers/standard/file")
-public class FileResource {
-
-    private static File f;
+@Path("providers/standard/string")
+public class StringResource {
 
     @POST
-    public File postFile(File f) {
-        return f;
-    }
-
-    @GET
-    public Response getFile() {
-        return Response.ok(FileResource.f).build();
-    }
-
-    @PUT
-    public void putFile(File f) throws IOException {
-        FileResource.f = f;
+    @Path("/empty")
+    public Response postString(String str) throws IOException {
+        if (str != null && str.length() == 0) {
+            return Response.ok("expected").build();
+        }
+        return Response.serverError().build();
     }
 }

Copied: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/jaxb/ObjectFactory.java
(from r812684, incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/jaxb/ObjectFactory.java?p2=incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/jaxb/ObjectFactory.java&p1=incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java&r1=812684&r2=812694&rev=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/jaxb/ObjectFactory.java
Tue Sep  8 21:09:43 2009
@@ -16,33 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+package org.apache.wink.itest.standard.jaxb;
 
-package org.apache.wink.itest.standard;
+import javax.xml.bind.annotation.XmlRegistry;
 
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Response;
+@XmlRegistry
+public class ObjectFactory {
 
-@Path("providers/standard/bytesarray")
-public class BytesArrayResource {
-
-    private byte[] barr = null;
-
-    @GET
-    public Response getByteArray() {
-        return Response.ok(barr).build();
-    }
-
-    @POST
-    public byte[] postByteArray(byte[] bytearray) {
-        return bytearray;
+    public Person createPerson() {
+        return new Person();
     }
-
-    @PUT
-    public void putByteArray(byte[] bytearray) {
-        barr = bytearray;
-    }
-
 }

Copied: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/jaxb/Person.java
(from r812684, incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/jaxb/Person.java?p2=incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/jaxb/Person.java&p1=incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java&r1=812684&r2=812694&rev=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/BytesArrayResource.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/main/java/org/apache/wink/itest/standard/jaxb/Person.java
Tue Sep  8 21:09:43 2009
@@ -16,33 +16,22 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+package org.apache.wink.itest.standard.jaxb;
 
-package org.apache.wink.itest.standard;
+import javax.xml.bind.annotation.XmlRootElement;
 
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Response;
+@XmlRootElement
+public class Person {
 
-@Path("providers/standard/bytesarray")
-public class BytesArrayResource {
+    private String name;
 
-    private byte[] barr = null;
-
-    @GET
-    public Response getByteArray() {
-        return Response.ok(barr).build();
-    }
-
-    @POST
-    public byte[] postByteArray(byte[] bytearray) {
-        return bytearray;
+    public String getName() {
+        return name;
     }
 
-    @PUT
-    public void putByteArray(byte[] bytearray) {
-        barr = bytearray;
+    public void setName(String name) {
+        this.name = name;
     }
-
+    
+    
 }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSBytesArrayTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSBytesArrayTest.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSBytesArrayTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSBytesArrayTest.java
Tue Sep  8 21:09:43 2009
@@ -177,4 +177,24 @@
             getMethod.releaseConnection();
         }
     }
+
+    /**
+     * Tests posting an request parameter to a byte[] entity parameter.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testSendingNoRequestEntityByteArray() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod =
+            new PostMethod(getBaseURI() + "/providers/standard/bytesarray/empty");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("expected", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
 }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSDataSourceTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSDataSourceTest.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSDataSourceTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSDataSourceTest.java
Tue Sep  8 21:09:43 2009
@@ -252,4 +252,24 @@
             }
         }
     }
+
+    /**
+     * Tests posting an empty request entity to a DataSource entity parameter.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testSendingNoRequestEntityDataSource() throws HttpException, IOException
{
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod =
+            new PostMethod(getBaseURI() + "/dstest/empty");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("expected", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
 }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSFileTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSFileTest.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSFileTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSFileTest.java
Tue Sep  8 21:09:43 2009
@@ -131,4 +131,24 @@
             getMethod.releaseConnection();
         }
     }
+
+    /**
+     * Tests posting to a File entity parameter with no incoming request entity.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testPostFileEmptyRequestEntity() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI() + "/providers/standard/file/empty");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("expected", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
 }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSInputStreamTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSInputStreamTest.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSInputStreamTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSInputStreamTest.java
Tue Sep  8 21:09:43 2009
@@ -208,4 +208,43 @@
             postMethod.releaseConnection();
         }
     }
+
+    /**
+     * Tests posting to an InputStream entity parameter with no incoming request entity.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testPostInputStreamEmptyRequestEntity() throws HttpException, IOException
{
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod = new PostMethod(getBaseURI() + "/providers/standard/file/empty");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("expected", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests posting an empty request entity to a InputStream.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testSendingNoRequestEntityInputStream() throws HttpException, IOException
{
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod =
+            new PostMethod(getBaseURI() + "/providers/standard/inputstream/empty");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("expected", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
 }

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSJAXBTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSJAXBTest.java?rev=812694&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSJAXBTest.java
(added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSJAXBTest.java
Tue Sep  8 21:09:43 2009
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.itest.standard;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+public class JAXRSJAXBTest extends TestCase {
+
+    public String getBaseURI() {
+        if (ServerEnvironmentInfo.isRestFilterUsed()) {
+            return ServerEnvironmentInfo.getBaseURI();
+        }
+        return ServerEnvironmentInfo.getBaseURI() + "/standard";
+    }
+
+    /**
+     * Tests sending in no request entity to a JAXB entity parameter.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testSendingNoRequestEntityJAXB() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        PostMethod postMethod = new PostMethod(getBaseURI() + "/providers/standard/jaxb/empty");
+        postMethod.addRequestHeader(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_XML);
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(400, postMethod.getStatusCode());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+}

Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSJAXBTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSMultivaluedMapTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSMultivaluedMapTest.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSMultivaluedMapTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSMultivaluedMapTest.java
Tue Sep  8 21:09:43 2009
@@ -23,6 +23,9 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
 import junit.framework.TestCase;
 
 import org.apache.commons.httpclient.Header;
@@ -199,6 +202,28 @@
             getMethod.releaseConnection();
         }
     }
+
+    /**
+     * Tests posting an empty request entity to a MultivaluedMap.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testSendingNoRequestEntityMultivaluedMap() throws HttpException, IOException
{
+        HttpClient client = new HttpClient();
+
+        PostMethod postMethod =
+            new PostMethod(getBaseURI() + "/providers/standard/multivaluedmap/empty");
+        postMethod.addRequestHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED);
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("expected", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+
     //
     // /**
     // * Tests a resource method invoked with a MultivaluedMap&lt;String,

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSReaderTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSReaderTest.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSReaderTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSReaderTest.java
Tue Sep  8 21:09:43 2009
@@ -222,4 +222,22 @@
             postMethod.releaseConnection();
         }
     }
+
+    /**
+     * Tests sending in no request entity to a Reader entity parameter.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testSendingNoRequestEntityReader() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        PostMethod postMethod = new PostMethod(getBaseURI() + "/providers/standard/reader/empty");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("expected", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
 }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSSourceTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSSourceTest.java?rev=812694&r1=812693&r2=812694&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSSourceTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSSourceTest.java
Tue Sep  8 21:09:43 2009
@@ -23,6 +23,9 @@
 import java.io.IOException;
 import java.util.Random;
 
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
 import junit.framework.TestCase;
 
 import org.apache.commons.httpclient.Header;
@@ -228,4 +231,23 @@
             postMethod.releaseConnection();
         }
     }
+
+    /**
+     * Tests sending in no request entity to a Source entity parameter.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testSendingNoRequestEntitySource() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        PostMethod postMethod = new PostMethod(getBaseURI() + "/providers/standard/source/empty");
+        postMethod.addRequestHeader(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_XML);
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("expected", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
 }

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSStringTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSStringTest.java?rev=812694&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSStringTest.java
(added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSStringTest.java
Tue Sep  8 21:09:43 2009
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.wink.itest.standard;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+public class JAXRSStringTest extends TestCase {
+
+    public String getBaseURI() {
+        if (ServerEnvironmentInfo.isRestFilterUsed()) {
+            return ServerEnvironmentInfo.getBaseURI();
+        }
+        return ServerEnvironmentInfo.getBaseURI() + "/standard";
+    }
+
+
+    /**
+     * Tests sending in no request entity to a String entity parameter.
+     * 
+     * @throws HttpException
+     * @throws IOException
+     */
+    public void testSendingNoRequestEntityString() throws HttpException, IOException {
+        HttpClient client = new HttpClient();
+        PostMethod postMethod = new PostMethod(getBaseURI() + "/providers/standard/string/empty");
+        try {
+            client.executeMethod(postMethod);
+            assertEquals(200, postMethod.getStatusCode());
+            assertEquals("expected", postMethod.getResponseBodyAsString());
+        } finally {
+            postMethod.releaseConnection();
+        }
+    }
+}

Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/standard/JAXRSStringTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message