You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ju...@apache.org on 2012/10/01 15:22:46 UTC

svn commit: r1392315 - in /jackrabbit/oak/trunk/oak-mk-perf: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/jackrabbit/ src/main/java/org/apache/jackrabbit/mk/ src/main/java/org/apache/jackrabbit/...

Author: jukka
Date: Mon Oct  1 13:22:44 2012
New Revision: 1392315

URL: http://svn.apache.org/viewvc?rev=1392315&view=rev
Log:
OAK-335: Performance tests for microkernel - write tests

Patch by Tudor Rogoz

Added:
    jackrabbit/oak/trunk/oak-mk-perf/
    jackrabbit/oak/trunk/oak-mk-perf/README
    jackrabbit/oak/trunk/oak-mk-perf/pom.xml
    jackrabbit/oak/trunk/oak-mk-perf/remotePom.xml
    jackrabbit/oak/trunk/oak-mk-perf/src/
    jackrabbit/oak/trunk/oak-mk-perf/src/main/
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/Initializator.java
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/MicroKernelTestBase.java
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/MkCollection.java
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/OakMkinitializator.java
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/SCMkInitializator.java
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/BlobStoreFS.java
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Chronometer.java
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Committer.java
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Configuration.java
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/MKOperation.java
    jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/MkConfigProvider.java
    jackrabbit/oak/trunk/oak-mk-perf/src/main/resources/
    jackrabbit/oak/trunk/oak-mk-perf/src/main/resources/config.cfg
    jackrabbit/oak/trunk/oak-mk-perf/src/main/resources/remotePom.xml
    jackrabbit/oak/trunk/oak-mk-perf/src/test/
    jackrabbit/oak/trunk/oak-mk-perf/src/test/java/
    jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/
    jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/
    jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/
    jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/
    jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/
    jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MKAddNodesRelativePathTest.java
    jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MkAddNodesDifferentStructuresTest.java
    jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MkAddNodesMultipleCommitsTest.java

Added: jackrabbit/oak/trunk/oak-mk-perf/README
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/README?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/README (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/README Mon Oct  1 13:22:44 2012
@@ -0,0 +1,22 @@
+This module contains performance tests for microkernel instances.
+The tests can be launched locally by calling directly the remote profile from the pom file using the following commands:
+	mvn clean test -Premote -Poak   - for launching the tests against the oak microkernel or
+	mvn clean test -Premote -Psc - for launching the tests against the mongodb microkernel.
+	
+More than that the tests can be launched remotely, for example on an mongodb cluster.In this case the pom file uploads 
+the tests to the remote machine, runs them and collects the results.Use the following commands to remotely run the tests:
+
+mvn clean process-test-classes -Plocal -Psc(or -Poak the microkernel used in tests) -Dpass=<ssh-password for the remote machine>	
+
+Tests:
+- MkAddNodesDifferentStructuresTest
+	- builds Jsop diffs (for adding nodes) in different structures - all on the same line, in a pyramid structure etc.All the nodes 
+	are added in the same commit operation.
+	
+- MkAddNodesMultipleCommitsTest
+	- builds a Jsop diff for adding nodes as a pyramid structure.The nodes are added in separate commit operations (all in one commit,
+	or each 3 nodes in a commit etc.)
+	
+- MkAddNodesRelativePathTest	
+	- add nodes to a node structure.Each node is added in a separate commit and all the nodes are referenced using the relative path to 
+	the corresponding parent node.
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-mk-perf/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/pom.xml?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/pom.xml (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/pom.xml Mon Oct  1 13:22:44 2012
@@ -0,0 +1,147 @@
+<?xml version="1.0"?>
+<!-- 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
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.jackrabbit</groupId>
+		<artifactId>jackrabbit-oak</artifactId>
+		<version>0.5-SNAPSHOT</version>
+	</parent>
+	<artifactId>oak-mk-perf</artifactId>
+	<name>oak-mk-perf</name>
+	<url>http://maven.apache.org</url>
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	</properties>
+	<profiles>
+		<profile>
+			<id>oak</id>
+			<properties>
+				<user>qe1</user>
+				<mktype>oak</mktype>
+			</properties>
+		</profile>
+		<profile>
+			<id>sc</id>
+			<properties>
+				<user>qe</user>
+				<mktype>sc</mktype>
+			</properties>
+		</profile>
+		<profile>
+			<id>local</id>
+			<build>
+				<plugins>
+
+					<plugin>
+						<artifactId>maven-dependency-plugin</artifactId>
+						<configuration>
+							<outputDirectory> ${project.build.outputDirectory}</outputDirectory>
+						</configuration>
+						<executions>
+							<execution>
+								<id>unpack-dependencies</id>
+								<phase>process-resources</phase>
+								<goals>
+									<goal>unpack-dependencies</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+
+					<plugin>
+						<groupId>org.evolvis.maven.plugins.remote-testing</groupId>
+						<artifactId>remote-testing-plugin</artifactId>
+						<version>0.6</version>
+						<configuration>
+							<testMachine>ec2-107-22-9-190.compute-1.amazonaws.com</testMachine>
+							<username>${user}</username>
+							<password>${pass}</password>
+							<display>0</display>
+							<!--<keyFile>/home/rogoz/private-key-file</keyFile> -->
+							<remoteFolder>/home/${user}/tests/</remoteFolder>
+							<pomfile>${basedir}/remotePom.xml</pomfile>
+						</configuration>
+						<executions>
+							<execution>
+								<id>remote testing</id>
+								<goals>
+									<goal>clean</goal>
+									<goal>test</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<dependencies>
+						<dependency>
+							<groupId>org.apache.maven.surefire</groupId>
+							<artifactId>surefire-junit47</artifactId>
+							<version>2.12.3</version>
+						</dependency>
+					</dependencies>
+					<argLine>-Xmx2024m</argLine>
+					<testFailureIgnore>true</testFailureIgnore>
+					<includes>
+						<include>**/*Test.java</include>
+					</includes>
+					<systemPropertyVariables>
+						<mk.type>${mktype}</mk.type>
+					</systemPropertyVariables>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+
+		</dependency>
+		<dependency>
+			<groupId>org.apache.jackrabbit</groupId>
+			<artifactId>oak-mongomk</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.jackrabbit</groupId>
+			<artifactId>oak-mk</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.h2database</groupId>
+			<artifactId>h2</artifactId>
+			<version>1.3.158</version>
+		</dependency>
+	</dependencies>
+
+
+	<pluginRepositories>
+		<pluginRepository>
+			<id>maven-repo.evolvis.org</id>
+			<url>http://maven-repo.evolvis.org/releases/</url>
+		</pluginRepository>
+	</pluginRepositories>
+
+</project>

Added: jackrabbit/oak/trunk/oak-mk-perf/remotePom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/remotePom.xml?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/remotePom.xml (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/remotePom.xml Mon Oct  1 13:22:44 2012
@@ -0,0 +1,63 @@
+<!--
+   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/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<groupId>com.adobe.sharedcloud</groupId>
+	<artifactId>remote-sharedcloud-oak-performance</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<packaging>jar</packaging>
+
+	<name>remote-sharedcloud-oak-performance</name>
+	<url>http://maven.apache.org</url>
+
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	</properties>
+	<profiles>
+		<profile>
+			<id>remote</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-surefire-plugin</artifactId>
+						<version>2.10</version>
+						<dependencies>
+							<dependency>
+								<groupId>org.apache.maven.surefire</groupId>
+								<artifactId>surefire-junit47</artifactId>
+								<version>2.12.3</version>
+							</dependency>
+						</dependencies>
+						<configuration>
+							<systemPropertyVariables>
+								<mk.type>${env.mktype}</mk.type>
+							</systemPropertyVariables>
+							<testFailureIgnore>false</testFailureIgnore>
+							<argLine>-Xmx1024m</argLine>
+							<includes>
+								<include>**/*Test.java</include>
+							</includes>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
+</project>

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/Initializator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/Initializator.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/Initializator.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/Initializator.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,31 @@
+/*
+ * 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.mk.testing;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.util.Configuration;
+
+/**
+ * Interface for microkernel initialization.
+ * @author rogoz
+ *
+ */
+public interface Initializator {
+
+	public MicroKernel init(Configuration conf) throws Exception;
+	public String getType();
+}

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/MicroKernelTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/MicroKernelTestBase.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/MicroKernelTestBase.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/MicroKernelTestBase.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,63 @@
+/*
+ * 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.mk.testing;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.util.Chronometer;
+import org.apache.jackrabbit.mk.util.Configuration;
+import org.apache.jackrabbit.mk.util.MkConfigProvider;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+
+/**
+ * Base class for tests that are using only one microkernel instance.
+ * @author rogoz
+ *
+ */
+public class MicroKernelTestBase {
+
+	static Initializator initializator;
+	public MicroKernel mk;
+	public static Configuration conf;
+	public Chronometer chronometer;
+
+	/**
+	 * Creates a microkernel collection with only one microkernel.
+	 * 
+	 * @throws Exception
+	 */
+	@BeforeClass
+	public static void beforeSuite() throws Exception {
+		
+		String mktype = System.getProperty("mk.type");
+		initializator = (mktype == null || mktype.equals("oak")) ? new OakMkinitializator()
+				: new SCMkInitializator();
+	/*	initializator = new SCMkInitializator(); */
+		System.out.println("Tests will run against ***"+initializator.getType()+"***");
+		conf = MkConfigProvider.readConfig();
+	}
+
+	@Before
+	public void beforeTest() throws Exception {
+
+		mk = (new MkCollection(initializator, conf, 1)).getMicroKernels()
+				.get(0);
+		chronometer = new Chronometer();
+	}
+
+}

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/MkCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/MkCollection.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/MkCollection.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/MkCollection.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,67 @@
+/*
+ * 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.mk.testing;
+
+import java.util.ArrayList;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.util.Configuration;
+
+/**
+ * Represents a collection of microkernels.
+ * 
+ * @author rogoz
+ * 
+ */
+public class MkCollection {
+	ArrayList<MicroKernel> mks;
+
+	/**
+	 * Initialize a collection of mks.Each mk can have a particular
+	 * configuration.
+	 * 
+	 * @param initializator
+	 * @param conf
+	 * @throws Exception
+	 */
+	public MkCollection(Initializator initializator, Configuration conf[],
+			int size) throws Exception {
+		mks = new ArrayList<MicroKernel>();
+		for (int i = 0; i < size; i++) {
+			mks.add(initializator.init(conf[i]));
+		}
+	}
+
+	/**
+	 * Initialize a collection of mks.All mks have the same configuration.
+	 * 
+	 * @param initializator
+	 * @param conf
+	 * @throws Exception
+	 */
+	public MkCollection(Initializator initializator, Configuration conf,
+			int size) throws Exception {
+		mks = new ArrayList<MicroKernel>();
+		for (int i = 0; i < size; i++) {
+			mks.add(initializator.init(conf));
+		}
+	}
+
+	public ArrayList<MicroKernel> getMicroKernels() {
+		return mks;
+	}
+}

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/OakMkinitializator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/OakMkinitializator.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/OakMkinitializator.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/OakMkinitializator.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,46 @@
+/*
+ * 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.mk.testing;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.mk.core.Repository;
+import org.apache.jackrabbit.mk.util.Configuration;
+
+/**
+ * Initialize an oak microkernel.
+ * 
+ * @author rogoz
+ * 
+ */
+public class OakMkinitializator implements Initializator {
+
+	public MicroKernel init(Configuration conf) throws Exception {
+		// TODO use configuration
+		Repository rep = new Repository(conf.getStoragePath()
+				+ System.currentTimeMillis());
+		rep.init();
+		MicroKernel mk = new MicroKernelImpl(rep);
+		return mk;
+	}
+
+	public String getType() {
+		// TODO Auto-generated method stub
+		return "Oak Microkernel";
+	}
+
+}

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/SCMkInitializator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/SCMkInitializator.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/SCMkInitializator.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/testing/SCMkInitializator.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,75 @@
+/*
+ * 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.mk.testing;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.util.BlobStoreFS;
+import org.apache.jackrabbit.mk.util.Configuration;
+import org.apache.jackrabbit.mongomk.MongoConnection;
+import org.apache.jackrabbit.mongomk.NodeStoreMongo;
+import org.apache.jackrabbit.mongomk.api.NodeStore;
+import org.apache.jackrabbit.mongomk.impl.MongoMicroKernel;
+import org.apache.jackrabbit.mongomk.api.BlobStore;
+
+import org.apache.jackrabbit.mongomk.util.MongoUtil;
+
+import com.mongodb.BasicDBObjectBuilder;
+
+/**
+ * Initialize a mongodb microkernel.
+ * 
+ * @author rogoz
+ * 
+ */
+public class SCMkInitializator implements Initializator {
+
+	/**
+	 * Create a microkernel.Initialize the db.
+	 */
+	public MicroKernel init(Configuration conf) throws Exception {
+
+		MicroKernel mk;
+		MongoConnection mongoConnection = new MongoConnection(conf.getHost(),
+				conf.getMongoPort(), conf.getMongoDatabase());
+		MongoConnection adminConnection = new MongoConnection(conf.getHost(),
+				conf.getMongoPort(), "admin");
+
+		NodeStore nodeStore = new NodeStoreMongo(mongoConnection);
+		BlobStore blobStore = new BlobStoreFS(
+				System.getProperty("java.io.tmpdir"));
+
+		// initialize the database
+		//temporary workaround.Remove the sleep.
+		Thread.sleep(20000);
+		MongoUtil.initDatabase(mongoConnection);
+		// set the shard key
+		adminConnection.getDB()
+				.command(
+						BasicDBObjectBuilder
+								.start("shardCollection", "test.nodes")
+								.push("key").add("path", 1).add("revId", 1)
+								.pop().get());
+
+		mk = new MongoMicroKernel(nodeStore, blobStore);
+		return mk;
+	}
+
+	public String getType() {
+		return "SharedCloudMicrokernel implementation";
+	}
+
+}

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/BlobStoreFS.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/BlobStoreFS.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/BlobStoreFS.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/BlobStoreFS.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,50 @@
+/*
+ * 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.mk.util;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.apache.jackrabbit.mongomk.api.BlobStore;
+
+
+
+public class BlobStoreFS implements BlobStore {
+
+
+   public BlobStoreFS(String rootPath) {
+       File rootDir = new File(rootPath);
+       if (!rootDir.isDirectory()) {
+           rootDir.mkdirs();
+       }
+
+
+   }
+
+   public long getBlobLength(String blobId) throws Exception {
+       return 0;
+   }
+
+   public int readBlob(String blobId, long blobOffset, byte[] buffer, int bufferOffset, int length) throws Exception {
+       return 0;
+   }
+
+   public String writeBlob(InputStream is) throws Exception {
+       return null;
+   }
+   
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Chronometer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Chronometer.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Chronometer.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Chronometer.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,49 @@
+/*
+ * 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.mk.util;
+
+public final class Chronometer {
+    private long begin, end;
+
+    public void start() {
+        begin = System.currentTimeMillis();
+    }
+
+    public void stop() {
+        end = System.currentTimeMillis();
+    }
+
+    public long getTime() {
+        return end - begin;
+    }
+
+    public long getMilliseconds() {
+        return end - begin;
+    }
+
+    public double getSeconds() {
+        return (end - begin) / 1000.0;
+    }
+
+    public double getMinutes() {
+        return (end - begin) / 60000.0;
+    }
+
+    public double getHours() {
+        return (end - begin) / 3600000.0;
+    }
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Committer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Committer.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Committer.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Committer.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,66 @@
+/*
+ * 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.mk.util;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+
+public class Committer {
+
+	/**
+	 * Add nodes to the repository.
+	 * 
+	 * @param mk
+	 *            Microkernel that is performing the action.
+	 * @param diff
+	 *            The diff that is commited.All the nodes must have the absolute
+	 *            path.
+	 * @param nodesPerCommit
+	 *            Number of nodes per commit.
+	 */
+	public void addNodes(MicroKernel mk, String diff, int nodesPerCommit) {
+
+		if (nodesPerCommit == 0) {
+			mk.commit("", diff.toString(), null, "");
+			return;
+		}
+		String[] string = diff.split(System.getProperty("line.separator"));
+		int i = 0;
+		StringBuilder finalCommit = new StringBuilder();
+		for (String line : string) {
+			finalCommit.append(line);
+			i++;
+			if (i == nodesPerCommit) {
+				mk.commit("", finalCommit.toString(), null, "");
+				finalCommit.setLength(0);
+				i = 0;
+			}
+		}
+	}
+
+	/**
+	 * Add a node to repository.
+	 * 
+	 * @param mk
+	 *            Microkernel that is performing the action.
+	 * @param parentPath
+	 * @param name
+	 *            Name of the node.
+	 */
+	public void addNode(MicroKernel mk, String parentPath, String name) {
+		mk.commit(parentPath, "+\"" + name + "\" : {} \n", null, "");
+	}
+}

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Configuration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Configuration.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Configuration.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/Configuration.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,58 @@
+/*
+ * 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.mk.util;
+
+import java.util.Properties;
+
+public class Configuration {
+
+	    
+	    private static final String MK_TYPE="mk.type";
+	    private static final String HOST = "hostname";
+	    private static final String MONGO_PORT = "mongo.port";
+	    private static final String STORAGE_PATH = "storage.path";
+	    private static final String DATABASE="mongo.database";
+	    
+	    private final Properties properties;
+
+	    public Configuration(Properties properties) {
+	        this.properties = properties;
+	    }
+
+	    public String getMkType() {
+	        return properties.getProperty(MK_TYPE);
+	    }
+
+	    public String getHost() {
+	        return properties.getProperty(HOST);
+	    }
+
+	    public int getMongoPort() {
+	        return Integer.parseInt(properties.getProperty(MONGO_PORT));
+	    }
+	    
+	    public String getStoragePath() {
+	        return properties.getProperty(STORAGE_PATH);
+	    }
+
+		public String getMongoDatabase() {
+			
+			return properties.getProperty(DATABASE);
+		}
+}
+
+

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/MKOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/MKOperation.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/MKOperation.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/MKOperation.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,131 @@
+/*
+ * 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.mk.util;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+
+/**
+ * Useful methods for building/committing nodes.
+ * @author rogoz
+ *
+ */
+public class MKOperation {
+
+	/**
+	 * Commit an empty node.
+	 * 
+	 * @param mk
+	 *            The microkernel that performs the operation.
+	 * @param parentNode
+	 *            The path where the commit will be performed.
+	 * @param name
+	 *            Name of the node.
+	 * @return
+	 */
+	private static String commitEmptyNode(MicroKernel mk, String parentNode,
+			String name) {
+
+		return mk.commit(parentNode, "+\"" + name + "\" : {} \n", null, "");
+	}
+
+
+	/**
+	 * Recursively builds a pyramid tree structure.Each node is added in a
+	 * separate commit.
+	 * 
+	 * @param mk
+	 *            Microkernel used for adding nodes.
+	 * @param startingPoint
+	 *            The path where the node will be added.
+	 * @param index
+	 * @param numberOfChildren
+	 *            Number of children per level.
+	 * @param nodesNumber
+	 *            Total nodes number.
+	 * @param nodePrefixName
+	 *            The node's name prefix.The complete node name is
+	 *            prefix+indexNumber.
+	 **/
+	public static void addPyramidStructure(MicroKernel mk,
+			String startingPoint, int index, int numberOfChildren,
+			long nodesNumber, String nodePrefixName) {
+		// if all the nodes are on the same level
+		if (numberOfChildren == 0) {
+			for (long i = 0; i < nodesNumber; i++) {
+				commitEmptyNode(mk, startingPoint, nodePrefixName + i);
+				// System.out.println("Created node " + i);
+			}
+			return;
+		}
+		if (index >= nodesNumber)
+			return;
+		commitEmptyNode(mk, startingPoint, nodePrefixName + index);
+		for (int i = 1; i <= numberOfChildren; i++) {
+			if (!startingPoint.endsWith("/"))
+				startingPoint = startingPoint + "/";
+			addPyramidStructure(mk, startingPoint + nodePrefixName + index,
+					index * numberOfChildren + i, numberOfChildren,
+					nodesNumber, nodePrefixName);
+		}
+
+	}
+
+	/**
+	 * Builds a diff representing a pyramid node structure.
+	 * 
+	 * @param The
+	 *            path where the first node will be added.
+	 * @param index
+	 * @param numberOfChildren
+	 *            The number of children that each node must have.
+	 * @param nodesNumber
+	 *            Total number of nodes.
+	 * @param nodePrefixName
+	 *            The node name prefix.
+	 * @param diff
+	 *            The string where the diff is builded.Put an empty string for
+	 *            creating a new structure.
+	 * @return
+	 */
+	public static StringBuilder buildPyramidDiff(String startingPoint,
+			int index, int numberOfChildren, int nodesNumber,
+			String nodePrefixName, StringBuilder diff) {
+		if (numberOfChildren == 0) {
+			for (long i = 0; i < nodesNumber; i++)
+				diff.append(addNodeToDiff(startingPoint, nodePrefixName + i));
+			return diff;
+		}
+		if (index >= nodesNumber)
+			return diff;
+		diff.append(addNodeToDiff(startingPoint, nodePrefixName + index));
+		for (int i = 1; i <= numberOfChildren; i++) {
+			if (!startingPoint.endsWith("/"))
+				startingPoint = startingPoint + "/";
+			buildPyramidDiff(startingPoint + nodePrefixName + index, index
+					* numberOfChildren + i, numberOfChildren, nodesNumber,
+					nodePrefixName, diff);
+		}
+		return diff;
+	}
+	
+	private static String addNodeToDiff(String startingPoint, String nodeName) {
+		if (!startingPoint.endsWith("/"))
+			startingPoint = startingPoint + "/";
+
+		return ("+\"" + startingPoint + nodeName + "\" : {} \n");
+	}
+}

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/MkConfigProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/MkConfigProvider.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/MkConfigProvider.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/java/org/apache/jackrabbit/mk/util/MkConfigProvider.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,59 @@
+/*
+ * 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.mk.util;
+
+import java.io.InputStream;
+import java.util.Properties;
+
+
+public class MkConfigProvider {
+	
+	/**
+	 * Read the mk configuration from file.
+	 * @param resourcePath
+	 * @return
+	 * @throws Exception
+	 */
+	public static Configuration readConfig(String resourcePath) throws Exception {
+		
+		InputStream is = MkConfigProvider.class
+				.getResourceAsStream(resourcePath);
+		
+		Properties properties = new Properties();
+		properties.load(is);
+		is.close();
+		return new Configuration(properties);
+	}
+	/**
+	 * Read the mk configuration from config.cfg.
+	 * @param resourcePath
+	 * @return
+	 * @throws Exception
+	 */
+	public static Configuration readConfig() throws Exception {
+		
+		InputStream is = MkConfigProvider.class
+				.getResourceAsStream("/config.cfg");
+		
+		Properties properties = new Properties();
+		properties.load(is);
+		//System.out.println(properties.toString());
+		is.close();
+		return new Configuration(properties);
+	}
+	
+}

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/resources/config.cfg
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/resources/config.cfg?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/resources/config.cfg (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/resources/config.cfg Mon Oct  1 13:22:44 2012
@@ -0,0 +1,5 @@
+mk.type=oak
+hostname=localhost
+mongo.port=27017
+mongo.database=test
+storage.path=target/mk-tck-repo
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-mk-perf/src/main/resources/remotePom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/main/resources/remotePom.xml?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/main/resources/remotePom.xml (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/main/resources/remotePom.xml Mon Oct  1 13:22:44 2012
@@ -0,0 +1,49 @@
+<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/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<groupId>com.adobe.sharedcloud</groupId>
+	<artifactId>remote-sharedcloud-oak-performance</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<packaging>jar</packaging>
+
+	<name>remote-sharedcloud-oak-performance</name>
+	<url>http://maven.apache.org</url>
+
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	</properties>
+	<profiles>
+		<profile>
+			<id>remote</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-surefire-plugin</artifactId>
+						<version>2.10</version>
+
+						<dependencies>
+							<dependency>
+								<groupId>org.apache.maven.surefire</groupId>
+								<artifactId>surefire-junit47</artifactId>
+								<version>2.12.3</version>
+							</dependency>
+						</dependencies>
+						<configuration>
+							<systemPropertyVariables>
+								<mk.type>${env.mktype}</mk.type>
+							</systemPropertyVariables>
+							<testFailureIgnore>false</testFailureIgnore>
+							<includes>
+								<include>**/*Test.java</include>
+							</includes>
+						</configuration>
+					</plugin>
+
+				</plugins>
+
+			</build>
+		</profile>
+	</profiles>
+</project>

Added: jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MKAddNodesRelativePathTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MKAddNodesRelativePathTest.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MKAddNodesRelativePathTest.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MKAddNodesRelativePathTest.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,74 @@
+/*
+ * 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.mk.tests;
+
+import org.apache.jackrabbit.mk.util.MKOperation;
+import org.apache.jackrabbit.mk.testing.MicroKernelTestBase;
+import org.junit.Test;
+
+/**
+ * Measure the time needed for writing nodes in different tree structures.Each
+ * node is committed separately.Each node is also committed using the relative path of
+ * the parent node.
+ * 
+ * @author rogoz
+ * 
+ */
+
+public class MKAddNodesRelativePathTest extends MicroKernelTestBase {
+
+	static String nodeNamePrefix = "N";
+	static int nodesNumber = 1000;
+
+	/**
+	 * Writes all the nodes on the same level.All the nodes have the same
+	 * parent.
+	 * 
+	 * @throws Exception
+	 */
+
+	@Test
+	public void testWriteNodesSameLevel() throws Exception {
+
+		chronometer.start();
+		MKOperation.addPyramidStructure(mk, "/", 0, 0, nodesNumber,
+				nodeNamePrefix);
+		chronometer.stop();
+		System.out.println("Total time for testWriteNodesSameLevel is "
+				+ chronometer.getSeconds());
+	}
+
+	@Test
+	public void testWriteNodes10Children() {
+		chronometer.start();
+		MKOperation.addPyramidStructure(mk, "/", 0, 10, nodesNumber,
+				nodeNamePrefix);
+		chronometer.stop();
+		System.out.println("Total time for testWriteNodes10Children is "
+				+ chronometer.getSeconds());
+	}
+
+	@Test
+	public void testWriteNodes100Children() {
+		chronometer.start();
+		MKOperation.addPyramidStructure(mk, "/", 0, 100, nodesNumber,
+				nodeNamePrefix);
+		chronometer.stop();
+		System.out.println("Total time for testWriteNodes100Children is "
+				+ chronometer.getSeconds());
+	}
+}

Added: jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MkAddNodesDifferentStructuresTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MkAddNodesDifferentStructuresTest.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MkAddNodesDifferentStructuresTest.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MkAddNodesDifferentStructuresTest.java Mon Oct  1 13:22:44 2012
@@ -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.mk.tests;
+
+import org.apache.jackrabbit.mk.util.MKOperation;
+import org.apache.jackrabbit.mk.testing.MicroKernelTestBase;
+import org.apache.jackrabbit.mk.util.Committer;
+import org.junit.Test;
+
+/**
+ * Measure the time needed for writing nodes in different tree structures.All
+ * the nodes are added in a single commit.
+ * 
+ * @author rogoz
+ * 
+ */
+public class MkAddNodesDifferentStructuresTest extends MicroKernelTestBase {
+
+	static int nodesNumber = 100000;
+	static String nodeNamePrefix = "N";
+
+	@Test
+	public void testWriteNodesSameLevel() {
+
+		String diff = MKOperation.buildPyramidDiff("/", 0, 0, nodesNumber,
+				nodeNamePrefix, new StringBuilder()).toString();
+		Committer committer = new Committer();
+		chronometer.start();
+		committer.addNodes(mk, diff, 0);
+		chronometer.stop();
+		System.out.println("Total time for testWriteNodesSameLevel is "
+				+ chronometer.getSeconds());
+	}
+
+	@Test
+	public void testWriteNodes1Child() {
+		int nodesNumber = 100;
+
+		String diff = MKOperation.buildPyramidDiff("/", 0, 1, nodesNumber,
+				nodeNamePrefix, new StringBuilder()).toString();
+		Committer committer = new Committer();
+		chronometer.start();
+		committer.addNodes(mk, diff, 0);
+		chronometer.stop();
+		System.out.println("Total time for testWriteNodes1Child is "
+				+ chronometer.getSeconds());
+	}
+
+	@Test
+	public void testWriteNodes10Children() {
+
+		String diff = MKOperation.buildPyramidDiff("/", 0, 10, nodesNumber,
+				nodeNamePrefix, new StringBuilder()).toString();
+		Committer committer = new Committer();
+		chronometer.start();
+		committer.addNodes(mk, diff, 0);
+		chronometer.stop();
+		System.out.println("Total time for testWriteNodes10Children is "
+				+ chronometer.getSeconds());
+	}
+
+	@Test
+	public void testWriteNodes100Children() {
+
+		String diff = MKOperation.buildPyramidDiff("/", 0, 100, nodesNumber,
+				nodeNamePrefix, new StringBuilder()).toString();
+		Committer committer = new Committer();
+		chronometer.start();
+		committer.addNodes(mk, diff, 0);
+		chronometer.stop();
+		System.out.println("Total time for testWriteNodes100Children is "
+				+ chronometer.getSeconds());
+	}
+
+	@Test
+	public void testWriteNodes1000Children() {
+		String diff = MKOperation.buildPyramidDiff("/", 0, 1000, nodesNumber,
+				nodeNamePrefix, new StringBuilder()).toString();
+		Committer committer = new Committer();
+		chronometer.start();
+		committer.addNodes(mk, diff, 0);
+		chronometer.stop();
+		System.out.println("Total time for testWriteNodes1000Children is "
+				+ chronometer.getSeconds());
+	}
+}

Added: jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MkAddNodesMultipleCommitsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MkAddNodesMultipleCommitsTest.java?rev=1392315&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MkAddNodesMultipleCommitsTest.java (added)
+++ jackrabbit/oak/trunk/oak-mk-perf/src/test/java/org/apache/jackrabbit/mk/tests/MkAddNodesMultipleCommitsTest.java Mon Oct  1 13:22:44 2012
@@ -0,0 +1,89 @@
+/*
+ * 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.mk.tests;
+
+import org.apache.jackrabbit.mk.util.MKOperation;
+import org.apache.jackrabbit.mk.testing.MicroKernelTestBase;
+import org.apache.jackrabbit.mk.util.Committer;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Measure the time needed for writing the same node structure in one or
+ * multiple commit steps .
+ * 
+ * @author rogoz
+ * 
+ */
+public class MkAddNodesMultipleCommitsTest extends MicroKernelTestBase {
+
+	static String diff;
+	static int nodesNumber = 10000;
+	static String nodeNamePrefix = "N";
+
+	@BeforeClass
+	public static void prepareDiff() {
+		diff = MKOperation.buildPyramidDiff("/", 0, 100, nodesNumber,
+				nodeNamePrefix, new StringBuilder()).toString();
+	}
+
+	@Test
+	public void testWriteNodesAllNodes1Commit() {
+
+		Committer commiter = new Committer();
+		chronometer.start();
+		commiter.addNodes(mk, diff, 0);
+		chronometer.stop();
+		System.out.println("Total time for testWriteNodesAllNodes1Commit is "
+				+ chronometer.getSeconds());
+	}
+
+	@Test
+	public void testWriteNodes1NodePerCommit() {
+
+		Committer commiter = new Committer();
+		chronometer.start();
+		commiter.addNodes(mk, diff, 1);
+		chronometer.stop();
+		System.out.println("Total time for testWriteNodes1NodePerCommit is "
+				+ chronometer.getSeconds());
+	}
+
+	@Test
+	public void testWriteNodes50NodesPerCommit() {
+
+		Committer commiter = new Committer();
+		chronometer.start();
+		commiter.addNodes(mk, diff, 50);
+		chronometer.stop();
+		System.out.println("Total time for testWriteNodes50NodesPerCommit is "
+				+ chronometer.getSeconds());
+	}
+
+	@Test
+	public void testWriteNodes1000NodesPerCommit() {
+
+		Committer commiter = new Committer();
+		chronometer.start();
+		commiter.addNodes(mk, diff, 1000);
+		chronometer.stop();
+		System.out
+				.println("Total time for testWriteNodes1000NodesPerCommit is "
+						+ chronometer.getSeconds());
+	}
+
+}