bdelacretaz commented on a change in pull request #22:
URL: 
https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/22#discussion_r816846413



##########
File path: 
src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java
##########
@@ -692,28 +693,64 @@ public void testRemoveMatchingEntry() throws Exception {
         }
     }
 
+    @Test
+    public void testRemoveNoExistingPolicy() throws Exception {
+        String setup = "remove principal ACL for " + U.username + "\n"
+                + "allow jcr:read on " + path + "\n"
+                + "end";
+        U.parseAndExecute(setup);
+    }
+
+    @Test
+    public void testRemoveMatchingEntry() 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 ACL for " + U.username + "\n"
+                + "allow jcr:read,jcr:write on " + path + "\n"
+                + "end";
+        U.parseAndExecute(setup);
+        assertPolicy(principal, U.adminSession, 1);
+
+        // path mismatch
+        setup = "remove principal ACL for " + U.username + "\n"
+                + "allow jcr:write on " + path + "/mismatch\n"
+                + "end";
+        U.parseAndExecute(setup);
+        assertPolicy(principal, U.adminSession, 1);
+
+        // restriction mismatch
+        setup = "remove principal ACL for " + U.username + "\n"
+                + "allow jcr:write on " + path + " restriction(rep:glob, 
/*/jcr:content/*)\n"
+                + "end";
+        U.parseAndExecute(setup);
+        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 = "set principal ACL for " + U.username + "\n"

Review comment:
       IIUC this test goes away with your changes, shouldn't it be kept? To 
test backwards compatibility - even if the corresponding operation is 
deprecated.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to