You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2014/04/19 17:16:43 UTC

git commit: clean huge files (4GB) after test

Repository: maven-wagon
Updated Branches:
  refs/heads/master ac00290dd -> 36db56c37


clean huge files (4GB) after test

Project: http://git-wip-us.apache.org/repos/asf/maven-wagon/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-wagon/commit/36db56c3
Tree: http://git-wip-us.apache.org/repos/asf/maven-wagon/tree/36db56c3
Diff: http://git-wip-us.apache.org/repos/asf/maven-wagon/diff/36db56c3

Branch: refs/heads/master
Commit: 36db56c371b4d610d5383e1787457984d13c2813
Parents: ac00290
Author: Hervé Boutemy <hb...@apache.org>
Authored: Sat Apr 19 17:16:28 2014 +0200
Committer: Hervé Boutemy <hb...@apache.org>
Committed: Sat Apr 19 17:16:28 2014 +0200

----------------------------------------------------------------------
 .../providers/http/HugeFileDownloadTest.java      | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/36db56c3/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java
----------------------------------------------------------------------
diff --git a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java
index 941768e..0b6566d 100644
--- a/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java
+++ b/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HugeFileDownloadTest.java
@@ -53,7 +53,7 @@ public class HugeFileDownloadTest
     public void testDownloadHugeFileWithContentLength()
         throws Exception
     {
-        File hugeFile = new File( getBasedir(), "/target/hugefile.txt" );
+        File hugeFile = new File( getBasedir(), "target/hugefile.txt" );
         if ( !hugeFile.exists() || hugeFile.length() < HUGE_FILE_SIZE )
         {
             makeHugeFile( hugeFile );
@@ -62,18 +62,19 @@ public class HugeFileDownloadTest
         server = new Server( 0 );
 
         Context root = new Context( server, "/", Context.SESSIONS );
-        root.setResourceBase( new File( getBasedir(), "/target" ).getAbsolutePath() );
+        root.setResourceBase( new File( getBasedir(), "target" ).getAbsolutePath() );
         ServletHolder servletHolder = new ServletHolder( new DefaultServlet() );
         root.addServlet( servletHolder, "/*" );
 
         server.start();
 
+        File dest = null;
         try
         {
             Wagon wagon = getWagon();
             wagon.connect( new Repository( "id", "http://localhost:" + server.getConnectors()[0].getLocalPort() ) );
 
-            File dest = File.createTempFile( "huge", "txt" );
+            dest = File.createTempFile( "huge", "txt" );
 
             wagon.get( "hugefile.txt", dest );
 
@@ -84,6 +85,8 @@ public class HugeFileDownloadTest
         finally
         {
             server.start();
+            dest.delete();
+            hugeFile.delete();
         }
 
 
@@ -92,7 +95,7 @@ public class HugeFileDownloadTest
     public void testDownloadHugeFileWithChunked()
         throws Exception
     {
-        final File hugeFile = new File( getBasedir(), "/target/hugefile.txt" );
+        final File hugeFile = new File( getBasedir(), "target/hugefile.txt" );
         if ( !hugeFile.exists() || hugeFile.length() < HUGE_FILE_SIZE )
         {
             makeHugeFile( hugeFile );
@@ -101,7 +104,7 @@ public class HugeFileDownloadTest
         server = new Server( 0 );
 
         Context root = new Context( server, "/", Context.SESSIONS );
-        root.setResourceBase( new File( getBasedir(), "/target" ).getAbsolutePath() );
+        root.setResourceBase( new File( getBasedir(), "target" ).getAbsolutePath() );
         ServletHolder servletHolder = new ServletHolder( new HttpServlet()
         {
             @Override
@@ -123,12 +126,13 @@ public class HugeFileDownloadTest
 
         server.start();
 
+        File dest = null;
         try
         {
             Wagon wagon = getWagon();
             wagon.connect( new Repository( "id", "http://localhost:" + server.getConnectors()[0].getLocalPort() ) );
 
-            File dest = File.createTempFile( "huge", "txt" );
+            dest = File.createTempFile( "huge", "txt" );
 
             wagon.get( "hugefile.txt", dest );
 
@@ -139,6 +143,8 @@ public class HugeFileDownloadTest
         finally
         {
             server.start();
+            dest.delete();
+            hugeFile.delete();
         }