jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r633876 - in /jackrabbit/trunk: ./ jackrabbit-jcr-benchmark/ jackrabbit-jcr-benchmark/src/ jackrabbit-jcr-benchmark/src/main/ jackrabbit-jcr-benchmark/src/main/java/ jackrabbit-jcr-benchmark/src/main/java/org/ jackrabbit-jcr-benchmark/src/m...
Date Wed, 05 Mar 2008 15:22:14 GMT
Author: reschke
Date: Wed Mar  5 07:22:13 2008
New Revision: 633876

URL: http://svn.apache.org/viewvc?rev=633876&view=rev
Log:
JCR-1437: benchmark related test suite, including one initial test class testing big collections.

Added:
    jackrabbit/trunk/jackrabbit-jcr-benchmark/   (with props)
    jackrabbit/trunk/jackrabbit-jcr-benchmark/pom.xml   (with props)
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java
  (with props)
    jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java
  (with props)
Modified:
    jackrabbit/trunk/pom.xml

Propchange: jackrabbit/trunk/jackrabbit-jcr-benchmark/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Mar  5 07:22:13 2008
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project

Added: jackrabbit/trunk/jackrabbit-jcr-benchmark/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-benchmark/pom.xml?rev=633876&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-benchmark/pom.xml (added)
+++ jackrabbit/trunk/jackrabbit-jcr-benchmark/pom.xml Wed Mar  5 07:22:13 2008
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                             http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+<!-- ====================================================================== -->
+<!-- P R O J E C T  D E S C R I P T I O N                                   -->
+<!-- ====================================================================== -->
+  <parent>
+    <groupId>org.apache.jackrabbit</groupId>
+    <artifactId>jackrabbit</artifactId>
+    <version>1.5-SNAPSHOT</version>
+  </parent>
+  <artifactId>jackrabbit-jcr-benchmarks</artifactId>
+  <name>Jackrabbit JCR Benchmarks</name>
+  <description>JCR Benchmarks</description>
+
+  <scm>
+    <connection>
+      scm:svn:http://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-jcr-benchmark
+    </connection>
+    <developerConnection>
+      scm:svn:https://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-jcr-benchmark
+    </developerConnection>
+    <url>http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-benchmark</url>
+  </scm>
+
+  <dependencies>
+    <dependency>
+      <groupId>javax.jcr</groupId>
+      <artifactId>jcr</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-jcr-tests</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>

Propchange: jackrabbit/trunk/jackrabbit-jcr-benchmark/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java?rev=633876&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java
Wed Mar  5 07:22:13 2008
@@ -0,0 +1,28 @@
+/*
+ * 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.benchmark;
+
+import junit.framework.TestSuite;
+
+public class BenchmarkSuite extends TestSuite {
+
+    public BenchmarkSuite() {
+        super("JCR Benchmarks");
+        addTestSuite(BigCollectionTest.class);
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BenchmarkSuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java?rev=633876&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java
Wed Mar  5 07:22:13 2008
@@ -0,0 +1,139 @@
+/*
+ * 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.benchmark;
+
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import java.util.Calendar;
+
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BigCollectionTest extends AbstractJCRTest {
+
+  private static final Logger LOG = LoggerFactory.getLogger(BigCollectionTest.class);
+
+  private static int MEMBERS = 500;
+  private static int MEMBERSIZE = 1024;
+  private static String MIMETYPE = "application/octet-stream";
+  private static int MINTIME = 1000;
+  private static int MINCOUNT = 5;
+
+  protected void setUp() throws Exception {
+      super.setUp();
+
+      Session session = testRootNode.getSession();
+      Node folder = null;
+      try {
+          folder = testRootNode.getNode("bigcoll");
+      }
+      catch (RepositoryException ex) {
+        // nothing to do
+      }
+        
+      // delete when needed
+      if (folder != null) {
+          folder.remove();
+          session.save();
+      }
+        
+      folder = testRootNode.addNode("bigcoll", "nt:folder");
+
+      long cnt = 0;
+
+      while (cnt < MEMBERS) {
+          InputStream is = new BufferedInputStream(new ContentGenerator(MEMBERSIZE), MEMBERSIZE);
+          Node l_new = folder.addNode("tst" + cnt, "nt:file");
+          Node l_cnew = l_new.addNode("jcr:content", "nt:resource");
+          l_cnew.setProperty("jcr:data", is);
+          l_cnew.setProperty("jcr:mimeType", MIMETYPE);
+          l_cnew.setProperty("jcr:lastModified", Calendar.getInstance());
+          cnt += 1;
+      }
+      session.save();
+  }
+
+  protected void tearDown() throws Exception {
+      try {
+          Node folder = testRootNode.getNode("bigcoll");
+          folder.remove();
+          folder.getSession().save();
+      }
+      catch (RepositoryException ex) {
+          // nothing to do
+      }
+      super.tearDown();
+  }
+  
+  public void testBrowse() throws RepositoryException {
+      Session session = testRootNode.getSession();
+      
+      long start = System.currentTimeMillis();
+      long cnt = 0;
+
+      while (System.currentTimeMillis() - start < MINTIME || cnt < MINCOUNT) {
+          Node dir = testRootNode.getNode("bigcoll");
+          int members = 0;
+          for (NodeIterator it = dir.getNodes(); it.hasNext(); ) {
+              Node child = it.nextNode();
+              Node content = child.getNode("jcr:content");
+              String type = content.getProperty("jcr:mimeType").getString();
+              long length = content.getProperty("jcr:data").getLength();
+              assertTrue(child.isNode());
+              assertEquals(MIMETYPE, type);
+              assertEquals(MEMBERSIZE, length);
+              members += 1;
+          }
+          assertEquals(MEMBERS, members);
+          session.refresh(false);
+          cnt += 1;
+      }
+      
+      long elapsed = System.currentTimeMillis() - start;
+      
+      LOG.info("testBrowse: " +  (double)elapsed / cnt + "ms per call (" + cnt + " iterations)");
+  }
+
+  private class ContentGenerator extends InputStream {
+
+    private long length;
+    private long position;
+
+    public ContentGenerator(long length) {
+        this.length = length;
+        this.position = 0;
+    }
+
+    public int read() {
+        if (this.position++ < this.length) {
+            return 0;
+        }
+        else {
+            return -1;
+        }
+    }
+  }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-benchmark/src/main/java/org/apache/jackrabbit/benchmark/BigCollectionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/pom.xml?rev=633876&r1=633875&r2=633876&view=diff
==============================================================================
--- jackrabbit/trunk/pom.xml (original)
+++ jackrabbit/trunk/pom.xml Wed Mar  5 07:22:13 2008
@@ -57,6 +57,7 @@
     <module>jackrabbit-api</module>
     <module>jackrabbit-jcr-commons</module>
     <module>jackrabbit-jcr-tests</module>
+    <module>jackrabbit-jcr-benchmark</module>
     <module>jackrabbit-core</module>
     <module>jackrabbit-text-extractors</module>
     <module>jackrabbit-jcr-rmi</module>



Mime
View raw message