jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1572179 - in /jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark: BenchmarkRunner.java GetPoliciesTest.java
Date Wed, 26 Feb 2014 18:06:30 GMT
Author: angela
Date: Wed Feb 26 18:06:30 2014
New Revision: 1572179

URL: http://svn.apache.org/r1572179
Log:
OAK-1211: apply patch provided by antonio sanso

Added:
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/GetPoliciesTest.java
  (with props)
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=1572179&r1=1572178&r2=1572179&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
Wed Feb 26 18:06:30 2014
@@ -170,6 +170,7 @@ public class BenchmarkRunner {
             ReadManyTest.uniform("UniformReadNodes", 1, ReadManyTest.NODES),
             new ConcurrentCreateNodesTest(),
             new SequentialCreateNodesTest(),
+            new GetPoliciesTest(),
         };
 
         Set<String> argset = Sets.newHashSet(options.nonOptionArguments());

Added: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/GetPoliciesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/GetPoliciesTest.java?rev=1572179&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/GetPoliciesTest.java
(added)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/GetPoliciesTest.java
Wed Feb 26 18:06:30 2014
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.benchmark;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+import javax.jcr.security.AccessControlManager;
+
+import org.apache.jackrabbit.api.JackrabbitSession;
+import org.apache.jackrabbit.core.security.principal.EveryonePrincipal;
+
+import static javax.jcr.security.Privilege.JCR_READ;
+import static org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils.addAccessControlEntry;
+
+/**
+ * {@code GetPoliciesTest} implements a performance test, which get policies from the
+ * repository.
+ */
+public class GetPoliciesTest extends AbstractTest {
+
+    Session session;
+    private Node testRoot;
+    private String path;
+    private AccessControlManager acm;
+
+    @Override
+    protected void beforeSuite() throws Exception {
+        session = loginWriter();
+        testRoot = session.getRootNode().addNode(
+                getClass().getSimpleName() + TEST_ID, "nt:unstructured");
+        Node n = testRoot.addNode("node1");
+
+        path = n.getPath();
+        addAccessControlEntry(session, n.getPath(),
+                EveryonePrincipal.getInstance(), new String[] { JCR_READ },
+                true);
+        
+        session.save();
+        
+        testRoot = loginWriter().getNode(testRoot.getPath());
+        acm = ((JackrabbitSession) testRoot.getSession()).getAccessControlManager();
+
+        session.logout();
+    }
+
+    @Override
+    protected void runTest() throws Exception {
+        for (int i = 0; i < 10000; i++) {
+            acm.getPolicies(path);
+        }
+
+    }
+
+    @Override
+    protected void afterSuite() throws Exception {
+        Session session = loginWriter();
+        session.getNode(testRoot.getPath()).remove();
+        testRoot.getSession().logout();
+        session.save();
+        session.logout();
+    }
+
+}

Propchange: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/GetPoliciesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message