You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2017/02/06 10:51:34 UTC

svn commit: r1781873 - /sling/trunk/bundles/jcr/repoinit/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java

Author: bdelacretaz
Date: Mon Feb  6 10:51:34 2017
New Revision: 1781873

URL: http://svn.apache.org/viewvc?rev=1781873&view=rev
Log:
SLING-6182 - use a distinct session to set ACLs, test still passes

Modified:
    sling/trunk/bundles/jcr/repoinit/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java

Modified: sling/trunk/bundles/jcr/repoinit/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/repoinit/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java?rev=1781873&r1=1781872&r2=1781873&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/repoinit/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java (original)
+++ sling/trunk/bundles/jcr/repoinit/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java Mon Feb  6 10:51:34 2017
@@ -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