jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1347681 - in /jackrabbit/oak/trunk/oak-jcr/src: main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Date Thu, 07 Jun 2012 15:29:18 GMT
Author: mduerig
Date: Thu Jun  7 15:29:18 2012
New Revision: 1347681

URL: http://svn.apache.org/viewvc?rev=1347681&view=rev
Log:
OAK-135: Better support for RangeIterators

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1347681&r1=1347680&r2=1347681&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Thu Jun  7 15:29:18 2012
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import static org.apache.jackrabbit.oak.util.Iterators.filter;
-
 import java.io.InputStream;
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -70,6 +68,8 @@ import org.apache.jackrabbit.value.Value
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.jackrabbit.oak.util.Iterators.filter;
+
 /**
  * {@code NodeImpl}...
  */
@@ -441,7 +441,8 @@ public class NodeImpl extends ItemImpl i
         checkStatus();
 
         Iterator<NodeDelegate> children = dlg.getChildren();
-        return new NodeIteratorAdapter(nodeIterator(children));
+        long size = dlg.getChildCount();
+        return new NodeIteratorAdapter(nodeIterator(children), size);
     }
 
     @Override
@@ -505,7 +506,8 @@ public class NodeImpl extends ItemImpl i
         checkStatus();
 
         Iterator<PropertyDelegate> properties = dlg.getProperties();
-        return new PropertyIteratorAdapter(propertyIterator(properties));
+        long size = dlg.getPropertyCount();
+        return new PropertyIteratorAdapter(propertyIterator(properties), size);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java?rev=1347681&r1=1347680&r2=1347681&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/RepositoryTest.java
Thu Jun  7 15:29:18 2012
@@ -18,12 +18,21 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import org.apache.jackrabbit.JcrConstants;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import util.NumberStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 import javax.jcr.Binary;
 import javax.jcr.GuestCredentials;
@@ -49,21 +58,13 @@ import javax.jcr.observation.Event;
 import javax.jcr.observation.EventIterator;
 import javax.jcr.observation.EventListener;
 import javax.jcr.observation.ObservationManager;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
+
+import org.apache.jackrabbit.JcrConstants;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import util.NumberStream;
 
 import static java.util.Arrays.asList;
 import static org.apache.jackrabbit.oak.commons.ArrayUtils.contains;
@@ -221,6 +222,7 @@ public class RepositoryTest extends Abst
         root.getNode("bar").remove();  // transiently removed and...
         root.addNode("bar");           // ... added again
         NodeIterator nodes = root.getNodes();
+        assertEquals(3, nodes.getSize());
         while (nodes.hasNext()) {
             assertTrue(nodeNames.remove(nodes.nextNode().getName()));
         }
@@ -250,6 +252,7 @@ public class RepositoryTest extends Abst
         node.getProperty("intProp").remove();      // transiently removed...
         node.setProperty("intProp", 42);           // ...and added again
         PropertyIterator properties = node.getProperties();
+        assertEquals(4, properties.getSize());
         while (properties.hasNext()) {
             Property p = properties.nextProperty();
             if (JcrConstants.JCR_PRIMARYTYPE.equals(p.getName())) {



Mime
View raw message