jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1342693 - /jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
Date Fri, 25 May 2012 15:43:17 GMT
Author: stefan
Date: Fri May 25 15:43:16 2012
New Revision: 1342693

URL: http://svn.apache.org/viewvc?rev=1342693&view=rev
Log:
OAK-75: specify format and semantics of 'filter' parameter in MicroKernel API:

 test case for :childNodeCount metadata property

Modified:
    jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java

Modified: jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java?rev=1342693&r1=1342692&r2=1342693&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
(original)
+++ jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
Fri May 25 15:43:16 2012
@@ -37,7 +37,6 @@ import java.util.Set;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -450,6 +449,27 @@ public class MicroKernelIT extends Abstr
     }
 
     @Test
+    public void getNodesChildNodeCount() {
+        // :childNodeCount is included per default
+        JSONObject obj = parseJSONObject(mk.getNodes("/", null, 1, 0, -1, null));
+        assertPropertyExists(obj, ":childNodeCount", Long.class);
+        assertPropertyExists(obj, "test/:childNodeCount", Long.class);
+        long count = (Long) resolveValue(obj, ":childNodeCount") ;
+        assertEquals(count, mk.getChildNodeCount("/", null));
+
+        obj = parseJSONObject(mk.getNodes("/", null, 1, 0, -1, "{properties:[\"*\"]}"));
+        assertPropertyExists(obj, ":childNodeCount", Long.class);
+        assertPropertyExists(obj, "test/:childNodeCount", Long.class);
+        count = (Long) resolveValue(obj, ":childNodeCount") ;
+        assertEquals(count, mk.getChildNodeCount("/", null));
+
+        // explicitly exclude :childNodeCount
+        obj = parseJSONObject(mk.getNodes("/", null, 1, 0, -1, "{properties:[\"*\",\"-:childNodeCount\"]}"));
+        assertPropertyNotExists(obj, ":childNodeCount");
+        assertPropertyNotExists(obj, "test/:childNodeCount");
+    }
+
+    @Test
     public void getNodesFiltered() {
         String head = mk.getHeadRevision();
 



Mime
View raw message