SLING-11160 : Repoinit does not allow to remove individual ACEs (missing test for matching principal-based entries)
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java b/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java
index e1cba8e..913226b 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java
@@ -710,8 +710,31 @@
U.parseAndExecute(setup);
assertPolicy(principal, U.adminSession, 1);
+ setup = "remove principal ACE for " + U.username + "\n"
+ + "allow jcr:write on " + path + "\n"
+ + "end";
+ U.parseAndExecute(setup);
+ assertPolicy(principal, U.adminSession, 0);
+ }
+
+ @Test
+ public void testRemoveNoMatchingEntry() throws Exception {
+ Principal principal = getPrincipal(U.username);
+ String setup = "set principal ACL for " + U.username + "\n"
+ + "allow jcr:write on "+path+"\n"
+ + "end";
+ U.parseAndExecute(setup);
+ assertPolicy(principal, U.adminSession, 1);
+
// privilege mismatch
setup = "remove principal ACE for " + U.username + "\n"
+ + "allow jcr:read on " + path + "\n"
+ + "end";
+ U.parseAndExecute(setup);
+ assertPolicy(principal, U.adminSession, 1);
+
+ // privilege mismatch 2
+ setup = "remove principal ACE for " + U.username + "\n"
+ "allow jcr:read,jcr:write on " + path + "\n"
+ "end";
U.parseAndExecute(setup);
@@ -732,21 +755,6 @@
assertPolicy(principal, U.adminSession, 1);
}
- @Test
- public void testRemoveNoMatchingEntry() throws Exception {
- Principal principal = getPrincipal(U.username);
- String setup = "set principal ACL for " + U.username + "\n"
- + "allow jcr:write on "+path+"\n"
- + "end";
- U.parseAndExecute(setup);
- assertPolicy(principal, U.adminSession, 1);
-
- setup = "remove principal ACE for " + U.username + "\n"
- + "allow jcr:read on " + path + "\n"
- + "end";
- assertPolicy(principal, U.adminSession, 1);
- }
-
@Test(expected = RepoInitException.class)
public void testRemoveNonExistingPrincipal() throws Exception {
String setup = "remove principal ACE for nonExistingPrincipal\n"