FlatFileStoreIterator extends AbstractIterator<NodeStateEntry> implements Iterator<NodeStateEntry>, Closeable { int getBufferSize(){ return buffer.size(); } FlatFileStoreIterator(BlobStore blobStore, String fileName, Iterator<NodeStateEntry> baseItr, Set<String> preferredPathElements);  FlatFileStoreIterator(BlobStore blobStore, String fileName, Iterator<NodeStateEntry> baseItr, Set<String> preferredPathElements, int memLimitConfig); @Override void close();  }
@Test public void simpleTraversal() { Set<String> preferred = ImmutableSet.of("jcr:content"); CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/jcr:content", "/a/jcr:content/metadata", "/a/d", "/e", "/e/e")); try (FlatFileStoreIterator fitr = newFlatFileStore(citr.iterator(), preferred)) { NodeStateEntry a = fitr.next(); assertEquals("/a", a.getPath()); NodeState ns1 = a.getNodeState().getChildNode("jcr:content"); assertEquals("/a/jcr:content", ns1.getString("path")); assertEquals(1, fitr.getBufferSize()); NodeState ns2 = ns1.getChildNode("metadata"); assertEquals("/a/jcr:content/metadata", ns2.getString("path")); assertEquals(2, fitr.getBufferSize()); NodeStateEntry nse1 = fitr.next(); assertEquals("/a/jcr:content", nse1.getPath()); NodeStateEntry nse2 = fitr.next(); assertEquals("/a/jcr:content/metadata", nse2.getPath()); NodeStateEntry nse3 = fitr.next(); assertEquals("/a/d", nse3.getPath()); assertEquals(0, nse3.getNodeState().getChildNodeCount(100)); NodeStateEntry nse4 = fitr.next(); assertEquals("/e", nse4.getPath()); assertEquals(1, nse4.getNodeState().getChildNodeCount(100)); NodeStateEntry nse5 = fitr.next(); assertEquals("/e/e", nse5.getPath()); assertEquals(0, nse5.getNodeState().getChildNodeCount(100)); assertFalse(fitr.hasNext()); } }
@Test public void getChildNodeLimitedByNonPreferred() { Set<String> preferred = ImmutableSet.of("j:c", "md"); CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/b", "/a/c")); try (FlatFileStoreIterator fitr = newFlatFileStore(citr.iterator(), preferred)) { NodeStateEntry a = fitr.next(); assertEquals("/a", a.getPath()); NodeState aNS = a.getNodeState(); aNS.getChildNode("j:c"); assertEquals(1, fitr.getBufferSize()); Iterators.size(fitr); } }