You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2010/08/03 15:26:04 UTC

svn commit: r981864 - in /jackrabbit/trunk/jackrabbit-core/src/test/performance: ./ base/ base/src/ base/src/main/ base/src/main/java/ base/src/main/java/org/ base/src/main/java/org/apache/ base/src/main/java/org/apache/jackrabbit/ base/src/main/java/o...

Author: jukka
Date: Tue Aug  3 13:26:03 2010
New Revision: 981864

URL: http://svn.apache.org/viewvc?rev=981864&view=rev
Log:
JCR-2695: Jackrabbit performance test suite

Basic test suite structure. Work in progress...

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/performance/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/pom.xml   (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java   (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/resources/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/resources/log4j.properties   (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/pom.xml   (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/
    jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java   (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/performance/pom.xml   (with props)

Added: jackrabbit/trunk/jackrabbit-core/src/test/performance/base/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/performance/base/pom.xml?rev=981864&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/performance/base/pom.xml (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/performance/base/pom.xml Tue Aug  3 13:26:03 2010
@@ -0,0 +1,63 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.jackrabbit</groupId>
+    <artifactId>jackrabbit-perf-parent</artifactId>
+    <version>SNAPSHOT</version>
+    <relativePath>../parent/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>jackrabbit-perf-base</artifactId>
+  <version>SNAPSHOT</version>
+  <name>Jackrabbit Performance Test Utilities</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>javax.jcr</groupId>
+      <artifactId>jcr</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <version>1.4</version> <!-- overridden by downstream projects -->
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>1.4</version>
+    </dependency>
+    <dependency>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+      <classifier>jdk15</classifier>
+      <version>5.8</version>
+    </dependency>
+  </dependencies>
+
+</project>
+

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/performance/base/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java?rev=981864&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java Tue Aug  3 13:26:03 2010
@@ -0,0 +1,112 @@
+/*
+ * 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 static org.testng.AssertJUnit.fail;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Random;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionHistory;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
+import org.apache.jackrabbit.core.RepositoryImpl;
+import org.apache.jackrabbit.core.config.RepositoryConfig;
+
+public abstract class AbstractPerformanceTest {
+
+    protected void createRepositories(String name) throws Exception {
+        // Create a repository using the Jackrabbit default configuration
+        createRepository(
+                name,
+                RepositoryImpl.class.getResourceAsStream("repository.xml"));
+
+        // Create repositories for any special configurations included
+        File directory = new File(new File("src", "test"), "resources");
+        File[] files = directory.listFiles();
+        if (files != null) {
+            Arrays.sort(files);
+            for (File file : files) {
+                String xml = file.getName();
+                if (file.isFile() && xml.endsWith(".xml")) {
+                    createRepository(
+                            name + "-" + xml.substring(0, xml.length() - 4),
+                            FileUtils.openInputStream(file));
+                }
+            }
+        }
+    }
+
+    /**
+     * Creates a named test repository with the given configuration file.
+     *
+     * @param name name of the repository
+     * @param xml input stream for reading the repository configuration
+     * @throws Exception if the repository could not be created
+     */
+    protected void createRepository(String name, InputStream xml)
+            throws Exception {
+        File directory = new File(new File("target", "repository"), name);
+        File configuration = new File(directory, "repository.xml");
+
+        // Copy the configuration file into the repository directory
+        try {
+            OutputStream output = FileUtils.openOutputStream(configuration);
+            try {
+                IOUtils.copy(xml, output);
+            } finally {
+                output.close();
+            }
+        } finally {
+            xml.close();
+        }
+
+        // Create the repository
+        try {
+            RepositoryConfig config = RepositoryConfig.create(
+                    configuration.getPath(), directory.getPath());
+            RepositoryImpl repository = RepositoryImpl.create(config);
+            try {
+                Session session = repository.login(
+                        new SimpleCredentials("admin", "admin".toCharArray()));
+                try {
+                    createTestData(session);
+                } finally {
+                    session.logout();
+                }
+            } finally {
+                repository.shutdown();
+            }
+        } catch (RepositoryException e) {
+            e.printStackTrace();
+            fail("Create repository " + name);
+        }
+    }
+
+}

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

Added: jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/resources/log4j.properties?rev=981864&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/resources/log4j.properties (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/resources/log4j.properties Tue Aug  3 13:26:03 2010
@@ -0,0 +1,21 @@
+#  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.
+
+log4j.rootLogger=INFO, file
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.File=target/jcr.log
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L)\n
+

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/pom.xml?rev=981864&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/pom.xml (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/pom.xml Tue Aug  3 13:26:03 2010
@@ -0,0 +1,58 @@
+<?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>
+
+  <parent>
+    <groupId>org.apache.jackrabbit</groupId>
+    <artifactId>jackrabbit-perf-parent</artifactId>
+    <version>SNAPSHOT</version>
+    <relativePath>../parent/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>jackrabbit-perf-jackrabbit10</artifactId>
+  <name>Jackrabbit 1.0 Performance Test</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-perf-base</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <version>1.0</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>jsr170</groupId>
+          <artifactId>jcr</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+  </dependencies>
+
+</project>
+

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java?rev=981864&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java Tue Aug  3 13:26:03 2010
@@ -0,0 +1,21 @@
+/*
+ * 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;
+
+public class PerformanceTest extends AbstractPerformanceTest {
+
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-core/src/test/performance/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/performance/pom.xml?rev=981864&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/performance/pom.xml (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/performance/pom.xml Tue Aug  3 13:26:03 2010
@@ -0,0 +1,47 @@
+<?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-perf-parent</artifactId>
+    <version>SNAPSHOT</version>
+    <relativePath>parent/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>jackrabbit-perf</artifactId>
+  <name>Jackrabbit Performance Tests</name>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>parent</module>
+    <module>base</module>
+    <module>jackrabbit21</module>
+  </modules>
+
+</project>

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/performance/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native