]> source.dussan.org Git - archiva.git/commitdiff
[MRM-622] archiva-1.0.x@615120 tags/archiva-1.0.1@615120
authorMaria Odea B. Ching <oching@apache.org>
Fri, 25 Jan 2008 06:07:36 +0000 (06:07 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Fri, 25 Jan 2008 06:07:36 +0000 (06:07 +0000)
- added test for the order of deletion in RetentionCountRepositoryPurge

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@615120 13f79535-47bb-0310-9956-ffa450edef68

archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java
archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurgeTest.java
archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/maven/archiva/consumers/core/repository/RetentionCountRepositoryPurgeTest.java

index be209cc020427737bac065a8f6bff62a69c341b9..62385382422f59457d43399ffcba92dd81f0b695 100644 (file)
@@ -33,6 +33,7 @@ import org.jpox.SchemaTool;
 import java.io.File;
 import java.io.IOException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Properties;
@@ -229,4 +230,15 @@ public abstract class AbstractRepositoryPurgeTest
         
         return testDir.getAbsolutePath();
     }
+    
+    protected void populateDbForTestOrderOfDeletion()
+        throws Exception
+    {
+        List<String> versions = new ArrayList<String>();
+        versions.add( "1.1.2-20070427.065136-1" );
+        versions.add( "1.1.2-20070506.163513-2" );
+        versions.add( "1.1.2-20070615.105019-3" );
+    
+        populateDb( "org.apache.maven.plugins", "maven-assembly-plugin", versions );
+    }
 }
index 282b69edf451108c442c0c8266ffe2a1b094a408..9ed788f9f9558164a03fee4c347c86438fc5181b 100644 (file)
@@ -270,16 +270,5 @@ public class DaysOldRepositoryPurgeTest
         versions.add( "2.2-SNAPSHOT" );
 
         populateDb( "org.apache.maven.plugins", "maven-install-plugin", versions );
-    }
-
-    private void populateDbForTestOrderOfDeletion()
-        throws Exception
-    {
-        List<String> versions = new ArrayList<String>();
-        versions.add( "1.1.2-20070427.065136-1" );
-        versions.add( "1.1.2-20070506.163513-2" );
-        versions.add( "1.1.2-20070615.105019-3" );
-
-        populateDb( "org.apache.maven.plugins", "maven-assembly-plugin", versions );
-    }
+    }    
 }
index b9af53359a41168d0e44817c13040496ff349996..3cc7dd0ca31b7ddb3a9c3b66c989741a76faf5e7 100644 (file)
@@ -143,6 +143,41 @@ public class RetentionCountRepositoryPurgeTest
         assertExists( versionRoot + "/castor-anttasks-1.1.2-20070506.163513-2-sources.jar.sha1" );
     }
 
+    public void testOrderOfDeletion()
+        throws Exception
+    {
+        populateDbForTestOrderOfDeletion();
+
+        String repoRoot = prepareTestRepo();
+
+        repoPurge.process( PATH_TO_TEST_ORDER_OF_DELETION );
+
+        String versionRoot = repoRoot + 
+            "/org/apache/maven/plugins/maven-assembly-plugin/1.1.2-SNAPSHOT";
+        
+        assertDeleted( versionRoot + "/maven-assembly-plugin-1.1.2-20070427.065136-1.jar" );
+        assertDeleted( versionRoot + "/maven-assembly-plugin-1.1.2-20070427.065136-1.jar.sha1" );
+        assertDeleted( versionRoot + "/maven-assembly-plugin-1.1.2-20070427.065136-1.jar.md5" );
+        assertDeleted( versionRoot + "/maven-assembly-plugin-1.1.2-20070427.065136-1.pom" );
+        assertDeleted( versionRoot + "/maven-assembly-plugin-1.1.2-20070427.065136-1.pom.sha1" );
+        assertDeleted( versionRoot + "/maven-assembly-plugin-1.1.2-20070427.065136-1.pom.md5" );
+
+        // the following should not have been deleted
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070506.163513-2.jar" );
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070506.163513-2.jar.sha1" );
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070506.163513-2.jar.md5" );
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070506.163513-2.pom" );
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070506.163513-2.pom.sha1" );
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070506.163513-2.pom.md5" );
+
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070615.105019-3.jar" );
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070615.105019-3.jar.sha1" );
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070615.105019-3.jar.md5" );
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070615.105019-3.pom" );
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070615.105019-3.pom.sha1" );
+        assertExists( versionRoot + "/maven-assembly-plugin-1.1.2-20070615.105019-3.pom.md5" );
+    }
+    
     public void populateIfJarWasFoundDb()
         throws Exception
     {