jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1531044 - in /jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark: BenchmarkRunner.java ConcurrentReadAccessControlledTreeTest2.java
Date Thu, 10 Oct 2013 16:31:40 GMT
Author: angela
Date: Thu Oct 10 16:31:39 2013
New Revision: 1531044

URL: http://svn.apache.org/r1531044
Log:
OAK-527: more benchmark tests

Added:
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest2.java
      - copied, changed from r1530184, jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest.java
Modified:
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java?rev=1531044&r1=1531043&r2=1531044&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
Thu Oct 10 16:31:39 2013
@@ -115,12 +115,17 @@ public class BenchmarkRunner {
                     runAsAdmin.value(options),
                     itemsToRead.value(options),
                     report.value(options)),
+            new ConcurrentReadDeepTreeTest(
+                    runAsAdmin.value(options),
+                    itemsToRead.value(options),
+                    bgReaders.value(options),
+                    report.value(options)),
             new ConcurrentReadAccessControlledTreeTest(
                     runAsAdmin.value(options),
                     itemsToRead.value(options),
                     bgReaders.value(options),
                     report.value(options)),
-            new ConcurrentReadDeepTreeTest(
+            new ConcurrentReadAccessControlledTreeTest2(
                     runAsAdmin.value(options),
                     itemsToRead.value(options),
                     bgReaders.value(options),

Copied: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest2.java
(from r1530184, jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest2.java?p2=jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest2.java&p1=jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest.java&r1=1530184&r2=1531044&rev=1531044&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest2.java
Thu Oct 10 16:31:39 2013
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.oak.benchmark;
 
+import java.security.Principal;
+import java.util.ArrayList;
+import java.util.List;
 import javax.jcr.ItemVisitor;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
@@ -26,18 +29,22 @@ import javax.jcr.security.AccessControlP
 import javax.jcr.security.Privilege;
 import javax.jcr.util.TraversingItemVisitor;
 
-import org.apache.jackrabbit.core.security.principal.EveryonePrincipal;
+import org.apache.jackrabbit.api.JackrabbitSession;
+import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.api.security.user.UserManager;
 import org.apache.jackrabbit.oak.spi.security.authorization.accesscontrol.AccessControlConstants;
 import org.apache.jackrabbit.util.Text;
 
 /**
- * Concurrently reads random items from the deep tree where every 10th node is
- * access controlled.
+ * Concurrently reads random items from the deep tree where every 100th node
+ * is access controlled and each policy node contains 100 ACEs for different
+ * principals.
  */
-public class ConcurrentReadAccessControlledTreeTest
-        extends ConcurrentReadDeepTreeTest {
+public class ConcurrentReadAccessControlledTreeTest2 extends ConcurrentReadDeepTreeTest {
 
-    public ConcurrentReadAccessControlledTreeTest(
+    List<Principal> principals = new ArrayList();
+
+    public ConcurrentReadAccessControlledTreeTest2(
             boolean runAsAdmin, int itemsToRead, int bgReaders, boolean doReport) {
         super(runAsAdmin, itemsToRead, bgReaders, doReport);
     }
@@ -46,11 +53,20 @@ public class ConcurrentReadAccessControl
     protected void beforeSuite() throws Exception {
         super.beforeSuite();
 
+        UserManager uMgr = ((JackrabbitSession) adminSession).getUserManager();
+        for (int i = 0; i < 100; i++) {
+            Authorizable a = uMgr.getAuthorizable("group" + i);
+            if (a == null) {
+                a = uMgr.createGroup("group" + i);
+                principals.add(a.getPrincipal());
+            }
+        }
+
         ItemVisitor visitor = new TraversingItemVisitor.Default() {
             int counter = 0;
             @Override
             protected void entering(Node node, int level) throws RepositoryException {
-                if (++counter == 10) {
+                if (++counter == 100) {
                     addPolicy(node);
                     counter = 0;
                 }
@@ -80,10 +96,11 @@ public class ConcurrentReadAccessControl
                                 acMgr.privilegeFromName(Privilege.JCR_READ),
                                 acMgr.privilegeFromName(Privilege.JCR_READ_ACCESS_CONTROL)
                         };
-                        if (acl.addAccessControlEntry(EveryonePrincipal.getInstance(), privileges))
{
-                            acMgr.setPolicy(path, acl);
-                            node.getSession().save();
+                        for (Principal principal : principals) {
+                            acl.addAccessControlEntry(principal, privileges);
                         }
+                        acMgr.setPolicy(path, acl);
+                        adminSession.save();
                     }
                 }
             }



Mime
View raw message