Oak-run indexing fails with 'This map is closed' (fix test case)
@@ -62,7 +62,7 @@ public class FlatFileStoreIteratorTest {
CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/jcr:content", "/a/jcr:content/metadata",
"/a/d", "/e", "/e/e"));
- FlatFileStoreIterator fitr = newFlatFileStore(citr.iterator(), preferred);
+ try (FlatFileStoreIterator fitr = newFlatFileStore(citr.iterator(), preferred)) {
NodeStateEntry a = fitr.next();
assertEquals("/a", a.getPath());
@@ -94,6 +94,7 @@ public class FlatFileStoreIteratorTest {
assertFalse(fitr.hasNext());
}
+ }
@Test
public void invalidOrderAccess() {
@@ -101,7 +102,7 @@ public class FlatFileStoreIteratorTest {
CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/jcr:content", "/a/jcr:content/metadata",
"/a/d", "/e"));
- FlatFileStoreIterator fitr = newFlatFileStore(citr.iterator(), preferred);
+ try (FlatFileStoreIterator fitr = newFlatFileStore(citr.iterator(), preferred)) {
NodeStateEntry a = fitr.next();
assertEquals("/a", a.getPath());
@@ -120,7 +121,7 @@ public class FlatFileStoreIteratorTest {
ns1.getChildNodeCount(100);
fail("Access should have failed");
} catch (IllegalStateException ignore) {
-
+ }
}
}
@@ -131,8 +132,7 @@ public class FlatFileStoreIteratorTest {
CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/j:c", "/a/j:c/j:c", "/a/b"));
- FlatFileStoreIterator fitr = newFlatFileStore(citr.iterator(), preferred);
-
+ try (FlatFileStoreIterator fitr = newFlatFileStore(citr.iterator(), preferred)) {
NodeStateEntry a = fitr.next();
assertEquals("/a", a.getPath());
@@ -147,6 +147,7 @@ public class FlatFileStoreIteratorTest {
}
}
}
+ }
// OAK-7285
@Test
@@ -156,7 +157,7 @@ public class FlatFileStoreIteratorTest {
CountingIterable<NodeStateEntry> citr = createList(preferred, asList("/a", "/a/b", "/a/c"));
- FlatFileStoreIterator fitr = newFlatFileStore(citr.iterator(), preferred);
+ try (FlatFileStoreIterator fitr = newFlatFileStore(citr.iterator(), preferred)) {
NodeStateEntry a = fitr.next();
assertEquals("/a", a.getPath());
@@ -170,6 +171,7 @@ public class FlatFileStoreIteratorTest {
// read remaining entries to trigger release of resources
Iterators.size(fitr);
}
+ }
@Test
public void bufferEstimatesMemory() {
