From: Olivier Lamy Date: Wed, 7 Sep 2011 11:41:15 +0000 (+0000) Subject: MRM-1507 : api to configure ProxyConnector X-Git-Tag: archiva-1.4-M1~368 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=281092c41a59a5288a9918eff122d38f77313e32;p=archiva.git MRM-1507 : api to configure ProxyConnector git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1166130 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java index 40fe9baab..c5bcc3bdc 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java @@ -87,12 +87,6 @@ public abstract class AbstractRepositoryAdmin } } - protected List getProxyConnectors() - { - return new ArrayList( - archivaConfiguration.getConfiguration().getProxyConnectors() ); - } - public List getAuditListeners() { return auditListeners; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java index 6d1084887..99d80cf50 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java @@ -113,8 +113,9 @@ public class DefaultRemoteRepositoryAdmin configuration.removeRemoteRepository( remoteRepositoryConfiguration ); + // TODO use ProxyConnectorAdmin interface ? // [MRM-520] Proxy Connectors are not deleted with the deletion of a Repository. - List proxyConnectors = getProxyConnectors(); + List proxyConnectors = configuration.getProxyConnectors(); for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors ) { if ( StringUtils.equals( proxyConnector.getTargetRepoId(), repositoryId ) ) diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java index 27da863ed..0533faa37 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/AbstractRepositoryAdminTest.java @@ -23,6 +23,8 @@ import org.apache.archiva.admin.AuditInformation; import org.apache.archiva.admin.mock.MockAuditListener; import org.apache.archiva.admin.repository.managed.ManagedRepository; import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin; +import org.apache.archiva.admin.repository.proxyconnector.ProxyConnectorAdmin; +import org.apache.archiva.admin.repository.remote.RemoteRepository; import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; @@ -63,6 +65,9 @@ public abstract class AbstractRepositoryAdminTest @Inject protected ManagedRepositoryAdmin managedRepositoryAdmin; + @Inject + protected ProxyConnectorAdmin proxyConnectorAdmin; + protected AuditInformation getFakeAuditInformation() { AuditInformation auditInformation = new AuditInformation( getFakeUser(), "archiva-localhost" ); @@ -115,4 +120,21 @@ public abstract class AbstractRepositoryAdminTest } return null; } + + protected RemoteRepository getRemoteRepository() + { + return getRemoteRepository( "foo" ); + } + + protected RemoteRepository getRemoteRepository(String id) + { + RemoteRepository remoteRepository = new RemoteRepository(); + remoteRepository.setUrl( "http://foo.com/maven-it-rocks" ); + remoteRepository.setTimeout( 10 ); + remoteRepository.setName( "maven foo" ); + remoteRepository.setUserName( "foo-name" ); + remoteRepository.setPassword( "toto" ); + remoteRepository.setId( id ); + return remoteRepository; + } } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java index 44c5c12fe..85f8ef723 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/remote/RemoteRepositoryAdminTest.java @@ -149,15 +149,5 @@ public class RemoteRepositoryAdminTest } - private RemoteRepository getRemoteRepository() - { - RemoteRepository remoteRepository = new RemoteRepository(); - remoteRepository.setUrl( "http://foo.com/maven-it-rocks" ); - remoteRepository.setTimeout( 10 ); - remoteRepository.setName( "maven foo" ); - remoteRepository.setUserName( "foo-name" ); - remoteRepository.setPassword( "toto" ); - remoteRepository.setId( "foo" ); - return remoteRepository; - } + } diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index b680142cd..32f8abf9f 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -74,6 +74,13 @@ org.apache.archiva archiva-core-consumers + + org.apache.archiva + archiva-configuration + + org.apache.archiva archiva-metadata-consumer @@ -739,7 +746,7 @@ - + diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml index c0b2cb46e..b7bf7e78f 100644 --- a/archiva-modules/archiva-web/archiva-webdav/pom.xml +++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml @@ -42,6 +42,9 @@ org.apache.archiva archiva-configuration + org.apache.archiva diff --git a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditEvent.java b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditEvent.java index 779194927..99129dcfb 100644 --- a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditEvent.java +++ b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditEvent.java @@ -104,6 +104,12 @@ public class AuditEvent public static final String REMOVE_PATTERN = "Removed File Type Pattern"; public static final String MERGE_REPO_REMOTE = "Merged Staging Repository Triggered Remotely"; + + public static final String ADD_PROXY_CONNECTOR = "Added Proxy Connector"; + + public static final String DELETE_PROXY_CONNECTOR = "Deleted Proxy Connector"; + + public static final String MODIFY_PROXY_CONNECTOR = "Updated Proxy Connector"; private String repositoryId;