]> source.dussan.org Git - archiva.git/commitdiff
when deleting an artifact md5 and sha1 must be deleted too
authorOlivier Lamy <olamy@apache.org>
Tue, 5 Jun 2012 21:43:53 +0000 (21:43 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 5 Jun 2012 21:43:53 +0000 (21:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1346611 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/ManagedDefaultRepositoryContent.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java

index aabda49cfd0c9d8d178b1e1928eeb91b1ad63b67..0c626436fe14b0ddac9165a2d0c227c555813ba2 100644 (file)
@@ -86,6 +86,20 @@ public class ManagedDefaultRepositoryContent
         {
             FileUtils.deleteQuietly( filePath );
         }
+
+        File filePathmd5 = new File( getRepoRoot(), path + ".md5" );
+
+        if ( filePathmd5.exists() )
+        {
+            FileUtils.deleteQuietly( filePathmd5 );
+        }
+
+        File filePathsha1 = new File( getRepoRoot(), path + ".sha1" );
+
+        if ( filePathsha1.exists() )
+        {
+            FileUtils.deleteQuietly( filePathsha1 );
+        }
     }
 
     public String getId()
index 59fcbbd65fade030dc3d0cadb28a6fd54e0f9ae7..ad492a6c7c19f2d9dbae237cb3419a076460b636 100644 (file)
@@ -213,8 +213,17 @@ public class RepositoriesServiceTest
             File artifactFile = new File(
                 "target/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar" );
 
+            File artifactFilemd5 = new File(
+                "target/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.md5" );
+
+            File artifactFilesha1 = new File(
+                "target/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.sha1" );
+
             assertTrue( "artifact not exists:" + artifactFile.getPath(), artifactFile.exists() );
 
+            assertTrue( "md5 not exists:" + artifactFilemd5.getPath(), artifactFilemd5.exists() );
+            assertTrue( "sha1 not exists:" + artifactFilesha1.getPath(), artifactFilesha1.exists() );
+
             Artifact artifact = new Artifact();
             artifact.setGroupId( "commons-logging" );
             artifact.setArtifactId( "commons-logging" );
@@ -228,6 +237,8 @@ public class RepositoriesServiceTest
             repositoriesService.deleteArtifact( artifact );
 
             assertFalse( "artifact not deleted exists:" + artifactFile.getPath(), artifactFile.exists() );
+            assertFalse( "md5 still exists:" + artifactFilemd5.getPath(), artifactFilemd5.exists() );
+            assertFalse( "sha1 still exists:" + artifactFilesha1.getPath(), artifactFilesha1.exists() );
 
             artifacts =
                 browseService.getArtifactDownloadInfos( "commons-logging", "commons-logging", "1.0.1", SOURCE_REPO_ID );