You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:26:48 UTC

[sling-tooling-scm] annotated tag org.apache.sling.performance.base-0.0.2 created (now 49e2356)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a change to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git.


      at 49e2356  (tag)
 tagging 98e7d32519bd87ea6a6ee1fac9be70197dc5d763 (commit)
      by Radu Cotescu
      on Mon Mar 23 20:14:41 2015 +0000

- Log -----------------------------------------------------------------
org.apache.sling.performance.base-0.0.2
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new df68289  SLING-2311 - adding small performance test suite. Based heavily on the work of Antonio Sanso and the Jackrabbit team (Thanks!!!)
     new 0419154  SLING-2311 - removing extraneous listener fields
     new edda8ef  SLING-2311 - renaming tests to clarify that they are trying to resovle non-existing resources
     new b15d208  SLING-2593 - Improvement for the Sling performance tools. Adding first part of the patch provided from Christian Vazzolla:  Created a new maven project that contains only the sling performance tests and left the framework(tool) related part in the base project as we would like to use the framework for performance testing in other projects also. Thanks Christian!
     new eb67a44  SLING-2593 - Improvement for the Sling performance tools. Adding patch provided from Christian Vazzolla. Thanks Christian!
     new 9b5a2d9  SLING-2593 - Improvement for the Sling performance tools. adjusting formatting in order to be Sling compliant
     new df2a0fa  Set svn:ignore
     new 384edbc  SLING-2593 - Improvement for the Sling performance tools. Removed XML Report type since is not implemented. Changed getenv with getProperty. Removed 2 unused classes (AbstractPerformanceTest, AbstractTest)
     new f05b35e  SLING-2593 - Improvement for the Sling performance tools. Adding Report level parameter. Thanks Christian Vazzolla for the patch.
     new 022be37  SLING-2729 - Performance Testing suite: Modified ReportLogger to log the test case name
     new 7979bf8  SLING-2727 - Allow PerformanceRunner to run tests provided by a factory method
     new 81e762c  SLING-2727 - Allow PerformanceRunner to run tests provided by a factory method
     new a3c136f  SLING-3294 - Simplify Performance Test Creation
     new defc4ef  @releng removing intermediate parent pom and adding the modules to the reactor
     new 19f3f84  Add some simple performance test examples
     new bd4da1a  SLING-3579 - Allow performance tests to report custom class name to the report logger
     new c431d74  SLING-3746 - Combining Sling performance and Sling Junit
     new 2bca758  Update to latest parent pom 20
     new 61f259b  Update to Sling Parent POM 22 with baselining enabled
     new 4f20e50  @trivial Converted mixed tabs and spaces indentation to spaces
     new 7a5cbfc  SLING-4494 - Performance: update performance test framework to allow comparison of results
     new d800d03  @trivial: whitespace changes
     new cdcc9a2  [maven-release-plugin] prepare release org.apache.sling.performance.base-0.0.2
     new fb0146f  [maven-release-plugin] rollback the release of org.apache.sling.performance.base-0.0.2
     new 373864a  @trivial: corrected SCM info
     new 59d2348  [maven-release-plugin] prepare release org.apache.sling.performance.base-0.0.2
     new 98e7d32  [maven-release-plugin]  copy for tag org.apache.sling.performance.base-0.0.2

The 27 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-tooling-scm] 21/27: SLING-4494 - Performance: update performance test framework to allow comparison of results

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 7a5cbfc76de8817fe439e37aab0f587c50c628b5
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Thu Mar 12 16:39:36 2015 +0000

    SLING-4494 - Performance: update performance test framework to allow comparison of results
    
    * performance testing features which allow to not only log tests run time but also compare
    them and fail in case a certain threshold ratio is surpassed
    
    (applied patch sent by Vlad Băilescu - closes #69)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1666250 13f79535-47bb-0310-9956-ffa450edef68
---
 .../performance/FrameworkPerformanceMethod.java    |  17 +-
 .../sling/performance/PerformanceRecord.java       |  61 +++++
 .../sling/performance/PerformanceRunner.java       |  51 +++-
 .../org/apache/sling/performance/ReportLogger.java | 296 +++++++++++++++++++--
 .../performance/annotation/PerformanceTest.java    |   5 +-
 5 files changed, 392 insertions(+), 38 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
index 1e002f4..75e69af 100644
--- a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
+++ b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
@@ -38,15 +38,18 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
     private Object target;
     private PerformanceSuiteState performanceSuiteState;
     private PerformanceRunner.ReportLevel reportLevel = PerformanceRunner.ReportLevel.ClassLevel;
+    private String referenceMethod = null;
     private String testCaseName = "";
     private String className;
 
     public FrameworkPerformanceMethod(Method method, Object target,
-            PerformanceSuiteState performanceSuiteState, PerformanceRunner.ReportLevel reportLevel) {
+                                      PerformanceSuiteState performanceSuiteState, PerformanceRunner.ReportLevel reportLevel,
+                                      String referenceMethod) {
         super(method);
         this.target = target;
         this.performanceSuiteState = performanceSuiteState;
         this.reportLevel = reportLevel;
+        this.referenceMethod = referenceMethod;
         if (target instanceof IdentifiableTestCase) {
             this.testCaseName = ((IdentifiableTestCase) target).testCaseName();
         }
@@ -109,6 +112,7 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
         int runtime = performanceAnnotation.runtime();
         int warmupinvocations = performanceAnnotation.warmupinvocations();
         int runinvocations = performanceAnnotation.runinvocations();
+        double threshold = performanceAnnotation.threshold();
 
         DescriptiveStatistics statistics = new DescriptiveStatistics();
 
@@ -181,8 +185,13 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
         }
 
         if (statistics.getN() > 0) {
-            ReportLogger.writeReport(this.performanceSuiteState.testSuiteName, testCaseName, className, getMethod().getName(),
-                    statistics, ReportLogger.ReportType.TXT, reportLevel);
+            if (referenceMethod == null) {
+                ReportLogger.writeReport(this.performanceSuiteState.testSuiteName, testCaseName, className, getMethod().getName(),
+                        statistics, ReportLogger.ReportType.TXT, reportLevel);
+            } else {
+                ReportLogger reportLogger = ReportLogger.getOrCreate(this.performanceSuiteState.testSuiteName, testCaseName, getMethod().getDeclaringClass().getName(), referenceMethod);
+                reportLogger.recordStatistics(getMethod().getName(), statistics, threshold);
+            }
         }
 
         // In case of a PerformanceSuite we need to run the methods annotated
@@ -345,6 +354,6 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
         if (testCaseName == null || "".equals(testCaseName.trim())) { return super.getName(); }
         return String.format("%s  [%s.%s]", testCaseName, target.getClass().getSimpleName(),
                 getMethod().getName());
-}
+    }
 
 }
diff --git a/src/main/java/org/apache/sling/performance/PerformanceRecord.java b/src/main/java/org/apache/sling/performance/PerformanceRecord.java
new file mode 100644
index 0000000..c62640f
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/PerformanceRecord.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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 org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+
+/**
+ * Wrapper for recorded performance statistics and defined threshold
+ */
+public class PerformanceRecord {
+
+    private final DescriptiveStatistics statistics;
+
+    private final Number threshold;
+
+    public PerformanceRecord(final DescriptiveStatistics statistics, final Number threshold) {
+        this.statistics = statistics;
+        this.threshold = threshold;
+    }
+
+    public DescriptiveStatistics getStatistics() {
+        return this.statistics;
+    }
+
+    public Number getThreshold() {
+        return this.threshold;
+    }
+
+    /**
+     * Checks internal statistics against <code>reference</code>. Current implementation looks at 50 percentile.
+     *
+     * @param reference Reference statistics
+     * @return An error string if threshold is exceeded, <code>null</code> if not
+     */
+    public String checkThreshold(DescriptiveStatistics reference) {
+        if (threshold == null || threshold.doubleValue() <= 0) {
+            return null;
+        }
+        double ratio = this.statistics.getPercentile(50) / reference.getPercentile(50);
+        if (ratio > threshold.doubleValue()) {
+            return String.format("Threshold exceeded! Expected <%6.2f, actual %6.2f", threshold.doubleValue(), ratio);
+        }
+        return null;
+    }
+}
diff --git a/src/main/java/org/apache/sling/performance/PerformanceRunner.java b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
index bb646fe..21edf01 100644
--- a/src/main/java/org/apache/sling/performance/PerformanceRunner.java
+++ b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
@@ -23,10 +23,13 @@ import org.apache.sling.performance.annotation.PerformanceTestFactory;
 import org.apache.sling.performance.annotation.PerformanceTestSuite;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunNotifier;
 import org.junit.runners.BlockJUnit4ClassRunner;
 import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.TestClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.lang.annotation.Annotation;
 import java.lang.annotation.ElementType;
@@ -34,7 +37,6 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -44,15 +46,18 @@ import java.util.List;
 
 /**
  * The custom JUnit runner that collects the performance tests
- * 
+ *
  */
 
 
 
 public class PerformanceRunner extends BlockJUnit4ClassRunner {
+    private static final Logger logger = LoggerFactory.getLogger(ReportLogger.class);
+
     protected LinkedList<FrameworkMethod> tests = new LinkedList<FrameworkMethod>();
     private List<PerformanceSuiteState> suitesState = new ArrayList<PerformanceSuiteState>();
     public ReportLevel reportLevel = ReportLevel.ClassLevel;
+    public String referenceMethod = null;
 
     public static enum ReportLevel{
         ClassLevel,
@@ -63,6 +68,8 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
     @Target(ElementType.TYPE)
     public @interface Parameters {
         public ReportLevel reportLevel() default ReportLevel.ClassLevel;
+        /** This is the name of the reference method used to compute statistics */
+        public String referenceMethod() default "";
     }
 
     public PerformanceRunner(Class<?> clazz) throws InitializationError {
@@ -72,6 +79,21 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
         // by default set to class level for legacy tests compatibility
         if (clazz.getAnnotation(Parameters.class) != null){
             reportLevel = clazz.getAnnotation(Parameters.class).reportLevel();
+            referenceMethod = clazz.getAnnotation(Parameters.class).referenceMethod();
+            if ("".equals(referenceMethod)) {
+                referenceMethod = null;
+            } else {
+                boolean found = false;
+                for (Method method : clazz.getMethods()) {
+                    if (method.getName().equals(referenceMethod) && method.getParameterTypes().length == 0) {
+                        found = true;
+                        break;
+                    }
+                }
+                if (!found) {
+                    referenceMethod = null;
+                }
+            }
         }
 
         try {
@@ -81,6 +103,23 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
         }
     }
 
+    @Override
+    public void run(RunNotifier notifier) {
+        super.run(notifier);
+        try {
+            ReportLogger.writeAllResults();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+        try {
+            for (Failure failure : ReportLogger.checkAllThresholds()) {
+                notifier.fireTestFailure(failure);
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
     /**
      * Compute the tests that will be run
      *
@@ -219,7 +258,7 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
 
                 for (Method method : testMethods) {
                     FrameworkPerformanceMethod performaceTestMethod =
-                            new FrameworkPerformanceMethod(method, testObject, current, reportLevel);
+                            new FrameworkPerformanceMethod(method, testObject, current, reportLevel, referenceMethod);
                     tests.add(performaceTestMethod);
                 }
 
@@ -237,7 +276,7 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
         for (FrameworkMethod method : getTestClass().getAnnotatedMethods(PerformanceTest.class)) {
             Object targetObject = getTestClass().getJavaClass().newInstance();
             FrameworkPerformanceMethod performanceTestMethod = new FrameworkPerformanceMethod(
-                    method.getMethod(), targetObject, current, reportLevel);
+                    method.getMethod(), targetObject, current, reportLevel, referenceMethod);
             tests.add(performanceTestMethod);
         }
 
@@ -245,7 +284,7 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
     }
 
 
-        /**
+    /**
      * Retrieve specific method from test class
      *
      * @param testClass
diff --git a/src/main/java/org/apache/sling/performance/ReportLogger.java b/src/main/java/org/apache/sling/performance/ReportLogger.java
index 64dccd9..d93109b 100644
--- a/src/main/java/org/apache/sling/performance/ReportLogger.java
+++ b/src/main/java/org/apache/sling/performance/ReportLogger.java
@@ -5,10 +5,18 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
 
+import org.apache.commons.collections.map.MultiKeyMap;
 import org.apache.commons.io.output.FileWriterWithEncoding;
 import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+import org.junit.runner.Description;
+import org.junit.runner.notification.Failure;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -16,13 +24,77 @@ public class ReportLogger {
 
     private static boolean reportFolderLogged = false;
     private static final Logger logger = LoggerFactory.getLogger(ReportLogger.class);
-    
+
     public static final String REPORTS_DIR = "performance-reports";
 
+    /** Multi map of all ReportLogger instances created by getOrCreate(..) */
+    private static final MultiKeyMap reportLoggers = new MultiKeyMap();
+
     public enum ReportType {
         TXT
     }
 
+    /** Name of test suite */
+    private final String testSuiteName;
+
+    /** Name of test case */
+    private final String testCaseName;
+
+    /** Class name */
+    private final String className;
+
+    /** Name of test method to which all other tests will be compared */
+    private final String referenceMethod;
+
+    /** Recorded stats for ran tests */
+    private final Map<String, PerformanceRecord> records = new LinkedHashMap<String, PerformanceRecord>();
+
+    /**
+     * Do not allow instances to be created directly, use the getOrCreate(..) static method
+     */
+    private ReportLogger() {
+        this.testSuiteName = null;
+        this.testCaseName = null;
+        this.className = null;
+        this.referenceMethod = null;
+    }
+
+    /**
+     * Create a new ReportLogger, will be called by getOrCreate(..)
+     *
+     * @param testSuiteName
+     * @param testCaseName
+     * @param className
+     * @param referenceMethod
+     */
+    private ReportLogger(final String testSuiteName, final String testCaseName, final String className,
+                         final String referenceMethod) {
+        this.testSuiteName = testSuiteName;
+        this.testCaseName = testCaseName;
+        this.className = className;
+        this.referenceMethod = referenceMethod;
+    }
+
+    /**
+     * Factory method for ReportRecorder. Will return an existing ReportLogger for given parameters or create a new
+     * instance and register it internally.
+     *
+     * @param testSuiteName
+     * @param testCaseName
+     * @param className
+     * @param referenceMethod
+     * @return
+     */
+    public static ReportLogger getOrCreate(final String testSuiteName, final String testCaseName,
+                                           final String className, final String referenceMethod) {
+        Object reportLogger = reportLoggers.get(testSuiteName, testCaseName, className, referenceMethod);
+        if (reportLogger == null) {
+            reportLogger = new ReportLogger(testSuiteName, testCaseName, className, referenceMethod);
+            reportLoggers.put(testSuiteName, testCaseName, className, referenceMethod, reportLogger);
+        }
+        return (ReportLogger)reportLogger;
+    }
+
     /**
      * Method the writes the performance report after a test is run
      * @param testSuiteName
@@ -35,7 +107,7 @@ public class ReportLogger {
      * @throws Exception
      */
     public static void writeReport(String testSuiteName, String testCaseName, String className, String methodName,
-            DescriptiveStatistics statistics, ReportType reportType, PerformanceRunner.ReportLevel reportLevel) throws Exception {
+                                   DescriptiveStatistics statistics, ReportType reportType, PerformanceRunner.ReportLevel reportLevel) throws Exception {
         switch (reportType) {
             case TXT:
                 writeReportTxt(testSuiteName, testCaseName, className, methodName, statistics, reportLevel);
@@ -57,11 +129,64 @@ public class ReportLogger {
      * @throws Exception
      */
     public static void writeReportTxt(String testSuiteName, String testCaseName, String className, String methodName,
-            DescriptiveStatistics statistics, PerformanceRunner.ReportLevel reportLevel) throws Exception {
+                                      DescriptiveStatistics statistics, PerformanceRunner.ReportLevel reportLevel) throws Exception {
+        writeReportTxt(testSuiteName,
+                testCaseName,
+                className,
+                methodName,
+                statistics.getMin(),
+                statistics.getPercentile(10),
+                statistics.getPercentile(50),
+                statistics.getPercentile(90),
+                statistics.getMax(),
+                reportLevel);
+    }
 
+    /**
+     * Method that writes the performance report
+     *
+     * @param testSuiteName
+     * @param testCaseName
+     * @param className
+     * @param methodName
+     * @param min
+     * @param percentile10
+     * @param percentile50
+     * @param percentile90
+     * @param max
+     * @param reportLevel
+     * @throws Exception
+     */
+    public static void writeReportTxt(String testSuiteName, String testCaseName, String className, String methodName,
+                                      double min, double percentile10, double percentile50, double percentile90, double max,
+                                      PerformanceRunner.ReportLevel reportLevel) throws Exception {
+        writeReportTxt(testSuiteName, testCaseName, className, methodName,
+                min, percentile10, percentile50, percentile90, max,
+                reportLevel, false);
+    }
+
+    /**
+     * Method that writes the performance report
+     *
+     * @param testSuiteName
+     * @param testCaseName
+     * @param className
+     * @param methodName
+     * @param min
+     * @param percentile10
+     * @param percentile50
+     * @param percentile90
+     * @param max
+     * @param reportLevel
+     * @param showDecimals
+     * @throws Exception
+     */
+    public static void writeReportTxt(String testSuiteName, String testCaseName, String className, String methodName,
+                                      double min, double percentile10, double percentile50, double percentile90, double max,
+                                      PerformanceRunner.ReportLevel reportLevel, boolean showDecimals) throws Exception {
         File reportDir = new File("target/" + REPORTS_DIR);
         if (!reportDir.exists() && !reportDir.mkdir()) {
-                throw new IOException("Unable to create " + REPORTS_DIR + " directory");
+            throw new IOException("Unable to create " + REPORTS_DIR + " directory");
         }
 
         // need this in the case a user wants to set the suite name from the
@@ -76,10 +201,11 @@ public class ReportLogger {
 
         if (reportLevel.equals(PerformanceRunner.ReportLevel.ClassLevel)) {
             String resultFileName = className;
-            writeReportClassLevel(resultFileName, testSuiteName, statistics);
+            writeReportClassLevel(resultFileName, testSuiteName, min, percentile10, percentile50, percentile90, max);
         } else if (reportLevel.equals(PerformanceRunner.ReportLevel.MethodLevel)) {
             String resultFileName = className + "." + methodName;
-            writeReportMethodLevel(resultFileName, testSuiteName, testCaseName, className, methodName, statistics);
+            writeReportMethodLevel(resultFileName, testSuiteName, testCaseName, className, methodName,
+                    min, percentile10, percentile50, percentile90, max, showDecimals);
         }
     }
 
@@ -88,10 +214,15 @@ public class ReportLogger {
      *
      * @param resultFileName the name of the result file (without extension)
      * @param testSuiteName the name of the test suite name
-     * @param statistics the statistics object used to compute different medians
+     * @param min
+     * @param percentile10
+     * @param percentile50
+     * @param percentile90
+     * @param max
+
      */
     private static void writeReportClassLevel(String resultFileName, String testSuiteName,
-            DescriptiveStatistics statistics) throws IOException {
+                                              double min, double percentile10, double percentile50, double percentile90, double max) throws IOException {
 
         File report = getReportFile(resultFileName, ".txt");
         boolean needsPrefix = !report.exists();
@@ -105,16 +236,16 @@ public class ReportLogger {
             writer.format(
                     "%-52.52s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
                     testSuiteName,
-                    statistics.getMin(),
-                    statistics.getPercentile(10.0),
-                    statistics.getPercentile(50.0),
-                    statistics.getPercentile(90.0),
-                    statistics.getMax());
+                    min,
+                    percentile10,
+                    percentile50,
+                    percentile90,
+                    max);
         } finally {
             writer.close();
         }
     }
-    
+
     /**
      * Write report for method level tests
      *
@@ -123,10 +254,17 @@ public class ReportLogger {
      * @param testCaseName
      * @param className
      * @param methodName
-     * @param statistics the statistics object used to compute different medians
+     * @param min
+     * @param percentile10
+     * @param percentile50
+     * @param percentile90
+     * @param max
+
      */
-    private static void writeReportMethodLevel(String resultFileName, String testSuiteName, String testCaseName, String className,
-            String methodName, DescriptiveStatistics statistics) throws IOException {
+    private static void writeReportMethodLevel(String resultFileName, String testSuiteName,
+                                               String testCaseName, String className, String methodName,
+                                               double min, double percentile10, double percentile50, double percentile90, double max,
+                                               boolean showDecimals) throws IOException {
         File report = getReportFile(resultFileName, ".txt");
 
         boolean needsPrefix = !report.exists();
@@ -143,20 +281,22 @@ public class ReportLogger {
             }
 
             writer.format(
-                    "%-40.40s|%-120.120s|%-80.80s|%-40.40s|%-20.20s|%7.0f|%9.0f|%9.0f|%9.0f|%9.0f%n",
+                    showDecimals ?
+                            "%-40.40s|%-120.120s|%-80.80s|%-40.40s|%-20.20s|%7.2f|%9.2f|%9.2f|%9.2f|%9.2f%n":
+                            "%-40.40s|%-120.120s|%-80.80s|%-40.40s|%-20.20s|%7.0f|%9.0f|%9.0f|%9.0f|%9.0f%n",
                     testSuiteName,
                     (testCaseName.length() < 120) ? (testCaseName) : (testCaseName.substring(0, 115) + "[...]"),
                     className,
                     methodName,
                     getDate(),
-                    statistics.getMin(),
-                    statistics.getPercentile(10.0),
-                    statistics.getPercentile(50.0),
-                    statistics.getPercentile(90.0),
-                    statistics.getMax());
-            } finally {
-                writer.close();
-            }
+                    min,
+                    percentile10,
+                    percentile50,
+                    percentile90,
+                    max);
+        } finally {
+            writer.close();
+        }
     }
 
 
@@ -180,4 +320,108 @@ public class ReportLogger {
         return new File(folder, filename);
     }
 
+    /**
+     * Write results from all registered loggers
+     *
+     * @throws Exception
+     */
+    public static void writeAllResults() throws Exception {
+        for (Object reportLogger : reportLoggers.values()) {
+            ((ReportLogger)reportLogger).writeResults();
+        }
+    }
+
+    /**
+     * Check all thresholds for all records in all registered loggers
+     *
+     * @return
+     */
+    public static List<Failure> checkAllThresholds() throws ClassNotFoundException {
+        List<Failure> failures = new ArrayList<Failure>();
+        for (Object reportLogger : reportLoggers.values()) {
+            failures.addAll(((ReportLogger) reportLogger).checkThresholds());
+        }
+        return failures;
+    }
+
+    /**
+     * Record statistics for given method
+     *
+     * @param methodName
+     * @param statistics
+     */
+    public void recordStatistics(final String methodName, final DescriptiveStatistics statistics, final double threshold) {
+        records.put(methodName, new PerformanceRecord(statistics, threshold));
+    }
+
+    /**
+     * Write all records to file in TXT format
+     *
+     * @throws Exception
+     */
+    public void writeResults() throws Exception {
+        PerformanceRecord referenceRecord = records.get(referenceMethod);
+        for (String methodName : records.keySet()) {
+            DescriptiveStatistics statistics = records.get(methodName).getStatistics();
+            double min = statistics.getMin();
+            double percentile10 = statistics.getPercentile(10);
+            double percentile50 = statistics.getPercentile(50);
+            double percentile90 = statistics.getPercentile(90);
+            double max = statistics.getMax();
+            boolean showDecimals = false;
+            if (referenceRecord != null && !referenceMethod.equals(methodName)) {
+                DescriptiveStatistics referenceStatistics = referenceRecord.getStatistics();
+                double ref = referenceStatistics.getMin();
+                min = ref == 0 ? Double.POSITIVE_INFINITY : min/ref;
+
+                ref = referenceStatistics.getPercentile(10);
+                percentile10 = ref == 0 ? Double.POSITIVE_INFINITY : percentile10/ref;
+
+                ref = referenceStatistics.getPercentile(50);
+                percentile50 = ref == 0 ? Double.POSITIVE_INFINITY : percentile50/ref;
+
+                ref = referenceStatistics.getPercentile(90);
+                percentile90 = ref == 0 ? Double.POSITIVE_INFINITY : percentile90/ref;
+
+                ref = referenceStatistics.getMax();
+                max = ref == 0 ? Double.POSITIVE_INFINITY : max /referenceStatistics.getMax();
+
+                showDecimals = true;
+            }
+            ReportLogger.writeReportTxt(testSuiteName,
+                    testCaseName,
+                    Class.forName(className).getSimpleName(),
+                    methodName,
+                    min,
+                    percentile10,
+                    percentile50,
+                    percentile90,
+                    max,
+                    PerformanceRunner.ReportLevel.MethodLevel,
+                    showDecimals);
+        }
+    }
+
+    /**
+     * Test if any of the <link>PerformanceRecord</link> exceeds their threshold against the reference
+     *
+     * @return
+     */
+    public List<Failure> checkThresholds() throws ClassNotFoundException {
+        PerformanceRecord referenceRecord = records.get(referenceMethod);
+        if (referenceRecord == null) {
+            return Collections.EMPTY_LIST;
+        }
+        DescriptiveStatistics referenceStatistics = referenceRecord.getStatistics();
+        List<Failure> failures = new ArrayList<Failure>();
+        for (String methodName : records.keySet()) {
+            PerformanceRecord performanceRecord = records.get(methodName);
+            String result = performanceRecord.checkThreshold(referenceStatistics);
+            if (result != null) {
+                failures.add(new Failure(Description.createTestDescription(Class.forName(className), methodName),
+                        new Exception(result)));
+            }
+        }
+        return failures;
+    }
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/performance/annotation/PerformanceTest.java b/src/main/java/org/apache/sling/performance/annotation/PerformanceTest.java
index 3810234..1fec58c 100644
--- a/src/main/java/org/apache/sling/performance/annotation/PerformanceTest.java
+++ b/src/main/java/org/apache/sling/performance/annotation/PerformanceTest.java
@@ -42,6 +42,7 @@ public @interface PerformanceTest {
 	// set the number of invocations to run
 	// in the warm up phase
 	int warmupinvocations() default 0;
-	
-	
+
+	// set the performance threshold
+	double threshold() default 0;
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 12/27: SLING-2727 - Allow PerformanceRunner to run tests provided by a factory method

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 81e762c2b1293edd460e7ca9e9b05a38e3e0bcae
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Tue Dec 17 13:35:56 2013 +0000

    SLING-2727 - Allow PerformanceRunner to run tests provided by a factory method
    
    * removed system output
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1551539 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/sling/performance/FrameworkPerformanceMethod.java    | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
index 3532afa..36a0271 100644
--- a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
+++ b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
@@ -348,7 +348,6 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 
     @Override
     public String getName() {
-        System.out.println(testCaseName);
         if (testCaseName == null || "".equals(testCaseName.trim())) { return super.getName(); }
         return String.format("%s  [%s.%s]", testCaseName, target.getClass().getSimpleName(),
                 getMethod().getName());

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 08/27: SLING-2593 - Improvement for the Sling performance tools. Removed XML Report type since is not implemented. Changed getenv with getProperty. Removed 2 unused classes (AbstractPerformanceTest, AbstractTest)

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 384edbc1536dbdb210a7624cee7863e3aa7144aa
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Wed Oct 3 11:29:19 2012 +0000

    SLING-2593 - Improvement for the Sling performance tools. Removed XML Report type since is not implemented. Changed getenv with getProperty. Removed 2 unused classes (AbstractPerformanceTest, AbstractTest)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1393426 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/performance/AbstractPerformanceTest.java |  91 --------------
 .../org/apache/sling/performance/AbstractTest.java | 134 ---------------------
 .../org/apache/sling/performance/ReportLogger.java |   8 +-
 3 files changed, 3 insertions(+), 230 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java b/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java
deleted file mode 100644
index 1540cf7..0000000
--- a/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java
+++ /dev/null
@@ -1,91 +0,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.
- */
-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();
-        }
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/performance/AbstractTest.java b/src/main/java/org/apache/sling/performance/AbstractTest.java
deleted file mode 100644
index 7cdaca2..0000000
--- a/src/main/java/org/apache/sling/performance/AbstractTest.java
+++ /dev/null
@@ -1,134 +0,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.
- */
-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);
-    }
- }
diff --git a/src/main/java/org/apache/sling/performance/ReportLogger.java b/src/main/java/org/apache/sling/performance/ReportLogger.java
index f0822f1..d43f455 100644
--- a/src/main/java/org/apache/sling/performance/ReportLogger.java
+++ b/src/main/java/org/apache/sling/performance/ReportLogger.java
@@ -13,7 +13,7 @@ import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
 public class ReportLogger {
 
 	public enum ReportType {
-		TXT, XML
+		TXT
 	}
 
 	public static void writeReport(String test, String testSuiteName,
@@ -23,8 +23,6 @@ public class ReportLogger {
 		case TXT:
 			writeReportTxt(test, testSuiteName, name, statistics);
 			break;
-		case XML:
-			throw new Exception("The XML reporting format is not yet supported");
 		default:
 			throw new Exception(
 					"The specified reporting format is not yet supported");
@@ -60,8 +58,8 @@ public class ReportLogger {
 		// useful if we run the test cases from the command line for example
 		// by using maven
 		if (testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
-			if (System.getenv("testsuitename") != null) {
-				testSuiteName = System.getenv("testsuitename");
+			if (System.getProperty("testsuitename") != null) {
+				testSuiteName = System.getProperty("testsuitename");
 			}
 		}
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 23/27: [maven-release-plugin] prepare release org.apache.sling.performance.base-0.0.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit cdcc9a27e29df7e6d39026b793ac95e0f82e87ca
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Mar 23 20:09:34 2015 +0000

    [maven-release-plugin] prepare release org.apache.sling.performance.base-0.0.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1668710 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5908f03..0c1fc02 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
     </parent>
 
     <artifactId>org.apache.sling.performance.base</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
+    <version>0.0.2</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Performance Test Utilities</name>
@@ -38,9 +38,9 @@
     </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>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.performance.base-0.0.2</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.performance.base-0.0.2</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.performance.base-0.0.2</url>
     </scm>
 
     <dependencies>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 27/27: [maven-release-plugin] copy for tag org.apache.sling.performance.base-0.0.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 98e7d32519bd87ea6a6ee1fac9be70197dc5d763
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Mar 23 20:14:41 2015 +0000

    [maven-release-plugin]  copy for tag org.apache.sling.performance.base-0.0.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.performance.base-0.0.2@1668716 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 17/27: SLING-3746 - Combining Sling performance and Sling Junit

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit c431d748f90805b8904c9324e2de9c29bd5563e7
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Tue Jul 8 11:28:59 2014 +0000

    SLING-3746 - Combining Sling performance and Sling Junit
    
    * bundlelize performance base
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1608728 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/pom.xml b/pom.xml
index a4c6ce6..315493b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,6 +29,7 @@
 
     <artifactId>org.apache.sling.performance.base</artifactId>
     <version>0.0.1-SNAPSHOT</version>
+    <packaging>bundle</packaging>
  
     <name>Apache Sling Performance Test Utilities</name>
     
@@ -117,6 +118,26 @@
                    <argLine>-Xms256m -Xmx1024m -XX:MaxPermSize=512m</argLine>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Export-Package>
+                            org.apache.sling.performance.*;
+                        </Export-Package>
+                         <Import-Package>                         	 
+                         	!org.apache.sling.commons.testing.jcr.*,
+                         	*;
+                         </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>  
         </plugins>
     </build>
 </project>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 03/27: SLING-2311 - renaming tests to clarify that they are trying to resovle non-existing resources

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit edda8ef236d35ecee43d73954df3ee4adf3cb2f1
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Aug 29 18:15:34 2012 +0000

    SLING-2311 - renaming tests to clarify that they are trying to resovle non-existing resources
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1378668 13f79535-47bb-0310-9956-ffa450edef68
---
 ...h10000AliasTest.java => ResolveNonExistingWith10000AliasTest.java} | 4 ++--
 ...tyPathTest.java => ResolveNonExistingWith10000VanityPathTest.java} | 4 ++--
 ...ith1000AliasTest.java => ResolveNonExistingWith1000AliasTest.java} | 4 ++--
 ...ityPathTest.java => ResolveNonExistingWith1000VanityPathTest.java} | 4 ++--
 ...h30000AliasTest.java => ResolveNonExistingWith30000AliasTest.java} | 4 ++--
 ...tyPathTest.java => ResolveNonExistingWith30000VanityPathTest.java} | 4 ++--
 ...ith5000AliasTest.java => ResolveNonExistingWith5000AliasTest.java} | 4 ++--
 ...ityPathTest.java => ResolveNonExistingWith5000VanityPathTest.java} | 4 ++--
 ...ithManyAliasTest.java => ResolveNonExistingWithManyAliasTest.java} | 4 ++--
 ...ityPathTest.java => ResolveNonExistingWithManyVanityPathTest.java} | 4 ++--
 10 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000AliasTest.java
similarity index 84%
rename from src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java
rename to src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000AliasTest.java
index 4f6952a..49f7fc4 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000AliasTest.java
@@ -18,9 +18,9 @@ package org.apache.sling.performance.tests;
 
 import org.apache.sling.performance.TestHelper;
 
-public class ResolveWith10000AliasTest extends ResolveWithManyAliasTest {
+public class ResolveNonExistingWith10000AliasTest extends ResolveNonExistingWithManyAliasTest {
     
-    public ResolveWith10000AliasTest(TestHelper helper) {
+    public ResolveNonExistingWith10000AliasTest(TestHelper helper) {
         super(helper, 10000);
     }
 
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000VanityPathTest.java
similarity index 83%
rename from src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java
rename to src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000VanityPathTest.java
index 88ad4ab..998b5c3 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000VanityPathTest.java
@@ -18,9 +18,9 @@ package org.apache.sling.performance.tests;
 
 import org.apache.sling.performance.TestHelper;
 
-public class ResolveWith10000VanityPathTest extends ResolveWithManyVanityPathTest {
+public class ResolveNonExistingWith10000VanityPathTest extends ResolveNonExistingWithManyVanityPathTest {
 
-    public ResolveWith10000VanityPathTest(TestHelper helper) {
+    public ResolveNonExistingWith10000VanityPathTest(TestHelper helper) {
         super(helper, 100, 100);
     }
 
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000AliasTest.java
similarity index 85%
rename from src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java
rename to src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000AliasTest.java
index 9f93d1d..43fdfc9 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000AliasTest.java
@@ -18,9 +18,9 @@ package org.apache.sling.performance.tests;
 
 import org.apache.sling.performance.TestHelper;
 
-public class ResolveWith1000AliasTest extends ResolveWithManyAliasTest {
+public class ResolveNonExistingWith1000AliasTest extends ResolveNonExistingWithManyAliasTest {
     
-    public ResolveWith1000AliasTest(TestHelper helper) {
+    public ResolveNonExistingWith1000AliasTest(TestHelper helper) {
         super(helper, 1000);
     }
 
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000VanityPathTest.java
similarity index 83%
rename from src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java
rename to src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000VanityPathTest.java
index 7c5f167..7e2bcfb 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000VanityPathTest.java
@@ -18,9 +18,9 @@ package org.apache.sling.performance.tests;
 
 import org.apache.sling.performance.TestHelper;
 
-public class ResolveWith1000VanityPathTest extends ResolveWithManyVanityPathTest {
+public class ResolveNonExistingWith1000VanityPathTest extends ResolveNonExistingWithManyVanityPathTest {
 
-    public ResolveWith1000VanityPathTest(TestHelper helper) {
+    public ResolveNonExistingWith1000VanityPathTest(TestHelper helper) {
         super(helper, 100, 10);
     }
 
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000AliasTest.java
similarity index 84%
rename from src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java
rename to src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000AliasTest.java
index 56e4ab2..cd1ed35 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000AliasTest.java
@@ -18,9 +18,9 @@ package org.apache.sling.performance.tests;
 
 import org.apache.sling.performance.TestHelper;
 
-public class ResolveWith30000AliasTest extends ResolveWithManyAliasTest {
+public class ResolveNonExistingWith30000AliasTest extends ResolveNonExistingWithManyAliasTest {
     
-    public ResolveWith30000AliasTest(TestHelper helper) {
+    public ResolveNonExistingWith30000AliasTest(TestHelper helper) {
         super(helper, 30000);
     }
 
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000VanityPathTest.java
similarity index 83%
rename from src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java
rename to src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000VanityPathTest.java
index 7248a6e..b4b2a7d 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000VanityPathTest.java
@@ -18,9 +18,9 @@ package org.apache.sling.performance.tests;
 
 import org.apache.sling.performance.TestHelper;
 
-public class ResolveWith30000VanityPathTest extends ResolveWithManyVanityPathTest {
+public class ResolveNonExistingWith30000VanityPathTest extends ResolveNonExistingWithManyVanityPathTest {
 
-    public ResolveWith30000VanityPathTest(TestHelper helper) {
+    public ResolveNonExistingWith30000VanityPathTest(TestHelper helper) {
         super(helper, 300, 100);
     }
 
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000AliasTest.java
similarity index 85%
rename from src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java
rename to src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000AliasTest.java
index 54f9cdb..9771516 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000AliasTest.java
@@ -18,9 +18,9 @@ package org.apache.sling.performance.tests;
 
 import org.apache.sling.performance.TestHelper;
 
-public class ResolveWith5000AliasTest extends ResolveWithManyAliasTest {
+public class ResolveNonExistingWith5000AliasTest extends ResolveNonExistingWithManyAliasTest {
     
-    public ResolveWith5000AliasTest(TestHelper helper) {
+    public ResolveNonExistingWith5000AliasTest(TestHelper helper) {
         super(helper, 5000);
     }
 
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000VanityPathTest.java
similarity index 83%
rename from src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java
rename to src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000VanityPathTest.java
index b22c6d4..0b3f6fb 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000VanityPathTest.java
@@ -18,9 +18,9 @@ package org.apache.sling.performance.tests;
 
 import org.apache.sling.performance.TestHelper;
 
-public class ResolveWith5000VanityPathTest extends ResolveWithManyVanityPathTest {
+public class ResolveNonExistingWith5000VanityPathTest extends ResolveNonExistingWithManyVanityPathTest {
 
-    public ResolveWith5000VanityPathTest(TestHelper helper) {
+    public ResolveNonExistingWith5000VanityPathTest(TestHelper helper) {
         super(helper, 100, 50);
     }
 
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyAliasTest.java
similarity index 96%
rename from src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java
rename to src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyAliasTest.java
index a6d7061..f77ffb6 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyAliasTest.java
@@ -33,7 +33,7 @@ import org.apache.sling.performance.ResourceResolverTestRequest;
 
 import static org.junit.Assert.assertNotNull;
 
-class ResolveWithManyAliasTest extends AbstractRepositoryTest {
+class ResolveNonExistingWithManyAliasTest extends AbstractRepositoryTest {
     
     private static final String PN_SLING_ALIAS = "sling:alias";
     
@@ -49,7 +49,7 @@ class ResolveWithManyAliasTest extends AbstractRepositoryTest {
 
     private final int nodeCount;
     
-    public ResolveWithManyAliasTest(TestHelper helper, int nodeCount) {
+    public ResolveNonExistingWithManyAliasTest(TestHelper helper, int nodeCount) {
         this.helper = helper;
         this.nodeCount = nodeCount;
     }
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyVanityPathTest.java
similarity index 96%
rename from src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java
rename to src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyVanityPathTest.java
index c803f33..3dbc2b4 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyVanityPathTest.java
@@ -33,7 +33,7 @@ import org.apache.sling.performance.AbstractRepositoryTest;
 import org.apache.sling.performance.TestHelper;
 import org.apache.sling.performance.ResourceResolverTestRequest;
 
-class ResolveWithManyVanityPathTest extends AbstractRepositoryTest {
+class ResolveNonExistingWithManyVanityPathTest extends AbstractRepositoryTest {
     
     private static final String NT_VANITY_PATH = "sling:VanityPath";
 
@@ -53,7 +53,7 @@ class ResolveWithManyVanityPathTest extends AbstractRepositoryTest {
     
     private final int childNodeCount;
     
-    public ResolveWithManyVanityPathTest(TestHelper helper, int nodeCount, int childNodeCount) {
+    public ResolveNonExistingWithManyVanityPathTest(TestHelper helper, int nodeCount, int childNodeCount) {
         this.helper = helper;
         this.nodeCount = nodeCount;
         this.childNodeCount = childNodeCount;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 02/27: SLING-2311 - removing extraneous listener fields

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 0419154727df642cce253533e38bd6982008b731
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Aug 29 16:16:08 2012 +0000

    SLING-2311 - removing extraneous listener fields
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1378629 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/performance/tests/ResolveWithManyAliasTest.java   | 3 ---
 .../apache/sling/performance/tests/ResolveWithManyVanityPathTest.java  | 1 -
 2 files changed, 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java
index f886957..a6d7061 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java
@@ -66,9 +66,6 @@ class ResolveWithManyAliasTest extends AbstractRepositoryTest {
         if (mapRoot != null) {
             mapRoot.remove();
         }
-        /*
-         * if ( this.listener != null ) { this.listener.dispose(); }
-         */
         session.save();
     }
 
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java
index 3e51942..c803f33 100644
--- a/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java
@@ -43,7 +43,6 @@ class ResolveWithManyVanityPathTest extends AbstractRepositoryTest {
     
     private Node mapRoot;
     
-    // private JcrResourceListener listener;
     private ResourceResolver resResolver;
     
     private Node rootNode;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 04/27: SLING-2593 - Improvement for the Sling performance tools. Adding first part of the patch provided from Christian Vazzolla: Created a new maven project that contains only the sling performance tests and left the framework(tool) related part in the base project as we would like to use the framework for performance testing in other projects also. Thanks Christian!

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit b15d208210f4b4bcb4673d165c21f5399b0ba287
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Sun Sep 23 09:49:08 2012 +0000

    SLING-2593 - Improvement for the Sling performance tools. Adding first part of the patch provided from Christian Vazzolla:  Created a new maven project that contains only the sling performance tests and left the framework(tool) related part in the base project as we would like to use the framework for performance testing in other projects also. Thanks Christian!
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1388992 13f79535-47bb-0310-9956-ffa450edef68
---
 .../ResolveNonExistingWith10000AliasTest.java      |  27 ----
 .../ResolveNonExistingWith10000VanityPathTest.java |  27 ----
 .../tests/ResolveNonExistingWith1000AliasTest.java |  27 ----
 .../ResolveNonExistingWith1000VanityPathTest.java  |  27 ----
 .../ResolveNonExistingWith30000AliasTest.java      |  27 ----
 .../ResolveNonExistingWith30000VanityPathTest.java |  27 ----
 .../tests/ResolveNonExistingWith5000AliasTest.java |  27 ----
 .../ResolveNonExistingWith5000VanityPathTest.java  |  27 ----
 .../tests/ResolveNonExistingWithManyAliasTest.java | 124 -------------------
 .../ResolveNonExistingWithManyVanityPathTest.java  | 136 ---------------------
 10 files changed, 476 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000AliasTest.java
deleted file mode 100644
index 49f7fc4..0000000
--- a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000AliasTest.java
+++ /dev/null
@@ -1,27 +0,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.
- */
-package org.apache.sling.performance.tests;
-
-import org.apache.sling.performance.TestHelper;
-
-public class ResolveNonExistingWith10000AliasTest extends ResolveNonExistingWithManyAliasTest {
-    
-    public ResolveNonExistingWith10000AliasTest(TestHelper helper) {
-        super(helper, 10000);
-    }
-
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000VanityPathTest.java
deleted file mode 100644
index 998b5c3..0000000
--- a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith10000VanityPathTest.java
+++ /dev/null
@@ -1,27 +0,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.
- */
-package org.apache.sling.performance.tests;
-
-import org.apache.sling.performance.TestHelper;
-
-public class ResolveNonExistingWith10000VanityPathTest extends ResolveNonExistingWithManyVanityPathTest {
-
-    public ResolveNonExistingWith10000VanityPathTest(TestHelper helper) {
-        super(helper, 100, 100);
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000AliasTest.java
deleted file mode 100644
index 43fdfc9..0000000
--- a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000AliasTest.java
+++ /dev/null
@@ -1,27 +0,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.
- */
-package org.apache.sling.performance.tests;
-
-import org.apache.sling.performance.TestHelper;
-
-public class ResolveNonExistingWith1000AliasTest extends ResolveNonExistingWithManyAliasTest {
-    
-    public ResolveNonExistingWith1000AliasTest(TestHelper helper) {
-        super(helper, 1000);
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000VanityPathTest.java
deleted file mode 100644
index 7e2bcfb..0000000
--- a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith1000VanityPathTest.java
+++ /dev/null
@@ -1,27 +0,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.
- */
-package org.apache.sling.performance.tests;
-
-import org.apache.sling.performance.TestHelper;
-
-public class ResolveNonExistingWith1000VanityPathTest extends ResolveNonExistingWithManyVanityPathTest {
-
-    public ResolveNonExistingWith1000VanityPathTest(TestHelper helper) {
-        super(helper, 100, 10);
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000AliasTest.java
deleted file mode 100644
index cd1ed35..0000000
--- a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000AliasTest.java
+++ /dev/null
@@ -1,27 +0,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.
- */
-package org.apache.sling.performance.tests;
-
-import org.apache.sling.performance.TestHelper;
-
-public class ResolveNonExistingWith30000AliasTest extends ResolveNonExistingWithManyAliasTest {
-    
-    public ResolveNonExistingWith30000AliasTest(TestHelper helper) {
-        super(helper, 30000);
-    }
-
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000VanityPathTest.java
deleted file mode 100644
index b4b2a7d..0000000
--- a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith30000VanityPathTest.java
+++ /dev/null
@@ -1,27 +0,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.
- */
-package org.apache.sling.performance.tests;
-
-import org.apache.sling.performance.TestHelper;
-
-public class ResolveNonExistingWith30000VanityPathTest extends ResolveNonExistingWithManyVanityPathTest {
-
-    public ResolveNonExistingWith30000VanityPathTest(TestHelper helper) {
-        super(helper, 300, 100);
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000AliasTest.java
deleted file mode 100644
index 9771516..0000000
--- a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000AliasTest.java
+++ /dev/null
@@ -1,27 +0,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.
- */
-package org.apache.sling.performance.tests;
-
-import org.apache.sling.performance.TestHelper;
-
-public class ResolveNonExistingWith5000AliasTest extends ResolveNonExistingWithManyAliasTest {
-    
-    public ResolveNonExistingWith5000AliasTest(TestHelper helper) {
-        super(helper, 5000);
-    }
-
-}
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000VanityPathTest.java
deleted file mode 100644
index 0b3f6fb..0000000
--- a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWith5000VanityPathTest.java
+++ /dev/null
@@ -1,27 +0,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.
- */
-package org.apache.sling.performance.tests;
-
-import org.apache.sling.performance.TestHelper;
-
-public class ResolveNonExistingWith5000VanityPathTest extends ResolveNonExistingWithManyVanityPathTest {
-
-    public ResolveNonExistingWith5000VanityPathTest(TestHelper helper) {
-        super(helper, 100, 50);
-    }
-
-}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyAliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyAliasTest.java
deleted file mode 100644
index f77ffb6..0000000
--- a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyAliasTest.java
+++ /dev/null
@@ -1,124 +0,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.
- */
-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 ResolveNonExistingWithManyAliasTest 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 ResolveNonExistingWithManyAliasTest(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();
-        }
-        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);
-    }
-}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyVanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyVanityPathTest.java
deleted file mode 100644
index 3dbc2b4..0000000
--- a/src/main/java/org/apache/sling/performance/tests/ResolveNonExistingWithManyVanityPathTest.java
+++ /dev/null
@@ -1,136 +0,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.
- */
-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 ResolveNonExistingWithManyVanityPathTest 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 ResourceResolver resResolver;
-    
-    private Node rootNode;
-    
-    private String rootPath;
-
-    private final int nodeCount;
-    
-    private final int childNodeCount;
-    
-    public ResolveNonExistingWithManyVanityPathTest(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);
-    }
-
-}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 20/27: @trivial Converted mixed tabs and spaces indentation to spaces

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 4f20e50861d5c40a46f84ad99176d8f0b1dc79d9
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Thu Mar 12 16:38:37 2015 +0000

    @trivial Converted mixed tabs and spaces indentation to spaces
    
    * applied patch sent by Vlad Băilescu
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1666248 13f79535-47bb-0310-9956-ffa450edef68
---
 .../performance/FrameworkPerformanceMethod.java    | 574 ++++++++++-----------
 .../sling/performance/PerformanceRunner.java       | 408 +++++++--------
 .../org/apache/sling/performance/ReportLogger.java | 182 +++----
 3 files changed, 582 insertions(+), 582 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
index 42ee110..1e002f4 100644
--- a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
+++ b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
@@ -35,21 +35,21 @@ import org.junit.runners.model.FrameworkMethod;
 
 class FrameworkPerformanceMethod extends FrameworkMethod {
 
-	private Object target;
-	private PerformanceSuiteState performanceSuiteState;
-	private PerformanceRunner.ReportLevel reportLevel = PerformanceRunner.ReportLevel.ClassLevel;
+    private Object target;
+    private PerformanceSuiteState performanceSuiteState;
+    private PerformanceRunner.ReportLevel reportLevel = PerformanceRunner.ReportLevel.ClassLevel;
     private String testCaseName = "";
     private String className;
 
-	public FrameworkPerformanceMethod(Method method, Object target,
-			PerformanceSuiteState performanceSuiteState, PerformanceRunner.ReportLevel reportLevel) {
-		super(method);
-		this.target = target;
-		this.performanceSuiteState = performanceSuiteState;
-		this.reportLevel = reportLevel;
+    public FrameworkPerformanceMethod(Method method, Object target,
+            PerformanceSuiteState performanceSuiteState, PerformanceRunner.ReportLevel reportLevel) {
+        super(method);
+        this.target = target;
+        this.performanceSuiteState = performanceSuiteState;
+        this.reportLevel = reportLevel;
         if (target instanceof IdentifiableTestCase) {
             this.testCaseName = ((IdentifiableTestCase) target).testCaseName();
-	    }
+        }
 
         // Name of the test class, as the report logger needs it
         // This can be overwritten by tests by implementing IdentifiableTestClass
@@ -61,284 +61,284 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 
     }
 
-	@Override
-	public Object invokeExplosively(Object target, Object... params)
-			throws Throwable {
-		// Executes the test method on the supplied target
-
-		// Check if this is the first test running from this specific
-		// PerformanceSuite
-		// and run the BeforeSuite methods
-		if ((performanceSuiteState != null)
-				&& (performanceSuiteState.getBeforeSuiteMethod() != null)
-				&& (performanceSuiteState.getTargetObjectSuite() != null)
-				&& (performanceSuiteState.getNumberOfExecutedMethods() == 0)
-				&& !performanceSuiteState.testSuiteName
-						.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
-			performanceSuiteState.getBeforeSuiteMethod().invoke(
-					performanceSuiteState.getTargetObjectSuite());
-		}
-
-		// In case of a PerformanceSuite we need to run the methods annotated
-		// with Before and After
-		// ourselves as JUnit can't find them (JUnit is looking for them in the
-		// test suite class);
-		// in case we don't have to deal with a PerformanceSuite just skip this
-		// as JUnit will run the methods itself
-		if ((performanceSuiteState != null)
-				&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
-
-			recursiveCallSpecificMethod(this.target.getClass(), this.target, Before.class);
-		}
-
-		// Need to count the number of tests run from the PerformanceSuite
-		// so that we can call the AfterSuite method after the last test from
-		// the suite
-		// has run and the AfterSuite needs to run
-		performanceSuiteState.incrementNumberOfExecutedTestMethods();
-
-		Object response = null;
-
-		Method testMethodToInvoke = this.getMethod();
-
-		PerformanceTest performanceAnnotation = testMethodToInvoke
-				.getAnnotation(PerformanceTest.class);
-
-		// retrieve the test configuration options
-		int warmuptime = performanceAnnotation.warmuptime();
-		int runtime = performanceAnnotation.runtime();
-		int warmupinvocations = performanceAnnotation.warmupinvocations();
-		int runinvocations = performanceAnnotation.runinvocations();
-
-		DescriptiveStatistics statistics = new DescriptiveStatistics();
-
-		if (warmupinvocations != 0) {
-			// Run the number of invocation specified in the annotation
-			// for warming up the system
-			for (int invocationIndex = 0; invocationIndex < warmupinvocations; invocationIndex++) {
-
-				recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeMethodInvocation.class);
-
-				// TODO: implement the method to run a before a specific test
-				// method
-				// recursiveCallSpecificMethod(this.target.getClass(),
-				// this.target, BeforeSpecificTest.class);
-
-				response = super.invokeExplosively(this.target, params);
-
-				// TODO: implement the method to run a after a specific test
-				// method
-				// recursiveCallSpecificMethod(this.target.getClass(),
-				// this.target, AfterSpecificTest.class);
-
-				recursiveCallSpecificMethod(this.target.getClass(),
-						this.target, AfterMethodInvocation.class);
-			}
-		} else {
-			// Run a few iterations to warm up the system
-			long warmupEnd = System.currentTimeMillis() + warmuptime * 1000;
-			while (System.currentTimeMillis() < warmupEnd) {
-				recursiveCallSpecificMethod(this.target.getClass(),
-						this.target, BeforeMethodInvocation.class);
-
-				// TODO: implement the method to run a before a specific test
-				// method
-				// recursiveCallSpecificMethod(this.target.getClass(),
-				// this.target, BeforeSpecificTest.class);
-
-				response = super.invokeExplosively(this.target, params);
-
-				// recursiveCallSpecificMethod(this.target.getClass(),
-				// this.target, AfterSpecificTest.class);
-				// TODO: implement the method to run a after a specific test
-				// method
-
-				recursiveCallSpecificMethod(this.target.getClass(),
-						this.target, AfterMethodInvocation.class);
-			}
-		}
-
-		// System.out.println("Warmup ended - test :" +
-		// testMethodToInvoke.getName());
-		if (runinvocations != 0) {
-			// Run the specified number of iterations and capture the execution
-			// times
-			for (int invocationIndex = 0; invocationIndex < runinvocations; invocationIndex++) {
-
-				response = this.invokeTimedTestMethod(testMethodToInvoke,
-						statistics, params);
-			}
-		} else {
-			// Run test iterations and capture the execution times
-			long runtimeEnd = System.currentTimeMillis() + runtime * 1000;
-
-			while (System.currentTimeMillis() < runtimeEnd) {
-
-				response = this.invokeTimedTestMethod(testMethodToInvoke,
-						statistics, params);
-
-			}
-		}
-
-		if (statistics.getN() > 0) {
-		    ReportLogger.writeReport(this.performanceSuiteState.testSuiteName, testCaseName, className, getMethod().getName(),
+    @Override
+    public Object invokeExplosively(Object target, Object... params)
+            throws Throwable {
+        // Executes the test method on the supplied target
+
+        // Check if this is the first test running from this specific
+        // PerformanceSuite
+        // and run the BeforeSuite methods
+        if ((performanceSuiteState != null)
+                && (performanceSuiteState.getBeforeSuiteMethod() != null)
+                && (performanceSuiteState.getTargetObjectSuite() != null)
+                && (performanceSuiteState.getNumberOfExecutedMethods() == 0)
+                && !performanceSuiteState.testSuiteName
+                        .equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+            performanceSuiteState.getBeforeSuiteMethod().invoke(
+                    performanceSuiteState.getTargetObjectSuite());
+        }
+
+        // In case of a PerformanceSuite we need to run the methods annotated
+        // with Before and After
+        // ourselves as JUnit can't find them (JUnit is looking for them in the
+        // test suite class);
+        // in case we don't have to deal with a PerformanceSuite just skip this
+        // as JUnit will run the methods itself
+        if ((performanceSuiteState != null)
+                && !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+
+            recursiveCallSpecificMethod(this.target.getClass(), this.target, Before.class);
+        }
+
+        // Need to count the number of tests run from the PerformanceSuite
+        // so that we can call the AfterSuite method after the last test from
+        // the suite
+        // has run and the AfterSuite needs to run
+        performanceSuiteState.incrementNumberOfExecutedTestMethods();
+
+        Object response = null;
+
+        Method testMethodToInvoke = this.getMethod();
+
+        PerformanceTest performanceAnnotation = testMethodToInvoke
+                .getAnnotation(PerformanceTest.class);
+
+        // retrieve the test configuration options
+        int warmuptime = performanceAnnotation.warmuptime();
+        int runtime = performanceAnnotation.runtime();
+        int warmupinvocations = performanceAnnotation.warmupinvocations();
+        int runinvocations = performanceAnnotation.runinvocations();
+
+        DescriptiveStatistics statistics = new DescriptiveStatistics();
+
+        if (warmupinvocations != 0) {
+            // Run the number of invocation specified in the annotation
+            // for warming up the system
+            for (int invocationIndex = 0; invocationIndex < warmupinvocations; invocationIndex++) {
+
+                recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeMethodInvocation.class);
+
+                // TODO: implement the method to run a before a specific test
+                // method
+                // recursiveCallSpecificMethod(this.target.getClass(),
+                // this.target, BeforeSpecificTest.class);
+
+                response = super.invokeExplosively(this.target, params);
+
+                // TODO: implement the method to run a after a specific test
+                // method
+                // recursiveCallSpecificMethod(this.target.getClass(),
+                // this.target, AfterSpecificTest.class);
+
+                recursiveCallSpecificMethod(this.target.getClass(),
+                        this.target, AfterMethodInvocation.class);
+            }
+        } else {
+            // Run a few iterations to warm up the system
+            long warmupEnd = System.currentTimeMillis() + warmuptime * 1000;
+            while (System.currentTimeMillis() < warmupEnd) {
+                recursiveCallSpecificMethod(this.target.getClass(),
+                        this.target, BeforeMethodInvocation.class);
+
+                // TODO: implement the method to run a before a specific test
+                // method
+                // recursiveCallSpecificMethod(this.target.getClass(),
+                // this.target, BeforeSpecificTest.class);
+
+                response = super.invokeExplosively(this.target, params);
+
+                // recursiveCallSpecificMethod(this.target.getClass(),
+                // this.target, AfterSpecificTest.class);
+                // TODO: implement the method to run a after a specific test
+                // method
+
+                recursiveCallSpecificMethod(this.target.getClass(),
+                        this.target, AfterMethodInvocation.class);
+            }
+        }
+
+        // System.out.println("Warmup ended - test :" +
+        // testMethodToInvoke.getName());
+        if (runinvocations != 0) {
+            // Run the specified number of iterations and capture the execution
+            // times
+            for (int invocationIndex = 0; invocationIndex < runinvocations; invocationIndex++) {
+
+                response = this.invokeTimedTestMethod(testMethodToInvoke,
+                        statistics, params);
+            }
+        } else {
+            // Run test iterations and capture the execution times
+            long runtimeEnd = System.currentTimeMillis() + runtime * 1000;
+
+            while (System.currentTimeMillis() < runtimeEnd) {
+
+                response = this.invokeTimedTestMethod(testMethodToInvoke,
+                        statistics, params);
+
+            }
+        }
+
+        if (statistics.getN() > 0) {
+            ReportLogger.writeReport(this.performanceSuiteState.testSuiteName, testCaseName, className, getMethod().getName(),
                     statistics, ReportLogger.ReportType.TXT, reportLevel);
-		}
-
-		// In case of a PerformanceSuite we need to run the methods annotated
-		// with Before and After
-		// ourselves as JUnit can't find them; in case we don't have to deal
-		// with a PerformanceSuite
-		// just skip this as JUnit will run the methods itself
-		if ((performanceSuiteState != null)
-				&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
-
-			recursiveCallSpecificMethod(this.target.getClass(), this.target, After.class);
-		}
-
-		// Check if this is the last test running from a PerformanceSuite
-		// and run the AfterSuite method
-		if ((performanceSuiteState != null)
-				&& (performanceSuiteState.getAfterSuiteMethod() != null)
-				&& (performanceSuiteState.getTargetObjectSuite() != null)
-				&& (performanceSuiteState.getNumberOfExecutedMethods() == performanceSuiteState.getNumberOfMethodsInSuite())
-				&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
-			performanceSuiteState.getAfterSuiteMethod().invoke(performanceSuiteState.getTargetObjectSuite());
-		}
-
-		return response;
-	}
-
-	/**
-	 * Method that runs 1 invocation of the timed test method
-	 * 
-	 * @param testMethodToInvoke
-	 *            the test method to invoke
-	 * @param statistics
-	 *            the statistics object that collects the results
-	 * @param params
-	 *            the parameters for the invocation of the test method
-	 * @return the response from the method invocation
-	 * @throws Throwable
-	 */
-	private Object invokeTimedTestMethod(Method testMethodToInvoke,
-			DescriptiveStatistics statistics, Object... params)
-			throws Throwable {
-
-		Object response = null;
-
-		recursiveCallSpecificMethod(this.target.getClass(), this.target,
-				BeforeMethodInvocation.class);
-
-		// TODO: implement the method to run a before a specific test method
-		// recursiveCallSpecificMethod(this.target.getClass(), this.target,
-		// BeforeSpecificTest.class);
-
-		// timing the test method execution
-		// System.out.println("Start test: " + testMethodToInvoke.getName());
-		long start = System.nanoTime();
-		response = super.invokeExplosively(this.target, params);
-		long timeMilliseconds = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS);
-		statistics.addValue(timeMilliseconds);
-
-		// System.out.println("End test: " + testMethodToInvoke.getName());
-
-		// System.out.println("Test execution time (ms): " + timeMilliseconds);
-
-		// TODO: implement the method to run a after a specific test method
-		// recursiveCallSpecificMethod(this.target.getClass(), this.target,
-		// AfterSpecificTest.class);
-
-		recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterMethodInvocation.class);
-
-		return response;
-	}
-
-	/**
-	 * Recursively call a specific method annotated with a custom annotation
-	 * 
-	 * @param test
-	 *            the test class that contains the method
-	 * @param instance
-	 *            the instance on which will run the method
-	 * @param methodAnnotation
-	 *            the method annotation to look for
-	 * @throws InvocationTargetException
-	 * @throws InvalidAttributesException
-	 * @throws IllegalAccessException
-	 * @throws InstantiationException
-	 */
-	@SuppressWarnings({ "rawtypes" })
-	private void recursiveCallSpecificMethod(Class test, Object instance,
-			Class<? extends Annotation> methodAnnotation)
-			throws InvocationTargetException, InvalidAttributesException,
-			IllegalAccessException, InstantiationException {
-		if (test.getSuperclass() != null) {
-			recursiveCallSpecificMethod(test.getSuperclass(), instance,
-					methodAnnotation);
-		}
-
-		Method testMethod = getSpecificTestMethod(test, methodAnnotation);
-		if (testMethod != null) {
-			if (!testMethod.isAccessible()) {
-				testMethod.setAccessible(true);
-			}
-			testMethod.invoke(instance);
-		}
-	}
-
-	/**
-	 * Get the method annotated with the custom annotation
-	 * 
-	 * @param testClass
-	 *            the test class on which to look for the method
-	 * @param methodAnnotation
-	 *            the method annotation to look for
-	 * @return
-	 * @throws InvalidAttributesException
-	 * @throws IllegalAccessException
-	 * @throws InstantiationException
-	 */
-	@SuppressWarnings({ "rawtypes" })
-	private Method getSpecificTestMethod(Class testClass,
-			Class<? extends Annotation> methodAnnotation)
-			throws InvalidAttributesException, IllegalAccessException,
-			InstantiationException {
-
-		Method[] methodsToReturn = getSpecificMethods(testClass, methodAnnotation);
-		Method methodToReturn = null;
-		if (methodsToReturn.length == 1) {
-			methodToReturn = methodsToReturn[0];
-		} else if (methodsToReturn.length > 1) {
-			throw new InvalidAttributesException("Only 1 non parameterized before method accepted");
-		}
-
-		return methodToReturn;
-	}
-
-	/**
-	 * Retrieve all the specific methods from test class
-	 * 
-	 * @param testClass
-	 *            the test class that we need to search in
-	 * @param annotation
-	 *            the annotation that we should look for
-	 * @return the list with the methods that have the specified annotation
-	 */
-	@SuppressWarnings({ "rawtypes" })
-	private Method[] getSpecificMethods(Class testClass,
-			Class<? extends Annotation> annotation) {
-		Method[] allMethods = testClass.getDeclaredMethods();
-
-		List<Method> methodListResult = new ArrayList<Method>();
-
-		for (Method testMethod : allMethods) {
-			if (testMethod.isAnnotationPresent(annotation)) {
-				methodListResult.add(testMethod);
-			}
-		}
-		return methodListResult.toArray(new Method[] {});
-	}
+        }
+
+        // In case of a PerformanceSuite we need to run the methods annotated
+        // with Before and After
+        // ourselves as JUnit can't find them; in case we don't have to deal
+        // with a PerformanceSuite
+        // just skip this as JUnit will run the methods itself
+        if ((performanceSuiteState != null)
+                && !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+
+            recursiveCallSpecificMethod(this.target.getClass(), this.target, After.class);
+        }
+
+        // Check if this is the last test running from a PerformanceSuite
+        // and run the AfterSuite method
+        if ((performanceSuiteState != null)
+                && (performanceSuiteState.getAfterSuiteMethod() != null)
+                && (performanceSuiteState.getTargetObjectSuite() != null)
+                && (performanceSuiteState.getNumberOfExecutedMethods() == performanceSuiteState.getNumberOfMethodsInSuite())
+                && !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+            performanceSuiteState.getAfterSuiteMethod().invoke(performanceSuiteState.getTargetObjectSuite());
+        }
+
+        return response;
+    }
+
+    /**
+     * Method that runs 1 invocation of the timed test method
+     *
+     * @param testMethodToInvoke
+     *            the test method to invoke
+     * @param statistics
+     *            the statistics object that collects the results
+     * @param params
+     *            the parameters for the invocation of the test method
+     * @return the response from the method invocation
+     * @throws Throwable
+     */
+    private Object invokeTimedTestMethod(Method testMethodToInvoke,
+            DescriptiveStatistics statistics, Object... params)
+            throws Throwable {
+
+        Object response = null;
+
+        recursiveCallSpecificMethod(this.target.getClass(), this.target,
+                BeforeMethodInvocation.class);
+
+        // TODO: implement the method to run a before a specific test method
+        // recursiveCallSpecificMethod(this.target.getClass(), this.target,
+        // BeforeSpecificTest.class);
+
+        // timing the test method execution
+        // System.out.println("Start test: " + testMethodToInvoke.getName());
+        long start = System.nanoTime();
+        response = super.invokeExplosively(this.target, params);
+        long timeMilliseconds = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS);
+        statistics.addValue(timeMilliseconds);
+
+        // System.out.println("End test: " + testMethodToInvoke.getName());
+
+        // System.out.println("Test execution time (ms): " + timeMilliseconds);
+
+        // TODO: implement the method to run a after a specific test method
+        // recursiveCallSpecificMethod(this.target.getClass(), this.target,
+        // AfterSpecificTest.class);
+
+        recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterMethodInvocation.class);
+
+        return response;
+    }
+
+    /**
+     * Recursively call a specific method annotated with a custom annotation
+     *
+     * @param test
+     *            the test class that contains the method
+     * @param instance
+     *            the instance on which will run the method
+     * @param methodAnnotation
+     *            the method annotation to look for
+     * @throws InvocationTargetException
+     * @throws InvalidAttributesException
+     * @throws IllegalAccessException
+     * @throws InstantiationException
+     */
+    @SuppressWarnings({ "rawtypes" })
+    private void recursiveCallSpecificMethod(Class test, Object instance,
+            Class<? extends Annotation> methodAnnotation)
+            throws InvocationTargetException, InvalidAttributesException,
+            IllegalAccessException, InstantiationException {
+        if (test.getSuperclass() != null) {
+            recursiveCallSpecificMethod(test.getSuperclass(), instance,
+                    methodAnnotation);
+        }
+
+        Method testMethod = getSpecificTestMethod(test, methodAnnotation);
+        if (testMethod != null) {
+            if (!testMethod.isAccessible()) {
+                testMethod.setAccessible(true);
+            }
+            testMethod.invoke(instance);
+        }
+    }
+
+    /**
+     * Get the method annotated with the custom annotation
+     *
+     * @param testClass
+     *            the test class on which to look for the method
+     * @param methodAnnotation
+     *            the method annotation to look for
+     * @return
+     * @throws InvalidAttributesException
+     * @throws IllegalAccessException
+     * @throws InstantiationException
+     */
+    @SuppressWarnings({ "rawtypes" })
+    private Method getSpecificTestMethod(Class testClass,
+            Class<? extends Annotation> methodAnnotation)
+            throws InvalidAttributesException, IllegalAccessException,
+            InstantiationException {
+
+        Method[] methodsToReturn = getSpecificMethods(testClass, methodAnnotation);
+        Method methodToReturn = null;
+        if (methodsToReturn.length == 1) {
+            methodToReturn = methodsToReturn[0];
+        } else if (methodsToReturn.length > 1) {
+            throw new InvalidAttributesException("Only 1 non parameterized before method accepted");
+        }
+
+        return methodToReturn;
+    }
+
+    /**
+     * Retrieve all the specific methods from test class
+     *
+     * @param testClass
+     *            the test class that we need to search in
+     * @param annotation
+     *            the annotation that we should look for
+     * @return the list with the methods that have the specified annotation
+     */
+    @SuppressWarnings({ "rawtypes" })
+    private Method[] getSpecificMethods(Class testClass,
+            Class<? extends Annotation> annotation) {
+        Method[] allMethods = testClass.getDeclaredMethods();
+
+        List<Method> methodListResult = new ArrayList<Method>();
+
+        for (Method testMethod : allMethods) {
+            if (testMethod.isAnnotationPresent(annotation)) {
+                methodListResult.add(testMethod);
+            }
+        }
+        return methodListResult.toArray(new Method[] {});
+    }
 
     @Override
     public String getName() {
diff --git a/src/main/java/org/apache/sling/performance/PerformanceRunner.java b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
index ecd1bbc..bb646fe 100644
--- a/src/main/java/org/apache/sling/performance/PerformanceRunner.java
+++ b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
@@ -50,80 +50,80 @@ import java.util.List;
 
 
 public class PerformanceRunner extends BlockJUnit4ClassRunner {
-	protected LinkedList<FrameworkMethod> tests = new LinkedList<FrameworkMethod>();
-	private List<PerformanceSuiteState> suitesState = new ArrayList<PerformanceSuiteState>();
-	public ReportLevel reportLevel = ReportLevel.ClassLevel;
-	
-	public static enum ReportLevel{
-		ClassLevel,
-		MethodLevel
-	}
-	
-	@Retention(RetentionPolicy.RUNTIME)
-	@Target(ElementType.TYPE)
-	public @interface Parameters {
-		public ReportLevel reportLevel() default ReportLevel.ClassLevel;
-	}
-	
-	public PerformanceRunner(Class<?> clazz) throws InitializationError {
-		super(clazz);
-		
-		// set the report level for the tests that are run with the PerformanceRunner
-		// by default set to class level for legacy tests compatibility
-		if (clazz.getAnnotation(Parameters.class) != null){
-			reportLevel = clazz.getAnnotation(Parameters.class).reportLevel();
-		}
-		
-		try {
-			computeTests();
-		} catch (Exception e) {
-			throw new InitializationError(e);
-		}
-	}
-
-	/**
-	 * Compute the tests that will be run
-	 * 
-	 * @throws Exception
-	 */
-	protected void computeTests() throws Exception {
-		// add normal JUnit tests
-		tests.addAll(super.computeTestMethods());
-
-		// add the performance tests
-		tests.addAll(computePerformanceTests());
-
-		// This is called here to ensure the test class constructor is called at
-		// least
-		// once during testing.
-		createTest();
-	}
-
-	/**
-	 * Compute performance tests
-	 * 
-	 * @return the list containing the performance test methods
-	 * @throws Exception
-	 */
-	protected Collection<? extends FrameworkMethod> computePerformanceTests()
-			throws Exception {
-		List<FrameworkMethod> tests = new LinkedList<FrameworkMethod>();
-
-		List<Object> testObjects = new ArrayList<Object>();
-		List<Object> testObjectsTmp = new ArrayList<Object>();
-
-
-		ParameterizedTestList testCenter = new ParameterizedTestList();
-
-		// Retrieve the test objects included in the Performance test suite
-		for (FrameworkMethod method : getTestClass().getAnnotatedMethods(
-				PerformanceTestSuite.class)) {
-			Object targetObject = getTestClass().getJavaClass().newInstance();
-			if (method.getMethod().getReturnType()
-					.equals(ParameterizedTestList.class)) {
-				testCenter = (ParameterizedTestList) method.getMethod().invoke(
-						targetObject);
-				testObjectsTmp = testCenter.getTestObjectList();
+    protected LinkedList<FrameworkMethod> tests = new LinkedList<FrameworkMethod>();
+    private List<PerformanceSuiteState> suitesState = new ArrayList<PerformanceSuiteState>();
+    public ReportLevel reportLevel = ReportLevel.ClassLevel;
+
+    public static enum ReportLevel{
+        ClassLevel,
+        MethodLevel
+    }
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.TYPE)
+    public @interface Parameters {
+        public ReportLevel reportLevel() default ReportLevel.ClassLevel;
+    }
+
+    public PerformanceRunner(Class<?> clazz) throws InitializationError {
+        super(clazz);
+
+        // set the report level for the tests that are run with the PerformanceRunner
+        // by default set to class level for legacy tests compatibility
+        if (clazz.getAnnotation(Parameters.class) != null){
+            reportLevel = clazz.getAnnotation(Parameters.class).reportLevel();
+        }
+
+        try {
+            computeTests();
+        } catch (Exception e) {
+            throw new InitializationError(e);
+        }
+    }
+
+    /**
+     * Compute the tests that will be run
+     *
+     * @throws Exception
+     */
+    protected void computeTests() throws Exception {
+        // add normal JUnit tests
+        tests.addAll(super.computeTestMethods());
+
+        // add the performance tests
+        tests.addAll(computePerformanceTests());
+
+        // This is called here to ensure the test class constructor is called at
+        // least
+        // once during testing.
+        createTest();
+    }
+
+    /**
+     * Compute performance tests
+     *
+     * @return the list containing the performance test methods
+     * @throws Exception
+     */
+    protected Collection<? extends FrameworkMethod> computePerformanceTests()
+            throws Exception {
+        List<FrameworkMethod> tests = new LinkedList<FrameworkMethod>();
+
+        List<Object> testObjects = new ArrayList<Object>();
+        List<Object> testObjectsTmp = new ArrayList<Object>();
+
+
+        ParameterizedTestList testCenter = new ParameterizedTestList();
+
+        // Retrieve the test objects included in the Performance test suite
+        for (FrameworkMethod method : getTestClass().getAnnotatedMethods(
+                PerformanceTestSuite.class)) {
+            Object targetObject = getTestClass().getJavaClass().newInstance();
+            if (method.getMethod().getReturnType()
+                    .equals(ParameterizedTestList.class)) {
+                testCenter = (ParameterizedTestList) method.getMethod().invoke(
+                        targetObject);
+                testObjectsTmp = testCenter.getTestObjectList();
 
                 // Iterate through all the test cases and see if they have a factory
                 for (Object testObject : testObjectsTmp) {
@@ -156,138 +156,138 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
                         testObjects.add(testObject);
                     }
                 }
-			} else {
-				throw new InitializationError(
-						"Wrong signature for the @PerformanceTestSuite method");
-			}
-		}
-
-		// Retrieve the methods before running the methods from the test suite
-		List<FrameworkMethod> beforeSuiteMethods = getTestClass()
-				.getAnnotatedMethods(BeforeSuite.class);
-		if (beforeSuiteMethods.size() > 1) {
-			throw new InitializationError(
-					"Only one @BeforeSuite method is allowed for a @PerformanceSuite");
-		}
-
-		// Retrieve the methods before running the methods from the test suite
-		List<FrameworkMethod> afterSuiteMethods = getTestClass()
-				.getAnnotatedMethods(AfterSuite.class);
-		if (afterSuiteMethods.size() > 1) {
-			throw new InitializationError(
-					"Only one @AfterSuite method is allowed for a @PerformanceSuite");
-		}
-
-		PerformanceSuiteState current = null;
-		boolean suiteAlreadyRegistered = false;
-
-		for (PerformanceSuiteState suiteState : suitesState) {
-			if (suiteState.testSuiteName.equals(testCenter.getTestSuiteName())) {
-				suiteAlreadyRegistered = true;
-				suiteState.incrementNumberOfTestMethodsInSuite();
-				current = suiteState;
-				break;
-			}
-		}
-
-		// Create a new PerformanceSuiteState object
-		PerformanceSuiteState newSuite = new PerformanceSuiteState(
-				testCenter.getTestSuiteName());
-
-		if (!suiteAlreadyRegistered) {
-			if (beforeSuiteMethods.size() == 1) {
-				newSuite.setBeforeSuiteMethod(beforeSuiteMethods.get(0).getMethod());
-			}
-			if (afterSuiteMethods.size() == 1) {
-				newSuite.setAfterSuiteMethod(afterSuiteMethods.get(0).getMethod());
-			}
-
-			current = newSuite;
-			newSuite.setTargetObjectSuite(getTestClass().getJavaClass().newInstance());
-
-		}
-
-		// In case there are any objects retrieved from the Performance Suite
-		// we should add them to the tests that will be run and increase the
-		// number of methods
-		// contained in the PerformanceSuite
-		if (!testObjects.isEmpty()) {
-			for (Object testObject : testObjects) {
-
-				// retrieve the test methods from the test classes
-				Method[] testMethods = getSpecificMethods(testObject.getClass(), PerformanceTest.class);
-
-				for (Method method : testMethods) {
-					FrameworkPerformanceMethod performaceTestMethod =
+            } else {
+                throw new InitializationError(
+                        "Wrong signature for the @PerformanceTestSuite method");
+            }
+        }
+
+        // Retrieve the methods before running the methods from the test suite
+        List<FrameworkMethod> beforeSuiteMethods = getTestClass()
+                .getAnnotatedMethods(BeforeSuite.class);
+        if (beforeSuiteMethods.size() > 1) {
+            throw new InitializationError(
+                    "Only one @BeforeSuite method is allowed for a @PerformanceSuite");
+        }
+
+        // Retrieve the methods before running the methods from the test suite
+        List<FrameworkMethod> afterSuiteMethods = getTestClass()
+                .getAnnotatedMethods(AfterSuite.class);
+        if (afterSuiteMethods.size() > 1) {
+            throw new InitializationError(
+                    "Only one @AfterSuite method is allowed for a @PerformanceSuite");
+        }
+
+        PerformanceSuiteState current = null;
+        boolean suiteAlreadyRegistered = false;
+
+        for (PerformanceSuiteState suiteState : suitesState) {
+            if (suiteState.testSuiteName.equals(testCenter.getTestSuiteName())) {
+                suiteAlreadyRegistered = true;
+                suiteState.incrementNumberOfTestMethodsInSuite();
+                current = suiteState;
+                break;
+            }
+        }
+
+        // Create a new PerformanceSuiteState object
+        PerformanceSuiteState newSuite = new PerformanceSuiteState(
+                testCenter.getTestSuiteName());
+
+        if (!suiteAlreadyRegistered) {
+            if (beforeSuiteMethods.size() == 1) {
+                newSuite.setBeforeSuiteMethod(beforeSuiteMethods.get(0).getMethod());
+            }
+            if (afterSuiteMethods.size() == 1) {
+                newSuite.setAfterSuiteMethod(afterSuiteMethods.get(0).getMethod());
+            }
+
+            current = newSuite;
+            newSuite.setTargetObjectSuite(getTestClass().getJavaClass().newInstance());
+
+        }
+
+        // In case there are any objects retrieved from the Performance Suite
+        // we should add them to the tests that will be run and increase the
+        // number of methods
+        // contained in the PerformanceSuite
+        if (!testObjects.isEmpty()) {
+            for (Object testObject : testObjects) {
+
+                // retrieve the test methods from the test classes
+                Method[] testMethods = getSpecificMethods(testObject.getClass(), PerformanceTest.class);
+
+                for (Method method : testMethods) {
+                    FrameworkPerformanceMethod performaceTestMethod =
                             new FrameworkPerformanceMethod(method, testObject, current, reportLevel);
-					tests.add(performaceTestMethod);
-				}
+                    tests.add(performaceTestMethod);
+                }
 
                 if (!suiteAlreadyRegistered) {
-					newSuite.incrementNumberOfTestMethodsInSuite();
-				}
-			}
-
-			// add the new suite to the list of suites
-			suitesState.add(newSuite);
-		}
-
-		// Retrieve the performance tests in the case we don't have a
-		// performance test suite
-		for (FrameworkMethod method : getTestClass().getAnnotatedMethods(PerformanceTest.class)) {
-			Object targetObject = getTestClass().getJavaClass().newInstance();
-			FrameworkPerformanceMethod performanceTestMethod = new FrameworkPerformanceMethod(
-					method.getMethod(), targetObject, current, reportLevel);
-			tests.add(performanceTestMethod);
-		}
-
-		return tests;
-	}
-
-
-		/**
-	 * Retrieve specific method from test class
-	 * 
-	 * @param testClass
-	 *            the test class that we need to search in
-	 * @param annotation
-	 *            the annotation that we should look for
-	 * @return the list with the methods that have the specified annotation
-	 */
-	@SuppressWarnings({ "rawtypes" })
-	private Method[] getSpecificMethods(Class testClass,
-			Class<? extends Annotation> annotation) {
-		Method[] allMethods = testClass.getDeclaredMethods();
-
-		List<Method> methodListResult = new ArrayList<Method>();
-
-		for (Method testMethod : allMethods) {
-			if (testMethod.isAnnotationPresent(annotation)) {
-				methodListResult.add(testMethod);
-			}
-		}
-		return methodListResult.toArray(new Method[] {});
-	}
-
-	/**
-	 * {@inheritDoc}
-	 * 
-	 * @see org.junit.runners.BlockJUnit4ClassRunner#computeTestMethods()
-	 */
-	@Override
-	protected List<FrameworkMethod> computeTestMethods() {
-		return tests;
-	}
-
-	/**
-	 * Need to override method otherwise the validation will fail because of
-	 * some hardcoded conditions in JUnit
-	 */
-	@Override
-	protected void validateInstanceMethods(List<Throwable> errors) {
-		validatePublicVoidNoArgMethods(After.class, false, errors);
-		validatePublicVoidNoArgMethods(Before.class, false, errors);
-		validateTestMethods(errors);
-	}
+                    newSuite.incrementNumberOfTestMethodsInSuite();
+                }
+            }
+
+            // add the new suite to the list of suites
+            suitesState.add(newSuite);
+        }
+
+        // Retrieve the performance tests in the case we don't have a
+        // performance test suite
+        for (FrameworkMethod method : getTestClass().getAnnotatedMethods(PerformanceTest.class)) {
+            Object targetObject = getTestClass().getJavaClass().newInstance();
+            FrameworkPerformanceMethod performanceTestMethod = new FrameworkPerformanceMethod(
+                    method.getMethod(), targetObject, current, reportLevel);
+            tests.add(performanceTestMethod);
+        }
+
+        return tests;
+    }
+
+
+        /**
+     * Retrieve specific method from test class
+     *
+     * @param testClass
+     *            the test class that we need to search in
+     * @param annotation
+     *            the annotation that we should look for
+     * @return the list with the methods that have the specified annotation
+     */
+    @SuppressWarnings({ "rawtypes" })
+    private Method[] getSpecificMethods(Class testClass,
+            Class<? extends Annotation> annotation) {
+        Method[] allMethods = testClass.getDeclaredMethods();
+
+        List<Method> methodListResult = new ArrayList<Method>();
+
+        for (Method testMethod : allMethods) {
+            if (testMethod.isAnnotationPresent(annotation)) {
+                methodListResult.add(testMethod);
+            }
+        }
+        return methodListResult.toArray(new Method[] {});
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @see org.junit.runners.BlockJUnit4ClassRunner#computeTestMethods()
+     */
+    @Override
+    protected List<FrameworkMethod> computeTestMethods() {
+        return tests;
+    }
+
+    /**
+     * Need to override method otherwise the validation will fail because of
+     * some hardcoded conditions in JUnit
+     */
+    @Override
+    protected void validateInstanceMethods(List<Throwable> errors) {
+        validatePublicVoidNoArgMethods(After.class, false, errors);
+        validatePublicVoidNoArgMethods(Before.class, false, errors);
+        validateTestMethods(errors);
+    }
 
 }
diff --git a/src/main/java/org/apache/sling/performance/ReportLogger.java b/src/main/java/org/apache/sling/performance/ReportLogger.java
index ac4ed49..64dccd9 100644
--- a/src/main/java/org/apache/sling/performance/ReportLogger.java
+++ b/src/main/java/org/apache/sling/performance/ReportLogger.java
@@ -19,9 +19,9 @@ public class ReportLogger {
     
     public static final String REPORTS_DIR = "performance-reports";
 
-	public enum ReportType {
-		TXT
-	}
+    public enum ReportType {
+        TXT
+    }
 
     /**
      * Method the writes the performance report after a test is run
@@ -36,54 +36,54 @@ public class ReportLogger {
      */
     public static void writeReport(String testSuiteName, String testCaseName, String className, String methodName,
             DescriptiveStatistics statistics, ReportType reportType, PerformanceRunner.ReportLevel reportLevel) throws Exception {
-		switch (reportType) {
+        switch (reportType) {
             case TXT:
                 writeReportTxt(testSuiteName, testCaseName, className, methodName, statistics, reportLevel);
                 break;
             default:
                 throw new Exception("The specified reporting format is not yet supported");
-		}
-	}
+        }
+    }
 
-	/**
+    /**
      * Method the writes the performance report after a test is run, in text format
-	 * 
+     *
      * @param testSuiteName
      * @param testCaseName
      * @param className
      * @param methodName
-	 * @param statistics
+     * @param statistics
      * @param reportLevel
      * @throws Exception
-	 */
+     */
     public static void writeReportTxt(String testSuiteName, String testCaseName, String className, String methodName,
             DescriptiveStatistics statistics, PerformanceRunner.ReportLevel reportLevel) throws Exception {
 
         File reportDir = new File("target/" + REPORTS_DIR);
-		if (!reportDir.exists() && !reportDir.mkdir()) {
+        if (!reportDir.exists() && !reportDir.mkdir()) {
                 throw new IOException("Unable to create " + REPORTS_DIR + " directory");
-		}
-
-		// need this in the case a user wants to set the suite name from the
-		// command line
-		// useful if we run the test cases from the command line for example
-		// by using maven
-		if (testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
-			if (System.getProperty("testsuitename") != null) {
-				testSuiteName = System.getProperty("testsuitename");
-			}
-		}
-
-		if (reportLevel.equals(PerformanceRunner.ReportLevel.ClassLevel)) {
+        }
+
+        // need this in the case a user wants to set the suite name from the
+        // command line
+        // useful if we run the test cases from the command line for example
+        // by using maven
+        if (testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+            if (System.getProperty("testsuitename") != null) {
+                testSuiteName = System.getProperty("testsuitename");
+            }
+        }
+
+        if (reportLevel.equals(PerformanceRunner.ReportLevel.ClassLevel)) {
             String resultFileName = className;
             writeReportClassLevel(resultFileName, testSuiteName, statistics);
         } else if (reportLevel.equals(PerformanceRunner.ReportLevel.MethodLevel)) {
             String resultFileName = className + "." + methodName;
             writeReportMethodLevel(resultFileName, testSuiteName, testCaseName, className, methodName, statistics);
         }
-	}
-	
-	/**
+    }
+
+    /**
      * Write report for class level tests
      *
      * @param resultFileName the name of the result file (without extension)
@@ -92,28 +92,28 @@ public class ReportLogger {
      */
     private static void writeReportClassLevel(String resultFileName, String testSuiteName,
             DescriptiveStatistics statistics) throws IOException {
-    	
+
         File report = getReportFile(resultFileName, ".txt");
-		boolean needsPrefix = !report.exists();
-	    PrintWriter writer = new PrintWriter(
-	    		new FileWriterWithEncoding(report, "UTF-8", true));
-	    try {
-	    	if (needsPrefix) {
-	    		writer.format("# %-50.50s     min     10%%     50%%     90%%     max%n", resultFileName);
-	    	}
-	    	
-	    	writer.format(
-	    			"%-52.52s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
-	    			testSuiteName,
-	    			statistics.getMin(),
-	    			statistics.getPercentile(10.0),
-	    			statistics.getPercentile(50.0),
-	    			statistics.getPercentile(90.0),
-	    			statistics.getMax());
+        boolean needsPrefix = !report.exists();
+        PrintWriter writer = new PrintWriter(
+                new FileWriterWithEncoding(report, "UTF-8", true));
+        try {
+            if (needsPrefix) {
+                writer.format("# %-50.50s     min     10%%     50%%     90%%     max%n", resultFileName);
+            }
+
+            writer.format(
+                    "%-52.52s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
+                    testSuiteName,
+                    statistics.getMin(),
+                    statistics.getPercentile(10.0),
+                    statistics.getPercentile(50.0),
+                    statistics.getPercentile(90.0),
+                    statistics.getMax());
         } finally {
             writer.close();
         }
-	}
+    }
     
     /**
      * Write report for method level tests
@@ -128,56 +128,56 @@ public class ReportLogger {
     private static void writeReportMethodLevel(String resultFileName, String testSuiteName, String testCaseName, String className,
             String methodName, DescriptiveStatistics statistics) throws IOException {
         File report = getReportFile(resultFileName, ".txt");
-	
-    	boolean needsPrefix = !report.exists();
-    	PrintWriter writer = new PrintWriter(
-    			new FileWriterWithEncoding(report, "UTF-8", true));
-    	try {
-    		if (needsPrefix) {
-    			writer.format(
+
+        boolean needsPrefix = !report.exists();
+        PrintWriter writer = new PrintWriter(
+                new FileWriterWithEncoding(report, "UTF-8", true));
+        try {
+            if (needsPrefix) {
+                writer.format(
                         "%-40.40s|%-120.120s|%-80.80s|%-40.40s|      DateTime      |  min  |   10%%   |   50%%   |   90%%   |   max%n",
-    					"Test Suite",
+                        "Test Suite",
                         "Test Case",
-    					"Test Class",
-    					"Test Method");
-    		}
-    		
-    		writer.format(
+                        "Test Class",
+                        "Test Method");
+            }
+
+            writer.format(
                     "%-40.40s|%-120.120s|%-80.80s|%-40.40s|%-20.20s|%7.0f|%9.0f|%9.0f|%9.0f|%9.0f%n",
-    				testSuiteName,
+                    testSuiteName,
                     (testCaseName.length() < 120) ? (testCaseName) : (testCaseName.substring(0, 115) + "[...]"),
-    				className,
-    				methodName,
-    				getDate(),
-    				statistics.getMin(),
-    				statistics.getPercentile(10.0),
-    				statistics.getPercentile(50.0),
-    				statistics.getPercentile(90.0),
-    				statistics.getMax());
-    		} finally {
-    			writer.close();
-    		}
+                    className,
+                    methodName,
+                    getDate(),
+                    statistics.getMin(),
+                    statistics.getPercentile(10.0),
+                    statistics.getPercentile(50.0),
+                    statistics.getPercentile(90.0),
+                    statistics.getMax());
+            } finally {
+                writer.close();
+            }
+    }
+
+
+    /**
+     * Get the date that will be written into the result file
+     */
+    private static String getDate() {
+        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+        Date date = new Date();
+
+        return dateFormat.format(date);
+    }
+
+    private static File getReportFile(String resultFileName, String extension) {
+        final String folder = "target/" + REPORTS_DIR;
+        final String filename =  resultFileName + extension;
+        if(!reportFolderLogged) {
+            logger.info("Writing performance test results under {}", folder);
+            reportFolderLogged = true;
+        }
+        return new File(folder, filename);
     }
-	    
-	
-	/**
-	 * Get the date that will be written into the result file
-	 */
-	private static String getDate() {
-		DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
-		Date date = new Date();
-
-		return dateFormat.format(date);
-	}
-	
-	private static File getReportFile(String resultFileName, String extension) {
-	    final String folder = "target/" + REPORTS_DIR;
-	    final String filename =  resultFileName + extension;
-	    if(!reportFolderLogged) {
-	        logger.info("Writing performance test results under {}", folder);
-	        reportFolderLogged = true;
-	    }
-	    return new File(folder, filename);
-	}
 
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 19/27: Update to Sling Parent POM 22 with baselining enabled

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 61f259b74536c63e817c5b2e284070cd857a7b86
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Oct 1 06:42:16 2014 +0000

    Update to Sling Parent POM 22 with baselining enabled
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1628613 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 3379344..92557be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>20</version>
+        <version>22</version>
         <relativePath>../../../parent/pom.xml</relativePath>
     </parent>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 16/27: SLING-3579 - Allow performance tests to report custom class name to the report logger

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit bd4da1a0977eb8c5f3952d3c55288581e6cc2058
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Tue Jul 8 11:07:18 2014 +0000

    SLING-3579 - Allow performance tests to report custom class name to the report logger
    
    * applied patch from Andrei Dulvac
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1608717 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/performance/AbstractRepositoryTest.java  |  9 ++--
 .../performance/FrameworkPerformanceMethod.java    | 56 ++++++++++------------
 .../sling/performance/IdentifiableTestClass.java   | 10 ++++
 .../sling/performance/PerformanceRunner.java       | 21 +++-----
 .../org/apache/sling/performance/ReportLogger.java | 41 +++++++---------
 5 files changed, 63 insertions(+), 74 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java b/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
index 4854bca..7a813ea 100644
--- a/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
+++ b/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
@@ -26,7 +26,7 @@ import org.apache.sling.jcr.api.SlingRepository;
 
 
   
-public abstract class AbstractRepositoryTest {
+public abstract class AbstractRepositoryTest implements IdentifiableTestClass{
 
     protected String testInstanceName;
 
@@ -87,9 +87,8 @@ public abstract class AbstractRepositoryTest {
         }
         return testRoot;
     }
-    
-    public String toString(){
-    	return testInstanceName;
-    }
 
+    public String testClassName() {
+        return testInstanceName;
+    }
 }
diff --git a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
index be28c78..42ee110 100644
--- a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
+++ b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
@@ -39,6 +39,7 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 	private PerformanceSuiteState performanceSuiteState;
 	private PerformanceRunner.ReportLevel reportLevel = PerformanceRunner.ReportLevel.ClassLevel;
     private String testCaseName = "";
+    private String className;
 
 	public FrameworkPerformanceMethod(Method method, Object target,
 			PerformanceSuiteState performanceSuiteState, PerformanceRunner.ReportLevel reportLevel) {
@@ -48,7 +49,16 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 		this.reportLevel = reportLevel;
         if (target instanceof IdentifiableTestCase) {
             this.testCaseName = ((IdentifiableTestCase) target).testCaseName();
-	}
+	    }
+
+        // Name of the test class, as the report logger needs it
+        // This can be overwritten by tests by implementing IdentifiableTestClass
+        String longClassName = this.target.getClass().getName();
+        className = longClassName.substring(longClassName.lastIndexOf(".") + 1);
+        if (target instanceof IdentifiableTestClass) {
+            this.className = ((IdentifiableTestClass) target).testClassName();
+        }
+
     }
 
 	@Override
@@ -76,11 +86,9 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 		// in case we don't have to deal with a PerformanceSuite just skip this
 		// as JUnit will run the methods itself
 		if ((performanceSuiteState != null)
-				&& !performanceSuiteState.testSuiteName
-						.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+				&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
 
-			recursiveCallSpecificMethod(this.target.getClass(), this.target,
-					Before.class);
+			recursiveCallSpecificMethod(this.target.getClass(), this.target, Before.class);
 		}
 
 		// Need to count the number of tests run from the PerformanceSuite
@@ -104,16 +112,12 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 
 		DescriptiveStatistics statistics = new DescriptiveStatistics();
 
-		// System.out.println("Warmup started - test :" +
-		// testMethodToInvoke.getName());
-
 		if (warmupinvocations != 0) {
 			// Run the number of invocation specified in the annotation
 			// for warming up the system
 			for (int invocationIndex = 0; invocationIndex < warmupinvocations; invocationIndex++) {
 
-				recursiveCallSpecificMethod(this.target.getClass(),
-						this.target, BeforeMethodInvocation.class);
+				recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeMethodInvocation.class);
 
 				// TODO: implement the method to run a before a specific test
 				// method
@@ -177,8 +181,8 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 		}
 
 		if (statistics.getN() > 0) {
-		    ReportLogger.writeReport(this.performanceSuiteState.testSuiteName, testCaseName, ((String )this.target.getClass().getMethod("toString", null).invoke(this.target, null)),
-                    getMethod().getName(), statistics, ReportLogger.ReportType.TXT, reportLevel);
+		    ReportLogger.writeReport(this.performanceSuiteState.testSuiteName, testCaseName, className, getMethod().getName(),
+                    statistics, ReportLogger.ReportType.TXT, reportLevel);
 		}
 
 		// In case of a PerformanceSuite we need to run the methods annotated
@@ -187,11 +191,9 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 		// with a PerformanceSuite
 		// just skip this as JUnit will run the methods itself
 		if ((performanceSuiteState != null)
-				&& !performanceSuiteState.testSuiteName
-						.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+				&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
 
-			recursiveCallSpecificMethod(this.target.getClass(), this.target,
-					After.class);
+			recursiveCallSpecificMethod(this.target.getClass(), this.target, After.class);
 		}
 
 		// Check if this is the last test running from a PerformanceSuite
@@ -199,13 +201,9 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 		if ((performanceSuiteState != null)
 				&& (performanceSuiteState.getAfterSuiteMethod() != null)
 				&& (performanceSuiteState.getTargetObjectSuite() != null)
-				&& (performanceSuiteState.getNumberOfExecutedMethods() == performanceSuiteState
-						.getNumberOfMethodsInSuite())
-				&& !performanceSuiteState.testSuiteName
-						.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
-			performanceSuiteState.getAfterSuiteMethod().invoke(
-					performanceSuiteState.getTargetObjectSuite());
-
+				&& (performanceSuiteState.getNumberOfExecutedMethods() == performanceSuiteState.getNumberOfMethodsInSuite())
+				&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+			performanceSuiteState.getAfterSuiteMethod().invoke(performanceSuiteState.getTargetObjectSuite());
 		}
 
 		return response;
@@ -240,8 +238,7 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 		// System.out.println("Start test: " + testMethodToInvoke.getName());
 		long start = System.nanoTime();
 		response = super.invokeExplosively(this.target, params);
-		long timeMilliseconds = TimeUnit.MILLISECONDS.convert(System.nanoTime()
-				- start, TimeUnit.NANOSECONDS);
+		long timeMilliseconds = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS);
 		statistics.addValue(timeMilliseconds);
 
 		// System.out.println("End test: " + testMethodToInvoke.getName());
@@ -252,8 +249,7 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 		// recursiveCallSpecificMethod(this.target.getClass(), this.target,
 		// AfterSpecificTest.class);
 
-		recursiveCallSpecificMethod(this.target.getClass(), this.target,
-				AfterMethodInvocation.class);
+		recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterMethodInvocation.class);
 
 		return response;
 	}
@@ -309,14 +305,12 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 			throws InvalidAttributesException, IllegalAccessException,
 			InstantiationException {
 
-		Method[] methodsToReturn = getSpecificMethods(testClass,
-				methodAnnotation);
+		Method[] methodsToReturn = getSpecificMethods(testClass, methodAnnotation);
 		Method methodToReturn = null;
 		if (methodsToReturn.length == 1) {
 			methodToReturn = methodsToReturn[0];
 		} else if (methodsToReturn.length > 1) {
-			throw new InvalidAttributesException(
-					"Only 1 non parameterized before method accepted");
+			throw new InvalidAttributesException("Only 1 non parameterized before method accepted");
 		}
 
 		return methodToReturn;
diff --git a/src/main/java/org/apache/sling/performance/IdentifiableTestClass.java b/src/main/java/org/apache/sling/performance/IdentifiableTestClass.java
new file mode 100644
index 0000000..b7c78d0
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/IdentifiableTestClass.java
@@ -0,0 +1,10 @@
+package org.apache.sling.performance;
+
+/**
+ * Interface to be implemented by a class with PerformanceTests.
+ * <p></p>The provided method @{link #testCaseName()} exposes the possibility to give a name to each instance of the
+ * implementing class</p>
+ */
+public interface IdentifiableTestClass {
+    public String testClassName();
+}
diff --git a/src/main/java/org/apache/sling/performance/PerformanceRunner.java b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
index a2ff109..ecd1bbc 100644
--- a/src/main/java/org/apache/sling/performance/PerformanceRunner.java
+++ b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
@@ -196,17 +196,14 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
 
 		if (!suiteAlreadyRegistered) {
 			if (beforeSuiteMethods.size() == 1) {
-				newSuite.setBeforeSuiteMethod(beforeSuiteMethods.get(0)
-						.getMethod());
+				newSuite.setBeforeSuiteMethod(beforeSuiteMethods.get(0).getMethod());
 			}
 			if (afterSuiteMethods.size() == 1) {
-				newSuite.setAfterSuiteMethod(afterSuiteMethods.get(0)
-						.getMethod());
+				newSuite.setAfterSuiteMethod(afterSuiteMethods.get(0).getMethod());
 			}
 
 			current = newSuite;
-			newSuite.setTargetObjectSuite(getTestClass().getJavaClass()
-					.newInstance());
+			newSuite.setTargetObjectSuite(getTestClass().getJavaClass().newInstance());
 
 		}
 
@@ -218,14 +215,11 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
 			for (Object testObject : testObjects) {
 
 				// retrieve the test methods from the test classes
-				Method[] testMethods = getSpecificMethods(
-						testObject.getClass(), PerformanceTest.class);
-
+				Method[] testMethods = getSpecificMethods(testObject.getClass(), PerformanceTest.class);
 
 				for (Method method : testMethods) {
-					FrameworkPerformanceMethod performaceTestMethod = new
-							FrameworkPerformanceMethod(
-							method, testObject, current, reportLevel);
+					FrameworkPerformanceMethod performaceTestMethod =
+                            new FrameworkPerformanceMethod(method, testObject, current, reportLevel);
 					tests.add(performaceTestMethod);
 				}
 
@@ -240,8 +234,7 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
 
 		// Retrieve the performance tests in the case we don't have a
 		// performance test suite
-		for (FrameworkMethod method : getTestClass().getAnnotatedMethods(
-				PerformanceTest.class)) {
+		for (FrameworkMethod method : getTestClass().getAnnotatedMethods(PerformanceTest.class)) {
 			Object targetObject = getTestClass().getJavaClass().newInstance();
 			FrameworkPerformanceMethod performanceTestMethod = new FrameworkPerformanceMethod(
 					method.getMethod(), targetObject, current, reportLevel);
diff --git a/src/main/java/org/apache/sling/performance/ReportLogger.java b/src/main/java/org/apache/sling/performance/ReportLogger.java
index 6e3161e..ac4ed49 100644
--- a/src/main/java/org/apache/sling/performance/ReportLogger.java
+++ b/src/main/java/org/apache/sling/performance/ReportLogger.java
@@ -37,10 +37,10 @@ public class ReportLogger {
     public static void writeReport(String testSuiteName, String testCaseName, String className, String methodName,
             DescriptiveStatistics statistics, ReportType reportType, PerformanceRunner.ReportLevel reportLevel) throws Exception {
 		switch (reportType) {
-		case TXT:
+            case TXT:
                 writeReportTxt(testSuiteName, testCaseName, className, methodName, statistics, reportLevel);
-			break;
-		default:
+                break;
+            default:
                 throw new Exception("The specified reporting format is not yet supported");
 		}
 	}
@@ -53,21 +53,16 @@ public class ReportLogger {
      * @param className
      * @param methodName
 	 * @param statistics
-     * @param reportlevel
+     * @param reportLevel
      * @throws Exception
 	 */
     public static void writeReportTxt(String testSuiteName, String testCaseName, String className, String methodName,
-            DescriptiveStatistics statistics, PerformanceRunner.ReportLevel reportlevel) throws Exception {
-
-        // Short class form
-        String shortClassName = className.substring(className.lastIndexOf(".") + 1);
+            DescriptiveStatistics statistics, PerformanceRunner.ReportLevel reportLevel) throws Exception {
 
         File reportDir = new File("target/" + REPORTS_DIR);
-		if (!reportDir.exists()) {
-            if (!reportDir.mkdir()) {
+		if (!reportDir.exists() && !reportDir.mkdir()) {
                 throw new IOException("Unable to create " + REPORTS_DIR + " directory");
 		}
-        }
 
 		// need this in the case a user wants to set the suite name from the
 		// command line
@@ -79,13 +74,13 @@ public class ReportLogger {
 			}
 		}
 
-        String resultFileName = shortClassName;
-		if (reportlevel.equals(PerformanceRunner.ReportLevel.ClassLevel)){
-			writeReportClassLevel(resultFileName, testSuiteName, statistics);
-			}else if (reportlevel.equals(PerformanceRunner.ReportLevel.MethodLevel)){
-            resultFileName = shortClassName + "." + methodName;
+		if (reportLevel.equals(PerformanceRunner.ReportLevel.ClassLevel)) {
+            String resultFileName = className;
+            writeReportClassLevel(resultFileName, testSuiteName, statistics);
+        } else if (reportLevel.equals(PerformanceRunner.ReportLevel.MethodLevel)) {
+            String resultFileName = className + "." + methodName;
             writeReportMethodLevel(resultFileName, testSuiteName, testCaseName, className, methodName, statistics);
-			}
+        }
 	}
 	
 	/**
@@ -104,22 +99,20 @@ public class ReportLogger {
 	    		new FileWriterWithEncoding(report, "UTF-8", true));
 	    try {
 	    	if (needsPrefix) {
-	    		writer.format(
-	    				"# %-34.34s     min     10%%     50%%     90%%     max%n",
-	    				resultFileName);
+	    		writer.format("# %-50.50s     min     10%%     50%%     90%%     max%n", resultFileName);
 	    	}
 	    	
 	    	writer.format(
-	    			"%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
+	    			"%-52.52s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
 	    			testSuiteName,
 	    			statistics.getMin(),
 	    			statistics.getPercentile(10.0),
 	    			statistics.getPercentile(50.0),
 	    			statistics.getPercentile(90.0),
 	    			statistics.getMax());
-	    	} finally {
-	    		writer.close();
-	   		}
+        } finally {
+            writer.close();
+        }
 	}
     
     /**

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 22/27: @trivial: whitespace changes

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit d800d0378c160758a41a0ffeeffc90ed7faa508a
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Mar 23 20:06:10 2015 +0000

    @trivial: whitespace changes
    
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1668708 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/pom.xml b/pom.xml
index 92557be..5908f03 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,9 +7,9 @@
     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
@@ -30,9 +30,9 @@
     <artifactId>org.apache.sling.performance.base</artifactId>
     <version>0.0.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
- 
+
     <name>Apache Sling Performance Test Utilities</name>
-    
+
     <properties>
         <junit.version>4.8.2</junit.version>
     </properties>
@@ -131,13 +131,13 @@
                         <Export-Package>
                             org.apache.sling.performance.*;
                         </Export-Package>
-                         <Import-Package>                         	 
-                         	!org.apache.sling.commons.testing.jcr.*,
-                         	*;
-                         </Import-Package>
+                        <Import-Package>
+                            !org.apache.sling.commons.testing.jcr.*,
+                            *;
+                        </Import-Package>
                     </instructions>
                 </configuration>
-            </plugin>  
+            </plugin>
         </plugins>
     </build>
 </project>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 11/27: SLING-2727 - Allow PerformanceRunner to run tests provided by a factory method

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 7979bf8e3ddc0c1866fe4b503fc5cb6e5b3b8787
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Tue Dec 17 13:09:06 2013 +0000

    SLING-2727 - Allow PerformanceRunner to run tests provided by a factory method
    
    * applied patch from Andrei Dulvac (thanks)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1551535 13f79535-47bb-0310-9956-ffa450edef68
---
 .../performance/FrameworkPerformanceMethod.java    | 19 +++--
 .../sling/performance/IdentifiableTestCase.java    | 10 +++
 .../sling/performance/PerformanceRunner.java       | 89 ++++++++++++++++------
 .../annotation/PerformanceTestFactory.java         | 11 +++
 4 files changed, 102 insertions(+), 27 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
index 8010a3a..3532afa 100644
--- a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
+++ b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
@@ -38,6 +38,7 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 	private Object target;
 	private PerformanceSuiteState performanceSuiteState;
 	private PerformanceRunner.ReportLevel reportLevel = PerformanceRunner.ReportLevel.ClassLevel;
+    private String testCaseName = "";
 
 	public FrameworkPerformanceMethod(Method method, Object target,
 			PerformanceSuiteState performanceSuiteState, PerformanceRunner.ReportLevel reportLevel) {
@@ -45,7 +46,10 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 		this.target = target;
 		this.performanceSuiteState = performanceSuiteState;
 		this.reportLevel = reportLevel;
+        if (target instanceof IdentifiableTestCase) {
+            this.testCaseName = ((IdentifiableTestCase) target).testCaseName();
 	}
+    }
 
 	@Override
 	public Object invokeExplosively(Object target, Object... params)
@@ -173,11 +177,8 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 		}
 
 		if (statistics.getN() > 0) {
-			ReportLogger
-					.writeReport(this.target.getClass().getName(),
-							this.performanceSuiteState.testSuiteName,
-							getMethod().getName(), statistics,
-							ReportLogger.ReportType.TXT, reportLevel);
+            ReportLogger.writeReport(this.performanceSuiteState.testSuiteName, testCaseName, this.target.getClass().getName(),
+                    getMethod().getName(), statistics, ReportLogger.ReportType.TXT, reportLevel);
 		}
 
 		// In case of a PerformanceSuite we need to run the methods annotated
@@ -345,4 +346,12 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 		return methodListResult.toArray(new Method[] {});
 	}
 
+    @Override
+    public String getName() {
+        System.out.println(testCaseName);
+        if (testCaseName == null || "".equals(testCaseName.trim())) { return super.getName(); }
+        return String.format("%s  [%s.%s]", testCaseName, target.getClass().getSimpleName(),
+                getMethod().getName());
+}
+
 }
diff --git a/src/main/java/org/apache/sling/performance/IdentifiableTestCase.java b/src/main/java/org/apache/sling/performance/IdentifiableTestCase.java
new file mode 100644
index 0000000..cfae459
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/IdentifiableTestCase.java
@@ -0,0 +1,10 @@
+package org.apache.sling.performance;
+
+/**
+ * Interface to be implemented by a class with PerformanceTests.
+ * <p></p>The provided method @{link #testCaseName()} exposes the possibility to give a name to each instance of the
+ * implementing class</p>
+ */
+public interface IdentifiableTestCase {
+    public String testCaseName();
+}
diff --git a/src/main/java/org/apache/sling/performance/PerformanceRunner.java b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
index 68e2926..a2ff109 100644
--- a/src/main/java/org/apache/sling/performance/PerformanceRunner.java
+++ b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
@@ -16,27 +16,32 @@
  */
 package org.apache.sling.performance;
 
+import org.apache.sling.performance.annotation.AfterSuite;
+import org.apache.sling.performance.annotation.BeforeSuite;
+import org.apache.sling.performance.annotation.PerformanceTest;
+import org.apache.sling.performance.annotation.PerformanceTestFactory;
+import org.apache.sling.performance.annotation.PerformanceTestSuite;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.TestClass;
+
 import java.lang.annotation.Annotation;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 
-import org.apache.sling.performance.annotation.AfterSuite;
-import org.apache.sling.performance.annotation.BeforeSuite;
-import org.apache.sling.performance.annotation.PerformanceTest;
-import org.apache.sling.performance.annotation.PerformanceTestSuite;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-
 /**
  * The custom JUnit runner that collects the performance tests
  * 
@@ -82,9 +87,10 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
 	 * @throws Exception
 	 */
 	protected void computeTests() throws Exception {
+		// add normal JUnit tests
 		tests.addAll(super.computeTestMethods());
 
-		// count the performance tests
+		// add the performance tests
 		tests.addAll(computePerformanceTests());
 
 		// This is called here to ensure the test class constructor is called at
@@ -101,9 +107,12 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
 	 */
 	protected Collection<? extends FrameworkMethod> computePerformanceTests()
 			throws Exception {
-		List<FrameworkPerformanceMethod> tests = new LinkedList<FrameworkPerformanceMethod>();
+		List<FrameworkMethod> tests = new LinkedList<FrameworkMethod>();
 
 		List<Object> testObjects = new ArrayList<Object>();
+		List<Object> testObjectsTmp = new ArrayList<Object>();
+
+
 		ParameterizedTestList testCenter = new ParameterizedTestList();
 
 		// Retrieve the test objects included in the Performance test suite
@@ -114,10 +123,42 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
 					.equals(ParameterizedTestList.class)) {
 				testCenter = (ParameterizedTestList) method.getMethod().invoke(
 						targetObject);
-				testObjects = testCenter.getTestObjectList();
+				testObjectsTmp = testCenter.getTestObjectList();
+
+                // Iterate through all the test cases and see if they have a factory
+                for (Object testObject : testObjectsTmp) {
+                    Method[] factoryMethods = getSpecificMethods(
+                            testObject.getClass(), PerformanceTestFactory.class);
+
+                    // If we have a factory method, get all the instance objects returned by this factory
+                    if (factoryMethods.length > 0) {
+                        // Make sure there's only one factory method
+                        if (factoryMethods.length > 1) {
+                            throw new IllegalStateException(
+                                    "There should be at most one PerformanceTestFactory method");
+                        }
+                        Method factoryMethod = factoryMethods[0];
+
+                        // Execute the method (statically)
+                        Object instances = factoryMethod.invoke(testObject);
+
+                        // If the factory returned an array, make a list
+                        if (instances.getClass().isArray()) {
+                            instances = Arrays.asList((Object[]) instances);
+                        }
+
+                        // If the factory returned a single element, put it in a list
+                        if (!(instances instanceof Iterable<?>)) {
+                            instances = Collections.singletonList(instances);
+                        }
+                        testObjects.addAll((List) instances);
+                    } else {
+                        testObjects.add(testObject);
+                    }
+                }
 			} else {
 				throw new InitializationError(
-						"Wrong signature for the @PerformanceSuite method");
+						"Wrong signature for the @PerformanceTestSuite method");
 			}
 		}
 
@@ -172,22 +213,25 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
 		// In case there are any objects retrieved from the Performance Suite
 		// we should add them to the tests that will be run and increase the
 		// number of methods
-		// contained in the PerformaceSuite
+		// contained in the PerformanceSuite
 		if (!testObjects.isEmpty()) {
 			for (Object testObject : testObjects) {
+
 				// retrieve the test methods from the test classes
 				Method[] testMethods = getSpecificMethods(
 						testObject.getClass(), PerformanceTest.class);
 
-				if (!suiteAlreadyRegistered) {
-					newSuite.incrementNumberOfTestMethodsInSuite();
-				}
 
 				for (Method method : testMethods) {
-					FrameworkPerformanceMethod performaceTestMethod = new FrameworkPerformanceMethod(
+					FrameworkPerformanceMethod performaceTestMethod = new
+							FrameworkPerformanceMethod(
 							method, testObject, current, reportLevel);
 					tests.add(performaceTestMethod);
 				}
+
+                if (!suiteAlreadyRegistered) {
+					newSuite.incrementNumberOfTestMethodsInSuite();
+				}
 			}
 
 			// add the new suite to the list of suites
@@ -199,15 +243,16 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
 		for (FrameworkMethod method : getTestClass().getAnnotatedMethods(
 				PerformanceTest.class)) {
 			Object targetObject = getTestClass().getJavaClass().newInstance();
-			FrameworkPerformanceMethod performaceTestMethod = new FrameworkPerformanceMethod(
+			FrameworkPerformanceMethod performanceTestMethod = new FrameworkPerformanceMethod(
 					method.getMethod(), targetObject, current, reportLevel);
-			tests.add(performaceTestMethod);
+			tests.add(performanceTestMethod);
 		}
 
 		return tests;
 	}
 
-	/**
+
+		/**
 	 * Retrieve specific method from test class
 	 * 
 	 * @param testClass
diff --git a/src/main/java/org/apache/sling/performance/annotation/PerformanceTestFactory.java b/src/main/java/org/apache/sling/performance/annotation/PerformanceTestFactory.java
new file mode 100644
index 0000000..b7341b3
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/annotation/PerformanceTestFactory.java
@@ -0,0 +1,11 @@
+package org.apache.sling.performance.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PerformanceTestFactory {
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 15/27: Add some simple performance test examples

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 19f3f8444599d06b888b292d0fb307d08bc7ca01
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jun 27 13:40:59 2014 +0000

    Add some simple performance test examples
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1606095 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/performance/ReportLogger.java | 21 ++++++++++--
 .../performance/samples/SimplePerformanceTest.java | 37 ++++++++++++++++++++
 .../performance/samples/WithParametersTest.java    | 39 ++++++++++++++++++++++
 3 files changed, 94 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/ReportLogger.java b/src/main/java/org/apache/sling/performance/ReportLogger.java
index aea8bfc..6e3161e 100644
--- a/src/main/java/org/apache/sling/performance/ReportLogger.java
+++ b/src/main/java/org/apache/sling/performance/ReportLogger.java
@@ -9,9 +9,14 @@ import java.util.Date;
 
 import org.apache.commons.io.output.FileWriterWithEncoding;
 import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ReportLogger {
 
+    private static boolean reportFolderLogged = false;
+    private static final Logger logger = LoggerFactory.getLogger(ReportLogger.class);
+    
     public static final String REPORTS_DIR = "performance-reports";
 
 	public enum ReportType {
@@ -93,7 +98,7 @@ public class ReportLogger {
     private static void writeReportClassLevel(String resultFileName, String testSuiteName,
             DescriptiveStatistics statistics) throws IOException {
     	
-        File report = new File("target/" + REPORTS_DIR, resultFileName + ".txt");
+        File report = getReportFile(resultFileName, ".txt");
 		boolean needsPrefix = !report.exists();
 	    PrintWriter writer = new PrintWriter(
 	    		new FileWriterWithEncoding(report, "UTF-8", true));
@@ -129,7 +134,7 @@ public class ReportLogger {
      */
     private static void writeReportMethodLevel(String resultFileName, String testSuiteName, String testCaseName, String className,
             String methodName, DescriptiveStatistics statistics) throws IOException {
-        File report = new File("target/" + REPORTS_DIR, resultFileName + ".txt");
+        File report = getReportFile(resultFileName, ".txt");
 	
     	boolean needsPrefix = !report.exists();
     	PrintWriter writer = new PrintWriter(
@@ -171,5 +176,15 @@ public class ReportLogger {
 
 		return dateFormat.format(date);
 	}
+	
+	private static File getReportFile(String resultFileName, String extension) {
+	    final String folder = "target/" + REPORTS_DIR;
+	    final String filename =  resultFileName + extension;
+	    if(!reportFolderLogged) {
+	        logger.info("Writing performance test results under {}", folder);
+	        reportFolderLogged = true;
+	    }
+	    return new File(folder, filename);
+	}
 
-}
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/performance/samples/SimplePerformanceTest.java b/src/test/java/org/apache/sling/performance/samples/SimplePerformanceTest.java
new file mode 100644
index 0000000..2f8efdc
--- /dev/null
+++ b/src/test/java/org/apache/sling/performance/samples/SimplePerformanceTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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.samples;
+
+import org.apache.sling.performance.PerformanceRunner;
+import org.apache.sling.performance.annotation.PerformanceTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/** Simple performance test example */
+@RunWith(PerformanceRunner.class)
+public class SimplePerformanceTest {
+    
+    @Test
+    public void notPerformanceTest() throws InterruptedException {
+        Thread.sleep((long)(Math.random() * 10));
+    }
+    
+    @PerformanceTest
+    public void randomDurationPerformanceTest() throws InterruptedException {
+        Thread.sleep((long)(Math.random() * 12));
+    }
+}
diff --git a/src/test/java/org/apache/sling/performance/samples/WithParametersTest.java b/src/test/java/org/apache/sling/performance/samples/WithParametersTest.java
new file mode 100644
index 0000000..8311281
--- /dev/null
+++ b/src/test/java/org/apache/sling/performance/samples/WithParametersTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.samples;
+
+import org.apache.sling.performance.PerformanceRunner;
+import org.apache.sling.performance.PerformanceRunner.Parameters;
+import org.apache.sling.performance.PerformanceRunner.ReportLevel;
+import org.apache.sling.performance.annotation.PerformanceTest;
+import org.junit.runner.RunWith;
+
+/** Demonstrate the Parameters annotation */
+@RunWith(PerformanceRunner.class)
+@Parameters(reportLevel=ReportLevel.MethodLevel)
+public class WithParametersTest {
+    
+    @PerformanceTest
+    public void PerformanceTestA() throws InterruptedException {
+        Thread.sleep((long)(Math.random() * 13));
+    }
+    
+    @PerformanceTest(warmuptime=0,runinvocations=5)
+    public void PerformanceTestB() throws InterruptedException {
+        Thread.sleep((long)(Math.random() * 11));
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 18/27: Update to latest parent pom 20

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 2bca7588b2d18585c0ac73fd676260baf6575096
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Sep 2 14:51:30 2014 +0000

    Update to latest parent pom 20
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1622030 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 315493b..3379344 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>19</version>
+        <version>20</version>
         <relativePath>../../../parent/pom.xml</relativePath>
     </parent>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 06/27: SLING-2593 - Improvement for the Sling performance tools. adjusting formatting in order to be Sling compliant

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 9b5a2d94a4a7ab7252bbebc1f5a525285db5492d
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Mon Oct 1 11:29:34 2012 +0000

    SLING-2593 - Improvement for the Sling performance tools. adjusting formatting in order to be Sling compliant
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1392281 13f79535-47bb-0310-9956-ffa450edef68
---
 .../performance/FrameworkPerformanceMethod.java    | 553 ++++++++++++---------
 .../sling/performance/ParameterizedTestList.java   |  22 +-
 .../sling/performance/PerformanceRunner.java       | 358 ++++++-------
 .../sling/performance/PerformanceSuiteState.java   |  18 +-
 .../org/apache/sling/performance/ReportLogger.java | 132 ++---
 5 files changed, 586 insertions(+), 497 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
index 1f151cc..4f95d3e 100644
--- a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
+++ b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
@@ -34,249 +34,314 @@ import org.junit.Before;
 import org.junit.runners.model.FrameworkMethod;
 
 class FrameworkPerformanceMethod extends FrameworkMethod {
-        
-		private Object target;
-        private PerformanceSuiteState performanceSuiteState; 
-        
-        public FrameworkPerformanceMethod(Method method, Object target, PerformanceSuiteState performanceSuiteState) {
-        		super(method);
-                this.target = target;
-                this.performanceSuiteState = performanceSuiteState;
-                
-        }
-
-        @Override
-        public Object invokeExplosively(Object target, Object... params) throws Throwable {
-        	// Executes the test method on the supplied target
-        	
-        	// Check if this is the first test running from this specific PerformanceSuite
-        	// and run the BeforeSuite methods
-        	if ((performanceSuiteState != null) && (performanceSuiteState.getBeforeSuiteMethod() != null)
-        			&& (performanceSuiteState.getTargetObjectSuite() != null)
-        			&& (performanceSuiteState.getNumberOfExecutedMethods() == 0)
-        			&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)){
-        		performanceSuiteState.getBeforeSuiteMethod().invoke(performanceSuiteState.getTargetObjectSuite());
-        	}
-        	
-        	// In case of a PerformanceSuite we need to run the methods annotated with Before and After
-        	// ourselves as JUnit can't find them (JUnit is looking for them in the test  suite class);
-        	// in case we don't have to deal with a PerformanceSuite just skip this as JUnit will run the methods itself
-        	if ((performanceSuiteState != null) && !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)){
-        		
-        		recursiveCallSpecificMethod(this.target.getClass(), this.target, Before.class);
-        	}
-        	
-        	// Need to count the number of tests run from the PerformanceSuite
-        	// so that we can call the AfterSuite method after the last test from the suite 
-        	// has run and the AfterSuite needs to run
-        	performanceSuiteState.incrementNumberOfExecutedTestMethods();
-        	
-        	Object response = null;
-        	
- 	    	Method testMethodToInvoke = this.getMethod();
- 	    	
- 	    	PerformanceTest performanceAnnotation = testMethodToInvoke.getAnnotation(PerformanceTest.class);
- 	    	
- 	    	// retrieve the test configuration options
- 	    	int warmuptime = performanceAnnotation.warmuptime();
- 	    	int runtime = performanceAnnotation.runtime();
- 	    	int warmupinvocations = performanceAnnotation.warmupinvocations();
- 	    	int runinvocations = performanceAnnotation.runinvocations();
- 	    	
-     		DescriptiveStatistics statistics = new DescriptiveStatistics();
- 	         	
-     		//System.out.println("Warmup started - test :" + testMethodToInvoke.getName());
-     		
- 	            if (warmupinvocations != 0){
- 	            	// Run the number of invocation specified in the annotation
- 	            	// for warming up the system
- 	            	for (int invocationIndex = 0; invocationIndex < warmupinvocations; invocationIndex++){
- 	            		
- 	            		recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeMethodInvocation.class);
- 	            		
- 	            		//TODO: implement the method to run a before a specific test method
- 	            		//recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeSpecificTest.class);
- 	            		
- 	            		response = super.invokeExplosively(this.target, params);
- 	            		
- 	            		//TODO: implement the method to run a after a specific test method
- 	            		//recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterSpecificTest.class);
- 	            		
- 	            		recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterMethodInvocation.class);
- 	            	}
- 	            }
- 	            else{
- 		        	// Run a few iterations to warm up the system
- 		            long warmupEnd = System.currentTimeMillis() + warmuptime * 1000;
- 		            while (System.currentTimeMillis() < warmupEnd) {
- 		            	recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeMethodInvocation.class);
- 		            	
- 		            	//TODO: implement the method to run a before a specific test method
- 		            	//recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeSpecificTest.class);
- 	            		
- 	            		response = super.invokeExplosively(this.target, params);
- 	            		
- 	            		//recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterSpecificTest.class);
- 	            		//TODO: implement the method to run a after a specific test method
- 	            		
- 	            		recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterMethodInvocation.class);
- 		            }
- 	            }
- 	
- 	            //System.out.println("Warmup ended - test :" + testMethodToInvoke.getName());
- 	            if (runinvocations != 0){
- 	            	// Run the specified number of iterations and capture the execution times
- 	            	for (int invocationIndex = 0; invocationIndex < runinvocations; invocationIndex++){
- 	            		
- 	            		response = this.invokeTimedTestMethod(testMethodToInvoke, statistics, params);
-	            	}
- 	            }
- 	            else{
- 		            // Run test iterations and capture the execution times
- 		            long runtimeEnd = System.currentTimeMillis() + runtime * 1000;
-            		
- 		            while (System.currentTimeMillis() < runtimeEnd) {
- 		            	
- 		            	response = this.invokeTimedTestMethod(testMethodToInvoke, statistics, params);
- 		            	
- 		            }
- 		        }
-  	            
- 	        if (statistics.getN() > 0) {
- 	            ReportLogger.writeReport(this.target.getClass().getName(), this.performanceSuiteState.testSuiteName, 
- 	            		getMethod().getName() , statistics, ReportLogger.ReportType.TXT);
- 	        }
-  	        
- 	        // In case of a PerformanceSuite we need to run the methods annotated with Before and After
-        	// ourselves as JUnit can't find them; in case we don't have to deal with a PerformanceSuite
-        	// just skip this as JUnit will run the methods itself
- 	        if ((performanceSuiteState != null) 
- 	        		&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)){
-	        	
-	        	recursiveCallSpecificMethod(this.target.getClass(), this.target, After.class);
-	        }
- 	        
- 	        
- 	        // Check if this is the last test running from a PerformanceSuite
-        	// and run the AfterSuite method
- 	        if ((performanceSuiteState != null) && (performanceSuiteState.getAfterSuiteMethod() != null)
- 	        		&& (performanceSuiteState.getTargetObjectSuite() != null)
- 	        		&& (performanceSuiteState.getNumberOfExecutedMethods() == performanceSuiteState.getNumberOfMethodsInSuite())
- 	        		&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)){
- 	    	    performanceSuiteState.getAfterSuiteMethod().invoke(performanceSuiteState.getTargetObjectSuite());
- 	    	   
- 	        }
- 	         	        
-            return response;
-        }
-        
-        /**
-         * Method that runs 1 invocation of the timed test method
-         * @param testMethodToInvoke the test method to invoke
-         * @param statistics the statistics object that collects the results
-         * @param params the parameters for the invocation of the test method
-         * @return the response from the method invocation
-         * @throws Throwable
-         */
-        private Object invokeTimedTestMethod(Method testMethodToInvoke, DescriptiveStatistics statistics, Object... params) 
-        		throws Throwable{
-        	
-        	Object response = null;
-        	
-        	recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeMethodInvocation.class);
-	            
-	        //TODO: implement the method to run a before a specific test method
-	        //recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeSpecificTest.class); 
-         	
-     		// timing the test method execution
-         	//System.out.println("Start test: " + testMethodToInvoke.getName());
-         	long start = System.nanoTime();
-         	response = super.invokeExplosively(this.target, params);
-         	long timeMilliseconds =TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS); 
-         	statistics.addValue(timeMilliseconds);
-         	
-            //System.out.println("End test: " + testMethodToInvoke.getName());
-              
-            //System.out.println("Test execution time (ms): " + timeMilliseconds);
-             
-            //TODO: implement the method to run a after a specific test method
-	        //recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterSpecificTest.class);
-	            
-	        recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterMethodInvocation.class);
-	        
-	        return response;
-        }
-        
-        /**
-         * Recursively call a specific method annotated with a custom annotation 
-         * @param test the test class that contains the method
-         * @param instance the instance on which will run the method
-         * @param methodAnnotation the method annotation to look for
-         * @throws InvocationTargetException
-         * @throws InvalidAttributesException
-         * @throws IllegalAccessException
-         * @throws InstantiationException
-         */
-        @SuppressWarnings({"rawtypes"})
-        private void recursiveCallSpecificMethod(Class test, Object instance, Class<? extends Annotation> methodAnnotation) throws InvocationTargetException, InvalidAttributesException, IllegalAccessException, InstantiationException{
-     	   if (test.getSuperclass() != null){
-     		  recursiveCallSpecificMethod(test.getSuperclass(), instance, methodAnnotation);
-     	   }
-     	   
-     	   Method testMethod = getSpecificTestMethod(test, methodAnnotation);
-     		if (testMethod != null){
-     			if (!testMethod.isAccessible()){
-     				testMethod.setAccessible(true);
-      			}
-     			testMethod.invoke(instance);
-     		}
-     	}
-        
-        /**
-         * Get the method annotated with the custom annotation
-         * @param testClass the test class on which to look for the method
-         * @param methodAnnotation the method annotation to look for
-         * @return
-         * @throws InvalidAttributesException
-         * @throws IllegalAccessException
-         * @throws InstantiationException
-         */
-        @SuppressWarnings({"rawtypes"})
-        private Method getSpecificTestMethod(Class testClass, Class<? extends Annotation> methodAnnotation) throws InvalidAttributesException, IllegalAccessException, InstantiationException{
-        	
-        	Method[] methodsToReturn =  getSpecificMethods(testClass,methodAnnotation);
-        	Method methodToReturn = null;
-        	if (methodsToReturn.length == 1){
-        		methodToReturn = methodsToReturn[0];
-        	}
-        	else if (methodsToReturn.length > 1){
-        		throw new InvalidAttributesException("Only 1 non parameterized before method accepted");
-        	}
-        	
-        	return methodToReturn;
-        }
-        
-       
-         /**
-          * Retrieve all the specific methods from test class
-          * @param testClass the test class that we need to search in
-          * @param annotation the annotation that we should look for
-          * @return the list with the methods that have the specified annotation
-          */
-         @SuppressWarnings({"rawtypes"})
-         private Method[] getSpecificMethods(Class testClass, Class<? extends Annotation> annotation){
-         	Method[] allMethods = testClass.getDeclaredMethods(); 
-             
-             List<Method> methodListResult = new ArrayList<Method>();
-             
-             for(Method testMethod : allMethods){
-             	if (testMethod.isAnnotationPresent(annotation)){
-             		methodListResult.add(testMethod);
-             	}
-             }
-             return methodListResult.toArray(new Method[]{});
-         }
- 
-}
 
+	private Object target;
+	private PerformanceSuiteState performanceSuiteState;
+
+	public FrameworkPerformanceMethod(Method method, Object target,
+			PerformanceSuiteState performanceSuiteState) {
+		super(method);
+		this.target = target;
+		this.performanceSuiteState = performanceSuiteState;
+
+	}
+
+	@Override
+	public Object invokeExplosively(Object target, Object... params)
+			throws Throwable {
+		// Executes the test method on the supplied target
+
+		// Check if this is the first test running from this specific
+		// PerformanceSuite
+		// and run the BeforeSuite methods
+		if ((performanceSuiteState != null)
+				&& (performanceSuiteState.getBeforeSuiteMethod() != null)
+				&& (performanceSuiteState.getTargetObjectSuite() != null)
+				&& (performanceSuiteState.getNumberOfExecutedMethods() == 0)
+				&& !performanceSuiteState.testSuiteName
+						.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+			performanceSuiteState.getBeforeSuiteMethod().invoke(
+					performanceSuiteState.getTargetObjectSuite());
+		}
+
+		// In case of a PerformanceSuite we need to run the methods annotated
+		// with Before and After
+		// ourselves as JUnit can't find them (JUnit is looking for them in the
+		// test suite class);
+		// in case we don't have to deal with a PerformanceSuite just skip this
+		// as JUnit will run the methods itself
+		if ((performanceSuiteState != null)
+				&& !performanceSuiteState.testSuiteName
+						.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+
+			recursiveCallSpecificMethod(this.target.getClass(), this.target,
+					Before.class);
+		}
+
+		// Need to count the number of tests run from the PerformanceSuite
+		// so that we can call the AfterSuite method after the last test from
+		// the suite
+		// has run and the AfterSuite needs to run
+		performanceSuiteState.incrementNumberOfExecutedTestMethods();
+
+		Object response = null;
+
+		Method testMethodToInvoke = this.getMethod();
+
+		PerformanceTest performanceAnnotation = testMethodToInvoke
+				.getAnnotation(PerformanceTest.class);
+
+		// retrieve the test configuration options
+		int warmuptime = performanceAnnotation.warmuptime();
+		int runtime = performanceAnnotation.runtime();
+		int warmupinvocations = performanceAnnotation.warmupinvocations();
+		int runinvocations = performanceAnnotation.runinvocations();
+
+		DescriptiveStatistics statistics = new DescriptiveStatistics();
+
+		// System.out.println("Warmup started - test :" +
+		// testMethodToInvoke.getName());
+
+		if (warmupinvocations != 0) {
+			// Run the number of invocation specified in the annotation
+			// for warming up the system
+			for (int invocationIndex = 0; invocationIndex < warmupinvocations; invocationIndex++) {
+
+				recursiveCallSpecificMethod(this.target.getClass(),
+						this.target, BeforeMethodInvocation.class);
+
+				// TODO: implement the method to run a before a specific test
+				// method
+				// recursiveCallSpecificMethod(this.target.getClass(),
+				// this.target, BeforeSpecificTest.class);
+
+				response = super.invokeExplosively(this.target, params);
+
+				// TODO: implement the method to run a after a specific test
+				// method
+				// recursiveCallSpecificMethod(this.target.getClass(),
+				// this.target, AfterSpecificTest.class);
+
+				recursiveCallSpecificMethod(this.target.getClass(),
+						this.target, AfterMethodInvocation.class);
+			}
+		} else {
+			// Run a few iterations to warm up the system
+			long warmupEnd = System.currentTimeMillis() + warmuptime * 1000;
+			while (System.currentTimeMillis() < warmupEnd) {
+				recursiveCallSpecificMethod(this.target.getClass(),
+						this.target, BeforeMethodInvocation.class);
+
+				// TODO: implement the method to run a before a specific test
+				// method
+				// recursiveCallSpecificMethod(this.target.getClass(),
+				// this.target, BeforeSpecificTest.class);
+
+				response = super.invokeExplosively(this.target, params);
+
+				// recursiveCallSpecificMethod(this.target.getClass(),
+				// this.target, AfterSpecificTest.class);
+				// TODO: implement the method to run a after a specific test
+				// method
+
+				recursiveCallSpecificMethod(this.target.getClass(),
+						this.target, AfterMethodInvocation.class);
+			}
+		}
+
+		// System.out.println("Warmup ended - test :" +
+		// testMethodToInvoke.getName());
+		if (runinvocations != 0) {
+			// Run the specified number of iterations and capture the execution
+			// times
+			for (int invocationIndex = 0; invocationIndex < runinvocations; invocationIndex++) {
+
+				response = this.invokeTimedTestMethod(testMethodToInvoke,
+						statistics, params);
+			}
+		} else {
+			// Run test iterations and capture the execution times
+			long runtimeEnd = System.currentTimeMillis() + runtime * 1000;
+
+			while (System.currentTimeMillis() < runtimeEnd) {
 
+				response = this.invokeTimedTestMethod(testMethodToInvoke,
+						statistics, params);
+
+			}
+		}
+
+		if (statistics.getN() > 0) {
+			ReportLogger
+					.writeReport(this.target.getClass().getName(),
+							this.performanceSuiteState.testSuiteName,
+							getMethod().getName(), statistics,
+							ReportLogger.ReportType.TXT);
+		}
+
+		// In case of a PerformanceSuite we need to run the methods annotated
+		// with Before and After
+		// ourselves as JUnit can't find them; in case we don't have to deal
+		// with a PerformanceSuite
+		// just skip this as JUnit will run the methods itself
+		if ((performanceSuiteState != null)
+				&& !performanceSuiteState.testSuiteName
+						.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+
+			recursiveCallSpecificMethod(this.target.getClass(), this.target,
+					After.class);
+		}
+
+		// Check if this is the last test running from a PerformanceSuite
+		// and run the AfterSuite method
+		if ((performanceSuiteState != null)
+				&& (performanceSuiteState.getAfterSuiteMethod() != null)
+				&& (performanceSuiteState.getTargetObjectSuite() != null)
+				&& (performanceSuiteState.getNumberOfExecutedMethods() == performanceSuiteState
+						.getNumberOfMethodsInSuite())
+				&& !performanceSuiteState.testSuiteName
+						.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+			performanceSuiteState.getAfterSuiteMethod().invoke(
+					performanceSuiteState.getTargetObjectSuite());
+
+		}
+
+		return response;
+	}
+
+	/**
+	 * Method that runs 1 invocation of the timed test method
+	 * 
+	 * @param testMethodToInvoke
+	 *            the test method to invoke
+	 * @param statistics
+	 *            the statistics object that collects the results
+	 * @param params
+	 *            the parameters for the invocation of the test method
+	 * @return the response from the method invocation
+	 * @throws Throwable
+	 */
+	private Object invokeTimedTestMethod(Method testMethodToInvoke,
+			DescriptiveStatistics statistics, Object... params)
+			throws Throwable {
+
+		Object response = null;
+
+		recursiveCallSpecificMethod(this.target.getClass(), this.target,
+				BeforeMethodInvocation.class);
+
+		// TODO: implement the method to run a before a specific test method
+		// recursiveCallSpecificMethod(this.target.getClass(), this.target,
+		// BeforeSpecificTest.class);
+
+		// timing the test method execution
+		// System.out.println("Start test: " + testMethodToInvoke.getName());
+		long start = System.nanoTime();
+		response = super.invokeExplosively(this.target, params);
+		long timeMilliseconds = TimeUnit.MILLISECONDS.convert(System.nanoTime()
+				- start, TimeUnit.NANOSECONDS);
+		statistics.addValue(timeMilliseconds);
+
+		// System.out.println("End test: " + testMethodToInvoke.getName());
+
+		// System.out.println("Test execution time (ms): " + timeMilliseconds);
+
+		// TODO: implement the method to run a after a specific test method
+		// recursiveCallSpecificMethod(this.target.getClass(), this.target,
+		// AfterSpecificTest.class);
+
+		recursiveCallSpecificMethod(this.target.getClass(), this.target,
+				AfterMethodInvocation.class);
+
+		return response;
+	}
+
+	/**
+	 * Recursively call a specific method annotated with a custom annotation
+	 * 
+	 * @param test
+	 *            the test class that contains the method
+	 * @param instance
+	 *            the instance on which will run the method
+	 * @param methodAnnotation
+	 *            the method annotation to look for
+	 * @throws InvocationTargetException
+	 * @throws InvalidAttributesException
+	 * @throws IllegalAccessException
+	 * @throws InstantiationException
+	 */
+	@SuppressWarnings({ "rawtypes" })
+	private void recursiveCallSpecificMethod(Class test, Object instance,
+			Class<? extends Annotation> methodAnnotation)
+			throws InvocationTargetException, InvalidAttributesException,
+			IllegalAccessException, InstantiationException {
+		if (test.getSuperclass() != null) {
+			recursiveCallSpecificMethod(test.getSuperclass(), instance,
+					methodAnnotation);
+		}
+
+		Method testMethod = getSpecificTestMethod(test, methodAnnotation);
+		if (testMethod != null) {
+			if (!testMethod.isAccessible()) {
+				testMethod.setAccessible(true);
+			}
+			testMethod.invoke(instance);
+		}
+	}
+
+	/**
+	 * Get the method annotated with the custom annotation
+	 * 
+	 * @param testClass
+	 *            the test class on which to look for the method
+	 * @param methodAnnotation
+	 *            the method annotation to look for
+	 * @return
+	 * @throws InvalidAttributesException
+	 * @throws IllegalAccessException
+	 * @throws InstantiationException
+	 */
+	@SuppressWarnings({ "rawtypes" })
+	private Method getSpecificTestMethod(Class testClass,
+			Class<? extends Annotation> methodAnnotation)
+			throws InvalidAttributesException, IllegalAccessException,
+			InstantiationException {
+
+		Method[] methodsToReturn = getSpecificMethods(testClass,
+				methodAnnotation);
+		Method methodToReturn = null;
+		if (methodsToReturn.length == 1) {
+			methodToReturn = methodsToReturn[0];
+		} else if (methodsToReturn.length > 1) {
+			throw new InvalidAttributesException(
+					"Only 1 non parameterized before method accepted");
+		}
+
+		return methodToReturn;
+	}
+
+	/**
+	 * Retrieve all the specific methods from test class
+	 * 
+	 * @param testClass
+	 *            the test class that we need to search in
+	 * @param annotation
+	 *            the annotation that we should look for
+	 * @return the list with the methods that have the specified annotation
+	 */
+	@SuppressWarnings({ "rawtypes" })
+	private Method[] getSpecificMethods(Class testClass,
+			Class<? extends Annotation> annotation) {
+		Method[] allMethods = testClass.getDeclaredMethods();
+
+		List<Method> methodListResult = new ArrayList<Method>();
+
+		for (Method testMethod : allMethods) {
+			if (testMethod.isAnnotationPresent(annotation)) {
+				methodListResult.add(testMethod);
+			}
+		}
+		return methodListResult.toArray(new Method[] {});
+	}
+
+}
diff --git a/src/main/java/org/apache/sling/performance/ParameterizedTestList.java b/src/main/java/org/apache/sling/performance/ParameterizedTestList.java
index bfd7cd0..ba8e83f 100644
--- a/src/main/java/org/apache/sling/performance/ParameterizedTestList.java
+++ b/src/main/java/org/apache/sling/performance/ParameterizedTestList.java
@@ -22,19 +22,19 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * Represents the object that will be returned by the method 
- * in which a new PerformanceTestSuite is created
- *
+ * Represents the object that will be returned by the method in which a new
+ * PerformanceTestSuite is created
+ * 
  */
 public class ParameterizedTestList {
 
 	public static final String TEST_CASE_ONLY = "TESTCASEONLY";
-	
+
 	private List<Object> testObjectList = new ArrayList<Object>();
 	private String testSuiteTitle = TEST_CASE_ONLY;
 	private Map<String, String> parameters = new LinkedHashMap<String, String>();
 	private Map<String, Object> parametersObjects = new LinkedHashMap<String, Object>();
-	
+
 	public Map<String, Object> getParametersObjects() {
 		return parametersObjects;
 	}
@@ -42,23 +42,23 @@ public class ParameterizedTestList {
 	public void addParameterObject(String key, Object parameterObject) {
 		this.parametersObjects.put(key, parameterObject);
 	}
-	
+
 	public Map<String, String> getParameters() {
 		return parameters;
 	}
-	
+
 	public void addParameter(String key, String value) {
 		parameters.put(key, value);
 	}
-	
+
 	public List<Object> getTestObjectList() {
 		return testObjectList;
 	}
-	
+
 	public void addTestObject(Object testObject) {
 		testObjectList.add(testObject);
 	}
-	
+
 	public String getTestSuiteName() {
 		return testSuiteTitle;
 	}
@@ -66,5 +66,5 @@ public class ParameterizedTestList {
 	public void setTestSuiteTitle(String testSuiteTitle) {
 		this.testSuiteTitle = testSuiteTitle;
 	}
-	
+
 }
diff --git a/src/main/java/org/apache/sling/performance/PerformanceRunner.java b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
index cc971da..fef112c 100644
--- a/src/main/java/org/apache/sling/performance/PerformanceRunner.java
+++ b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
@@ -33,177 +33,197 @@ import org.junit.runners.BlockJUnit4ClassRunner;
 import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.InitializationError;
 
-
 /**
  * The custom JUnit runner that collects the performance tests
- *
+ * 
  */
 public class PerformanceRunner extends BlockJUnit4ClassRunner {
-        protected LinkedList<FrameworkMethod> tests = new LinkedList<FrameworkMethod>();
-        private List<PerformanceSuiteState> suitesState = new ArrayList<PerformanceSuiteState>();
-        
-        
-        public PerformanceRunner(Class<?> clazz) throws InitializationError {
-        	super(clazz);
-        	try {
-        		computeTests();
-        		}
-        	catch (Exception e) {
-        		throw new InitializationError(e);
-        	}
-        }
-
-        /**
-         * Compute the tests that will be run
-         * @throws Exception
-         */
-        protected void computeTests() throws Exception {
-                tests.addAll(super.computeTestMethods());
-                
-                // count the performance tests
-                tests.addAll(computePerformanceTests());
-                
-                // This is called here to ensure the test class constructor is called at least
-                // once during testing.  
-                createTest();
-        }
-        
-        /**
-         * Compute performance tests
-         * @return the list containing the performance test methods
-         * @throws Exception
-         */
-        protected Collection<? extends FrameworkMethod> computePerformanceTests() throws Exception {
-                List<FrameworkPerformanceMethod> tests = new LinkedList<FrameworkPerformanceMethod>();
-
-                List<Object> testObjects = new ArrayList<Object>();
-                ParameterizedTestList testCenter = new ParameterizedTestList();
-                
-                // Retrieve the test objects included in the Performance test suite
-                for (FrameworkMethod method: getTestClass().getAnnotatedMethods(PerformanceTestSuite.class)) {
-                	Object targetObject = getTestClass().getJavaClass().newInstance();
-                	if (method.getMethod().getReturnType().equals(ParameterizedTestList.class)){
-                		testCenter = (ParameterizedTestList) method.getMethod().invoke(targetObject);
-                		testObjects = testCenter.getTestObjectList();
-                	}
-                	else{
-                		throw new InitializationError("Wrong signature for the @PerformanceSuite method");
-                	}
-                }
-                
-                // Retrieve the methods before running the methods from the test suite
-                List<FrameworkMethod> beforeSuiteMethods = getTestClass().getAnnotatedMethods(BeforeSuite.class);
-                if (beforeSuiteMethods.size() > 1){
-                	throw new InitializationError("Only one @BeforeSuite method is allowed for a @PerformanceSuite");
-                }
-                
-                // Retrieve the methods before running the methods from the test suite
-                List<FrameworkMethod> afterSuiteMethods = getTestClass().getAnnotatedMethods(AfterSuite.class);
-                if (afterSuiteMethods.size() > 1){
-                	throw new InitializationError("Only one @AfterSuite method is allowed for a @PerformanceSuite");
-                }
-                
-                PerformanceSuiteState current = null;
-                boolean suiteAlreadyRegistered = false;
-                
-                for(PerformanceSuiteState suiteState : suitesState){
-                	if (suiteState.testSuiteName.equals(testCenter.getTestSuiteName())){
-                		suiteAlreadyRegistered = true;
-                		suiteState.incrementNumberOfTestMethodsInSuite();
-                		current = suiteState;
-                		break;
-                	}
-                }
-                
-                // Create a new PerformanceSuiteState object
-                PerformanceSuiteState newSuite = new PerformanceSuiteState(testCenter.getTestSuiteName());
-                
-                if (!suiteAlreadyRegistered){	
-                	if (beforeSuiteMethods.size() == 1){
-	        			newSuite.setBeforeSuiteMethod(beforeSuiteMethods.get(0).getMethod());
-	        		}
-	        		if (afterSuiteMethods.size() == 1){
-	        			newSuite.setAfterSuiteMethod(afterSuiteMethods.get(0).getMethod());
-	        		}
-	        		
-	        		current = newSuite;
-	        		newSuite.setTargetObjectSuite(getTestClass().getJavaClass().newInstance());
-	        		
-                }
-        		
-                
-                // In case there are any objects retrieved from the Performance Suite
-                // we should add them to the tests that will be run and increase the number of methods
-                // contained in the PerformaceSuite
-                if (!testObjects.isEmpty()){
-                	for (Object testObject : testObjects){
-                		// retrieve the test methods from the test classes 
-                		Method[] testMethods = getSpecificMethods(testObject.getClass(), PerformanceTest.class); 
-                		
-                		if (!suiteAlreadyRegistered){
-                			newSuite.incrementNumberOfTestMethodsInSuite();
-                		}
-                		
-                		for (Method method: testMethods){
-                			FrameworkPerformanceMethod performaceTestMethod = new FrameworkPerformanceMethod(method, testObject, current);
-                			tests.add(performaceTestMethod);
-                		}
-                	}
-                	
-                	// add the new suite to the list of suites 
-                	suitesState.add(newSuite);
-                }
-
-                // Retrieve the performance tests in the case we don't have a performance test suite
-                for (FrameworkMethod method: getTestClass().getAnnotatedMethods(PerformanceTest.class)) {
-                	Object targetObject = getTestClass().getJavaClass().newInstance();
-                	FrameworkPerformanceMethod performaceTestMethod = new FrameworkPerformanceMethod(method.getMethod(), targetObject, current);
-              	  	tests.add(performaceTestMethod);
-                }
-                
-                return tests;
-        }
-       
-        
-        /**
-         * Retrieve specific method from test class
-         * @param testClass the test class that we need to search in
-         * @param annotation the annotation that we should look for
-         * @return the list with the methods that have the specified annotation
-         */
-        @SuppressWarnings({"rawtypes"})
-        private Method[] getSpecificMethods(Class testClass, Class<? extends Annotation> annotation){
-        	Method[] allMethods = testClass.getDeclaredMethods(); 
-            
-            List<Method> methodListResult = new ArrayList<Method>();
-            
-            for(Method testMethod : allMethods){
-            	if (testMethod.isAnnotationPresent(annotation)){
-            		methodListResult.add(testMethod);
-            	}
-            }
-            return methodListResult.toArray(new Method[]{});
-        }
-        
-        /**
-         * {@inheritDoc}
-         * @see org.junit.runners.BlockJUnit4ClassRunner#computeTestMethods()
-         */
-        @Override
-        protected List<FrameworkMethod> computeTestMethods() {
-                return tests;
-        }
-
-        /**
-         * Need to override method otherwise the validation will fail because of some
-         * hardcoded conditions in JUnit
-         */
-        @Override
-        protected void validateInstanceMethods(List<Throwable> errors) {
-                validatePublicVoidNoArgMethods(After.class, false, errors);
-                validatePublicVoidNoArgMethods(Before.class, false, errors);
-                validateTestMethods(errors);
-        }
-        
-        
+	protected LinkedList<FrameworkMethod> tests = new LinkedList<FrameworkMethod>();
+	private List<PerformanceSuiteState> suitesState = new ArrayList<PerformanceSuiteState>();
+
+	public PerformanceRunner(Class<?> clazz) throws InitializationError {
+		super(clazz);
+		try {
+			computeTests();
+		} catch (Exception e) {
+			throw new InitializationError(e);
+		}
+	}
+
+	/**
+	 * Compute the tests that will be run
+	 * 
+	 * @throws Exception
+	 */
+	protected void computeTests() throws Exception {
+		tests.addAll(super.computeTestMethods());
+
+		// count the performance tests
+		tests.addAll(computePerformanceTests());
+
+		// This is called here to ensure the test class constructor is called at
+		// least
+		// once during testing.
+		createTest();
+	}
+
+	/**
+	 * Compute performance tests
+	 * 
+	 * @return the list containing the performance test methods
+	 * @throws Exception
+	 */
+	protected Collection<? extends FrameworkMethod> computePerformanceTests()
+			throws Exception {
+		List<FrameworkPerformanceMethod> tests = new LinkedList<FrameworkPerformanceMethod>();
+
+		List<Object> testObjects = new ArrayList<Object>();
+		ParameterizedTestList testCenter = new ParameterizedTestList();
+
+		// Retrieve the test objects included in the Performance test suite
+		for (FrameworkMethod method : getTestClass().getAnnotatedMethods(
+				PerformanceTestSuite.class)) {
+			Object targetObject = getTestClass().getJavaClass().newInstance();
+			if (method.getMethod().getReturnType()
+					.equals(ParameterizedTestList.class)) {
+				testCenter = (ParameterizedTestList) method.getMethod().invoke(
+						targetObject);
+				testObjects = testCenter.getTestObjectList();
+			} else {
+				throw new InitializationError(
+						"Wrong signature for the @PerformanceSuite method");
+			}
+		}
+
+		// Retrieve the methods before running the methods from the test suite
+		List<FrameworkMethod> beforeSuiteMethods = getTestClass()
+				.getAnnotatedMethods(BeforeSuite.class);
+		if (beforeSuiteMethods.size() > 1) {
+			throw new InitializationError(
+					"Only one @BeforeSuite method is allowed for a @PerformanceSuite");
+		}
+
+		// Retrieve the methods before running the methods from the test suite
+		List<FrameworkMethod> afterSuiteMethods = getTestClass()
+				.getAnnotatedMethods(AfterSuite.class);
+		if (afterSuiteMethods.size() > 1) {
+			throw new InitializationError(
+					"Only one @AfterSuite method is allowed for a @PerformanceSuite");
+		}
+
+		PerformanceSuiteState current = null;
+		boolean suiteAlreadyRegistered = false;
+
+		for (PerformanceSuiteState suiteState : suitesState) {
+			if (suiteState.testSuiteName.equals(testCenter.getTestSuiteName())) {
+				suiteAlreadyRegistered = true;
+				suiteState.incrementNumberOfTestMethodsInSuite();
+				current = suiteState;
+				break;
+			}
+		}
+
+		// Create a new PerformanceSuiteState object
+		PerformanceSuiteState newSuite = new PerformanceSuiteState(
+				testCenter.getTestSuiteName());
+
+		if (!suiteAlreadyRegistered) {
+			if (beforeSuiteMethods.size() == 1) {
+				newSuite.setBeforeSuiteMethod(beforeSuiteMethods.get(0)
+						.getMethod());
+			}
+			if (afterSuiteMethods.size() == 1) {
+				newSuite.setAfterSuiteMethod(afterSuiteMethods.get(0)
+						.getMethod());
+			}
+
+			current = newSuite;
+			newSuite.setTargetObjectSuite(getTestClass().getJavaClass()
+					.newInstance());
+
+		}
+
+		// In case there are any objects retrieved from the Performance Suite
+		// we should add them to the tests that will be run and increase the
+		// number of methods
+		// contained in the PerformaceSuite
+		if (!testObjects.isEmpty()) {
+			for (Object testObject : testObjects) {
+				// retrieve the test methods from the test classes
+				Method[] testMethods = getSpecificMethods(
+						testObject.getClass(), PerformanceTest.class);
+
+				if (!suiteAlreadyRegistered) {
+					newSuite.incrementNumberOfTestMethodsInSuite();
+				}
+
+				for (Method method : testMethods) {
+					FrameworkPerformanceMethod performaceTestMethod = new FrameworkPerformanceMethod(
+							method, testObject, current);
+					tests.add(performaceTestMethod);
+				}
+			}
+
+			// add the new suite to the list of suites
+			suitesState.add(newSuite);
+		}
+
+		// Retrieve the performance tests in the case we don't have a
+		// performance test suite
+		for (FrameworkMethod method : getTestClass().getAnnotatedMethods(
+				PerformanceTest.class)) {
+			Object targetObject = getTestClass().getJavaClass().newInstance();
+			FrameworkPerformanceMethod performaceTestMethod = new FrameworkPerformanceMethod(
+					method.getMethod(), targetObject, current);
+			tests.add(performaceTestMethod);
+		}
+
+		return tests;
+	}
+
+	/**
+	 * Retrieve specific method from test class
+	 * 
+	 * @param testClass
+	 *            the test class that we need to search in
+	 * @param annotation
+	 *            the annotation that we should look for
+	 * @return the list with the methods that have the specified annotation
+	 */
+	@SuppressWarnings({ "rawtypes" })
+	private Method[] getSpecificMethods(Class testClass,
+			Class<? extends Annotation> annotation) {
+		Method[] allMethods = testClass.getDeclaredMethods();
+
+		List<Method> methodListResult = new ArrayList<Method>();
+
+		for (Method testMethod : allMethods) {
+			if (testMethod.isAnnotationPresent(annotation)) {
+				methodListResult.add(testMethod);
+			}
+		}
+		return methodListResult.toArray(new Method[] {});
+	}
+
+	/**
+	 * {@inheritDoc}
+	 * 
+	 * @see org.junit.runners.BlockJUnit4ClassRunner#computeTestMethods()
+	 */
+	@Override
+	protected List<FrameworkMethod> computeTestMethods() {
+		return tests;
+	}
+
+	/**
+	 * Need to override method otherwise the validation will fail because of
+	 * some hardcoded conditions in JUnit
+	 */
+	@Override
+	protected void validateInstanceMethods(List<Throwable> errors) {
+		validatePublicVoidNoArgMethods(After.class, false, errors);
+		validatePublicVoidNoArgMethods(Before.class, false, errors);
+		validateTestMethods(errors);
+	}
+
 }
diff --git a/src/main/java/org/apache/sling/performance/PerformanceSuiteState.java b/src/main/java/org/apache/sling/performance/PerformanceSuiteState.java
index 337cad0..b013c19 100644
--- a/src/main/java/org/apache/sling/performance/PerformanceSuiteState.java
+++ b/src/main/java/org/apache/sling/performance/PerformanceSuiteState.java
@@ -21,25 +21,25 @@ import java.lang.reflect.Method;
 public class PerformanceSuiteState {
 
 	public String testSuiteName = ParameterizedTestList.TEST_CASE_ONLY;
-	
+
 	private Method beforeSuiteMethod;
 	private Method afterSuiteMethod;
 	private int numberOfMethodsInSuite = 0;
 	private int numberOfExecutedMethods = 0;
 	private Object targetObjectSuite;
-	
-	public PerformanceSuiteState(String testSuiteName){
+
+	public PerformanceSuiteState(String testSuiteName) {
 		this.testSuiteName = testSuiteName;
 	}
-	
-	public void incrementNumberOfTestMethodsInSuite(){
+
+	public void incrementNumberOfTestMethodsInSuite() {
 		numberOfMethodsInSuite++;
 	}
-	
-	public void incrementNumberOfExecutedTestMethods(){
+
+	public void incrementNumberOfExecutedTestMethods() {
 		numberOfExecutedMethods++;
 	}
-	
+
 	public String getTestSuiteName() {
 		return testSuiteName;
 	}
@@ -87,5 +87,5 @@ public class PerformanceSuiteState {
 	public void setTargetObjectSuite(Object targetObjectSuite) {
 		this.targetObjectSuite = targetObjectSuite;
 	}
-	
+
 }
diff --git a/src/main/java/org/apache/sling/performance/ReportLogger.java b/src/main/java/org/apache/sling/performance/ReportLogger.java
index e0f24d2..f0822f1 100644
--- a/src/main/java/org/apache/sling/performance/ReportLogger.java
+++ b/src/main/java/org/apache/sling/performance/ReportLogger.java
@@ -12,85 +12,89 @@ import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
 
 public class ReportLogger {
 
-	public enum ReportType{
+	public enum ReportType {
 		TXT, XML
 	}
-	
-	
-	public static void writeReport(String test, String testSuiteName, String name, DescriptiveStatistics statistics, ReportType reportType) throws Exception{
-		switch(reportType){
+
+	public static void writeReport(String test, String testSuiteName,
+			String name, DescriptiveStatistics statistics, ReportType reportType)
+			throws Exception {
+		switch (reportType) {
 		case TXT:
 			writeReportTxt(test, testSuiteName, name, statistics);
 			break;
 		case XML:
 			throw new Exception("The XML reporting format is not yet supported");
 		default:
-			throw new Exception("The specified reporting format is not yet supported");
+			throw new Exception(
+					"The specified reporting format is not yet supported");
 		}
 	}
-	
+
 	/**
-     * Method the writes the performance report after a test is run
-     * @param test the test name
-     * @param name the name that will be listed in the report
-     * @param statistics the statistics data to be written
-     * @throws IOException
-     */
-    public static void writeReportTxt(String test, String testSuiteName, String name, DescriptiveStatistics statistics)
-   		    throws IOException {
-    	
-	        	String className=test;  
-	        	className=className.substring(className.lastIndexOf(".")+1);
-    	
-    			File reportDir = new File("target/performance-reports");
-    			if (!reportDir.exists()){
-   		        	boolean test1 = reportDir.mkdir();	 
-   		        }
-    			
-    			File report = new File("target/performance-reports", className + ".txt");
-   		           		        
-   		        // need this in the case a user wants to set the suite name from the command line
-   		        // useful if we run the test cases from the command line for example 
-   		        // by using maven
-   		        if (testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)){
-	   		        if (System.getenv("testsuitename") != null){
-	   		        	testSuiteName = System.getenv("testsuitename");
-	   		        }
-   		        }
-   		        
-   		        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",
-   	                        className);
-   	            }
+	 * Method the writes the performance report after a test is run
+	 * 
+	 * @param test
+	 *            the test name
+	 * @param name
+	 *            the name that will be listed in the report
+	 * @param statistics
+	 *            the statistics data to be written
+	 * @throws IOException
+	 */
+	public static void writeReportTxt(String test, String testSuiteName,
+			String name, DescriptiveStatistics statistics) throws IOException {
+
+		String className = test;
+		className = className.substring(className.lastIndexOf(".") + 1);
+
+		File reportDir = new File("target/performance-reports");
+		if (!reportDir.exists()) {
+			boolean test1 = reportDir.mkdir();
+		}
+
+		File report = new File("target/performance-reports", className + ".txt");
+
+		// need this in the case a user wants to set the suite name from the
+		// command line
+		// useful if we run the test cases from the command line for example
+		// by using maven
+		if (testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)) {
+			if (System.getenv("testsuitename") != null) {
+				testSuiteName = System.getenv("testsuitename");
+			}
+		}
+
+		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",
+						className);
+			}
 
-   	            writer.format(
-   	                    "%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
-   	                    testSuiteName,
-   	                    statistics.getMin(),
-   	                    statistics.getPercentile(10.0),
-   	                    statistics.getPercentile(50.0),
-   	                    statistics.getPercentile(90.0),
-   	                    statistics.getMax());
-   	        } finally {
-   	            writer.close();
-   	        }
-    }
-    
-  
-    /**
-     * Get the date that will be written into the result file
-     * @return
-     */
-    private static String getDate(){
+			writer.format("%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
+					testSuiteName, statistics.getMin(),
+					statistics.getPercentile(10.0),
+					statistics.getPercentile(50.0),
+					statistics.getPercentile(90.0), statistics.getMax());
+		} finally {
+			writer.close();
+		}
+	}
+
+	/**
+	 * Get the date that will be written into the result file
+	 * 
+	 * @return
+	 */
+	private static String getDate() {
 		DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
 		Date date = new Date();
 
 		return dateFormat.format(date);
 	}
-	
+
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 01/27: SLING-2311 - adding small performance test suite. Based heavily on the work of Antonio Sanso and the Jackrabbit team (Thanks!!!)

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit df6828963622eea9e292083a49ccce003d110ee1
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Mon Aug 27 20:13:21 2012 +0000

    SLING-2311 - adding small performance test suite. Based heavily on the work of Antonio Sanso and the Jackrabbit team (Thanks!!!)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1377819 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 110 ++++++++
 .../sling/performance/AbstractPerformanceTest.java |  91 +++++++
 .../sling/performance/AbstractRepositoryTest.java  |  90 +++++++
 .../org/apache/sling/performance/AbstractTest.java | 134 ++++++++++
 .../performance/ResourceResolverTestRequest.java   | 285 +++++++++++++++++++++
 .../org/apache/sling/performance/TestHelper.java   |  32 +++
 .../tests/ResolveWith10000AliasTest.java           |  27 ++
 .../tests/ResolveWith10000VanityPathTest.java      |  27 ++
 .../tests/ResolveWith1000AliasTest.java            |  27 ++
 .../tests/ResolveWith1000VanityPathTest.java       |  27 ++
 .../tests/ResolveWith30000AliasTest.java           |  27 ++
 .../tests/ResolveWith30000VanityPathTest.java      |  27 ++
 .../tests/ResolveWith5000AliasTest.java            |  27 ++
 .../tests/ResolveWith5000VanityPathTest.java       |  27 ++
 .../tests/ResolveWithManyAliasTest.java            | 127 +++++++++
 .../tests/ResolveWithManyVanityPathTest.java       | 137 ++++++++++
 16 files changed, 1222 insertions(+)

diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..c02e8db
--- /dev/null
+++ b/pom.xml
@@ -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>
diff --git a/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java b/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java
new file mode 100644
index 0000000..1540cf7
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/AbstractPerformanceTest.java
@@ -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();
+        }
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java b/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
new file mode 100644
index 0000000..f5f818d
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
@@ -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();
+        }
+    }}
diff --git a/src/main/java/org/apache/sling/performance/AbstractTest.java b/src/main/java/org/apache/sling/performance/AbstractTest.java
new file mode 100644
index 0000000..7cdaca2
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/AbstractTest.java
@@ -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);
+    }
+ }
diff --git a/src/main/java/org/apache/sling/performance/ResourceResolverTestRequest.java b/src/main/java/org/apache/sling/performance/ResourceResolverTestRequest.java
new file mode 100644
index 0000000..38f9ceb
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/ResourceResolverTestRequest.java
@@ -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
diff --git a/src/main/java/org/apache/sling/performance/TestHelper.java b/src/main/java/org/apache/sling/performance/TestHelper.java
new file mode 100644
index 0000000..6584ca1
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/TestHelper.java
@@ -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;
+
+}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java
new file mode 100644
index 0000000..4f6952a
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWith10000AliasTest.java
@@ -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
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java
new file mode 100644
index 0000000..88ad4ab
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWith10000VanityPathTest.java
@@ -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);
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java
new file mode 100644
index 0000000..9f93d1d
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWith1000AliasTest.java
@@ -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);
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java
new file mode 100644
index 0000000..7c5f167
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWith1000VanityPathTest.java
@@ -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);
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java
new file mode 100644
index 0000000..56e4ab2
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWith30000AliasTest.java
@@ -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
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java
new file mode 100644
index 0000000..7248a6e
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWith30000VanityPathTest.java
@@ -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);
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java
new file mode 100644
index 0000000..54f9cdb
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWith5000AliasTest.java
@@ -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
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java
new file mode 100644
index 0000000..b22c6d4
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWith5000VanityPathTest.java
@@ -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);
+    }
+
+}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java
new file mode 100644
index 0000000..f886957
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWithManyAliasTest.java
@@ -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);
+    }
+}
diff --git a/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java b/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java
new file mode 100644
index 0000000..3e51942
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/tests/ResolveWithManyVanityPathTest.java
@@ -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);
+    }
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 05/27: SLING-2593 - Improvement for the Sling performance tools. Adding patch provided from Christian Vazzolla. Thanks Christian!

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit eb67a440c990e294c858ea91f2f84b36b7aa347d
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Sat Sep 29 18:22:43 2012 +0000

    SLING-2593 - Improvement for the Sling performance tools. Adding patch provided from Christian Vazzolla. Thanks Christian!
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1391855 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/performance/AbstractRepositoryTest.java  |  12 +-
 .../performance/FrameworkPerformanceMethod.java    | 282 +++++++++++++++++++++
 .../sling/performance/ParameterizedTestList.java   |  70 +++++
 .../sling/performance/PerformanceRunner.java       | 209 +++++++++++++++
 .../sling/performance/PerformanceSuiteState.java   |  91 +++++++
 .../org/apache/sling/performance/ReportLogger.java |  96 +++++++
 .../annotation/AfterMethodInvocation.java          |  25 ++
 .../performance/annotation/AfterSpecificTest.java  |  25 ++
 .../sling/performance/annotation/AfterSuite.java   |  25 ++
 .../annotation/BeforeMethodInvocation.java         |  25 ++
 .../performance/annotation/BeforeSpecificTest.java |  25 ++
 .../sling/performance/annotation/BeforeSuite.java  |  25 ++
 .../performance/annotation/PerformanceTest.java    |  47 ++++
 .../annotation/PerformanceTestSuite.java           |  10 +
 14 files changed, 958 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java b/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
index f5f818d..ff542c5 100644
--- a/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
+++ b/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
@@ -26,7 +26,7 @@ import org.apache.sling.jcr.api.SlingRepository;
 
 
   
-public abstract class AbstractRepositoryTest extends AbstractTest {
+public abstract class AbstractRepositoryTest {
 	
 	private static class ShutdownThread extends Thread {
         @Override
@@ -34,7 +34,7 @@ public abstract class AbstractRepositoryTest extends AbstractTest {
             try {
                 RepositoryUtil.stopRepository();
             } catch(Exception e) {
-                System.out.println("Exception in ShutdownThread:" + e);
+                //ignore for now
             }
         }
         
@@ -81,10 +81,4 @@ public abstract class AbstractRepositoryTest extends AbstractTest {
         return testRoot;
     }
 
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-        if(session != null) {
-            session.logout();
-        }
-    }}
+}
diff --git a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
new file mode 100644
index 0000000..1f151cc
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
@@ -0,0 +1,282 @@
+/*
+ * 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.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import javax.naming.directory.InvalidAttributesException;
+
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+import org.apache.sling.performance.annotation.AfterMethodInvocation;
+import org.apache.sling.performance.annotation.BeforeMethodInvocation;
+import org.apache.sling.performance.annotation.PerformanceTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runners.model.FrameworkMethod;
+
+class FrameworkPerformanceMethod extends FrameworkMethod {
+        
+		private Object target;
+        private PerformanceSuiteState performanceSuiteState; 
+        
+        public FrameworkPerformanceMethod(Method method, Object target, PerformanceSuiteState performanceSuiteState) {
+        		super(method);
+                this.target = target;
+                this.performanceSuiteState = performanceSuiteState;
+                
+        }
+
+        @Override
+        public Object invokeExplosively(Object target, Object... params) throws Throwable {
+        	// Executes the test method on the supplied target
+        	
+        	// Check if this is the first test running from this specific PerformanceSuite
+        	// and run the BeforeSuite methods
+        	if ((performanceSuiteState != null) && (performanceSuiteState.getBeforeSuiteMethod() != null)
+        			&& (performanceSuiteState.getTargetObjectSuite() != null)
+        			&& (performanceSuiteState.getNumberOfExecutedMethods() == 0)
+        			&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)){
+        		performanceSuiteState.getBeforeSuiteMethod().invoke(performanceSuiteState.getTargetObjectSuite());
+        	}
+        	
+        	// In case of a PerformanceSuite we need to run the methods annotated with Before and After
+        	// ourselves as JUnit can't find them (JUnit is looking for them in the test  suite class);
+        	// in case we don't have to deal with a PerformanceSuite just skip this as JUnit will run the methods itself
+        	if ((performanceSuiteState != null) && !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)){
+        		
+        		recursiveCallSpecificMethod(this.target.getClass(), this.target, Before.class);
+        	}
+        	
+        	// Need to count the number of tests run from the PerformanceSuite
+        	// so that we can call the AfterSuite method after the last test from the suite 
+        	// has run and the AfterSuite needs to run
+        	performanceSuiteState.incrementNumberOfExecutedTestMethods();
+        	
+        	Object response = null;
+        	
+ 	    	Method testMethodToInvoke = this.getMethod();
+ 	    	
+ 	    	PerformanceTest performanceAnnotation = testMethodToInvoke.getAnnotation(PerformanceTest.class);
+ 	    	
+ 	    	// retrieve the test configuration options
+ 	    	int warmuptime = performanceAnnotation.warmuptime();
+ 	    	int runtime = performanceAnnotation.runtime();
+ 	    	int warmupinvocations = performanceAnnotation.warmupinvocations();
+ 	    	int runinvocations = performanceAnnotation.runinvocations();
+ 	    	
+     		DescriptiveStatistics statistics = new DescriptiveStatistics();
+ 	         	
+     		//System.out.println("Warmup started - test :" + testMethodToInvoke.getName());
+     		
+ 	            if (warmupinvocations != 0){
+ 	            	// Run the number of invocation specified in the annotation
+ 	            	// for warming up the system
+ 	            	for (int invocationIndex = 0; invocationIndex < warmupinvocations; invocationIndex++){
+ 	            		
+ 	            		recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeMethodInvocation.class);
+ 	            		
+ 	            		//TODO: implement the method to run a before a specific test method
+ 	            		//recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeSpecificTest.class);
+ 	            		
+ 	            		response = super.invokeExplosively(this.target, params);
+ 	            		
+ 	            		//TODO: implement the method to run a after a specific test method
+ 	            		//recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterSpecificTest.class);
+ 	            		
+ 	            		recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterMethodInvocation.class);
+ 	            	}
+ 	            }
+ 	            else{
+ 		        	// Run a few iterations to warm up the system
+ 		            long warmupEnd = System.currentTimeMillis() + warmuptime * 1000;
+ 		            while (System.currentTimeMillis() < warmupEnd) {
+ 		            	recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeMethodInvocation.class);
+ 		            	
+ 		            	//TODO: implement the method to run a before a specific test method
+ 		            	//recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeSpecificTest.class);
+ 	            		
+ 	            		response = super.invokeExplosively(this.target, params);
+ 	            		
+ 	            		//recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterSpecificTest.class);
+ 	            		//TODO: implement the method to run a after a specific test method
+ 	            		
+ 	            		recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterMethodInvocation.class);
+ 		            }
+ 	            }
+ 	
+ 	            //System.out.println("Warmup ended - test :" + testMethodToInvoke.getName());
+ 	            if (runinvocations != 0){
+ 	            	// Run the specified number of iterations and capture the execution times
+ 	            	for (int invocationIndex = 0; invocationIndex < runinvocations; invocationIndex++){
+ 	            		
+ 	            		response = this.invokeTimedTestMethod(testMethodToInvoke, statistics, params);
+	            	}
+ 	            }
+ 	            else{
+ 		            // Run test iterations and capture the execution times
+ 		            long runtimeEnd = System.currentTimeMillis() + runtime * 1000;
+            		
+ 		            while (System.currentTimeMillis() < runtimeEnd) {
+ 		            	
+ 		            	response = this.invokeTimedTestMethod(testMethodToInvoke, statistics, params);
+ 		            	
+ 		            }
+ 		        }
+  	            
+ 	        if (statistics.getN() > 0) {
+ 	            ReportLogger.writeReport(this.target.getClass().getName(), this.performanceSuiteState.testSuiteName, 
+ 	            		getMethod().getName() , statistics, ReportLogger.ReportType.TXT);
+ 	        }
+  	        
+ 	        // In case of a PerformanceSuite we need to run the methods annotated with Before and After
+        	// ourselves as JUnit can't find them; in case we don't have to deal with a PerformanceSuite
+        	// just skip this as JUnit will run the methods itself
+ 	        if ((performanceSuiteState != null) 
+ 	        		&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)){
+	        	
+	        	recursiveCallSpecificMethod(this.target.getClass(), this.target, After.class);
+	        }
+ 	        
+ 	        
+ 	        // Check if this is the last test running from a PerformanceSuite
+        	// and run the AfterSuite method
+ 	        if ((performanceSuiteState != null) && (performanceSuiteState.getAfterSuiteMethod() != null)
+ 	        		&& (performanceSuiteState.getTargetObjectSuite() != null)
+ 	        		&& (performanceSuiteState.getNumberOfExecutedMethods() == performanceSuiteState.getNumberOfMethodsInSuite())
+ 	        		&& !performanceSuiteState.testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)){
+ 	    	    performanceSuiteState.getAfterSuiteMethod().invoke(performanceSuiteState.getTargetObjectSuite());
+ 	    	   
+ 	        }
+ 	         	        
+            return response;
+        }
+        
+        /**
+         * Method that runs 1 invocation of the timed test method
+         * @param testMethodToInvoke the test method to invoke
+         * @param statistics the statistics object that collects the results
+         * @param params the parameters for the invocation of the test method
+         * @return the response from the method invocation
+         * @throws Throwable
+         */
+        private Object invokeTimedTestMethod(Method testMethodToInvoke, DescriptiveStatistics statistics, Object... params) 
+        		throws Throwable{
+        	
+        	Object response = null;
+        	
+        	recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeMethodInvocation.class);
+	            
+	        //TODO: implement the method to run a before a specific test method
+	        //recursiveCallSpecificMethod(this.target.getClass(), this.target, BeforeSpecificTest.class); 
+         	
+     		// timing the test method execution
+         	//System.out.println("Start test: " + testMethodToInvoke.getName());
+         	long start = System.nanoTime();
+         	response = super.invokeExplosively(this.target, params);
+         	long timeMilliseconds =TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS); 
+         	statistics.addValue(timeMilliseconds);
+         	
+            //System.out.println("End test: " + testMethodToInvoke.getName());
+              
+            //System.out.println("Test execution time (ms): " + timeMilliseconds);
+             
+            //TODO: implement the method to run a after a specific test method
+	        //recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterSpecificTest.class);
+	            
+	        recursiveCallSpecificMethod(this.target.getClass(), this.target, AfterMethodInvocation.class);
+	        
+	        return response;
+        }
+        
+        /**
+         * Recursively call a specific method annotated with a custom annotation 
+         * @param test the test class that contains the method
+         * @param instance the instance on which will run the method
+         * @param methodAnnotation the method annotation to look for
+         * @throws InvocationTargetException
+         * @throws InvalidAttributesException
+         * @throws IllegalAccessException
+         * @throws InstantiationException
+         */
+        @SuppressWarnings({"rawtypes"})
+        private void recursiveCallSpecificMethod(Class test, Object instance, Class<? extends Annotation> methodAnnotation) throws InvocationTargetException, InvalidAttributesException, IllegalAccessException, InstantiationException{
+     	   if (test.getSuperclass() != null){
+     		  recursiveCallSpecificMethod(test.getSuperclass(), instance, methodAnnotation);
+     	   }
+     	   
+     	   Method testMethod = getSpecificTestMethod(test, methodAnnotation);
+     		if (testMethod != null){
+     			if (!testMethod.isAccessible()){
+     				testMethod.setAccessible(true);
+      			}
+     			testMethod.invoke(instance);
+     		}
+     	}
+        
+        /**
+         * Get the method annotated with the custom annotation
+         * @param testClass the test class on which to look for the method
+         * @param methodAnnotation the method annotation to look for
+         * @return
+         * @throws InvalidAttributesException
+         * @throws IllegalAccessException
+         * @throws InstantiationException
+         */
+        @SuppressWarnings({"rawtypes"})
+        private Method getSpecificTestMethod(Class testClass, Class<? extends Annotation> methodAnnotation) throws InvalidAttributesException, IllegalAccessException, InstantiationException{
+        	
+        	Method[] methodsToReturn =  getSpecificMethods(testClass,methodAnnotation);
+        	Method methodToReturn = null;
+        	if (methodsToReturn.length == 1){
+        		methodToReturn = methodsToReturn[0];
+        	}
+        	else if (methodsToReturn.length > 1){
+        		throw new InvalidAttributesException("Only 1 non parameterized before method accepted");
+        	}
+        	
+        	return methodToReturn;
+        }
+        
+       
+         /**
+          * Retrieve all the specific methods from test class
+          * @param testClass the test class that we need to search in
+          * @param annotation the annotation that we should look for
+          * @return the list with the methods that have the specified annotation
+          */
+         @SuppressWarnings({"rawtypes"})
+         private Method[] getSpecificMethods(Class testClass, Class<? extends Annotation> annotation){
+         	Method[] allMethods = testClass.getDeclaredMethods(); 
+             
+             List<Method> methodListResult = new ArrayList<Method>();
+             
+             for(Method testMethod : allMethods){
+             	if (testMethod.isAnnotationPresent(annotation)){
+             		methodListResult.add(testMethod);
+             	}
+             }
+             return methodListResult.toArray(new Method[]{});
+         }
+ 
+}
+
+
diff --git a/src/main/java/org/apache/sling/performance/ParameterizedTestList.java b/src/main/java/org/apache/sling/performance/ParameterizedTestList.java
new file mode 100644
index 0000000..bfd7cd0
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/ParameterizedTestList.java
@@ -0,0 +1,70 @@
+/*
+ * 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.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Represents the object that will be returned by the method 
+ * in which a new PerformanceTestSuite is created
+ *
+ */
+public class ParameterizedTestList {
+
+	public static final String TEST_CASE_ONLY = "TESTCASEONLY";
+	
+	private List<Object> testObjectList = new ArrayList<Object>();
+	private String testSuiteTitle = TEST_CASE_ONLY;
+	private Map<String, String> parameters = new LinkedHashMap<String, String>();
+	private Map<String, Object> parametersObjects = new LinkedHashMap<String, Object>();
+	
+	public Map<String, Object> getParametersObjects() {
+		return parametersObjects;
+	}
+
+	public void addParameterObject(String key, Object parameterObject) {
+		this.parametersObjects.put(key, parameterObject);
+	}
+	
+	public Map<String, String> getParameters() {
+		return parameters;
+	}
+	
+	public void addParameter(String key, String value) {
+		parameters.put(key, value);
+	}
+	
+	public List<Object> getTestObjectList() {
+		return testObjectList;
+	}
+	
+	public void addTestObject(Object testObject) {
+		testObjectList.add(testObject);
+	}
+	
+	public String getTestSuiteName() {
+		return testSuiteTitle;
+	}
+
+	public void setTestSuiteTitle(String testSuiteTitle) {
+		this.testSuiteTitle = testSuiteTitle;
+	}
+	
+}
diff --git a/src/main/java/org/apache/sling/performance/PerformanceRunner.java b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
new file mode 100644
index 0000000..cc971da
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
@@ -0,0 +1,209 @@
+/*
+ * 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.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.sling.performance.annotation.AfterSuite;
+import org.apache.sling.performance.annotation.BeforeSuite;
+import org.apache.sling.performance.annotation.PerformanceTest;
+import org.apache.sling.performance.annotation.PerformanceTestSuite;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+
+
+/**
+ * The custom JUnit runner that collects the performance tests
+ *
+ */
+public class PerformanceRunner extends BlockJUnit4ClassRunner {
+        protected LinkedList<FrameworkMethod> tests = new LinkedList<FrameworkMethod>();
+        private List<PerformanceSuiteState> suitesState = new ArrayList<PerformanceSuiteState>();
+        
+        
+        public PerformanceRunner(Class<?> clazz) throws InitializationError {
+        	super(clazz);
+        	try {
+        		computeTests();
+        		}
+        	catch (Exception e) {
+        		throw new InitializationError(e);
+        	}
+        }
+
+        /**
+         * Compute the tests that will be run
+         * @throws Exception
+         */
+        protected void computeTests() throws Exception {
+                tests.addAll(super.computeTestMethods());
+                
+                // count the performance tests
+                tests.addAll(computePerformanceTests());
+                
+                // This is called here to ensure the test class constructor is called at least
+                // once during testing.  
+                createTest();
+        }
+        
+        /**
+         * Compute performance tests
+         * @return the list containing the performance test methods
+         * @throws Exception
+         */
+        protected Collection<? extends FrameworkMethod> computePerformanceTests() throws Exception {
+                List<FrameworkPerformanceMethod> tests = new LinkedList<FrameworkPerformanceMethod>();
+
+                List<Object> testObjects = new ArrayList<Object>();
+                ParameterizedTestList testCenter = new ParameterizedTestList();
+                
+                // Retrieve the test objects included in the Performance test suite
+                for (FrameworkMethod method: getTestClass().getAnnotatedMethods(PerformanceTestSuite.class)) {
+                	Object targetObject = getTestClass().getJavaClass().newInstance();
+                	if (method.getMethod().getReturnType().equals(ParameterizedTestList.class)){
+                		testCenter = (ParameterizedTestList) method.getMethod().invoke(targetObject);
+                		testObjects = testCenter.getTestObjectList();
+                	}
+                	else{
+                		throw new InitializationError("Wrong signature for the @PerformanceSuite method");
+                	}
+                }
+                
+                // Retrieve the methods before running the methods from the test suite
+                List<FrameworkMethod> beforeSuiteMethods = getTestClass().getAnnotatedMethods(BeforeSuite.class);
+                if (beforeSuiteMethods.size() > 1){
+                	throw new InitializationError("Only one @BeforeSuite method is allowed for a @PerformanceSuite");
+                }
+                
+                // Retrieve the methods before running the methods from the test suite
+                List<FrameworkMethod> afterSuiteMethods = getTestClass().getAnnotatedMethods(AfterSuite.class);
+                if (afterSuiteMethods.size() > 1){
+                	throw new InitializationError("Only one @AfterSuite method is allowed for a @PerformanceSuite");
+                }
+                
+                PerformanceSuiteState current = null;
+                boolean suiteAlreadyRegistered = false;
+                
+                for(PerformanceSuiteState suiteState : suitesState){
+                	if (suiteState.testSuiteName.equals(testCenter.getTestSuiteName())){
+                		suiteAlreadyRegistered = true;
+                		suiteState.incrementNumberOfTestMethodsInSuite();
+                		current = suiteState;
+                		break;
+                	}
+                }
+                
+                // Create a new PerformanceSuiteState object
+                PerformanceSuiteState newSuite = new PerformanceSuiteState(testCenter.getTestSuiteName());
+                
+                if (!suiteAlreadyRegistered){	
+                	if (beforeSuiteMethods.size() == 1){
+	        			newSuite.setBeforeSuiteMethod(beforeSuiteMethods.get(0).getMethod());
+	        		}
+	        		if (afterSuiteMethods.size() == 1){
+	        			newSuite.setAfterSuiteMethod(afterSuiteMethods.get(0).getMethod());
+	        		}
+	        		
+	        		current = newSuite;
+	        		newSuite.setTargetObjectSuite(getTestClass().getJavaClass().newInstance());
+	        		
+                }
+        		
+                
+                // In case there are any objects retrieved from the Performance Suite
+                // we should add them to the tests that will be run and increase the number of methods
+                // contained in the PerformaceSuite
+                if (!testObjects.isEmpty()){
+                	for (Object testObject : testObjects){
+                		// retrieve the test methods from the test classes 
+                		Method[] testMethods = getSpecificMethods(testObject.getClass(), PerformanceTest.class); 
+                		
+                		if (!suiteAlreadyRegistered){
+                			newSuite.incrementNumberOfTestMethodsInSuite();
+                		}
+                		
+                		for (Method method: testMethods){
+                			FrameworkPerformanceMethod performaceTestMethod = new FrameworkPerformanceMethod(method, testObject, current);
+                			tests.add(performaceTestMethod);
+                		}
+                	}
+                	
+                	// add the new suite to the list of suites 
+                	suitesState.add(newSuite);
+                }
+
+                // Retrieve the performance tests in the case we don't have a performance test suite
+                for (FrameworkMethod method: getTestClass().getAnnotatedMethods(PerformanceTest.class)) {
+                	Object targetObject = getTestClass().getJavaClass().newInstance();
+                	FrameworkPerformanceMethod performaceTestMethod = new FrameworkPerformanceMethod(method.getMethod(), targetObject, current);
+              	  	tests.add(performaceTestMethod);
+                }
+                
+                return tests;
+        }
+       
+        
+        /**
+         * Retrieve specific method from test class
+         * @param testClass the test class that we need to search in
+         * @param annotation the annotation that we should look for
+         * @return the list with the methods that have the specified annotation
+         */
+        @SuppressWarnings({"rawtypes"})
+        private Method[] getSpecificMethods(Class testClass, Class<? extends Annotation> annotation){
+        	Method[] allMethods = testClass.getDeclaredMethods(); 
+            
+            List<Method> methodListResult = new ArrayList<Method>();
+            
+            for(Method testMethod : allMethods){
+            	if (testMethod.isAnnotationPresent(annotation)){
+            		methodListResult.add(testMethod);
+            	}
+            }
+            return methodListResult.toArray(new Method[]{});
+        }
+        
+        /**
+         * {@inheritDoc}
+         * @see org.junit.runners.BlockJUnit4ClassRunner#computeTestMethods()
+         */
+        @Override
+        protected List<FrameworkMethod> computeTestMethods() {
+                return tests;
+        }
+
+        /**
+         * Need to override method otherwise the validation will fail because of some
+         * hardcoded conditions in JUnit
+         */
+        @Override
+        protected void validateInstanceMethods(List<Throwable> errors) {
+                validatePublicVoidNoArgMethods(After.class, false, errors);
+                validatePublicVoidNoArgMethods(Before.class, false, errors);
+                validateTestMethods(errors);
+        }
+        
+        
+}
diff --git a/src/main/java/org/apache/sling/performance/PerformanceSuiteState.java b/src/main/java/org/apache/sling/performance/PerformanceSuiteState.java
new file mode 100644
index 0000000..337cad0
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/PerformanceSuiteState.java
@@ -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.lang.reflect.Method;
+
+public class PerformanceSuiteState {
+
+	public String testSuiteName = ParameterizedTestList.TEST_CASE_ONLY;
+	
+	private Method beforeSuiteMethod;
+	private Method afterSuiteMethod;
+	private int numberOfMethodsInSuite = 0;
+	private int numberOfExecutedMethods = 0;
+	private Object targetObjectSuite;
+	
+	public PerformanceSuiteState(String testSuiteName){
+		this.testSuiteName = testSuiteName;
+	}
+	
+	public void incrementNumberOfTestMethodsInSuite(){
+		numberOfMethodsInSuite++;
+	}
+	
+	public void incrementNumberOfExecutedTestMethods(){
+		numberOfExecutedMethods++;
+	}
+	
+	public String getTestSuiteName() {
+		return testSuiteName;
+	}
+
+	public void setTestSuiteName(String testSuiteName) {
+		this.testSuiteName = testSuiteName;
+	}
+
+	public Method getBeforeSuiteMethod() {
+		return beforeSuiteMethod;
+	}
+
+	public void setBeforeSuiteMethod(Method beforeSuiteMethod) {
+		this.beforeSuiteMethod = beforeSuiteMethod;
+	}
+
+	public Method getAfterSuiteMethod() {
+		return afterSuiteMethod;
+	}
+
+	public void setAfterSuiteMethod(Method afterSuiteMethod) {
+		this.afterSuiteMethod = afterSuiteMethod;
+	}
+
+	public int getNumberOfMethodsInSuite() {
+		return numberOfMethodsInSuite;
+	}
+
+	public void setNumberOfMethodsInSuite(int numberOfMethodsInSuite) {
+		this.numberOfMethodsInSuite = numberOfMethodsInSuite;
+	}
+
+	public int getNumberOfExecutedMethods() {
+		return numberOfExecutedMethods;
+	}
+
+	public void setNumberOfExecutedMethods(int numberOfExecutedMethods) {
+		this.numberOfExecutedMethods = numberOfExecutedMethods;
+	}
+
+	public Object getTargetObjectSuite() {
+		return targetObjectSuite;
+	}
+
+	public void setTargetObjectSuite(Object targetObjectSuite) {
+		this.targetObjectSuite = targetObjectSuite;
+	}
+	
+}
diff --git a/src/main/java/org/apache/sling/performance/ReportLogger.java b/src/main/java/org/apache/sling/performance/ReportLogger.java
new file mode 100644
index 0000000..e0f24d2
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/ReportLogger.java
@@ -0,0 +1,96 @@
+package org.apache.sling.performance;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.commons.io.output.FileWriterWithEncoding;
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+
+public class ReportLogger {
+
+	public enum ReportType{
+		TXT, XML
+	}
+	
+	
+	public static void writeReport(String test, String testSuiteName, String name, DescriptiveStatistics statistics, ReportType reportType) throws Exception{
+		switch(reportType){
+		case TXT:
+			writeReportTxt(test, testSuiteName, name, statistics);
+			break;
+		case XML:
+			throw new Exception("The XML reporting format is not yet supported");
+		default:
+			throw new Exception("The specified reporting format is not yet supported");
+		}
+	}
+	
+	/**
+     * Method the writes the performance report after a test is run
+     * @param test the test name
+     * @param name the name that will be listed in the report
+     * @param statistics the statistics data to be written
+     * @throws IOException
+     */
+    public static void writeReportTxt(String test, String testSuiteName, String name, DescriptiveStatistics statistics)
+   		    throws IOException {
+    	
+	        	String className=test;  
+	        	className=className.substring(className.lastIndexOf(".")+1);
+    	
+    			File reportDir = new File("target/performance-reports");
+    			if (!reportDir.exists()){
+   		        	boolean test1 = reportDir.mkdir();	 
+   		        }
+    			
+    			File report = new File("target/performance-reports", className + ".txt");
+   		           		        
+   		        // need this in the case a user wants to set the suite name from the command line
+   		        // useful if we run the test cases from the command line for example 
+   		        // by using maven
+   		        if (testSuiteName.equals(ParameterizedTestList.TEST_CASE_ONLY)){
+	   		        if (System.getenv("testsuitename") != null){
+	   		        	testSuiteName = System.getenv("testsuitename");
+	   		        }
+   		        }
+   		        
+   		        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",
+   	                        className);
+   	            }
+
+   	            writer.format(
+   	                    "%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
+   	                    testSuiteName,
+   	                    statistics.getMin(),
+   	                    statistics.getPercentile(10.0),
+   	                    statistics.getPercentile(50.0),
+   	                    statistics.getPercentile(90.0),
+   	                    statistics.getMax());
+   	        } finally {
+   	            writer.close();
+   	        }
+    }
+    
+  
+    /**
+     * Get the date that will be written into the result file
+     * @return
+     */
+    private static String getDate(){
+		DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+		Date date = new Date();
+
+		return dateFormat.format(date);
+	}
+	
+}
diff --git a/src/main/java/org/apache/sling/performance/annotation/AfterMethodInvocation.java b/src/main/java/org/apache/sling/performance/annotation/AfterMethodInvocation.java
new file mode 100644
index 0000000..00da352
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/annotation/AfterMethodInvocation.java
@@ -0,0 +1,25 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AfterMethodInvocation {
+
+}
diff --git a/src/main/java/org/apache/sling/performance/annotation/AfterSpecificTest.java b/src/main/java/org/apache/sling/performance/annotation/AfterSpecificTest.java
new file mode 100644
index 0000000..2020f8f
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/annotation/AfterSpecificTest.java
@@ -0,0 +1,25 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AfterSpecificTest {
+
+}
diff --git a/src/main/java/org/apache/sling/performance/annotation/AfterSuite.java b/src/main/java/org/apache/sling/performance/annotation/AfterSuite.java
new file mode 100644
index 0000000..0acdaa3
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/annotation/AfterSuite.java
@@ -0,0 +1,25 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AfterSuite {
+
+}
diff --git a/src/main/java/org/apache/sling/performance/annotation/BeforeMethodInvocation.java b/src/main/java/org/apache/sling/performance/annotation/BeforeMethodInvocation.java
new file mode 100644
index 0000000..725bb51
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/annotation/BeforeMethodInvocation.java
@@ -0,0 +1,25 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface BeforeMethodInvocation {
+
+}
diff --git a/src/main/java/org/apache/sling/performance/annotation/BeforeSpecificTest.java b/src/main/java/org/apache/sling/performance/annotation/BeforeSpecificTest.java
new file mode 100644
index 0000000..d89307e
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/annotation/BeforeSpecificTest.java
@@ -0,0 +1,25 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface BeforeSpecificTest {
+
+}
diff --git a/src/main/java/org/apache/sling/performance/annotation/BeforeSuite.java b/src/main/java/org/apache/sling/performance/annotation/BeforeSuite.java
new file mode 100644
index 0000000..6bbb112
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/annotation/BeforeSuite.java
@@ -0,0 +1,25 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface BeforeSuite {
+
+}
diff --git a/src/main/java/org/apache/sling/performance/annotation/PerformanceTest.java b/src/main/java/org/apache/sling/performance/annotation/PerformanceTest.java
new file mode 100644
index 0000000..3810234
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/annotation/PerformanceTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+
+/**
+ * Performance test annotation to use for the framework to be able to find
+ * all the tests in the test class 
+ *
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PerformanceTest {
+	
+	
+	// set the warmup time for the test
+	int warmuptime() default 1;
+	
+	// set the run time of the test
+	int runtime() default 5;
+	
+	// set the number of invocations to time 
+	// by default the run time is used instead
+	int runinvocations() default 0;
+	
+	// set the number of invocations to run
+	// in the warm up phase
+	int warmupinvocations() default 0;
+	
+	
+}
diff --git a/src/main/java/org/apache/sling/performance/annotation/PerformanceTestSuite.java b/src/main/java/org/apache/sling/performance/annotation/PerformanceTestSuite.java
new file mode 100644
index 0000000..54a1837
--- /dev/null
+++ b/src/main/java/org/apache/sling/performance/annotation/PerformanceTestSuite.java
@@ -0,0 +1,10 @@
+package org.apache.sling.performance.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PerformanceTestSuite {
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 10/27: SLING-2729 - Performance Testing suite: Modified ReportLogger to log the test case name

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 022be37033e3d716d53316aeabbca1679dd7b977
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Tue Dec 17 13:06:46 2013 +0000

    SLING-2729 - Performance Testing suite: Modified ReportLogger to log the test case name
    
    * applied patch from Andrei Dulvac (thanks)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1551534 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sling/performance/ReportLogger.java | 90 ++++++++++++----------
 1 file changed, 50 insertions(+), 40 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/ReportLogger.java b/src/main/java/org/apache/sling/performance/ReportLogger.java
index ddbeb62..aea8bfc 100644
--- a/src/main/java/org/apache/sling/performance/ReportLogger.java
+++ b/src/main/java/org/apache/sling/performance/ReportLogger.java
@@ -12,45 +12,57 @@ import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
 
 public class ReportLogger {
 
+    public static final String REPORTS_DIR = "performance-reports";
+
 	public enum ReportType {
 		TXT
 	}
 
-	public static void writeReport(String test, String testSuiteName,
-			String name, DescriptiveStatistics statistics, ReportType reportType, PerformanceRunner.ReportLevel reportlevel)
-			throws Exception {
+    /**
+     * Method the writes the performance report after a test is run
+     * @param testSuiteName
+     * @param testCaseName
+     * @param className
+     * @param methodName
+     * @param statistics
+     * @param reportType
+     * @param reportLevel
+     * @throws Exception
+     */
+    public static void writeReport(String testSuiteName, String testCaseName, String className, String methodName,
+            DescriptiveStatistics statistics, ReportType reportType, PerformanceRunner.ReportLevel reportLevel) throws Exception {
 		switch (reportType) {
 		case TXT:
-			writeReportTxt(test, testSuiteName, name, statistics, reportlevel);
+                writeReportTxt(testSuiteName, testCaseName, className, methodName, statistics, reportLevel);
 			break;
 		default:
-			throw new Exception(
-					"The specified reporting format is not yet supported");
+                throw new Exception("The specified reporting format is not yet supported");
 		}
 	}
 
 	/**
-	 * Method the writes the performance report after a test is run
+     * Method the writes the performance report after a test is run, in text format
 	 * 
-	 * @param test
-	 *            the test name
-	 * @param name
-	 *            the name that will be listed in the report
+     * @param testSuiteName
+     * @param testCaseName
+     * @param className
+     * @param methodName
 	 * @param statistics
-	 *            the statistics data to be written
-	 * @throws IOException
+     * @param reportlevel
+     * @throws Exception
 	 */
-	public static void writeReportTxt(String test, String testSuiteName, String name, DescriptiveStatistics statistics, PerformanceRunner.ReportLevel reportlevel)
-			throws Exception{
+    public static void writeReportTxt(String testSuiteName, String testCaseName, String className, String methodName,
+            DescriptiveStatistics statistics, PerformanceRunner.ReportLevel reportlevel) throws Exception {
 
-		String className = test;
-		className = className.substring(className.lastIndexOf(".") + 1);
+        // Short class form
+        String shortClassName = className.substring(className.lastIndexOf(".") + 1);
 
-		File reportDir = new File("target/performance-reports");
+        File reportDir = new File("target/" + REPORTS_DIR);
 		if (!reportDir.exists()) {
-			if (!reportDir.mkdir())
-				throw new IOException("Unable to create performance-reports directory");	
+            if (!reportDir.mkdir()) {
+                throw new IOException("Unable to create " + REPORTS_DIR + " directory");
 		}
+        }
 
 		// need this in the case a user wants to set the suite name from the
 		// command line
@@ -62,26 +74,26 @@ public class ReportLogger {
 			}
 		}
 
-		String resultFileName = className;
+        String resultFileName = shortClassName;
 		if (reportlevel.equals(PerformanceRunner.ReportLevel.ClassLevel)){
 			writeReportClassLevel(resultFileName, testSuiteName, statistics);
 			}else if (reportlevel.equals(PerformanceRunner.ReportLevel.MethodLevel)){
-				resultFileName = test + "." + name;
-				writeReportMethodLevel(resultFileName, testSuiteName, statistics);
+            resultFileName = shortClassName + "." + methodName;
+            writeReportMethodLevel(resultFileName, testSuiteName, testCaseName, className, methodName, statistics);
 			}
 	}
 	
 	/**
      * Write report for class level tests
+     *
      * @param resultFileName the name of the result file (without extension)
      * @param testSuiteName the name of the test suite name
      * @param statistics the statistics object used to compute different medians
-     * @throws IOException
      */
-    private static void writeReportClassLevel(String resultFileName, String testSuiteName, DescriptiveStatistics statistics)
-    		throws IOException{
+    private static void writeReportClassLevel(String resultFileName, String testSuiteName,
+            DescriptiveStatistics statistics) throws IOException {
     	
-    	File report = new File("target/performance-reports", resultFileName + ".txt");
+        File report = new File("target/" + REPORTS_DIR, resultFileName + ".txt");
 		boolean needsPrefix = !report.exists();
 	    PrintWriter writer = new PrintWriter(
 	    		new FileWriterWithEncoding(report, "UTF-8", true));
@@ -107,33 +119,35 @@ public class ReportLogger {
     
     /**
      * Write report for method level tests
+     *
      * @param resultFileName the name of the result file (without extension)
      * @param testSuiteName the name of the test suite name
+     * @param testCaseName
+     * @param className
+     * @param methodName
      * @param statistics the statistics object used to compute different medians
-     * @throws IOException
      */
-    private static void writeReportMethodLevel(String resultFileName, String testSuiteName, DescriptiveStatistics statistics)
-    	    throws IOException{
-    	File report = new File("target/performance-reports", resultFileName + ".txt");
+    private static void writeReportMethodLevel(String resultFileName, String testSuiteName, String testCaseName, String className,
+            String methodName, DescriptiveStatistics statistics) throws IOException {
+        File report = new File("target/" + REPORTS_DIR, resultFileName + ".txt");
 	
-    	String className = resultFileName.substring(0, resultFileName.lastIndexOf(".")); 
-    	String methodName = resultFileName.substring(resultFileName.lastIndexOf(".") + 1); 
-    	
     	boolean needsPrefix = !report.exists();
     	PrintWriter writer = new PrintWriter(
     			new FileWriterWithEncoding(report, "UTF-8", true));
     	try {
     		if (needsPrefix) {
     			writer.format(
-    					"%-40.40s|%-80.80s|%-40.40s|      DateTime      |  min  |   10%%   |   50%%   |   90%%   |   max%n",
+                        "%-40.40s|%-120.120s|%-80.80s|%-40.40s|      DateTime      |  min  |   10%%   |   50%%   |   90%%   |   max%n",
     					"Test Suite",
+                        "Test Case",
     					"Test Class",
     					"Test Method");
     		}
     		
     		writer.format(
-    				"%-40.40s|%-80.80s|%-40.40s|%-20.20s|%7.0f|%9.0f|%9.0f|%9.0f|%9.0f%n",
+                    "%-40.40s|%-120.120s|%-80.80s|%-40.40s|%-20.20s|%7.0f|%9.0f|%9.0f|%9.0f|%9.0f%n",
     				testSuiteName,
+                    (testCaseName.length() < 120) ? (testCaseName) : (testCaseName.substring(0, 115) + "[...]"),
     				className,
     				methodName,
     				getDate(),
@@ -148,12 +162,8 @@ public class ReportLogger {
     }
 	    
 	
-	
-
 	/**
 	 * Get the date that will be written into the result file
-	 * 
-	 * @return
 	 */
 	private static String getDate() {
 		DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 25/27: @trivial: corrected SCM info

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 373864a851928abd253b93ff5495bf3296ca602f
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Mar 23 20:13:46 2015 +0000

    @trivial: corrected SCM info
    
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1668714 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5908f03..18a50f4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,9 +38,9 @@
     </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>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/performance/base</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/performance/base</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/performance/base</url>
     </scm>
 
     <dependencies>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 14/27: @releng removing intermediate parent pom and adding the modules to the reactor

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit defc4ef27b069f44ab55cc2923973cb99bed57b6
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Thu May 15 10:20:08 2014 +0000

    @releng removing intermediate parent pom and adding the modules to the reactor
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1594849 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index c02e8db..a4c6ce6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,8 +22,9 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.sling</groupId>
-        <artifactId>sling-performance-tests</artifactId>
-        <version>0.0.1-SNAPSHOT</version>
+        <artifactId>sling</artifactId>
+        <version>19</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
     </parent>
 
     <artifactId>org.apache.sling.performance.base</artifactId>
@@ -107,4 +108,15 @@
             <scope>compile</scope>
         </dependency>
     </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                   <argLine>-Xms256m -Xmx1024m -XX:MaxPermSize=512m</argLine>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 09/27: SLING-2593 - Improvement for the Sling performance tools. Adding Report level parameter. Thanks Christian Vazzolla for the patch.

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit f05b35ed0a1aadd90f972b22b98c01066a28340f
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Mon Oct 15 07:34:45 2012 +0000

    SLING-2593 - Improvement for the Sling performance tools. Adding Report level parameter. Thanks Christian Vazzolla for the patch.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1398205 13f79535-47bb-0310-9956-ffa450edef68
---
 .../performance/FrameworkPerformanceMethod.java    |   7 +-
 .../sling/performance/PerformanceRunner.java       |  32 +++++-
 .../org/apache/sling/performance/ReportLogger.java | 115 ++++++++++++++++-----
 3 files changed, 124 insertions(+), 30 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
index 4f95d3e..8010a3a 100644
--- a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
+++ b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
@@ -37,13 +37,14 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 
 	private Object target;
 	private PerformanceSuiteState performanceSuiteState;
+	private PerformanceRunner.ReportLevel reportLevel = PerformanceRunner.ReportLevel.ClassLevel;
 
 	public FrameworkPerformanceMethod(Method method, Object target,
-			PerformanceSuiteState performanceSuiteState) {
+			PerformanceSuiteState performanceSuiteState, PerformanceRunner.ReportLevel reportLevel) {
 		super(method);
 		this.target = target;
 		this.performanceSuiteState = performanceSuiteState;
-
+		this.reportLevel = reportLevel;
 	}
 
 	@Override
@@ -176,7 +177,7 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 					.writeReport(this.target.getClass().getName(),
 							this.performanceSuiteState.testSuiteName,
 							getMethod().getName(), statistics,
-							ReportLogger.ReportType.TXT);
+							ReportLogger.ReportType.TXT, reportLevel);
 		}
 
 		// In case of a PerformanceSuite we need to run the methods annotated
diff --git a/src/main/java/org/apache/sling/performance/PerformanceRunner.java b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
index fef112c..68e2926 100644
--- a/src/main/java/org/apache/sling/performance/PerformanceRunner.java
+++ b/src/main/java/org/apache/sling/performance/PerformanceRunner.java
@@ -17,6 +17,10 @@
 package org.apache.sling.performance;
 
 import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -37,12 +41,34 @@ import org.junit.runners.model.InitializationError;
  * The custom JUnit runner that collects the performance tests
  * 
  */
+
+
+
 public class PerformanceRunner extends BlockJUnit4ClassRunner {
 	protected LinkedList<FrameworkMethod> tests = new LinkedList<FrameworkMethod>();
 	private List<PerformanceSuiteState> suitesState = new ArrayList<PerformanceSuiteState>();
-
+	public ReportLevel reportLevel = ReportLevel.ClassLevel;
+	
+	public static enum ReportLevel{
+		ClassLevel,
+		MethodLevel
+	}
+	
+	@Retention(RetentionPolicy.RUNTIME)
+	@Target(ElementType.TYPE)
+	public @interface Parameters {
+		public ReportLevel reportLevel() default ReportLevel.ClassLevel;
+	}
+	
 	public PerformanceRunner(Class<?> clazz) throws InitializationError {
 		super(clazz);
+		
+		// set the report level for the tests that are run with the PerformanceRunner
+		// by default set to class level for legacy tests compatibility
+		if (clazz.getAnnotation(Parameters.class) != null){
+			reportLevel = clazz.getAnnotation(Parameters.class).reportLevel();
+		}
+		
 		try {
 			computeTests();
 		} catch (Exception e) {
@@ -159,7 +185,7 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
 
 				for (Method method : testMethods) {
 					FrameworkPerformanceMethod performaceTestMethod = new FrameworkPerformanceMethod(
-							method, testObject, current);
+							method, testObject, current, reportLevel);
 					tests.add(performaceTestMethod);
 				}
 			}
@@ -174,7 +200,7 @@ public class PerformanceRunner extends BlockJUnit4ClassRunner {
 				PerformanceTest.class)) {
 			Object targetObject = getTestClass().getJavaClass().newInstance();
 			FrameworkPerformanceMethod performaceTestMethod = new FrameworkPerformanceMethod(
-					method.getMethod(), targetObject, current);
+					method.getMethod(), targetObject, current, reportLevel);
 			tests.add(performaceTestMethod);
 		}
 
diff --git a/src/main/java/org/apache/sling/performance/ReportLogger.java b/src/main/java/org/apache/sling/performance/ReportLogger.java
index d43f455..ddbeb62 100644
--- a/src/main/java/org/apache/sling/performance/ReportLogger.java
+++ b/src/main/java/org/apache/sling/performance/ReportLogger.java
@@ -17,11 +17,11 @@ public class ReportLogger {
 	}
 
 	public static void writeReport(String test, String testSuiteName,
-			String name, DescriptiveStatistics statistics, ReportType reportType)
+			String name, DescriptiveStatistics statistics, ReportType reportType, PerformanceRunner.ReportLevel reportlevel)
 			throws Exception {
 		switch (reportType) {
 		case TXT:
-			writeReportTxt(test, testSuiteName, name, statistics);
+			writeReportTxt(test, testSuiteName, name, statistics, reportlevel);
 			break;
 		default:
 			throw new Exception(
@@ -40,19 +40,18 @@ public class ReportLogger {
 	 *            the statistics data to be written
 	 * @throws IOException
 	 */
-	public static void writeReportTxt(String test, String testSuiteName,
-			String name, DescriptiveStatistics statistics) throws IOException {
+	public static void writeReportTxt(String test, String testSuiteName, String name, DescriptiveStatistics statistics, PerformanceRunner.ReportLevel reportlevel)
+			throws Exception{
 
 		String className = test;
 		className = className.substring(className.lastIndexOf(".") + 1);
 
 		File reportDir = new File("target/performance-reports");
 		if (!reportDir.exists()) {
-			boolean test1 = reportDir.mkdir();
+			if (!reportDir.mkdir())
+				throw new IOException("Unable to create performance-reports directory");	
 		}
 
-		File report = new File("target/performance-reports", className + ".txt");
-
 		// need this in the case a user wants to set the suite name from the
 		// command line
 		// useful if we run the test cases from the command line for example
@@ -63,25 +62,93 @@ public class ReportLogger {
 			}
 		}
 
-		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",
-						className);
+		String resultFileName = className;
+		if (reportlevel.equals(PerformanceRunner.ReportLevel.ClassLevel)){
+			writeReportClassLevel(resultFileName, testSuiteName, statistics);
+			}else if (reportlevel.equals(PerformanceRunner.ReportLevel.MethodLevel)){
+				resultFileName = test + "." + name;
+				writeReportMethodLevel(resultFileName, testSuiteName, statistics);
 			}
-
-			writer.format("%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
-					testSuiteName, statistics.getMin(),
-					statistics.getPercentile(10.0),
-					statistics.getPercentile(50.0),
-					statistics.getPercentile(90.0), statistics.getMax());
-		} finally {
-			writer.close();
-		}
 	}
+	
+	/**
+     * Write report for class level tests
+     * @param resultFileName the name of the result file (without extension)
+     * @param testSuiteName the name of the test suite name
+     * @param statistics the statistics object used to compute different medians
+     * @throws IOException
+     */
+    private static void writeReportClassLevel(String resultFileName, String testSuiteName, DescriptiveStatistics statistics)
+    		throws IOException{
+    	
+    	File report = new File("target/performance-reports", resultFileName + ".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",
+	    				resultFileName);
+	    	}
+	    	
+	    	writer.format(
+	    			"%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
+	    			testSuiteName,
+	    			statistics.getMin(),
+	    			statistics.getPercentile(10.0),
+	    			statistics.getPercentile(50.0),
+	    			statistics.getPercentile(90.0),
+	    			statistics.getMax());
+	    	} finally {
+	    		writer.close();
+	   		}
+	}
+    
+    /**
+     * Write report for method level tests
+     * @param resultFileName the name of the result file (without extension)
+     * @param testSuiteName the name of the test suite name
+     * @param statistics the statistics object used to compute different medians
+     * @throws IOException
+     */
+    private static void writeReportMethodLevel(String resultFileName, String testSuiteName, DescriptiveStatistics statistics)
+    	    throws IOException{
+    	File report = new File("target/performance-reports", resultFileName + ".txt");
+	
+    	String className = resultFileName.substring(0, resultFileName.lastIndexOf(".")); 
+    	String methodName = resultFileName.substring(resultFileName.lastIndexOf(".") + 1); 
+    	
+    	boolean needsPrefix = !report.exists();
+    	PrintWriter writer = new PrintWriter(
+    			new FileWriterWithEncoding(report, "UTF-8", true));
+    	try {
+    		if (needsPrefix) {
+    			writer.format(
+    					"%-40.40s|%-80.80s|%-40.40s|      DateTime      |  min  |   10%%   |   50%%   |   90%%   |   max%n",
+    					"Test Suite",
+    					"Test Class",
+    					"Test Method");
+    		}
+    		
+    		writer.format(
+    				"%-40.40s|%-80.80s|%-40.40s|%-20.20s|%7.0f|%9.0f|%9.0f|%9.0f|%9.0f%n",
+    				testSuiteName,
+    				className,
+    				methodName,
+    				getDate(),
+    				statistics.getMin(),
+    				statistics.getPercentile(10.0),
+    				statistics.getPercentile(50.0),
+    				statistics.getPercentile(90.0),
+    				statistics.getMax());
+    		} finally {
+    			writer.close();
+    		}
+    }
+	    
+	
+	
 
 	/**
 	 * Get the date that will be written into the result file

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 26/27: [maven-release-plugin] prepare release org.apache.sling.performance.base-0.0.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 59d23484e39e41b774b31674d5195a39a211cea3
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Mar 23 20:14:37 2015 +0000

    [maven-release-plugin] prepare release org.apache.sling.performance.base-0.0.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1668715 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 18a50f4..0c1fc02 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
     </parent>
 
     <artifactId>org.apache.sling.performance.base</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
+    <version>0.0.2</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Performance Test Utilities</name>
@@ -38,9 +38,9 @@
     </properties>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/performance/base</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/performance/base</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/performance/base</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.performance.base-0.0.2</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.performance.base-0.0.2</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.performance.base-0.0.2</url>
     </scm>
 
     <dependencies>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 13/27: SLING-3294 - Simplify Performance Test Creation

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit a3c136f53d9a933da411f038c36eb9694afd2725
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Wed Dec 18 10:04:45 2013 +0000

    SLING-3294 - Simplify Performance Test Creation
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1551896 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/performance/AbstractRepositoryTest.java    | 13 ++++++++++++-
 .../sling/performance/FrameworkPerformanceMethod.java       |  2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java b/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
index ff542c5..4854bca 100644
--- a/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
+++ b/src/main/java/org/apache/sling/performance/AbstractRepositoryTest.java
@@ -27,7 +27,14 @@ import org.apache.sling.jcr.api.SlingRepository;
 
   
 public abstract class AbstractRepositoryTest {
-	
+
+    protected String testInstanceName;
+
+    public AbstractRepositoryTest(String testInstanceName) {
+        super();
+        this.testInstanceName = testInstanceName;
+    }
+
 	private static class ShutdownThread extends Thread {
         @Override
         public void run() {
@@ -80,5 +87,9 @@ public abstract class AbstractRepositoryTest {
         }
         return testRoot;
     }
+    
+    public String toString(){
+    	return testInstanceName;
+    }
 
 }
diff --git a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
index 36a0271..be28c78 100644
--- a/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
+++ b/src/main/java/org/apache/sling/performance/FrameworkPerformanceMethod.java
@@ -177,7 +177,7 @@ class FrameworkPerformanceMethod extends FrameworkMethod {
 		}
 
 		if (statistics.getN() > 0) {
-            ReportLogger.writeReport(this.performanceSuiteState.testSuiteName, testCaseName, this.target.getClass().getName(),
+		    ReportLogger.writeReport(this.performanceSuiteState.testSuiteName, testCaseName, ((String )this.target.getClass().getMethod("toString", null).invoke(this.target, null)),
                     getMethod().getName(), statistics, ReportLogger.ReportType.TXT, reportLevel);
 		}
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 07/27: Set svn:ignore

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit df2a0fac7936445d93759bf52eb33a0df689f0f7
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Oct 1 15:14:43 2012 +0000

    Set svn:ignore
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1392379 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-tooling-scm] 24/27: [maven-release-plugin] rollback the release of org.apache.sling.performance.base-0.0.2

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.performance.base-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit fb0146f048ce2dbc5ae035b68bc999101ed2faf8
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Mar 23 20:12:12 2015 +0000

    [maven-release-plugin] rollback the release of org.apache.sling.performance.base-0.0.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/performance/base@1668713 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 0c1fc02..5908f03 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
     </parent>
 
     <artifactId>org.apache.sling.performance.base</artifactId>
-    <version>0.0.2</version>
+    <version>0.0.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Performance Test Utilities</name>
@@ -38,9 +38,9 @@
     </properties>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.performance.base-0.0.2</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.performance.base-0.0.2</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.performance.base-0.0.2</url>
+        <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>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.