From 217ae162828cce5f473c4e3b87c985f21c1a3b5b Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 8 Jun 2011 13:32:25 +0000 Subject: [PATCH] fix unit test in archiva-proxy cache url failure clear between tests git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1133396 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/archiva/checksum/ChecksummedFile.java | 2 +- archiva-modules/archiva-base/archiva-proxy/pom.xml | 13 +++++++++++++ .../maven/archiva/proxy/AbstractProxyTestCase.java | 3 +++ .../maven/archiva/proxy/HttpProxyTransferTest.java | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java b/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java index b4cf9c4bf..a26b2348c 100644 --- a/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java +++ b/archiva-modules/archiva-base/archiva-checksum/src/main/java/org/apache/archiva/checksum/ChecksummedFile.java @@ -267,7 +267,7 @@ public class ChecksummedFile String rawChecksum = FileUtils.readFileToString( checksumFile ); String expectedChecksum = parseChecksum( rawChecksum, checksumAlgorithm, referenceFile.getName() ); - if ( StringUtils.equalsIgnoreCase( expectedChecksum, actualChecksum ) == false ) + if ( ! StringUtils.equalsIgnoreCase( expectedChecksum, actualChecksum ) ) { // create checksum (again) FileUtils.writeStringToFile( checksumFile, actualChecksum + " " + referenceFile.getName() ); diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index f1715cdd5..8275c40aa 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -111,4 +111,17 @@ test + + + + org.apache.maven.plugins + maven-surefire-plugin + + + ${project.build.outputDirectory} + + + + + diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java index 476a9b4fc..574358476 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java @@ -20,6 +20,7 @@ package org.apache.maven.archiva.proxy; */ import junit.framework.TestCase; +import net.sf.ehcache.CacheManager; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; @@ -201,6 +202,8 @@ public abstract class AbstractProxyTestCase delegate.setDelegate( wagonMock ); + CacheManager.getInstance().clearAll(); + log.info( "\n.\\ " + getName() + "() \\._________________________________________\n" ); } diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/HttpProxyTransferTest.java index 92068ad4b..2f2bca3db 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/HttpProxyTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/HttpProxyTransferTest.java @@ -20,6 +20,7 @@ package org.apache.maven.archiva.proxy; */ import junit.framework.TestCase; +import net.sf.ehcache.CacheManager; import org.apache.commons.io.FileUtils; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; @@ -158,6 +159,7 @@ public class HttpProxyTransferTest config.getConfiguration().addRemoteRepository( repoConfig ); + CacheManager.getInstance().clearAll(); }