diff options
author | Olivier Lamy <olamy@apache.org> | 2011-09-30 14:49:05 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2011-09-30 14:49:05 +0000 |
commit | 27526f52623e2e64e7595364890b9aaadbf5f955 (patch) | |
tree | f171dc96b8305f9fd90a88587f7275de43829fe6 /archiva-modules/archiva-web | |
parent | 3e0caade83f9627e72b749844d6eec7baecd0990 (diff) | |
download | archiva-27526f52623e2e64e7595364890b9aaadbf5f955.tar.gz archiva-27526f52623e2e64e7595364890b9aaadbf5f955.zip |
use wagon in unit test to download the file hope will fix the issue with 1.5
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1177683 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r-- | archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadArtifactsTest.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadArtifactsTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadArtifactsTest.java index 893cffbc2..fe5a13732 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadArtifactsTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/DownloadArtifactsTest.java @@ -30,6 +30,8 @@ import org.apache.cxf.common.util.Base64Utility; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.WebClient; import org.apache.cxf.transport.servlet.CXFServlet; +import org.apache.maven.wagon.providers.http.HttpWagon; +import org.apache.maven.wagon.repository.Repository; import org.codehaus.plexus.util.IOUtil; import org.codehaus.redback.integration.security.role.RedbackRoleConstants; import org.codehaus.redback.rest.api.services.RoleManagementService; @@ -221,18 +223,26 @@ public class DownloadArtifactsTest getUserService( authorizationHeader ).removeFromCache( "guest" ); + + /* URL url = new URL( "http://localhost:" + port + "/repository/internal/junit/junit/4.9/junit-4.9.jar" ); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); //urlConnection.setRequestProperty( "Authorization", authorizationHeader ); InputStream is = urlConnection.getInputStream(); + */ File file = new File( "target/junit-4.9.jar" ); if ( file.exists() ) { file.delete(); } - FileWriter fw = new FileWriter( file ); - IOUtil.copy( is, fw ); + HttpWagon httpWagon = new HttpWagon(); + httpWagon.connect( new Repository( "foo", "http://localhost:" + port ) ); + + httpWagon.get( "/repository/internal/junit/junit/4.9/junit-4.9.jar", file ); + + //FileWriter fw = new FileWriter( file ); + //IOUtil.copy( is, fw ); // assert jar contains org/junit/runners/JUnit4.class ZipFile zipFile = new ZipFile( file ); List<String> entries = getZipEntriesNames( zipFile ); |