chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r899010 - 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 Thu, 14 Jan 2010 00:48:54 GMT
Author: fguillaume
Date: Thu Jan 14 00:48:54 2010
New Revision: 899010

URL: http://svn.apache.org/viewvc?rev=899010&view=rev
Log:
Make JAX-RS binding support GET on descendants and foldertree

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=899010&r1=899009&r2=899010&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
Thu Jan 14 00:48:54 2010
@@ -297,16 +297,32 @@
         return postAbderaEntry(2);
     }
 
+    @GET
+    @Produces(AtomPubCMIS.MEDIA_TYPE_CMIS_TREE)
+    @Path("descendants/{objectid}")
+    public Response doGetDescendants() {
+        // objectid decoded by Abdera getCollectionAdapter
+        return getAbderaFeed(2);
+    }
+
     @DELETE
     @Path("descendants/{objectid}")
-    public Response deleteDescendants() {
+    public Response doDeleteDescendants() {
         // objectid decoded by Abdera getCollectionAdapter
         return deleteAbderaEntry(2);
     }
 
+    @GET
+    @Produces(AtomPub.MEDIA_TYPE_ATOM_FEED)
+    @Path("foldetree/{objectid}")
+    public Response doGetFolderTree() {
+        // objectid decoded by Abdera getCollectionAdapter
+        return getAbderaFeed(2);
+    }
+
     @DELETE
     @Path("foldertree/{objectid}")
-    public Response deleteFolderTree() {
+    public Response doDeleteFolderTree() {
         // objectid decoded by Abdera getCollectionAdapter
         return deleteAbderaEntry(2);
     }

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=899010&r1=899009&r2=899010&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
Thu Jan 14 00:48:54 2010
@@ -345,36 +345,45 @@
     }
 
     public void testDelete() {
-        RequestOptions options = new RequestOptions();
-        ClientResponse resp = client.delete(base + "/object/" + doc3id, options);
+        ClientResponse resp = client.delete(base + "/object/" + doc3id);
         assertEquals(HttpStatus.SC_NO_CONTENT, resp.getStatus());
         resp.release();
 
-        resp = client.delete(base + "/object/no-such-id", options);
+        resp = client.delete(base + "/object/no-such-id");
         assertEquals(HttpStatus.SC_NOT_FOUND, resp.getStatus());
         resp.release();
     }
 
-    public void testDeleteDescendants() {
-        RequestOptions options = new RequestOptions();
-        ClientResponse resp = client.delete(base + "/descendants/" + folder1id,
-                options);
+    public void testDescendants() {
+        ClientResponse resp = client.get(base + "/descendants/" + rootFolderId
+                + "?" + AtomPubCMIS.PARAM_DEPTH + "=1");
+        assertEquals(HttpStatus.SC_OK, resp.getStatus());
+        Element ch = resp.getDocument().getRoot();
+        assertNotNull(ch);
+        resp.release();
+
+        resp = client.delete(base + "/descendants/" + folder1id);
         assertEquals(HttpStatus.SC_NO_CONTENT, resp.getStatus());
         resp.release();
 
-        resp = client.delete(base + "/descendants/no-such-id", options);
+        resp = client.delete(base + "/descendants/no-such-id");
         assertEquals(HttpStatus.SC_NOT_FOUND, resp.getStatus());
         resp.release();
     }
 
-    public void testDeleteFolderTree() {
-        RequestOptions options = new RequestOptions();
-        ClientResponse resp = client.delete(base + "/foldertree/" + folder1id,
-                options);
+    public void testFolderTree() {
+        ClientResponse resp = client.get(base + "/descendants/" + rootFolderId
+                + "?" + AtomPubCMIS.PARAM_DEPTH + "=1");
+        assertEquals(HttpStatus.SC_OK, resp.getStatus());
+        Element ch = resp.getDocument().getRoot();
+        assertNotNull(ch);
+        resp.release();
+
+        resp = client.delete(base + "/foldertree/" + folder1id);
         assertEquals(HttpStatus.SC_NO_CONTENT, resp.getStatus());
         resp.release();
 
-        resp = client.delete(base + "/foldertree/no-such-id", options);
+        resp = client.delete(base + "/foldertree/no-such-id");
         assertEquals(HttpStatus.SC_NOT_FOUND, resp.getStatus());
         resp.release();
     }



Mime
View raw message