incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1377819 [1/2] - in /sling/trunk: ./ performance/ performance/base/ performance/base/src/ performance/base/src/main/ performance/base/src/main/java/ performance/base/src/main/java/org/ performance/base/src/main/java/org/apache/ performance/...
Date Mon, 27 Aug 2012 20:13:23 GMT
Author: justin
Date: Mon Aug 27 20:13:21 2012
New Revision: 1377819

URL: http://svn.apache.org/viewvc?rev=1377819&view=rev
Log:
SLING-2311 - adding small performance test suite. Based heavily on the work of Antonio Sanso and the Jackrabbit team (Thanks!!!)

Added:
    sling/trunk/performance/
    sling/trunk/performance/base/
    sling/trunk/performance/base/pom.xml   (with props)
    sling/trunk/performance/base/src/
    sling/trunk/performance/base/src/main/
    sling/trunk/performance/base/src/main/java/
    sling/trunk/performance/base/src/main/java/org/
    sling/trunk/performance/base/src/main/java/org/apache/
    sling/trunk/performance/base/src/main/java/org/apache/sling/
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/ResourceResolverTestRequest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/TestHelper.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java   (with props)
    sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java   (with props)
    sling/trunk/performance/jcr-resource-2.0.10/
    sling/trunk/performance/jcr-resource-2.0.10/pom.xml   (with props)
    sling/trunk/performance/jcr-resource-2.0.10/src/
    sling/trunk/performance/jcr-resource-2.0.10/src/test/
    sling/trunk/performance/jcr-resource-2.0.10/src/test/java/
    sling/trunk/performance/jcr-resource-2.0.10/src/test/java/org/
    sling/trunk/performance/jcr-resource-2.0.10/src/test/java/org/apache/
    sling/trunk/performance/jcr-resource-2.0.10/src/test/java/org/apache/sling/
    sling/trunk/performance/jcr-resource-2.0.10/src/test/java/org/apache/sling/performance/
    sling/trunk/performance/jcr-resource-2.0.10/src/test/java/org/apache/sling/performance/PerformanceTest.java   (with props)
    sling/trunk/performance/jcr-resource-2.1.0/
    sling/trunk/performance/jcr-resource-2.1.0/pom.xml   (with props)
    sling/trunk/performance/jcr-resource-2.1.0/src/
    sling/trunk/performance/jcr-resource-2.1.0/src/test/
    sling/trunk/performance/jcr-resource-2.1.0/src/test/java/
    sling/trunk/performance/jcr-resource-2.1.0/src/test/java/org/
    sling/trunk/performance/jcr-resource-2.1.0/src/test/java/org/apache/
    sling/trunk/performance/jcr-resource-2.1.0/src/test/java/org/apache/sling/
    sling/trunk/performance/jcr-resource-2.1.0/src/test/java/org/apache/sling/performance/
    sling/trunk/performance/jcr-resource-2.1.0/src/test/java/org/apache/sling/performance/PerformanceTest.java   (with props)
    sling/trunk/performance/jcr-resource-2.2.0/
    sling/trunk/performance/jcr-resource-2.2.0/pom.xml   (with props)
    sling/trunk/performance/jcr-resource-2.2.0/src/
    sling/trunk/performance/jcr-resource-2.2.0/src/test/
    sling/trunk/performance/jcr-resource-2.2.0/src/test/java/
    sling/trunk/performance/jcr-resource-2.2.0/src/test/java/org/
    sling/trunk/performance/jcr-resource-2.2.0/src/test/java/org/apache/
    sling/trunk/performance/jcr-resource-2.2.0/src/test/java/org/apache/sling/
    sling/trunk/performance/jcr-resource-2.2.0/src/test/java/org/apache/sling/performance/
    sling/trunk/performance/jcr-resource-2.2.0/src/test/java/org/apache/sling/performance/PerformanceTest.java   (with props)
    sling/trunk/performance/pom.xml   (with props)
Modified:
    sling/trunk/pom.xml

Added: sling/trunk/performance/base/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/pom.xml?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/pom.xml (added)
+++ sling/trunk/performance/base/pom.xml Mon Aug 27 20:13:21 2012
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling-performance-tests</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>org.apache.sling.performance.base</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+ 
+    <name>Apache Sling Performance Test Utilities</name>
+    
+    <properties>
+        <junit.version>4.8.2</junit.version>
+    </properties>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/testing/performance/base</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/testing/performance/base</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/testing/performance/base</url>
+    </scm>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-math</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>1.4</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit.version}</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit-addons</groupId>
+            <artifactId>junit-addons</artifactId>
+            <version>1.4</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <version>2.0</version>
+            <scope>compile</scope>
+        </dependency>
+         <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.testing</artifactId>
+            <version>2.0.8</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.classloader</artifactId>
+            <version>1.0.0</version>
+        </dependency>
+         <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>r09</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <version>1.8.2</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+</project>

Propchange: sling/trunk/performance/base/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,91 @@
+/*
+ * 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.sling.performance;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+import junit.framework.TestCase;
+import org.apache.commons.io.output.FileWriterWithEncoding;
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+
+public abstract class AbstractPerformanceTest extends TestCase {
+    
+    private final int runtime = 5;
+
+    private final int warmup = 1;
+    
+    private void runTest(String name, AbstractTest test) throws Exception {
+        DescriptiveStatistics statistics = new DescriptiveStatistics();
+
+        test.setUp();
+        try {
+            // Run a few iterations to warm up the system
+            long warmupEnd = System.currentTimeMillis() + warmup * 1000;
+            while (System.currentTimeMillis() < warmupEnd) {
+                test.execute();
+            }
+
+            // Run test iterations, and capture the execution times
+            long runtimeEnd = System.currentTimeMillis() + runtime * 1000;
+            while (System.currentTimeMillis() < runtimeEnd) {
+                statistics.addValue(test.execute());
+            }
+        } finally {
+            test.tearDown();
+        }
+ 
+        if (statistics.getN() > 0) {
+            writeReport(test.toString(), name, statistics);
+        }
+    }
+
+    protected void testPerformance(String name, List <AbstractTest> tests) throws Exception {
+        for (AbstractTest test:tests){
+            runTest(name,test);
+        }
+    }
+    
+    private void writeReport(String test, String name, DescriptiveStatistics statistics)
+    throws IOException {
+        File report = new File("target", test + ".txt");
+
+        boolean needsPrefix = !report.exists();
+        PrintWriter writer = new PrintWriter(
+                new FileWriterWithEncoding(report, "UTF-8", true));
+        try {
+            if (needsPrefix) {
+                writer.format(
+                        "# %-34.34s     min     10%%     50%%     90%%     max%n",
+                        test);
+            }
+
+            writer.format(
+                    "%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
+                    name,
+                    statistics.getMin(),
+                    statistics.getPercentile(10.0),
+                    statistics.getPercentile(50.0),
+                    statistics.getPercentile(90.0),
+                    statistics.getMax());
+        } finally {
+            writer.close();
+        }
+    }
+
+}

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

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,90 @@
+/*
+ * 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.sling.performance;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.naming.NamingException;
+
+import org.apache.sling.commons.testing.jcr.RepositoryUtil;
+import org.apache.sling.jcr.api.SlingRepository;
+
+
+  
+public abstract class AbstractRepositoryTest extends AbstractTest {
+	
+	private static class ShutdownThread extends Thread {
+        @Override
+        public void run() {
+            try {
+                RepositoryUtil.stopRepository();
+            } catch(Exception e) {
+                System.out.println("Exception in ShutdownThread:" + e);
+            }
+        }
+        
+    }
+    private static SlingRepository repository;
+    private int counter;
+    protected Session session;
+    
+    protected Node testRoot;;
+    
+    /** Return a Repository - first call initializes it, and a JVM
+     *  shutdown hook is registered to stop it
+     */
+    protected SlingRepository getRepository() throws RepositoryException, NamingException {
+        if(repository != null) {
+            return repository;
+        }
+        
+        synchronized (AbstractRepositoryTest.class) {
+            if(repository == null) {
+                RepositoryUtil.startRepository();
+                repository = RepositoryUtil.getRepository();
+                Runtime.getRuntime().addShutdownHook(new ShutdownThread());
+            }
+            return repository;
+        }
+    }
+
+    /** Return a JCR Session, initialized on demand */ 
+    protected Session getSession() throws RepositoryException, NamingException {
+        if(session == null) {
+            session = getRepository().loginAdministrative(null);
+        }
+        return session;
+    }
+    
+    /** Return a test root node, created on demand, with a unique path */ 
+    protected Node getTestRootNode() throws RepositoryException, NamingException {
+        if(testRoot==null) {
+            final Node root = getSession().getRootNode();
+            final Node classRoot = root.addNode(getClass().getSimpleName()); 
+            testRoot = classRoot.addNode(System.currentTimeMillis() + "_" + (++counter));
+        }
+        return testRoot;
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+        if(session != null) {
+            session.logout();
+        }
+    }}

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,134 @@
+/*
+ * 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.sling.performance;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Abstract base class for individual performance benchmarks.
+ */
+public abstract class AbstractTest {
+	
+	protected static int getScale(int def) {
+        int scale = Integer.getInteger("scale", 0);
+        if (scale == 0) {
+            scale = def;
+        }
+        return scale;
+    }
+
+    private volatile boolean running;
+
+    private List<Thread> threads;
+    
+    /**
+     * Adds a background thread that repeatedly executes the given job
+     * until all the iterations of this test have been executed.
+     *
+     * @param job background job
+     */
+    protected void addBackgroundJob(final Runnable job) {
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                while (running) {
+                    job.run();
+                }
+            }
+        };
+        thread.start();
+        threads.add(thread);
+    }
+	
+	/**
+     * Run after all iterations of this test have been executed. Subclasses can
+     * override this method to clean up static test content.
+     *
+     * @throws Exception if an error occurs
+     */
+    protected void afterSuite() throws Exception {
+    }
+    
+    protected void afterTest() throws Exception {
+    }
+
+    
+    /**
+     * Run before any iterations of this test get executed. Subclasses can
+     * override this method to set up static test content.
+     *
+     * @throws Exception if an error occurs
+     */
+    protected void beforeSuite() throws Exception {
+    }
+
+    protected void beforeTest() throws Exception {
+    }
+
+    /**
+     * Executes a single iteration of this test.
+     *
+     * @return number of milliseconds spent in this iteration
+     * @throws Exception if an error occurs
+     */
+    public long execute() throws Exception {
+        beforeTest();
+        try {
+            long start = System.currentTimeMillis();
+            runTest();
+            return System.currentTimeMillis() - start;
+        } finally {
+            afterTest();
+        }
+    }
+
+    protected abstract void runTest() throws Exception;
+    
+    /**
+     * Prepares this performance benchmark.
+     *
+     * @param repository the repository to use
+     * @param credentials credentials of a user with write access
+     * @throws Exception if the benchmark can not be prepared
+     */
+    public void setUp()
+            throws Exception {
+        this.threads = new LinkedList<Thread>();
+        this.running = true;
+        beforeSuite();
+    }
+    
+    /**
+     * Cleans up after this performance benchmark.
+     *
+     * @throws Exception if the benchmark can not be cleaned up
+     */
+    public void tearDown() throws Exception {
+        this.running = false;
+        for (Thread thread : threads) {
+            thread.join();
+        }
+        afterSuite();
+        this.threads = null;
+    }
+
+    public String toString() {
+        String name = getClass().getName();
+        return name.substring(name.lastIndexOf('.') + 1);
+    }
+ }

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/AbstractTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/ResourceResolverTestRequest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/ResourceResolverTestRequest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/ResourceResolverTestRequest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/ResourceResolverTestRequest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,285 @@
+/*
+ * 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.sling.performance;
+
+import java.io.BufferedReader;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+public class ResourceResolverTestRequest implements HttpServletRequest {
+
+    private final Map<String, Object> attrs = new HashMap<String, Object>();
+
+    private String contextPath;
+
+    private final String host;
+
+    private final String method;
+
+    private final String pathInfo;
+
+    private final int port;
+
+    private final String scheme;
+
+    public ResourceResolverTestRequest(String pathInfo) {
+        this(pathInfo, null);
+    }
+
+    public ResourceResolverTestRequest(String pathInfo, String httpMethod) {
+        this(null, null, -1, pathInfo, httpMethod);
+    }
+
+    public ResourceResolverTestRequest(String scheme, String host, int port, String pathInfo) {
+        this(scheme, host, port, pathInfo, null);
+    }
+
+    public ResourceResolverTestRequest(String scheme, String host, int port, String pathInfo, String httpMethod) {
+        this.scheme = (scheme == null) ? "http" : scheme;
+        this.host = (host == null) ? "localhost" : host;
+        this.port = port;
+        this.pathInfo = pathInfo;
+        this.method = httpMethod;
+    }
+
+    public Object getAttribute(String name) {
+        return attrs.get(name);
+    }
+
+    public Enumeration<?> getAttributeNames() {
+        return null;
+    }
+
+    public String getAuthType() {
+        return null;
+    }
+
+    public String getCharacterEncoding() {
+        return null;
+    }
+
+    public int getContentLength() {
+        return 0;
+    }
+
+    public String getContentType() {
+        return null;
+    }
+
+    public String getContextPath() {
+        return contextPath;
+    }
+
+    public Cookie[] getCookies() {
+        return null;
+    }
+
+    public long getDateHeader(String name) {
+        return 0;
+    }
+
+    public String getHeader(String name) {
+        return null;
+    }
+
+    public Enumeration<?> getHeaderNames() {
+        return null;
+    }
+
+    public Enumeration<?> getHeaders(String name) {
+        return null;
+    }
+
+    public ServletInputStream getInputStream() {
+        return null;
+    }
+
+    public int getIntHeader(String name) {
+        return 0;
+    }
+
+    public String getLocalAddr() {
+        return null;
+    }
+
+    public Locale getLocale() {
+        return null;
+    }
+
+    public Enumeration<?> getLocales() {
+        return null;
+    }
+
+    public String getLocalName() {
+        return null;
+    }
+
+    public int getLocalPort() {
+        return 0;
+    }
+
+    public String getMethod() {
+        return method;
+    }
+
+    public String getParameter(String name) {
+        return null;
+    }
+
+    public Map<?, ?> getParameterMap() {
+        return null;
+    }
+
+    public Enumeration<?> getParameterNames() {
+        return null;
+    }
+
+    public String[] getParameterValues(String name) {
+        return null;
+    }
+
+    public String getPathInfo() {
+        return pathInfo;
+    }
+
+    public String getPathTranslated() {
+        return null;
+    }
+
+    public String getProtocol() {
+        return null;
+    }
+
+    public String getQueryString() {
+        return null;
+    }
+
+    public BufferedReader getReader() {
+        return null;
+    }
+
+    public String getRealPath(String path) {
+        return null;
+    }
+
+    public String getRemoteAddr() {
+        return null;
+    }
+
+    public String getRemoteHost() {
+        return null;
+    }
+
+    public int getRemotePort() {
+        return 0;
+    }
+
+    public String getRemoteUser() {
+        return null;
+    }
+
+    public RequestDispatcher getRequestDispatcher(String path) {
+        return null;
+    }
+
+    public String getRequestedSessionId() {
+        return null;
+    }
+
+    public String getRequestURI() {
+        return null;
+    }
+
+    public StringBuffer getRequestURL() {
+        return null;
+    }
+
+    public String getScheme() {
+        return scheme;
+    }
+
+    public String getServerName() {
+        return host;
+    }
+
+    public int getServerPort() {
+        return port;
+    }
+
+    public String getServletPath() {
+        return null;
+    }
+
+    public HttpSession getSession() {
+        return null;
+    }
+
+    public HttpSession getSession(boolean create) {
+        return null;
+    }
+
+    public Principal getUserPrincipal() {
+        return null;
+    }
+
+    public boolean isRequestedSessionIdFromCookie() {
+        return false;
+    }
+
+    public boolean isRequestedSessionIdFromUrl() {
+        return false;
+    }
+
+    public boolean isRequestedSessionIdFromURL() {
+        return false;
+    }
+
+    public boolean isRequestedSessionIdValid() {
+        return false;
+    }
+
+    public boolean isSecure() {
+        return false;
+    }
+
+    public boolean isUserInRole(String role) {
+        return false;
+    }
+
+    public void removeAttribute(String name) {
+    }
+
+    public void setAttribute(String name, Object o) {
+        attrs.put(name, o);
+    }
+
+    public void setCharacterEncoding(String env) {
+    }
+
+    public void setContextPath(String contextPath) {
+        this.contextPath = contextPath;
+    }
+}
\ No newline at end of file

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/ResourceResolverTestRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/ResourceResolverTestRequest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/TestHelper.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/TestHelper.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/TestHelper.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/TestHelper.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,32 @@
+/*
+ * 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.sling.performance;
+
+import javax.jcr.Session;
+
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.jcr.api.SlingRepository;
+
+public interface TestHelper {
+
+    void dispose();
+
+    ResourceResolver getResourceResolver();
+
+    void init(String rootPath, Session session, SlingRepository repository) throws Exception;
+
+}

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/TestHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/TestHelper.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.sling.performance.tests;
+
+import org.apache.sling.performance.TestHelper;
+
+public class ResolveWith10000AliasTest extends ResolveWithManyAliasTest {
+    
+    public ResolveWith10000AliasTest(TestHelper helper) {
+        super(helper, 10000);
+    }
+
+}
\ No newline at end of file

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.sling.performance.tests;
+
+import org.apache.sling.performance.TestHelper;
+
+public class ResolveWith10000VanityPathTest extends ResolveWithManyVanityPathTest {
+
+    public ResolveWith10000VanityPathTest(TestHelper helper) {
+        super(helper, 100, 100);
+    }
+
+}

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.sling.performance.tests;
+
+import org.apache.sling.performance.TestHelper;
+
+public class ResolveWith1000AliasTest extends ResolveWithManyAliasTest {
+    
+    public ResolveWith1000AliasTest(TestHelper helper) {
+        super(helper, 1000);
+    }
+
+}

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.sling.performance.tests;
+
+import org.apache.sling.performance.TestHelper;
+
+public class ResolveWith1000VanityPathTest extends ResolveWithManyVanityPathTest {
+
+    public ResolveWith1000VanityPathTest(TestHelper helper) {
+        super(helper, 100, 10);
+    }
+
+}

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.sling.performance.tests;
+
+import org.apache.sling.performance.TestHelper;
+
+public class ResolveWith30000AliasTest extends ResolveWithManyAliasTest {
+    
+    public ResolveWith30000AliasTest(TestHelper helper) {
+        super(helper, 30000);
+    }
+
+}
\ No newline at end of file

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.sling.performance.tests;
+
+import org.apache.sling.performance.TestHelper;
+
+public class ResolveWith30000VanityPathTest extends ResolveWithManyVanityPathTest {
+
+    public ResolveWith30000VanityPathTest(TestHelper helper) {
+        super(helper, 300, 100);
+    }
+
+}

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.sling.performance.tests;
+
+import org.apache.sling.performance.TestHelper;
+
+public class ResolveWith5000AliasTest extends ResolveWithManyAliasTest {
+    
+    public ResolveWith5000AliasTest(TestHelper helper) {
+        super(helper, 5000);
+    }
+
+}
\ No newline at end of file

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.sling.performance.tests;
+
+import org.apache.sling.performance.TestHelper;
+
+public class ResolveWith5000VanityPathTest extends ResolveWithManyVanityPathTest {
+
+    public ResolveWith5000VanityPathTest(TestHelper helper) {
+        super(helper, 100, 50);
+    }
+
+}

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,127 @@
+/*
+ * 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.sling.performance.tests;
+
+import java.math.BigInteger;
+import java.security.SecureRandom;
+
+import javax.jcr.Node;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.jackrabbit.JcrConstants;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceUtil;
+import org.apache.sling.commons.testing.jcr.RepositoryUtil;
+import org.apache.sling.performance.AbstractRepositoryTest;
+import org.apache.sling.performance.TestHelper;
+import org.apache.sling.performance.ResourceResolverTestRequest;
+
+import static org.junit.Assert.assertNotNull;
+
+class ResolveWithManyAliasTest extends AbstractRepositoryTest {
+    
+    private static final String PN_SLING_ALIAS = "sling:alias";
+    
+    private final TestHelper helper;
+
+    private Node mapRoot;
+
+    private ResourceResolver resResolver;
+    
+    private Node rootNode;
+    
+    private String rootPath;
+
+    private final int nodeCount;
+    
+    public ResolveWithManyAliasTest(TestHelper helper, int nodeCount) {
+        this.helper = helper;
+        this.nodeCount = nodeCount;
+    }
+
+    @Override
+    protected void afterSuite() throws Exception {
+        if (helper != null) {
+            helper.dispose();
+        }
+
+        if (rootNode != null) {
+            rootNode.remove();
+        }
+        if (mapRoot != null) {
+            mapRoot.remove();
+        }
+        /*
+         * if ( this.listener != null ) { this.listener.dispose(); }
+         */
+        session.save();
+    }
+
+    @Override
+    protected void beforeSuite() throws Exception {
+        RepositoryUtil.registerNodeType(getSession(),
+                this.getClass().getResourceAsStream("/SLING-INF/nodetypes/folder.cnd"));
+        RepositoryUtil.registerNodeType(getSession(),
+                this.getClass().getResourceAsStream("/SLING-INF/nodetypes/resource.cnd"));
+        RepositoryUtil.registerNodeType(getSession(),
+                this.getClass().getResourceAsStream("/SLING-INF/nodetypes/vanitypath.cnd"));
+        RepositoryUtil.registerNodeType(getSession(),
+                this.getClass().getResourceAsStream("/SLING-INF/nodetypes/mapping.cnd"));
+
+        // test data
+        rootPath = "/test" + System.currentTimeMillis();
+        rootNode = getSession().getRootNode().addNode(rootPath.substring(1), JcrConstants.NT_UNSTRUCTURED);
+
+        // test mappings
+        mapRoot = getSession().getRootNode().addNode("etc", "nt:folder");
+        Node map = mapRoot.addNode("map", "sling:Mapping");
+        Node http = map.addNode("http", "sling:Mapping");
+        http.addNode("localhost.80", "sling:Mapping");
+        Node https = map.addNode("https", "sling:Mapping");
+        https.addNode("localhost.443", "sling:Mapping");
+
+        // define a vanity path for the rootPath
+        SecureRandom random = new SecureRandom();
+        // creating <nodeCount> nodes
+        for (int j = 0; j < nodeCount; j++) {
+            Node content = rootNode.addNode("a" + j, JcrConstants.NT_UNSTRUCTURED);
+            String alias = new BigInteger(130, random).toString(32);
+            content.setProperty(PN_SLING_ALIAS, alias);
+
+            if (j % 10 == 0) {
+                session.save();
+            }
+        }
+
+        session.save();
+        
+        helper.init(rootPath, session, getRepository());
+
+        resResolver = helper.getResourceResolver();
+
+    }
+
+    @Override
+    protected void runTest() throws Exception {
+        String path = ResourceUtil.normalize(ResourceUtil.getParent(rootPath) + "/" + "testNonExistingAlias"
+                + ".print.html");
+        HttpServletRequest request = new ResourceResolverTestRequest(path);
+        Resource res = resResolver.resolve(request, path);
+        assertNotNull(res);
+    }
+}

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java (added)
+++ sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,137 @@
+/*
+ * 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.sling.performance.tests;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.math.BigInteger;
+import java.security.SecureRandom;
+
+import javax.jcr.Node;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.jackrabbit.JcrConstants;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceUtil;
+import org.apache.sling.commons.testing.jcr.RepositoryUtil;
+import org.apache.sling.performance.AbstractRepositoryTest;
+import org.apache.sling.performance.TestHelper;
+import org.apache.sling.performance.ResourceResolverTestRequest;
+
+class ResolveWithManyVanityPathTest extends AbstractRepositoryTest {
+    
+    private static final String NT_VANITY_PATH = "sling:VanityPath";
+
+    private static final String PN_VANITY_PATH = "sling:vanityPath";
+    
+    private final TestHelper helper;
+    
+    private Node mapRoot;
+    
+    // private JcrResourceListener listener;
+    private ResourceResolver resResolver;
+    
+    private Node rootNode;
+    
+    private String rootPath;
+
+    private final int nodeCount;
+    
+    private final int childNodeCount;
+    
+    public ResolveWithManyVanityPathTest(TestHelper helper, int nodeCount, int childNodeCount) {
+        this.helper = helper;
+        this.nodeCount = nodeCount;
+        this.childNodeCount = childNodeCount;
+    }
+
+    @Override
+    protected void afterSuite() throws Exception {
+        if (helper != null) {
+            helper.dispose();
+        }
+
+        if (rootNode != null) {
+            rootNode.remove();
+        }
+        if (mapRoot != null) {
+            mapRoot.remove();
+        }
+        session.save();
+    }
+
+    @Override
+    protected void beforeSuite() throws Exception {
+        RepositoryUtil.registerNodeType(getSession(),
+                this.getClass().getResourceAsStream("/SLING-INF/nodetypes/folder.cnd"));
+        RepositoryUtil.registerNodeType(getSession(),
+                this.getClass().getResourceAsStream("/SLING-INF/nodetypes/resource.cnd"));
+        RepositoryUtil.registerNodeType(getSession(),
+                this.getClass().getResourceAsStream("/SLING-INF/nodetypes/vanitypath.cnd"));
+        RepositoryUtil.registerNodeType(getSession(),
+                this.getClass().getResourceAsStream("/SLING-INF/nodetypes/mapping.cnd"));
+
+        // test data
+        rootPath = "/test" + System.currentTimeMillis();
+        rootNode = getSession().getRootNode().addNode(rootPath.substring(1), "nt:unstructured");
+
+        // test mappings
+        mapRoot = getSession().getRootNode().addNode("etc", JcrConstants.NT_FOLDER);
+        Node map = mapRoot.addNode("map", "sling:Mapping");
+        Node http = map.addNode("http", "sling:Mapping");
+        http.addNode("localhost.80", "sling:Mapping");
+        Node https = map.addNode("https", "sling:Mapping");
+        https.addNode("localhost.443", "sling:Mapping");
+
+        SecureRandom random = new SecureRandom();
+
+        // creating <nodeCount> x <childNodeCount> nodes with vanity
+        for (int j = 0; j < nodeCount; j++) {
+            Node content = rootNode.addNode("a" + j, JcrConstants.NT_UNSTRUCTURED);
+            String s = new BigInteger(130, random).toString(32);
+            content.addMixin(NT_VANITY_PATH);
+            content.setProperty(PN_VANITY_PATH, s);
+            for (int k = 0; k < childNodeCount; k++) {
+                Node content2 = content.addNode("b" + k, JcrConstants.NT_UNSTRUCTURED);
+                String ss = new BigInteger(130, random).toString(32);
+                content2.addMixin(NT_VANITY_PATH);
+                content2.setProperty(PN_VANITY_PATH, ss);
+            }
+            if (j % 10 == 0) {
+                session.save();
+            }
+        }
+
+        session.save();
+        
+        helper.init(rootPath, session, getRepository());
+
+        resResolver = helper.getResourceResolver();
+
+    }
+
+    @Override
+    protected void runTest() throws Exception {
+        String path = ResourceUtil.normalize(ResourceUtil.getParent(rootPath) + "/" + "testNonExistingVanity"
+                + ".print.html");
+        HttpServletRequest request = new ResourceResolverTestRequest(path);
+        Resource res = resResolver.resolve(request, path);
+        assertNotNull(res);
+    }
+
+}

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/base/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/jcr-resource-2.0.10/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/performance/jcr-resource-2.0.10/pom.xml?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/jcr-resource-2.0.10/pom.xml (added)
+++ sling/trunk/performance/jcr-resource-2.0.10/pom.xml Mon Aug 27 20:13:21 2012
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+    license agreements. See the NOTICE file distributed with this work for additional 
+    information regarding copyright ownership. The ASF licenses this file to 
+    you under the Apache License, Version 2.0 (the "License"); you may not use 
+    this file except in compliance with the License. You may obtain a copy of 
+    the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+    by applicable law or agreed to in writing, software distributed under the 
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+    OF ANY KIND, either express or implied. See the License for the specific 
+    language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling-performance-tests</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>org.apache.sling.performance.jcr.resource-2.0.10</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+
+    <name>Apache Sling Performance Test - JCR Resource 2.0.10</name>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/performance/jcr-resource-2.0.10</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/performance/jcr-resource-2.0.10</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/performance/jcr-resource-2.0.10</url>
+    </scm>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.performance.base</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.jcr.resource</artifactId>
+            <version>2.0.10</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <version>2.0</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+</project>

Propchange: sling/trunk/performance/jcr-resource-2.0.10/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: sling/trunk/performance/jcr-resource-2.0.10/src/test/java/org/apache/sling/performance/PerformanceTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/jcr-resource-2.0.10/src/test/java/org/apache/sling/performance/PerformanceTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/jcr-resource-2.0.10/src/test/java/org/apache/sling/performance/PerformanceTest.java (added)
+++ sling/trunk/performance/jcr-resource-2.0.10/src/test/java/org/apache/sling/performance/PerformanceTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,104 @@
+/*
+ * 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.sling.performance;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.Session;
+
+import junitx.util.PrivateAccessor;
+
+import org.apache.sling.api.SlingConstants;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.jcr.api.SlingRepository;
+import org.apache.sling.jcr.resource.JcrResourceConstants;
+import org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl;
+import org.apache.sling.jcr.resource.internal.helper.MapEntries;
+import org.apache.sling.jcr.resource.internal.helper.Mapping;
+import org.apache.sling.performance.tests.ResolveWith10000AliasTest;
+import org.apache.sling.performance.tests.ResolveWith10000VanityPathTest;
+import org.apache.sling.performance.tests.ResolveWith1000AliasTest;
+import org.apache.sling.performance.tests.ResolveWith1000VanityPathTest;
+import org.apache.sling.performance.tests.ResolveWith30000AliasTest;
+import org.apache.sling.performance.tests.ResolveWith30000VanityPathTest;
+import org.apache.sling.performance.tests.ResolveWith5000AliasTest;
+import org.apache.sling.performance.tests.ResolveWith5000VanityPathTest;
+
+public class PerformanceTest extends AbstractPerformanceTest {
+
+    private class Helper implements TestHelper {
+
+        private MapEntries mapEntries;
+
+        private ResourceResolver resourceResolver;
+        
+        public void dispose() {
+             mapEntries.dispose();
+        }
+
+        public ResourceResolver getResourceResolver() {
+            return resourceResolver;
+        }
+
+        public void init(String rootPath, Session session, SlingRepository repository) throws Exception {
+            JcrResourceResolverFactoryImpl resFac = new JcrResourceResolverFactoryImpl();
+
+            PrivateAccessor.setField(resFac, "repository", repository);
+
+            // setup mappings
+            PrivateAccessor.setField(resFac, "mappings",
+                    new Mapping[] { new Mapping("/-/"), new Mapping(rootPath + "/-/") });
+
+            // ensure namespace mangling
+            PrivateAccessor.setField(resFac, "mangleNamespacePrefixes", true);
+
+            // setup mapping root
+            PrivateAccessor.setField(resFac, "mapRoot", "/etc/map");
+
+            this.mapEntries = new MapEntries(resFac, repository);
+            PrivateAccessor.setField(resFac, "mapEntries", mapEntries);
+
+            try {
+                NamespaceRegistry nsr = session.getWorkspace().getNamespaceRegistry();
+                nsr.registerNamespace(SlingConstants.NAMESPACE_PREFIX, JcrResourceConstants.SLING_NAMESPACE_URI);
+            } catch (Exception e) {
+                // don't care for now
+            }
+
+            PrivateAccessor.setField(resFac, "useMultiWorkspaces", true);
+            
+            resourceResolver = resFac.getResourceResolver(session);
+        }
+    }
+
+    public void testPerformance() throws Exception {
+        Helper helper = new Helper();
+        
+        List<AbstractTest> tests = new ArrayList<AbstractTest>();
+        tests.add(new ResolveWith1000VanityPathTest(helper));
+        tests.add(new ResolveWith5000VanityPathTest(helper));
+        tests.add(new ResolveWith10000VanityPathTest(helper));
+        //tests.add(new ResolveWith30000VanityPathTest(helper));
+        tests.add(new ResolveWith1000AliasTest(helper));
+        tests.add(new ResolveWith5000AliasTest(helper));
+        tests.add(new ResolveWith10000AliasTest(helper));
+        //tests.add(new ResolveWith30000AliasTest(helper));
+        testPerformance("jcr.resource-2.1.0", tests);
+    }
+}

Propchange: sling/trunk/performance/jcr-resource-2.0.10/src/test/java/org/apache/sling/performance/PerformanceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/jcr-resource-2.0.10/src/test/java/org/apache/sling/performance/PerformanceTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/jcr-resource-2.1.0/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/performance/jcr-resource-2.1.0/pom.xml?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/jcr-resource-2.1.0/pom.xml (added)
+++ sling/trunk/performance/jcr-resource-2.1.0/pom.xml Mon Aug 27 20:13:21 2012
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+    license agreements. See the NOTICE file distributed with this work for additional 
+    information regarding copyright ownership. The ASF licenses this file to 
+    you under the Apache License, Version 2.0 (the "License"); you may not use 
+    this file except in compliance with the License. You may obtain a copy of 
+    the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+    by applicable law or agreed to in writing, software distributed under the 
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+    OF ANY KIND, either express or implied. See the License for the specific 
+    language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>13</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>org.apache.sling.performance.jcr.resource-2.1.0</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+
+    <name>Apache Sling Performance Test - JCR Resource 2.1.0</name>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/performance/jcr-resource-2.1.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/performance/jcr-resource-2.1.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/performance/jcr-resource-2.1.0</url>
+    </scm>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.performance.base</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.jcr.resource</artifactId>
+            <version>2.1.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <version>2.0</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+</project>

Propchange: sling/trunk/performance/jcr-resource-2.1.0/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: sling/trunk/performance/jcr-resource-2.1.0/src/test/java/org/apache/sling/performance/PerformanceTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/performance/jcr-resource-2.1.0/src/test/java/org/apache/sling/performance/PerformanceTest.java?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/jcr-resource-2.1.0/src/test/java/org/apache/sling/performance/PerformanceTest.java (added)
+++ sling/trunk/performance/jcr-resource-2.1.0/src/test/java/org/apache/sling/performance/PerformanceTest.java Mon Aug 27 20:13:21 2012
@@ -0,0 +1,116 @@
+/*
+ * 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.sling.performance;
+
+import static org.mockito.Mockito.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.Session;
+
+import junitx.util.PrivateAccessor;
+
+import org.apache.sling.api.SlingConstants;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.jcr.api.SlingRepository;
+import org.apache.sling.jcr.resource.JcrResourceConstants;
+import org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl;
+import org.apache.sling.jcr.resource.internal.helper.MapEntries;
+import org.apache.sling.jcr.resource.internal.helper.Mapping;
+import org.apache.sling.performance.tests.*;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class PerformanceTest extends AbstractPerformanceTest {
+
+    private class Helper implements TestHelper {
+
+        private MapEntries mapEntries;
+
+        private ResourceResolver resourceResolver;
+        
+        public void dispose() {
+             mapEntries.dispose();
+        }
+
+        public ResourceResolver getResourceResolver() {
+            return resourceResolver;
+        }
+
+        public void init(String rootPath, Session session, SlingRepository repository) throws Exception {
+            JcrResourceResolverFactoryImpl resFac = new JcrResourceResolverFactoryImpl();
+
+            PrivateAccessor.setField(resFac, "repository", repository);
+
+            // setup mappings
+            PrivateAccessor.setField(resFac, "mappings",
+                    new Mapping[] { new Mapping("/-/"), new Mapping(rootPath + "/-/") });
+
+            // ensure namespace mangling
+            PrivateAccessor.setField(resFac, "mangleNamespacePrefixes", true);
+
+            // setup mapping root
+            PrivateAccessor.setField(resFac, "mapRoot", "/etc/map");
+            
+            final EventAdmin mockVoidEA = new EventAdmin() {
+
+                public void postEvent(Event event) {
+                    // nothing to do
+                }
+
+                public void sendEvent(Event event) {
+                    // nothing to do
+                }
+            };
+            final ServiceTracker voidTracker = mock(ServiceTracker.class);
+            when(voidTracker.getService()).thenReturn(mockVoidEA);
+
+            mapEntries = new MapEntries(resFac, mock(BundleContext.class), voidTracker);
+            PrivateAccessor.setField(resFac, "mapEntries", mapEntries);
+
+            try {
+                NamespaceRegistry nsr = session.getWorkspace().getNamespaceRegistry();
+                nsr.registerNamespace(SlingConstants.NAMESPACE_PREFIX, JcrResourceConstants.SLING_NAMESPACE_URI);
+            } catch (Exception e) {
+                // don't care for now
+            }
+
+            PrivateAccessor.setField(resFac, "useMultiWorkspaces", true);
+            
+            resourceResolver = resFac.getResourceResolver(session);
+        }
+    }
+    
+    public void testPerformance() throws Exception {
+        Helper helper = new Helper();
+        
+        List<AbstractTest> tests = new ArrayList<AbstractTest>();
+        tests.add(new ResolveWith1000VanityPathTest(helper));
+        tests.add(new ResolveWith5000VanityPathTest(helper));
+        tests.add(new ResolveWith10000VanityPathTest(helper));
+        //tests.add(new ResolveWith30000VanityPathTest(helper));
+        tests.add(new ResolveWith1000AliasTest(helper));
+        tests.add(new ResolveWith5000AliasTest(helper));
+        tests.add(new ResolveWith10000AliasTest(helper));
+        //tests.add(new ResolveWith30000AliasTest(helper));
+        testPerformance("jcr.resource-2.1.0", tests);
+    }
+}

Propchange: sling/trunk/performance/jcr-resource-2.1.0/src/test/java/org/apache/sling/performance/PerformanceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/performance/jcr-resource-2.1.0/src/test/java/org/apache/sling/performance/PerformanceTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/performance/jcr-resource-2.2.0/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/performance/jcr-resource-2.2.0/pom.xml?rev=1377819&view=auto
==============================================================================
--- sling/trunk/performance/jcr-resource-2.2.0/pom.xml (added)
+++ sling/trunk/performance/jcr-resource-2.2.0/pom.xml Mon Aug 27 20:13:21 2012
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+    license agreements. See the NOTICE file distributed with this work for additional 
+    information regarding copyright ownership. The ASF licenses this file to 
+    you under the Apache License, Version 2.0 (the "License"); you may not use 
+    this file except in compliance with the License. You may obtain a copy of 
+    the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+    by applicable law or agreed to in writing, software distributed under the 
+    License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
+    OF ANY KIND, either express or implied. See the License for the specific 
+    language governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling-performance-tests</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>org.apache.sling.performance.jcr.resource-2.2.0</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+
+    <name>Apache Sling Performance Test - JCR Resource 2.2.0</name>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/performance/jcr-resource-2.2.0</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/performance/jcr-resource-2.2.0</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/performance/jcr-resource-2.2.0</url>
+    </scm>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.performance.base</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.jcr.resource</artifactId>
+            <version>2.1.1-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.2.5-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.resourceresolver</artifactId>
+            <version>0.1.0-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <version>2.0</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.osgi</artifactId>
+            <version>2.1.0</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+</project>

Propchange: sling/trunk/performance/jcr-resource-2.2.0/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message