chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r899000 - in /incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src: main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResource.java test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
Date Wed, 13 Jan 2010 23:34:24 GMT
Author: fguillaume
Date: Wed Jan 13 23:34:23 2010
New Revision: 899000

URL: http://svn.apache.org/viewvc?rev=899000&view=rev
Log:
Fix POST @Consumes decoding to allow application/atom+xml for RESTEasy

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResource.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResource.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResource.java?rev=899000&r1=898999&r2=899000&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResource.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/jaxrs/AbderaResource.java
Wed Jan 13 23:34:23 2010
@@ -288,7 +288,8 @@
 
     @POST
     @Consumes( { AtomPub.MEDIA_TYPE_ATOM_ENTRY,
-    // IBM Firefox plugin compat, stupid RESTEasy
+            // need for RESTeasy:
+            AtomPub.MEDIA_TYPE_ATOM,
             AtomPub.MEDIA_TYPE_ATOM_ENTRY + ";charset=UTF-8" })
     @Path("children/{objectid}")
     public Response doPostChildren() {

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java?rev=899000&r1=898999&r2=899000&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
Wed Jan 13 23:34:23 2010
@@ -248,17 +248,21 @@
         assertNotNull(ch);
         resp.release();
 
-        // post of new document
-        PostMethod postMethod = new PostMethod(base + "/children/"
-                + rootFolderId);
-        postMethod.setRequestEntity(new InputStreamRequestEntity(
-                load("templates/createdocument.atomentry.xml"),
-                AtomPub.MEDIA_TYPE_ATOM_ENTRY));
-        int status = new HttpClient().executeMethod(postMethod);
-        assertEquals(HttpStatus.SC_CREATED, status);
-        assertNotNull(postMethod.getResponseHeader(HttpHeaders.LOCATION));
-        assertNotNull(postMethod.getResponseHeader(HttpHeaders.CONTENT_LOCATION));
-        postMethod.releaseConnection();
+        // post of new document, test using various content types
+        for (String contentType : Arrays.<String> asList(
+                AtomPub.MEDIA_TYPE_ATOM, //
+                AtomPub.MEDIA_TYPE_ATOM_ENTRY, //
+                AtomPub.MEDIA_TYPE_ATOM_ENTRY + ";charset=UTF-8")) {
+            PostMethod postMethod = new PostMethod(base + "/children/"
+                    + rootFolderId);
+            postMethod.setRequestEntity(new InputStreamRequestEntity(
+                    load("templates/createdocument.atomentry.xml"), contentType));
+            int status = new HttpClient().executeMethod(postMethod);
+            assertEquals(HttpStatus.SC_CREATED, status);
+            assertNotNull(postMethod.getResponseHeader(HttpHeaders.LOCATION));
+            assertNotNull(postMethod.getResponseHeader(HttpHeaders.CONTENT_LOCATION));
+            postMethod.releaseConnection();
+        }
     }
 
     public void testObject() throws Exception {



Mime
View raw message