diff options
author | Olivier Lamy <olamy@apache.org> | 2013-12-09 11:21:16 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2013-12-09 11:21:16 +0000 |
commit | cc94843a8d977cda5fab149790d9cfdd538c4084 (patch) | |
tree | d4c28c68ab68065951a0a9385a53ed8d9c490ad2 /archiva-modules/archiva-web/archiva-web-common/src | |
parent | 449de093e2e3293f308ee0f88012bd7662231ce8 (diff) | |
download | archiva-cc94843a8d977cda5fab149790d9cfdd538c4084.tar.gz archiva-cc94843a8d977cda5fab149790d9cfdd538c4084.zip |
[MRM-1761] add unit test
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1549543 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-web-common/src')
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<String> getZipEntriesNames( ZipFile zipFile ) + { + try + { + List<String> entriesNames = new ArrayList<String>(); + Enumeration<? extends ZipEntry> 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<String> getZipEntriesNames( ZipFile zipFile ) - { - try - { - List<String> entriesNames = new ArrayList<String>(); - Enumeration<? extends ZipEntry> 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 |