]> source.dussan.org Git - archiva.git/commitdiff
improve test stability if there is no clean beforehand
authorBrett Porter <brett@apache.org>
Wed, 15 Dec 2010 01:59:33 +0000 (01:59 +0000)
committerBrett Porter <brett@apache.org>
Wed, 15 Dec 2010 01:59:33 +0000 (01:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x@1049384 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/ArtifactMissingChecksumsConsumerTest.java

index 13bc4ac6b175e1e1eb2d8a5f92f9fd2afb89e901..ad2dbf82f1d51386d7daa1f24c96f3a0f5d671f1 100644 (file)
@@ -5,6 +5,7 @@ import java.util.Calendar;
 
 import org.apache.archiva.checksum.ChecksumAlgorithm;
 import org.apache.archiva.checksum.ChecksummedFile;
+import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 
 /*
@@ -54,6 +55,9 @@ public class ArtifactMissingChecksumsConsumerTest
         File sha1File = new File( repoConfig.getLocation(), path + ".sha1" );
         File md5File = new File( repoConfig.getLocation(), path + ".md5" );
 
+        sha1File.delete();
+        md5File.delete();
+
         assertFalse( sha1File.exists() );
         assertFalse( md5File.exists() );
 
@@ -68,6 +72,11 @@ public class ArtifactMissingChecksumsConsumerTest
     public void testExistingIncorrectChecksums()
         throws Exception
     {
+        File newLocation = getTestFile( "target/test-repo" );
+        FileUtils.deleteDirectory( newLocation );
+        FileUtils.copyDirectory( new File( repoConfig.getLocation() ), newLocation );
+        repoConfig.setLocation( newLocation.getAbsolutePath() );
+
         String path = "/incorrect-checksums/1.0/incorrect-checksums-1.0.jar";
 
         File sha1File = new File( repoConfig.getLocation(), path + ".sha1" );