From 614a6c1e2f8a76abee98381a3fcf03900bcb9149 Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Sun, 22 Nov 2009 09:28:36 +0000 Subject: [MRM-747] Archiva should prevent re-deployment of released or non-snapshot versioned artifacts o make blocking of re-dployments configurable per repository o added test git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@883051 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/mdo/configuration.mdo | 7 ++++ .../archiva/configuration/default-archiva.xml | 2 ++ .../repositories/AddManagedRepositoryAction.java | 4 ++- .../WEB-INF/jsp/admin/include/repositoryForm.jspf | 1 + .../archiva/webdav/ArchivaDavResourceFactory.java | 8 ++--- .../webdav/AbstractRepositoryServletTestCase.java | 6 ++-- .../webdav/RepositoryServletDeployTest.java | 42 ++++++++++++++++++++++ .../RepositoryServletRepositoryGroupTest.java | 10 +++--- 8 files changed, 68 insertions(+), 12 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo index 1af52dd63..0187601c2 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo @@ -475,6 +475,13 @@ True if this repository contains release versioned artifacts. true + + blockRedeployments + 1.0.0+ + boolean + True if re-deployment of artifacts already in the repository will be blocked. + false + snapshots 1.0.0+ diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml b/archiva-modules/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml index 12473f3f1..51b54f82f 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml @@ -9,6 +9,7 @@ default true false + true true 0 0 * * * ? 30 @@ -20,6 +21,7 @@ default false true + false true 0 0\,30 * * * ? 30 diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java index b51bc7f94..97151c816 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/AddManagedRepositoryAction.java @@ -52,13 +52,15 @@ public class AddManagedRepositoryAction { this.repository = new ManagedRepositoryConfiguration(); this.repository.setReleases( false ); - this.repository.setScanned( false ); + this.repository.setScanned( false ); + this.repository.setBlockRedeployments( false ); } public String input() { this.repository.setReleases( true ); this.repository.setScanned( true ); + this.repository.setBlockRedeployments( true ); return INPUT; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/repositoryForm.jspf b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/repositoryForm.jspf index 4c7f44191..4e58c73c8 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/repositoryForm.jspf +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/include/repositoryForm.jspf @@ -28,6 +28,7 @@ + managedRepoIds = new ArrayList(); managedRepoIds.add( MANAGED_REPO_FIRST ); @@ -101,11 +101,11 @@ public class RepositoryServletRepositoryGroupTest // Create the repository group with an invalid managed repository repoRootInvalid = new File( appserverBase, "data/repositories/" + MANAGED_REPO_INVALID ); - ManagedRepositoryConfiguration managedRepositoryConfiguration = createManagedRepository( MANAGED_REPO_INVALID, "Invalid Test Repo", repoRootInvalid ); + ManagedRepositoryConfiguration managedRepositoryConfiguration = createManagedRepository( MANAGED_REPO_INVALID, "Invalid Test Repo", repoRootInvalid, true ); - configuration.addManagedRepository( createManagedRepository( MANAGED_REPO_FIRST, "First Test Repo", repoRootFirst ) ); + configuration.addManagedRepository( createManagedRepository( MANAGED_REPO_FIRST, "First Test Repo", repoRootFirst, true ) ); configuration.addManagedRepository( managedRepositoryConfiguration ); - configuration.addManagedRepository( createManagedRepository( MANAGED_REPO_LAST, "Last Test Repo", repoRootLast ) ); + configuration.addManagedRepository( createManagedRepository( MANAGED_REPO_LAST, "Last Test Repo", repoRootLast, true ) ); List invalidManagedRepoIds = new ArrayList(); invalidManagedRepoIds.add( MANAGED_REPO_FIRST ); -- cgit v1.2.3