diff options
author | Olivier Lamy <olamy@apache.org> | 2012-06-05 21:43:53 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-06-05 21:43:53 +0000 |
commit | 0af5a819d92981b42c6baba9324173c931bcf02d (patch) | |
tree | 1211d46120db1f11e4cce248dc2dd3d3af4d6c7f /archiva-modules | |
parent | a1230dc9e73484aeaf6138f2682c295c694927fc (diff) | |
download | archiva-0af5a819d92981b42c6baba9324173c931bcf02d.tar.gz archiva-0af5a819d92981b42c6baba9324173c931bcf02d.zip |
when deleting an artifact md5 and sha1 must be deleted too
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1346611 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
2 files changed, 25 insertions, 0 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/ManagedDefaultRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/ManagedDefaultRepositoryContent.java index aabda49cf..0c626436f 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/ManagedDefaultRepositoryContent.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/content/ManagedDefaultRepositoryContent.java @@ -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() diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java index 59fcbbd65..ad492a6c7 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java @@ -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 ); |