You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2011/10/20 15:54:39 UTC

svn commit: r1186812 - in /maven/sandbox/trunk/wagon/wagon-benchmarks: wagon-benchmarks-api/ wagon-benchmarks-api/src/main/java/org/apache/maven/wagon/benchmarks/ wagon-benchmarks-run/src/test/java/org/apache/maven/wagon/benchmarks/

Author: olamy
Date: Thu Oct 20 13:54:39 2011
New Revision: 1186812

URL: http://svn.apache.org/viewvc?rev=1186812&view=rev
Log:
fix benchmark suite to run all unit tests

Modified:
    maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/pom.xml
    maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/src/main/java/org/apache/maven/wagon/benchmarks/AbstractWagonHttpClientTest.java
    maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-run/src/test/java/org/apache/maven/wagon/benchmarks/BenchmarkSuiteTest.java

Modified: maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/pom.xml?rev=1186812&r1=1186811&r2=1186812&view=diff
==============================================================================
--- maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/pom.xml (original)
+++ maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/pom.xml Thu Oct 20 13:54:39 2011
@@ -64,10 +64,6 @@ under the License.
       <artifactId>slf4j-api</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-simple</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.sonatype.sisu</groupId>
       <artifactId>sisu-inject-plexus</artifactId>
       <exclusions>

Modified: maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/src/main/java/org/apache/maven/wagon/benchmarks/AbstractWagonHttpClientTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/src/main/java/org/apache/maven/wagon/benchmarks/AbstractWagonHttpClientTest.java?rev=1186812&r1=1186811&r2=1186812&view=diff
==============================================================================
--- maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/src/main/java/org/apache/maven/wagon/benchmarks/AbstractWagonHttpClientTest.java (original)
+++ maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/src/main/java/org/apache/maven/wagon/benchmarks/AbstractWagonHttpClientTest.java Thu Oct 20 13:54:39 2011
@@ -24,6 +24,7 @@ import com.carrotsearch.junitbenchmarks.
 import com.carrotsearch.junitbenchmarks.annotation.BenchmarkHistoryChart;
 import com.carrotsearch.junitbenchmarks.annotation.BenchmarkMethodChart;
 import com.carrotsearch.junitbenchmarks.annotation.LabelType;
+import junit.framework.TestSuite;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.SystemUtils;
 import org.apache.maven.wagon.StreamingWagon;
@@ -34,6 +35,8 @@ import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.MethodRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -49,6 +52,11 @@ import java.util.concurrent.TimeUnit;
 /**
  * @author Olivier Lamy
  */
+@RunWith( JUnit4.class )
+@AxisRange( min = 0, max = 1 )
+@BenchmarkMethodChart( filePrefix = "target/benchmark-result" )
+@BenchmarkHistoryChart( labelWith = LabelType.CUSTOM_KEY, maxRuns = 5,filePrefix = "target/history-result")
+@BenchmarkOptions( benchmarkRounds = 2, warmupRounds = 1, concurrency = 2 )
 public abstract class AbstractWagonHttpClientTest
     extends AbstractWagonClientTest
 {
@@ -56,7 +64,6 @@ public abstract class AbstractWagonHttpC
     @Rule
     public MethodRule benchmarkRun = new BenchmarkRule();
 
-
     static int parallelRequestNumber = Integer.parseInt( System.getProperty( "wagon.benchmark.rq.parallel" ) );
 
     static int requestNumber = Integer.parseInt( System.getProperty( "wagon.benchmark.rq.number" ) );
@@ -82,8 +89,8 @@ public abstract class AbstractWagonHttpC
 
         resultWriter = new FileWriter( resultFile, true );
 
-        //System.setProperty( "jub.consumers", "CONSOLE,H2" );
-        //System.setProperty( "jub.db.file", new File( "../.benchmarks" ).getAbsolutePath() );
+        System.setProperty( "jub.consumers", "CONSOLE,H2" );
+        System.setProperty( "jub.db.file", new File( "target/.benchmarks" ).getAbsolutePath() );
     }
 
 
@@ -95,7 +102,7 @@ public abstract class AbstractWagonHttpC
     }
 
     @Test
-    public void getSmallFilesHttpNotCompressed()
+    public void testgetSmallFilesHttpNotCompressed()
         throws Exception
     {
         long start = System.currentTimeMillis();
@@ -110,7 +117,7 @@ public abstract class AbstractWagonHttpC
 
 
     @Test
-    public void getSmallFilesHttpsNotCompressed()
+    public void testgetSmallFilesHttpsNotCompressed()
         throws Exception
     {
         long start = System.currentTimeMillis();
@@ -123,7 +130,7 @@ public abstract class AbstractWagonHttpC
     }
 
     @Test
-    public void getSmallFilesHttpCompressed()
+    public void testgetSmallFilesHttpCompressed()
         throws Exception
     {
         long start = System.currentTimeMillis();
@@ -136,7 +143,7 @@ public abstract class AbstractWagonHttpC
     }
 
     @Test
-    public void getSmallFilesHttpsCompressed()
+    public void testgetSmallFilesHttpsCompressed()
         throws Exception
     {
         long start = System.currentTimeMillis();
@@ -173,7 +180,7 @@ public abstract class AbstractWagonHttpC
     }
 
     @Test
-    public void getHugeFileHttpNotCompressed()
+    public void testgetHugeFileHttpNotCompressed()
         throws Exception
     {
         long start = System.currentTimeMillis();
@@ -187,7 +194,7 @@ public abstract class AbstractWagonHttpC
     }
 
     @Test
-    public void getHugeFileHttpsNotCompressed()
+    public void testgetHugeFileHttpsNotCompressed()
         throws Exception
     {
         long start = System.currentTimeMillis();
@@ -201,7 +208,7 @@ public abstract class AbstractWagonHttpC
     }
 
     @Test
-    public void getHugeFileHttpCompressed()
+    public void testgetHugeFileHttpCompressed()
         throws Exception
     {
         long start = System.currentTimeMillis();
@@ -216,7 +223,7 @@ public abstract class AbstractWagonHttpC
 
 
     @Test
-    public void getHugeFileHttpsCompressed()
+    public void testgetHugeFileHttpsCompressed()
         throws Exception
     {
         long start = System.currentTimeMillis();
@@ -307,4 +314,5 @@ public abstract class AbstractWagonHttpC
     abstract StreamingWagon getHttpWagon() throws Exception;
 
     abstract StreamingWagon getHttpsWagon() throws Exception;
+
 }

Modified: maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-run/src/test/java/org/apache/maven/wagon/benchmarks/BenchmarkSuiteTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-run/src/test/java/org/apache/maven/wagon/benchmarks/BenchmarkSuiteTest.java?rev=1186812&r1=1186811&r2=1186812&view=diff
==============================================================================
--- maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-run/src/test/java/org/apache/maven/wagon/benchmarks/BenchmarkSuiteTest.java (original)
+++ maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-run/src/test/java/org/apache/maven/wagon/benchmarks/BenchmarkSuiteTest.java Thu Oct 20 13:54:39 2011
@@ -19,23 +19,76 @@ package org.apache.maven.wagon.benchmark
  */
 
 import com.carrotsearch.junitbenchmarks.BenchmarkOptions;
+import com.carrotsearch.junitbenchmarks.BenchmarkRule;
 import com.carrotsearch.junitbenchmarks.annotation.AxisRange;
 import com.carrotsearch.junitbenchmarks.annotation.BenchmarkHistoryChart;
 import com.carrotsearch.junitbenchmarks.annotation.BenchmarkMethodChart;
 import com.carrotsearch.junitbenchmarks.annotation.LabelType;
+import org.codehaus.plexus.PlexusTestCase;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.MethodRule;
+import org.junit.runner.JUnitCore;
 import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
+import org.junit.runners.JUnit4;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileWriter;
 
 /**
  * @author Olivier Lamy
  */
-@RunWith( Suite.class )
-@Suite.SuiteClasses( { WagonHttpAhcRunner.class, WagonHttpClientLigthRunner.class, WagonHttpClientRunner.class } )
+@RunWith( JUnit4.class )
 @AxisRange( min = 0, max = 1 )
-@BenchmarkMethodChart( filePrefix = "../benchmark-result" )
-@BenchmarkHistoryChart( labelWith = LabelType.CUSTOM_KEY, maxRuns = 5 )
+@BenchmarkMethodChart( filePrefix = "target/benchmark-result" )
+@BenchmarkHistoryChart( labelWith = LabelType.CUSTOM_KEY, maxRuns = 5,filePrefix = "target/history-result")
 @BenchmarkOptions( benchmarkRounds = 2, warmupRounds = 1, concurrency = 2 )
 public class BenchmarkSuiteTest
+    extends PlexusTestCase
 {
-    // no op
+
+    @Rule
+    public MethodRule benchmarkRun = new BenchmarkRule();
+
+    final protected Logger log = LoggerFactory.getLogger( getClass() );
+
+    @BeforeClass
+    public static void createResultFile()
+        throws Exception
+    {
+        System.setProperty( "jub.consumers", "CONSOLE,H2" );
+        System.setProperty( "jub.db.file", new File( "target/.benchmarks" ).getAbsolutePath() );
+    }
+
+    @Test
+    public void ahcSuite()
+        throws Throwable
+    {
+        JUnitCore core = new JUnitCore();
+        core.run( WagonHttpAhcRunner.class );
+
+    }
+
+    @Test
+    public void lightSuite()
+        throws Throwable
+    {
+        JUnitCore core = new JUnitCore();
+        core.run( WagonHttpClientLigthRunner.class );
+
+    }
+
+    @Test
+    public void httpSuite()
+        throws Throwable
+    {
+        JUnitCore core = new JUnitCore();
+        core.run( WagonHttpClientRunner.class );
+
+    }
+
+
 }