chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r888872 - in /incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src: main/java/org/apache/chemistry/atompub/server/CMISQueryFeed.java test/java/org/apache/chemistry/atompub/server/AtomPubServerTestCase.java
Date Wed, 09 Dec 2009 16:56:54 GMT
Author: fguillaume
Date: Wed Dec  9 16:56:54 2009
New Revision: 888872

URL: http://svn.apache.org/viewvc?rev=888872&view=rev
Log:
CMIS-70: make AtomPub query post return 201 (created)

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISQueryFeed.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/CMISQueryFeed.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISQueryFeed.java?rev=888872&r1=888871&r2=888872&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISQueryFeed.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISQueryFeed.java
Wed Dec  9 16:56:54 2009
@@ -13,6 +13,7 @@
  *
  * Authors:
  *     Florent Guillaume, Nuxeo
+ *     Amelie Avramo, EntropySoft
  */
 package org.apache.chemistry.atompub.server;
 
@@ -30,6 +31,7 @@
 import org.apache.chemistry.SPI;
 import org.apache.chemistry.atompub.AtomPubCMIS;
 import org.apache.chemistry.atompub.abdera.QueryElement;
+import org.apache.commons.httpclient.HttpStatus;
 
 /**
  * CMIS Feed for a query.
@@ -86,7 +88,11 @@
         Element element = (Element) document.getOMDocumentElement();
         QueryElement q = new QueryElement(element);
         statement = q.getStatement();
-        return getFeed(request); // calls getEntries
+        ResponseContext res = getFeed(request); // calls getEntries
+        if (res.getStatus() == HttpStatus.SC_OK) {
+            res.setStatus(HttpStatus.SC_CREATED);
+        }
+        return res;
     }
 
     @Override

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=888872&r1=888871&r2=888872&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 Dec  9 16:56:54 2009
@@ -56,8 +56,6 @@
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
 import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.cxf.helpers.FileUtils;
-import org.apache.cxf.helpers.IOUtils;
 import org.mortbay.jetty.Server;
 
 public abstract class AtomPubServerTestCase extends TestCase {
@@ -228,7 +226,7 @@
 
         EntityProvider provider = new QueryEntityProvider("SELECT * FROM doc");
         resp = client.post(base + "/query", provider);
-        assertEquals(HttpStatus.SC_OK, resp.getStatus());
+        assertEquals(HttpStatus.SC_CREATED, resp.getStatus());
         Element res = resp.getDocument().getRoot();
         assertNotNull(res);
 



Mime
View raw message