You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:50:30 UTC

[sling-org-apache-sling-jcr-repoinit] 06/14: SLING-6182 - use a distinct session to set ACLs, test still passes

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.repoinit-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 41bcdd93d01a11795f2445c14f746ae0d7c17c3a
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Mon Feb 6 10:51:34 2017 +0000

    SLING-6182 - use a distinct session to set ACLs, test still passes
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/repoinit@1781873 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java b/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java
index 89956b3..b1970c4 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java
@@ -21,6 +21,7 @@ import java.util.UUID;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
 import org.apache.sling.repoinit.parser.RepoInitParsingException;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
@@ -70,7 +71,9 @@ public class ManyServiceUsersTest {
         final String path = testRoot.getPath();
         s.save();
         
+        Session otherSession = null;
         try {
+            otherSession = s.getRepository().login(new SimpleCredentials("admin", "admin".toCharArray()));
             for(int i=1; i < N_USERS; i++) {
                 final String username = getClass().getSimpleName() + "_" + uniqueId + "_" + i;
                 UserUtil.createServiceUser(s, username);
@@ -80,7 +83,7 @@ public class ManyServiceUsersTest {
                 s.save();
                 
                 try {
-                    AclUtil.setAcl(s, Arrays.asList(username), Arrays.asList(path), Arrays.asList("jcr:read"), true);
+                    AclUtil.setAcl(otherSession, Arrays.asList(username), Arrays.asList(path), Arrays.asList("jcr:read"), true);
                 } catch(Exception e) {
                     fail("SetAcl failed at index " + i + ": " + e);
                 }
@@ -88,6 +91,9 @@ public class ManyServiceUsersTest {
         } finally {
             testRoot.remove();
             s.save();
+            if(otherSession != null) {
+                otherSession.logout();
+            }
         }
     }
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.