From e7bc35db81e879f19a7846098d1f6eed31e1b142 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 11 Oct 2012 22:43:15 +0000 Subject: add unit test for new method in MetadataRepository and fix compilation for some impls/mocks git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1397345 13f79535-47bb-0310-9956-ffa450edef68 --- .../metadata/repository/TestMetadataRepository.java | 6 ++++++ .../repository/file/FileMetadataRepository.java | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'archiva-modules/plugins') diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java index 3f615c09b..214e6a81e 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java @@ -217,4 +217,10 @@ public class TestMetadataRepository { } + + public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion ) + throws MetadataRepositoryException + { + + } } \ No newline at end of file diff --git a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java index 3294ab895..87c3b6711 100644 --- a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java +++ b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java @@ -703,7 +703,6 @@ public class FileMetadataRepository * @param namespace * @param project * @param projectVersion - * @param projectId * @param metadataFacet will remove artifacts which have this {@link MetadataFacet} using equals * @throws MetadataRepositoryException */ @@ -1163,6 +1162,24 @@ public class FileMetadataRepository return projectVersions; } + + public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion ) + throws MetadataRepositoryException + { + File directory = new File( getDirectory( repoId ), namespace + "/" + projectId + "/" + projectVersion ); + if ( directory.exists() ) + { + try + { + FileUtils.deleteDirectory( directory ); + } + catch ( IOException e ) + { + throw new MetadataRepositoryException( e.getMessage(), e ); + } + } + } + private void writeProperties( Properties properties, File directory, String propertiesKey ) throws IOException { -- cgit v1.2.3