EntryCache implements Constants { @NotNull Iterator<PermissionEntry> getEntries(@NotNull String path) { Iterable<PermissionEntry> list = entries.get(path); return (list == null) ? Collections.emptyIterator() : list.iterator(); } EntryCache(@NotNull Root root, @NotNull Iterable<String> principalPathSet, @NotNull RestrictionProvider restrictionProvider);   }
@Test public void testNoEntries() { EntryCache cache = new EntryCache(root, ImmutableSet.of(accessControlledPath), restrictionProvider); assertFalse(cache.getEntries(TEST_OAK_PATH).hasNext()); }
@Test public void testNonEntryChild() throws Exception { TreeUtil.addChild(policyTree, "invalidChild", NT_OAK_UNSTRUCTURED); EntryCache cache = new EntryCache(root, ImmutableSet.of(accessControlledPath), restrictionProvider); assertFalse(cache.getEntries(TEST_OAK_PATH).hasNext()); }
@Test public void testMissingEntriesForTestPath() throws Exception { Tree entry = TreeUtil.addChild(policyTree, "entry1", NT_REP_PRINCIPAL_ENTRY); entry.setProperty(REP_EFFECTIVE_PATH, PathUtils.ROOT_PATH, Type.PATH); entry.setProperty(REP_PRIVILEGES, ImmutableSet.of(JCR_READ), Type.NAMES); EntryCache cache = new EntryCache(root, ImmutableSet.of(accessControlledPath), restrictionProvider); assertFalse(cache.getEntries(TEST_OAK_PATH).hasNext()); }
@Test public void testEntriesForTestPath() throws Exception { Tree entry = TreeUtil.addChild(policyTree, "entry1", NT_REP_PRINCIPAL_ENTRY); entry.setProperty(REP_EFFECTIVE_PATH, TEST_OAK_PATH, Type.PATH); entry.setProperty(REP_PRIVILEGES, ImmutableSet.of(JCR_READ), Type.NAMES); EntryCache cache = new EntryCache(root, ImmutableSet.of(accessControlledPath), restrictionProvider); assertTrue(cache.getEntries(TEST_OAK_PATH).hasNext()); }