jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r981895 - in /jackrabbit/trunk/jackrabbit-core/src/test/performance: base/ base/src/main/java/org/apache/jackrabbit/performance/ jackrabbit10/src/test/java/org/apache/jackrabbit/performance/
Date Tue, 03 Aug 2010 14:14:31 GMT
Author: jukka
Date: Tue Aug  3 14:14:31 2010
New Revision: 981895

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

Use the benchmarks from jackrabbit-jcr-benchmark

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/pom.xml
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java

Modified: 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=981895&r1=981894&r2=981895&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/performance/base/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/performance/base/pom.xml Tue Aug  3 14:14:31
2010
@@ -42,8 +42,13 @@
     </dependency>
     <dependency>
       <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-jcr-benchmark</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-core</artifactId>
-      <version>1.4</version> <!-- overridden by downstream projects -->
+      <version>1.6.2</version> <!-- overridden by downstream projects -->
       <scope>provided</scope>
     </dependency>
     <dependency>
@@ -52,6 +57,11 @@
       <version>1.4</version>
     </dependency>
     <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-nop</artifactId>
+      <version>1.5.8</version>
+    </dependency>
+    <dependency>
       <groupId>org.testng</groupId>
       <artifactId>testng</artifactId>
       <classifier>jdk15</classifier>

Modified: 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=981895&r1=981894&r2=981895&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
Tue Aug  3 14:14:31 2010
@@ -35,15 +35,17 @@ 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;
+import org.apache.jackrabbit.benchmark.PerformanceTestSuite;
+import org.apache.jackrabbit.benchmark.LoginTest;
+import org.apache.jackrabbit.benchmark.LoginLogoutTest;
 
 public abstract class AbstractPerformanceTest {
 
-    protected void createRepositories(String name) throws Exception {
+    protected void testPerformance(String name) throws Exception {
         // Create a repository using the Jackrabbit default configuration
-        createRepository(
+        testPerformance(
                 name,
                 RepositoryImpl.class.getResourceAsStream("repository.xml"));
 
@@ -55,7 +57,7 @@ public abstract class AbstractPerformanc
             for (File file : files) {
                 String xml = file.getName();
                 if (file.isFile() && xml.endsWith(".xml")) {
-                    createRepository(
+                    testPerformance(
                             name + "-" + xml.substring(0, xml.length() - 4),
                             FileUtils.openInputStream(file));
                 }
@@ -63,6 +65,20 @@ public abstract class AbstractPerformanc
         }
     }
 
+    protected void testPerformance(String name, InputStream xml)
+            throws Exception {
+        RepositoryImpl repository = createRepository(name, xml);
+        try {
+            PerformanceTestSuite suite = new PerformanceTestSuite(
+                    repository,
+                    new SimpleCredentials("admin", "admin".toCharArray()));
+            suite.runTest(new LoginTest());
+            suite.runTest(new LoginLogoutTest());
+        } finally {
+            repository.shutdown();
+        }
+    }
+
     /**
      * Creates a named test repository with the given configuration file.
      *
@@ -70,7 +86,7 @@ public abstract class AbstractPerformanc
      * @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)
+    private RepositoryImpl createRepository(String name, InputStream xml)
             throws Exception {
         File directory = new File(new File("target", "repository"), name);
         File configuration = new File(directory, "repository.xml");
@@ -88,25 +104,8 @@ public abstract class AbstractPerformanc
         }
 
         // 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);
-        }
+        return RepositoryImpl.create(RepositoryConfig.create(
+                configuration.getPath(), directory.getPath()));
     }
 
 }

Modified: 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=981895&r1=981894&r2=981895&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/performance/jackrabbit10/src/test/java/org/apache/jackrabbit/performance/PerformanceTest.java
Tue Aug  3 14:14:31 2010
@@ -16,6 +16,13 @@
  */
 package org.apache.jackrabbit.performance;
 
+import org.testng.annotations.Test;
+
 public class PerformanceTest extends AbstractPerformanceTest {
 
+    @Test
+    public void testPerformance() throws Exception {
+        testPerformance("jackrabbit10");
+    }
+
 }



Mime
View raw message