jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1533150 - in /jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark: ConcurrentReadAccessControlledTreeTest.java ConcurrentReadAccessControlledTreeTest2.java ConcurrentReadSinglePolicyTreeTest.java
Date Thu, 17 Oct 2013 16:46:42 GMT
Author: angela
Date: Thu Oct 17 16:46:42 2013
New Revision: 1533150

URL: http://svn.apache.org/r1533150
Log:
OAK-527: benchmark tests (minor improvement)

Modified:
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest2.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadSinglePolicyTreeTest.java

Modified: 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/ConcurrentReadAccessControlledTreeTest.java?rev=1533150&r1=1533149&r2=1533150&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/ConcurrentReadAccessControlledTreeTest.java
Thu Oct 17 16:46:42 2013
@@ -42,16 +42,18 @@ public class ConcurrentReadAccessControl
 
     @Override
     protected void visitingNode(Node node, int i) throws RepositoryException {
-        if (++counter == 10) {
-            addPolicy(node);
-            counter = 0;
-        }
         super.visitingNode(node, i);
+        String path = node.getPath();
+        if (!path.contains("rep:policy")) {
+            if (++counter == 10) {
+                addPolicy(path, node);
+                counter = 0;
+            }
+        }
     }
 
-    private void addPolicy(Node node) throws RepositoryException {
+    private void addPolicy(String path, Node node) throws RepositoryException {
         AccessControlManager acMgr = node.getSession().getAccessControlManager();
-        String path = node.getPath();
         int level = 0;
         if (node.isNodeType(AccessControlConstants.NT_REP_POLICY)) {
             level = 1;

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest2.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest2.java?rev=1533150&r1=1533149&r2=1533150&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest2.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadAccessControlledTreeTest2.java
Thu Oct 17 16:46:42 2013
@@ -61,11 +61,13 @@ public class ConcurrentReadAccessControl
 
     @Override
     protected void visitingNode(Node node, int i) throws RepositoryException {
-        if (++counter == 100) {
-            addPolicy(node);
-            counter = 0;
-        }
         super.visitingNode(node, i);
+        if (!node.getPath().contains("rep:policy")) {
+            if (++counter == 100) {
+                addPolicy(node);
+                counter = 0;
+            }
+        }
     }
 
     private void addPolicy(Node node) throws RepositoryException {

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadSinglePolicyTreeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadSinglePolicyTreeTest.java?rev=1533150&r1=1533149&r2=1533150&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadSinglePolicyTreeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/ConcurrentReadSinglePolicyTreeTest.java
Thu Oct 17 16:46:42 2013
@@ -39,15 +39,16 @@ public class ConcurrentReadSinglePolicyT
 
     @Override
     protected void visitingNode(Node node, int i) throws RepositoryException {
+        super.visitingNode(node, i);
         String path = node.getPath();
         AccessControlManager acMgr = node.getSession().getAccessControlManager();
-        if ("/".equals(path)) {
+        if (testRoot.getPath().equals(path)) {
             JackrabbitAccessControlList policy = AccessControlUtils.getAccessControlList(acMgr,
path);
             if (policy != null) {
                 policy.addEntry(EveryonePrincipal.getInstance(), AccessControlUtils.privilegesFromNames(acMgr,
Privilege.JCR_READ), true);
             }
             acMgr.setPolicy(path, policy);
-        } else {
+        } else if (!path.contains("rep:policy")) {
             for (AccessControlPolicy policy : acMgr.getPolicies(path)) {
                 if (policy instanceof JackrabbitAccessControlList) {
                     acMgr.removePolicy(path, policy);
@@ -55,6 +56,5 @@ public class ConcurrentReadSinglePolicyT
             }
         }
         node.getSession().save();
-        super.visitingNode(node, i);
     }
 }



Mime
View raw message