You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2010/10/13 16:27:44 UTC

svn commit: r1022116 - in /jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance: AbstractPerformanceTest.java ReadPropertyTest.java

Author: mreutegg
Date: Wed Oct 13 14:27:43 2010
New Revision: 1022116

URL: http://svn.apache.org/viewvc?rev=1022116&view=rev
Log:
JCR-2695: Jackrabbit performance test suite
- add a property read test

Added:
    jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/ReadPropertyTest.java   (with props)
Modified:
    jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java

Modified: jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java?rev=1022116&r1=1022115&r2=1022116&view=diff
==============================================================================
--- jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java (original)
+++ jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java Wed Oct 13 14:27:43 2010
@@ -91,6 +91,7 @@ public abstract class AbstractPerformanc
 
         runTest(new LoginTest(), name, conf);
         runTest(new LoginLogoutTest(), name, conf);
+        runTest(new ReadPropertyTest(), name, conf);
         runTest(new SetPropertyTest(), name, conf);
         runTest(new SmallFileReadTest(), name, conf);
         runTest(new SmallFileWriteTest(), name, conf);

Added: jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/ReadPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/ReadPropertyTest.java?rev=1022116&view=auto
==============================================================================
--- jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/ReadPropertyTest.java (added)
+++ jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/ReadPropertyTest.java Wed Oct 13 14:27:43 2010
@@ -0,0 +1,57 @@
+/*
+ * 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.performance;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+/**
+ * <code>ReadPropertyTest</code> implements a performance test, which reads
+ * three properties: one with a jcr prefix, one with the empty prefix and a
+ * third one, which does not exist.
+ */
+public class ReadPropertyTest extends AbstractTest {
+
+    private Session session;
+
+    private Node root;
+
+    @Override
+    protected void beforeSuite() throws Exception {
+        session = getRepository().login(getCredentials());
+        root = session.getRootNode().addNode(
+                getClass().getSimpleName(), "nt:unstructured");
+        root.setProperty("property", "value");
+        session.save();
+    }
+
+    @Override
+    protected void runTest() throws Exception {
+        for (int i = 0; i < 100000; i++) {
+            root.getProperty("jcr:primaryType");
+            root.getProperty("property");
+            root.hasProperty("does-not-exist");
+        }
+    }
+
+    @Override
+    protected void afterSuite() throws Exception {
+        root.remove();
+        session.save();
+        session.logout();
+    }
+}

Propchange: jackrabbit/trunk/test/performance/base/src/main/java/org/apache/jackrabbit/performance/ReadPropertyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native