maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1186686 - in /maven/sandbox/trunk: ./ wagon/wagon-benchmarks/wagon-benchmarks-ahc/ wagon/wagon-benchmarks/wagon-benchmarks-api/src/main/java/org/apache/maven/wagon/benchmarks/ wagon/wagon-benchmarks/wagon-benchmarks-http-lightweight/ wagon...
Date Thu, 20 Oct 2011 09:28:41 GMT
Author: olamy
Date: Thu Oct 20 09:28:40 2011
New Revision: 1186686

URL: http://svn.apache.org/viewvc?rev=1186686&view=rev
Log:
write result to a result.txt file and fix https tests

Modified:
    maven/sandbox/trunk/.gitignore
    maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-ahc/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-api/src/main/java/org/apache/maven/wagon/benchmarks/TestServer.java
    maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-http-lightweight/pom.xml
    maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-http/pom.xml

Modified: maven/sandbox/trunk/.gitignore
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/.gitignore?rev=1186686&r1=1186685&r2=1186686&view=diff
==============================================================================
--- maven/sandbox/trunk/.gitignore (original)
+++ maven/sandbox/trunk/.gitignore Thu Oct 20 09:28:40 2011
@@ -6,3 +6,5 @@ target
 .classpath
 .project
 .settings
+
+result.txt

Modified: maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-ahc/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-ahc/pom.xml?rev=1186686&r1=1186685&r2=1186686&view=diff
==============================================================================
--- maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-ahc/pom.xml (original)
+++ maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-ahc/pom.xml Thu Oct 20 09:28:40
2011
@@ -61,6 +61,7 @@ under the License.
             <test.keystore.path>${basedir}/src/test/ssl/keystore</test.keystore.path>
             <wagon.benchmark.rq.number>${wagon.benchmark.rq.number}</wagon.benchmark.rq.number>
             <wagon.benchmark.rq.parallel>${wagon.benchmark.rq.parallel}</wagon.benchmark.rq.parallel>
+            <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
           </systemPropertyVariables>
         </configuration>
       </plugin>

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=1186686&r1=1186685&r2=1186686&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 09:28:40 2011
@@ -19,13 +19,16 @@ package org.apache.maven.wagon.benchmark
  */
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.SystemUtils;
 import org.apache.maven.wagon.StreamingWagon;
 import org.apache.maven.wagon.repository.Repository;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileWriter;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
@@ -45,6 +48,30 @@ public abstract class AbstractWagonHttpC
 
     static int requestNumber = Integer.parseInt( System.getProperty( "wagon.benchmark.rq.number"
) );
 
+    static FileWriter resultWriter = null;
+
+
+    @BeforeClass
+    public static void createResultFile()
+        throws Exception
+    {
+        File resultFile = new File( "../result.txt" );
+        if ( !resultFile.exists() )
+        {
+            resultFile.createNewFile();
+        }
+
+        resultWriter = new FileWriter( resultFile, true );
+    }
+
+
+    @AfterClass
+    public static void close()
+        throws Exception
+    {
+        resultWriter.flush();
+    }
+
     @Test
     public void getSmallFilesHttpNotCompressed()
         throws Exception
@@ -54,7 +81,9 @@ public abstract class AbstractWagonHttpC
         smallFileGet( false, false );
 
         long end = System.currentTimeMillis();
-        log.info( getClass() + " getSmallFilesHttpNotCompressed time " + ( end - start )
);
+        String msg = getClass().getSimpleName() + " getSmallFilesHttpNotCompressed time "
+ ( end - start );
+        log.info( msg );
+        IOUtils.write( msg + SystemUtils.LINE_SEPARATOR, resultWriter );
     }
 
     @Test
@@ -64,7 +93,9 @@ public abstract class AbstractWagonHttpC
         long start = System.currentTimeMillis();
         smallFileGet( false, true );
         long end = System.currentTimeMillis();
-        log.info( getClass() + "getSmallFilesHttpsNotCompressed time " + ( end - start )
);
+        String msg = getClass().getSimpleName() + " getSmallFilesHttpsNotCompressed time
" + ( end - start );
+        log.info( msg );
+        IOUtils.write( msg + SystemUtils.LINE_SEPARATOR, resultWriter );
 
     }
 
@@ -75,7 +106,9 @@ public abstract class AbstractWagonHttpC
         long start = System.currentTimeMillis();
         smallFileGet( true, false );
         long end = System.currentTimeMillis();
-        log.info( getClass() + "getSmallFilesHttpCompressed time " + ( end - start ) );
+        String msg = getClass().getSimpleName() + " getSmallFilesHttpCompressed time " +
( end - start );
+        log.info( msg );
+        IOUtils.write( msg + SystemUtils.LINE_SEPARATOR, resultWriter );
 
     }
 
@@ -88,7 +121,9 @@ public abstract class AbstractWagonHttpC
         smallFileGet( true, true );
 
         long end = System.currentTimeMillis();
-        log.info( getClass() + "getSmallFilesHttpsCompressed time " + ( end - start ) );
+        String msg = getClass().getSimpleName() + " getSmallFilesHttpsCompressed time " +
( end - start );
+        log.info( msg );
+        IOUtils.write( msg + SystemUtils.LINE_SEPARATOR, resultWriter );
 
     }
 
@@ -190,11 +225,13 @@ public abstract class AbstractWagonHttpC
     }
 
 
-    protected void call( boolean ssl, final int port, final boolean testcontent )
+    protected void call( final boolean ssl, final int port, final boolean testcontent )
         throws Exception
     {
         List<Callable<Void>> callables = new ArrayList<Callable<Void>>();
 
+        final String repoUrl = ( ssl ? "https" : "http" ) + "://localhost:" + port + "/";
+
         for ( int i = 0; i < requestNumber; i++ )
         {
             final StreamingWagon wagon = ssl ? getHttpsWagon() : getHttpWagon();
@@ -204,16 +241,19 @@ public abstract class AbstractWagonHttpC
             {
                 public Void call()
                 {
+                    File tmpFile = null;
                     try
                     {
-                        wagon.connect( new Repository( "foo", "http://localhost:" + port
+ "/" ) );
+                        wagon.connect( new Repository( "foo", repoUrl ) );
+
+                        tmpFile = File.createTempFile( "wagon-test", "benchmark" );
+                        tmpFile.deleteOnExit();
 
-                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                        wagon.getToStream( "foo", baos );
-                        if ( testcontent )
+                        wagon.get( "foo", tmpFile );
+                        /*if ( testcontent )
                         {
                             assertTrue( baos.toString().contains( "20110821162420" ) );
-                        }
+                        }*/
                     }
                     catch ( Exception e )
                     {

Modified: maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/src/main/java/org/apache/maven/wagon/benchmarks/TestServer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/src/main/java/org/apache/maven/wagon/benchmarks/TestServer.java?rev=1186686&r1=1186685&r2=1186686&view=diff
==============================================================================
--- maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/src/main/java/org/apache/maven/wagon/benchmarks/TestServer.java
(original)
+++ maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-api/src/main/java/org/apache/maven/wagon/benchmarks/TestServer.java
Thu Oct 20 09:28:40 2011
@@ -114,7 +114,7 @@ public class TestServer
         server.addConnector( connector );
 
         server.start();
-        port = server.getConnectors()[0].getLocalPort();
+        port = connector.getLocalPort();
 
     }
 

Modified: maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-http-lightweight/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-http-lightweight/pom.xml?rev=1186686&r1=1186685&r2=1186686&view=diff
==============================================================================
--- maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-http-lightweight/pom.xml (original)
+++ maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-http-lightweight/pom.xml Thu
Oct 20 09:28:40 2011
@@ -56,6 +56,7 @@ under the License.
             <test.keystore.path>${basedir}/src/test/ssl/keystore</test.keystore.path>
             <wagon.benchmark.rq.number>${wagon.benchmark.rq.number}</wagon.benchmark.rq.number>
             <wagon.benchmark.rq.parallel>${wagon.benchmark.rq.parallel}</wagon.benchmark.rq.parallel>
+            <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
           </systemPropertyVariables>
         </configuration>
       </plugin>

Modified: maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-http/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-http/pom.xml?rev=1186686&r1=1186685&r2=1186686&view=diff
==============================================================================
--- maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-http/pom.xml (original)
+++ maven/sandbox/trunk/wagon/wagon-benchmarks/wagon-benchmarks-http/pom.xml Thu Oct 20 09:28:40
2011
@@ -56,6 +56,7 @@ under the License.
             <test.keystore.path>${basedir}/src/test/ssl/keystore</test.keystore.path>
             <wagon.benchmark.rq.number>${wagon.benchmark.rq.number}</wagon.benchmark.rq.number>
             <wagon.benchmark.rq.parallel>${wagon.benchmark.rq.parallel}</wagon.benchmark.rq.parallel>
+            <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
           </systemPropertyVariables>
         </configuration>
       </plugin>



Mime
View raw message