From cc94843a8d977cda5fab149790d9cfdd538c4084 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 9 Dec 2013 11:21:16 +0000 Subject: [PATCH] [MRM-1761] add unit test git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549543 13f79535-47bb-0310-9956-ffa450edef68 --- .../remotedownload/AbstractDownloadTest.java | 27 ++++++++++++++++++- .../remotedownload/DownloadArtifactsTest.java | 19 +------------ 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java index eda732dba..03dd1d229 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java @@ -52,7 +52,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.context.ContextLoaderListener; +import java.util.ArrayList; import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner; import org.junit.runner.RunWith; @@ -66,7 +72,7 @@ public abstract class AbstractDownloadTest protected Logger log = LoggerFactory.getLogger( getClass() ); - static String previousAppServerBase; + protected static String previousAppServerBase; public String authorizationHeader = getAdminAuthzHeader(); @@ -283,4 +289,23 @@ public abstract class AbstractDownloadTest FakeCreateAdminService.class ); } + + protected List getZipEntriesNames( ZipFile zipFile ) + { + try + { + List entriesNames = new ArrayList(); + Enumeration entries = zipFile.entries(); + while ( entries.hasMoreElements() ) + { + entriesNames.add( entries.nextElement().getName() ); + } + return entriesNames; + } + catch ( Throwable e ) + { + log.info( "fail to get zipEntries {}", e.getMessage(), e ); + } + return Collections.emptyList(); + } } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java index c0d491d69..105c6d035 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java @@ -183,24 +183,7 @@ public class DownloadArtifactsTest file.deleteOnExit(); } - private List getZipEntriesNames( ZipFile zipFile ) - { - try - { - List entriesNames = new ArrayList(); - Enumeration entries = zipFile.entries(); - while ( entries.hasMoreElements() ) - { - entriesNames.add( entries.nextElement().getName() ); - } - return entriesNames; - } - catch ( Throwable e ) - { - log.info( "fail to get zipEntries {}", e.getMessage(), e ); - } - return Collections.emptyList(); - } + public static class RedirectServlet -- 2.39.5