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/09/10 12:22:12 UTC

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

Author: jukka
Date: Fri Sep 10 10:22:12 2010
New Revision: 995736

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

Fix format string error
Add protected methods to allow testing of non-Jackrabbit repositories

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=995736&r1=995735&r2=995736&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 Fri Sep 10 10:22:12 2010
@@ -23,6 +23,7 @@ import java.io.PrintWriter;
 import java.util.Arrays;
 import java.util.regex.Pattern;
 
+import javax.jcr.RepositoryException;
 import javax.jcr.SimpleCredentials;
 
 import org.apache.commons.io.FileUtils;
@@ -30,6 +31,7 @@ import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.output.FileWriterWithEncoding;
 import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
 import org.apache.jackrabbit.core.RepositoryImpl;
+import org.apache.jackrabbit.core.config.ConfigurationException;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
 
 public abstract class AbstractPerformanceTest {
@@ -47,10 +49,7 @@ public abstract class AbstractPerformanc
 
         // Create a repository using the Jackrabbit default configuration
         if (namePattern.matcher(name).matches()) {
-            testPerformance(
-                    name,
-                    RepositoryImpl.class.getResourceAsStream("repository.xml"),
-                    testPattern);
+            testPerformance(name, getDefaultConfig(), testPattern);
         }
 
         // Create repositories for any special configurations included
@@ -138,7 +137,7 @@ public abstract class AbstractPerformanc
                 }
 
                 writer.format(
-                        "%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6d%n",
+                        "%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
                         name,
                         statistics.getMin(),
                         statistics.getPercentile(10.0),
@@ -178,6 +177,16 @@ public abstract class AbstractPerformanc
         }
 
         // Create the repository
+        return createRepository(directory, configuration);
+    }
+
+    protected InputStream getDefaultConfig() {
+        return RepositoryImpl.class.getResourceAsStream("repository.xml");
+    }
+
+    protected RepositoryImpl createRepository(
+            File directory, File configuration)
+            throws RepositoryException, ConfigurationException {
         return RepositoryImpl.create(RepositoryConfig.create(
                 configuration.getPath(), directory.getPath()));
     }