ACL extends AbstractAccessControlList { @Override public void removeAccessControlEntry(AccessControlEntry ace) throws RepositoryException { ACE entry = checkACE(ace); if (!entries.remove(entry)) { throw new AccessControlException("Cannot remove AccessControlEntry " + ace); } } ACL(@Nullable String oakPath, @Nullable List<ACE> entries,
        @NotNull NamePathMapper namePathMapper); @NotNull @Override List<ACE> getEntries(); @Override void removeAccessControlEntry(AccessControlEntry ace); @Override boolean addEntry(@NotNull Principal principal, @NotNull Privilege[] privileges,
                            boolean isAllow, @Nullable Map<String, Value> restrictions,
                            @Nullable Map<String, Value[]> mvRestrictions); @Override void orderBefore(@NotNull AccessControlEntry srcEntry, @Nullable AccessControlEntry destEntry); @Override String toString();  }
@Test public void testRemoveEntry() throws Exception { assertTrue(acl.addAccessControlEntry(testPrincipal, testPrivileges)); acl.removeAccessControlEntry(acl.getAccessControlEntries()[0]); assertTrue(acl.isEmpty()); }
@Test public void testRemoveEntries() throws Exception { JackrabbitAccessControlList acl = createACL(TEST_PATH, createTestEntries(), namePathMapper); for (AccessControlEntry ace : acl.getAccessControlEntries()) { acl.removeAccessControlEntry(ace); } assertTrue(acl.isEmpty()); }
@Test(expected = AccessControlException.class) public void testRemoveInvalidEntry() throws Exception { acl.removeAccessControlEntry(new JackrabbitAccessControlEntry() { public boolean isAllow() { return false; } @NotNull public String[] getRestrictionNames() { return new String[0]; } @Nullable public Value getRestriction(@NotNull String restrictionName) { return null; } @Nullable public Value[] getRestrictions(@NotNull String restrictionName) { return null; } public Principal getPrincipal() { return testPrincipal; } public Privilege[] getPrivileges() { return testPrivileges; } }); }
@Test(expected = AccessControlException.class) public void testRemoveNonExisting() throws Exception { acl.removeAccessControlEntry(createEntry(testPrincipal, testPrivileges, true)); }