jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1449629 - in /jackrabbit/oak/trunk/oak-run: ./ src/main/java/org/apache/jackrabbit/oak/benchmark/ src/main/java/org/apache/jackrabbit/oak/fixture/ src/main/java/org/apache/jackrabbit/oak/run/
Date Mon, 25 Feb 2013 09:46:52 GMT
Author: jukka
Date: Mon Feb 25 09:46:51 2013
New Revision: 1449629

URL: http://svn.apache.org/r1449629
Log:
OAK-641: Improved benchmark tooling

Further benchmark refactoring:
- extract the Benchmark interface
- allow command line options to fixtures

Added:
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
Modified:
    jackrabbit/oak/trunk/oak-run/pom.xml
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/Benchmark.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/JackrabbitRepositoryFixture.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/RepositoryFixture.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java

Modified: jackrabbit/oak/trunk/oak-run/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/pom.xml?rev=1449629&r1=1449628&r2=1449629&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-run/pom.xml Mon Feb 25 09:46:51 2013
@@ -150,6 +150,11 @@
       <version>${jetty.version}</version>
     </dependency>
     <dependency>
+      <groupId>net.sf.jopt-simple</groupId>
+      <artifactId>jopt-simple</artifactId>
+      <version>4.4</version>
+    </dependency>
+    <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
       <version>1.0.1</version>

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java?rev=1449629&r1=1449628&r2=1449629&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
Mon Feb 25 09:46:51 2013
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.oak.benchm
 
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 import javax.jcr.Credentials;
@@ -33,7 +32,7 @@ import org.apache.jackrabbit.oak.fixture
 /**
  * Abstract base class for individual performance benchmarks.
  */
-public abstract class AbstractTest {
+public abstract class AbstractTest implements Benchmark {
 
     private Repository repository;
 
@@ -72,31 +71,33 @@ public abstract class AbstractTest {
         beforeSuite();
     }
 
-    public void run(Map<String, RepositoryFixture> fixtures) throws Exception {
+    @Override
+    public void run(Iterable<RepositoryFixture> fixtures) {
         System.out.format(
                 "# %-34.34s     min     10%%     50%%     90%%     max       N%n",
                 toString());
-        for (Map.Entry<String, RepositoryFixture> fixture : fixtures.entrySet()) {
-            Repository[] cluster = new Repository[1];
-            fixture.getValue().setUpCluster(cluster);
+        for (RepositoryFixture fixture : fixtures) {
             try {
-                // Run the test
-                DescriptiveStatistics statistics = runTest(cluster[0]);
-                if (statistics.getN() > 0) {
-                    System.out.format(
-                            "%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f  %6d%n",
-                            fixture.getKey(),
-                            statistics.getMin(),
-                            statistics.getPercentile(10.0),
-                            statistics.getPercentile(50.0),
-                            statistics.getPercentile(90.0),
-                            statistics.getMax(),
-                            statistics.getN());
+                Repository[] cluster = fixture.setUpCluster(1);
+                try {
+                    // Run the test
+                    DescriptiveStatistics statistics = runTest(cluster[0]);
+                    if (statistics.getN() > 0) {
+                        System.out.format(
+                                "%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f  %6d%n",
+                                fixture.toString(),
+                                statistics.getMin(),
+                                statistics.getPercentile(10.0),
+                                statistics.getPercentile(50.0),
+                                statistics.getPercentile(90.0),
+                                statistics.getMax(),
+                                statistics.getN());
+                    }
+                } finally {
+                    fixture.tearDownCluster();
                 }
             } catch (Exception e) {
                 e.printStackTrace();
-            } finally {
-                fixture.getValue().tearDownCluster(cluster);
             }
         }
     }

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/Benchmark.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/Benchmark.java?rev=1449629&r1=1449628&r2=1449629&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/Benchmark.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/Benchmark.java
Mon Feb 25 09:46:51 2013
@@ -16,70 +16,16 @@
  */
 package org.apache.jackrabbit.oak.benchmark;
 
-import java.util.List;
-import java.util.Map;
-
-import org.apache.jackrabbit.oak.fixture.JackrabbitRepositoryFixture;
-import org.apache.jackrabbit.oak.fixture.OakRepositoryFixture;
 import org.apache.jackrabbit.oak.fixture.RepositoryFixture;
 
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-public class Benchmark {
-
-    private static final Map<String, RepositoryFixture> FIXTURES =
-            ImmutableMap.<String, RepositoryFixture>builder()
-            .put("Jackrabbit", new JackrabbitRepositoryFixture())
-            .put("Oak-Memory", OakRepositoryFixture.getMemory())
-            .put("Oak-Default", OakRepositoryFixture.getDefault())
-            .put("Oak-Mongo", OakRepositoryFixture.getMongo())
-            .put("Oak-NewMongo", OakRepositoryFixture.getNewMongo())
-            .put("Oak-Segment", OakRepositoryFixture.getSegment())
-            .build();
-
-    private static final Map<String, AbstractTest> TESTS =
-            ImmutableMap.<String, AbstractTest>builder()
-            .put("Login",           new LoginTest())
-            .put("LoginLogout",     new LoginLogoutTest())
-            .put("GetProperty",     new ReadPropertyTest())
-            .put("SetProperty",     new SetPropertyTest())
-            .put("SmallRead",       new SmallFileReadTest())
-            .put("SmallWrite",      new SmallFileWriteTest())
-            .put("ConcurrentRead",  new ConcurrentReadTest())
-            .put("ConcurrentWrite", new ConcurrentReadWriteTest())
-            .put("SimpleSearch",    new SimpleSearchTest())
-            .put("SQL2",            new SQL2SearchTest())
-            .put("Descendant",      new DescendantSearchTest())
-            .put("SQL2Descendant",  new SQL2DescendantSearchTest())
-            .put("CreateFlatNode",  new CreateManyChildNodesTest())
-            .put("UpdateFlatNode", new UpdateManyChildNodesTest())
-            .put("TransientSpace", new TransientManyChildNodesTest())
-            .build();
-
-    public static void main(String[] args) throws Exception {
-        Map<String, RepositoryFixture> fixtures = Maps.newLinkedHashMap();
-        List<AbstractTest> tests = Lists.newArrayList();
-        for (String name : args) {
-            if (FIXTURES.containsKey(name)) {
-                fixtures.put(name, FIXTURES.get(name));
-            } else if (TESTS.containsKey(name)) {
-                tests.add(TESTS.get(name));
-            } else {
-                throw new RuntimeException("Unknown argument: " + name);
-            }
-        }
-        if (fixtures.isEmpty()) {
-            fixtures.putAll(FIXTURES);
-        }
-        if (tests.isEmpty()) {
-            tests.addAll(TESTS.values());
-        }
+public interface Benchmark {
 
-        for (AbstractTest test : tests) {
-            test.run(fixtures);
-        }
-    }
+    /**
+     * Runs this benchmark against all the given repository fixtures.
+     * The benchmark report is written to standard output.
+     *
+     * @param fixtures repository fixtures
+     */
+    void run(Iterable<RepositoryFixture> fixtures);
 
-}
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java?rev=1449629&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
(added)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java
Mon Feb 25 09:46:51 2013
@@ -0,0 +1,100 @@
+/*
+ * 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.oak.benchmark;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+import joptsimple.OptionParser;
+import joptsimple.OptionSet;
+import joptsimple.OptionSpec;
+
+import org.apache.jackrabbit.oak.fixture.JackrabbitRepositoryFixture;
+import org.apache.jackrabbit.oak.fixture.OakRepositoryFixture;
+import org.apache.jackrabbit.oak.fixture.RepositoryFixture;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+public class BenchmarkRunner {
+
+    private static final Benchmark[] BENCHMARKS = new Benchmark[] {
+            new LoginTest(),
+            new LoginLogoutTest(),
+            new ReadPropertyTest(),
+            new SetPropertyTest(),
+            new SmallFileReadTest(),
+            new SmallFileWriteTest(),
+            new ConcurrentReadTest(),
+            new ConcurrentReadWriteTest(),
+            new SimpleSearchTest(),
+            new SQL2SearchTest(),
+            new DescendantSearchTest(),
+            new SQL2DescendantSearchTest(),
+            new CreateManyChildNodesTest(),
+            new UpdateManyChildNodesTest(),
+            new TransientManyChildNodesTest() };
+
+    public static void main(String[] args) throws Exception {
+        OptionParser parser = new OptionParser();
+        OptionSpec<String> host = parser.accepts("host", "MongoDB host")
+                .withRequiredArg().defaultsTo("localhost");
+        OptionSpec<Integer> port = parser.accepts("port", "MongoDB port")
+                .withRequiredArg().ofType(Integer.class).defaultsTo(27017);
+
+        OptionSet options = parser.parse(args);
+        RepositoryFixture[] allFixtures = new RepositoryFixture[] {
+                new JackrabbitRepositoryFixture(),
+                OakRepositoryFixture.getMemory(),
+                OakRepositoryFixture.getDefault(),
+                OakRepositoryFixture.getMongo(host.value(options), port.value(options)),
+                OakRepositoryFixture.getSegment(host.value(options), port.value(options))
+        };
+
+        Set<String> argset = Sets.newHashSet(options.nonOptionArguments());
+        List<RepositoryFixture> fixtures = Lists.newArrayList();
+        for (RepositoryFixture fixture : allFixtures) {
+            if (argset.remove(fixture.toString())) {
+                fixtures.add(fixture);
+            }
+        }
+        if (fixtures.isEmpty()) {
+            fixtures = Arrays.asList(allFixtures);
+        }
+
+        List<Benchmark> benchmarks = Lists.newArrayList();
+        for (Benchmark benchmark : BENCHMARKS) {
+            if (argset.remove(benchmark.toString())) {
+                benchmarks.add(benchmark);
+            }
+        }
+        if (benchmarks.isEmpty()) {
+            benchmarks = Arrays.asList(BENCHMARKS);
+        }
+
+        if (argset.isEmpty()) {
+            for (Benchmark benchmark : benchmarks) {
+                benchmark.run(fixtures);
+            }
+        } else {
+            System.err.println("Unknown arguments: " + argset);
+        }
+
+    }
+
+}

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/JackrabbitRepositoryFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/JackrabbitRepositoryFixture.java?rev=1449629&r1=1449628&r2=1449629&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/JackrabbitRepositoryFixture.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/JackrabbitRepositoryFixture.java
Mon Feb 25 09:46:51 2013
@@ -26,18 +26,23 @@ import org.apache.jackrabbit.core.config
 
 public class JackrabbitRepositoryFixture implements RepositoryFixture {
 
+    private RepositoryImpl[] cluster;
+
     @Override
-    public boolean isAvailable() {
-        return true;
+    public boolean isAvailable(int n) {
+        return n == 1;
     }
 
     @Override
-    public void setUpCluster(Repository[] cluster) throws Exception {
-        if (cluster.length == 1) {
+    public Repository[] setUpCluster(int n) throws Exception {
+        if (n == 1) {
+            Repository[] cluster = new Repository[n];
             File directory = new File("jackrabbit-repository");
             RepositoryConfig config = RepositoryConfig.install(directory);
-            cluster[0] = RepositoryImpl.create(config);
-        } else if (cluster.length > 1) {
+            this.cluster[0] = RepositoryImpl.create(config);
+            cluster[0] = this.cluster[0];
+            return cluster;
+        } else {
             throw new UnsupportedOperationException("TODO");
         }
     }
@@ -48,9 +53,8 @@ public class JackrabbitRepositoryFixture
     }
 
     @Override
-    public void tearDownCluster(Repository[] cluster) {
-        for (Repository node : cluster) {
-            RepositoryImpl repository = ((RepositoryImpl) node);
+    public void tearDownCluster() {
+        for (RepositoryImpl repository : cluster) {
             File directory = new File(repository.getConfig().getHomeDir());
             repository.shutdown();
             FileUtils.deleteQuietly(directory);

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java?rev=1449629&r1=1449628&r2=1449629&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java
Mon Feb 25 09:46:51 2013
@@ -24,9 +24,6 @@ import org.apache.commons.io.FileUtils;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.mongomk.impl.MongoConnection;
-import org.apache.jackrabbit.mongomk.impl.MongoMicroKernel;
-import org.apache.jackrabbit.mongomk.impl.MongoNodeStore;
-import org.apache.jackrabbit.mongomk.impl.blob.MongoBlobStore;
 import org.apache.jackrabbit.mongomk.prototype.MongoMK;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.jcr.Jcr;
@@ -39,126 +36,108 @@ import com.mongodb.Mongo;
 public abstract class OakRepositoryFixture implements RepositoryFixture {
 
     public static RepositoryFixture getMemory() {
-        return new OakRepositoryFixture() {
+        return new OakRepositoryFixture("Oak-Memory") {
             @Override
-            public void setUpCluster(Repository[] cluster) throws Exception {
+            public Repository[] setUpCluster(int n) throws Exception {
+                Repository[] cluster = new Repository[n];
                 MicroKernel kernel = new MicroKernelImpl();
                 for (int i = 0; i < cluster.length; i++) {
                     Oak oak = new Oak(kernel);
                     cluster[i] = new Jcr(oak).createRepository();
                 }
+                return cluster;
             }
         };
     }
 
     public static RepositoryFixture getDefault() {
-        return new OakRepositoryFixture() {
-            private File file = new File("oak-benchmark-microkernel");
+        return new OakRepositoryFixture("Oak-Default") {
             private MicroKernelImpl[] kernels;
             @Override
-            public void setUpCluster(Repository[] cluster) throws Exception {
+            public Repository[] setUpCluster(int n) throws Exception {
+                Repository[] cluster = new Repository[n];
                 kernels = new MicroKernelImpl[cluster.length];
                 for (int i = 0; i < cluster.length; i++) {
-                    kernels[i] = new MicroKernelImpl(file.getName());
+                    kernels[i] = new MicroKernelImpl(unique);
                     cluster[i] = new Jcr(kernels[i]).createRepository();
                 }
+                return cluster;
             }
             @Override
-            public void tearDownCluster(Repository[] cluster) {
+            public void tearDownCluster() {
                 for (MicroKernelImpl kernel : kernels) {
                     kernel.dispose();
                 }
-                FileUtils.deleteQuietly(file);
+                FileUtils.deleteQuietly(new File(unique));
             }
         };
     }
 
-    public static RepositoryFixture getMongo() {
-        return new OakRepositoryFixture() {
-            private MongoMicroKernel[] kernels;
-            @Override
-            public void setUpCluster(Repository[] cluster) throws Exception {
-                kernels = new MongoMicroKernel[cluster.length];
-                for (int i = 0; i < cluster.length; i++) {
-                    MongoConnection mongo = new MongoConnection(
-                            "127.0.0.1", 27017, "oak-benchmark-mongo");
-                    kernels[i] = new MongoMicroKernel(
-                            mongo,
-                            new MongoNodeStore(mongo.getDB()),
-                            new MongoBlobStore(mongo.getDB()));
-                    cluster[i] = new Jcr(kernels[i]).createRepository();
-                }
-            }
-            @Override
-            public void tearDownCluster(Repository[] cluster) {
-                for (MongoMicroKernel kernel : kernels) {
-                    kernel.dispose();
-                }
-                try {
-                    MongoConnection mongo = new MongoConnection(
-                            "127.0.0.1", 27017, "oak-benchmark-mongo");
-                    mongo.getDB().dropDatabase();
-                    mongo.close();
-                } catch (Exception e) {
-                    throw new IllegalStateException(e);
-                }
-            }
-        };
-    }
-
-    public static RepositoryFixture getNewMongo() {
-        return new OakRepositoryFixture() {
+    public static RepositoryFixture getMongo(final String host, final int port) {
+        return new OakRepositoryFixture("Oak-Mongo") {
             private MongoMK[] kernels;
             @Override
-            public void setUpCluster(Repository[] cluster) throws Exception {
+            public Repository[] setUpCluster(int n) throws Exception {
+                Repository[] cluster = new Repository[n];
                 kernels = new MongoMK[cluster.length];
                 for (int i = 0; i < cluster.length; i++) {
-                    MongoConnection mongo = new MongoConnection(
-                            "127.0.0.1", 27017, "oak-benchmark-newmongo");
+                    MongoConnection mongo =
+                            new MongoConnection(host, port, unique);
                     kernels[i] = new MongoMK(mongo.getDB(), i);
                     cluster[i] = new Jcr(kernels[i]).createRepository();
                 }
+                return cluster;
             }
             @Override
-            public void tearDownCluster(Repository[] cluster) {
+            public void tearDownCluster() {
                 for (MongoMK kernel : kernels) {
                     kernel.dispose();
                 }
                 try {
-                    MongoConnection mongo = new MongoConnection(
-                            "127.0.0.1", 27017, "oak-benchmark-mongo");
+                    MongoConnection mongo =
+                            new MongoConnection(host, port, unique);
                     mongo.getDB().dropDatabase();
                     mongo.close();
                 } catch (Exception e) {
-                    throw new IllegalStateException(e);
+                    e.printStackTrace();
                 }
             }
         };
     }
 
-    public static RepositoryFixture getSegment() {
-        return new OakRepositoryFixture() {
+    public static RepositoryFixture getSegment(final String host, final int port) {
+        return new OakRepositoryFixture("Oak-Segment") {
             private Mongo mongo;
             @Override
-            public void setUpCluster(Repository[] cluster) throws Exception {
-                mongo = new Mongo();
+            public Repository[] setUpCluster(int n) throws Exception {
+                Repository[] cluster = new Repository[n];
+                mongo = new Mongo(host, port);
                 for (int i = 0; i < cluster.length; i++) {
-                    SegmentStore store = new MongoStore(
-                            mongo.getDB("oak-benchmark-segment"));
+                    SegmentStore store = new MongoStore(mongo.getDB(unique));
                     Oak oak = new Oak(new SegmentNodeStore(store));
                     cluster[i] = new Jcr(oak).createRepository();
                 }
+                return cluster;
             }
             @Override
-            public void tearDownCluster(Repository[] cluster) {
-                mongo.getDB("oak-benchmark-segment").dropDatabase();
+            public void tearDownCluster() {
+                mongo.getDB(unique).dropDatabase();
                 mongo.close();
             }
         };
     }
 
+    private final String name;
+
+    protected final String unique;
+
+    protected OakRepositoryFixture(String name) {
+        this.name = name;
+        this.unique = String.format("%s-%d", name, System.currentTimeMillis());
+    }
+
     @Override
-    public boolean isAvailable() {
+    public boolean isAvailable(int n) {
         return true;
     }
 
@@ -169,7 +148,11 @@ public abstract class OakRepositoryFixtu
     }
 
     @Override
-    public void tearDownCluster(Repository[] cluster) {
+    public void tearDownCluster() {
+    }
+
+    public String toString() {
+        return name;
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/RepositoryFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/RepositoryFixture.java?rev=1449629&r1=1449628&r2=1449629&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/RepositoryFixture.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/fixture/RepositoryFixture.java
Mon Feb 25 09:46:51 2013
@@ -25,25 +25,24 @@ public interface RepositoryFixture {
      * a database-based fixture would only be available when the underlying
      * database service is running.
      *
+     * @param n size of the requested cluster
      * @return {@code true} iff the fixture is available
      */
-    boolean isAvailable();
+    boolean isAvailable(int n);
 
     /**
-     * Creates a new repository cluster with as many nodes as the given
-     * array has elements. References to the cluster nodes are stored in
-     * the given array. The initial state of the cluster consists of just
-     * the default repository content included by the implementation. The
-     * caller of this method should have exclusive access to the created
-     * cluster. The caller is also responsible for calling
-     * {@link #tearDownCluster(Repository[])} when the test cluster is
-     * no longer needed.
+     * Creates a new repository cluster with the given number of nodes.
+     * The initial state of the cluster consists of just the default
+     * repository content included by the implementation. The caller of
+     * this method should have exclusive access to the created cluster.
+     * The caller is also responsible for calling {@link #tearDownCluster()}
+     * when the test cluster is no longer needed.
      *
-     * @param cluster array to which references to all nodes of the
-     *                created cluster should be stored
+     * @param n size of the requested cluster
+     * @return nodes of the created cluster
      * @throws Exception if the cluster could not be set up
      */
-    void setUpCluster(Repository[] cluster) throws Exception;
+    Repository[] setUpCluster(int n) throws Exception;
 
     /**
      * Ensures that all content changes seen by one of the given cluster
@@ -59,11 +58,9 @@ public interface RepositoryFixture {
 
     /**
      * Releases resources associated with the given repository cluster.
-     * The caller of {@link #setUpCluster(Repository[])} shall call this
+     * The caller of {@link #setUpCluster(int)} shall call this
      * method once the cluster is no longer needed.
-     *
-     * @param cluster array containing references to all nodes of the cluster
      */
-    void tearDownCluster(Repository[] cluster);
+    void tearDownCluster();
 
 }

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java?rev=1449629&r1=1449628&r2=1449629&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/Main.java Mon
Feb 25 09:46:51 2013
@@ -26,7 +26,7 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
-import org.apache.jackrabbit.oak.benchmark.Benchmark;
+import org.apache.jackrabbit.oak.benchmark.BenchmarkRunner;
 import org.apache.jackrabbit.oak.http.OakServlet;
 import org.apache.jackrabbit.oak.jcr.RepositoryImpl;
 import org.apache.jackrabbit.oak.plugins.commit.ConflictValidatorProvider;
@@ -74,7 +74,7 @@ public class Main {
         if ("mk".equals(command)) {
             MicroKernelServer.main(args);
         } else if ("benchmark".equals(command)){
-            Benchmark.main(args);
+            BenchmarkRunner.main(args);
         } else if ("server".equals(command)){
             HttpServer httpServer = new HttpServer(URI, args);
             httpServer.start();



Mime
View raw message