MRM-1507 : api to configure ProxyConnector

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1166130 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-07 11:41:15 +00:00
parent 9822a37199
commit 281092c41a
7 changed files with 42 additions and 19 deletions

View File

@ -87,12 +87,6 @@ public abstract class AbstractRepositoryAdmin
} }
} }
protected List<ProxyConnectorConfiguration> getProxyConnectors()
{
return new ArrayList<ProxyConnectorConfiguration>(
archivaConfiguration.getConfiguration().getProxyConnectors() );
}
public List<AuditListener> getAuditListeners() public List<AuditListener> getAuditListeners()
{ {
return auditListeners; return auditListeners;

View File

@ -113,8 +113,9 @@ public class DefaultRemoteRepositoryAdmin
configuration.removeRemoteRepository( remoteRepositoryConfiguration ); configuration.removeRemoteRepository( remoteRepositoryConfiguration );
// TODO use ProxyConnectorAdmin interface ?
// [MRM-520] Proxy Connectors are not deleted with the deletion of a Repository. // [MRM-520] Proxy Connectors are not deleted with the deletion of a Repository.
List<ProxyConnectorConfiguration> proxyConnectors = getProxyConnectors(); List<ProxyConnectorConfiguration> proxyConnectors = configuration.getProxyConnectors();
for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors ) for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
{ {
if ( StringUtils.equals( proxyConnector.getTargetRepoId(), repositoryId ) ) if ( StringUtils.equals( proxyConnector.getTargetRepoId(), repositoryId ) )

View File

@ -23,6 +23,8 @@ import org.apache.archiva.admin.AuditInformation;
import org.apache.archiva.admin.mock.MockAuditListener; import org.apache.archiva.admin.mock.MockAuditListener;
import org.apache.archiva.admin.repository.managed.ManagedRepository; import org.apache.archiva.admin.repository.managed.ManagedRepository;
import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin; 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.archiva.admin.repository.remote.RemoteRepositoryAdmin;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@ -63,6 +65,9 @@ public abstract class AbstractRepositoryAdminTest
@Inject @Inject
protected ManagedRepositoryAdmin managedRepositoryAdmin; protected ManagedRepositoryAdmin managedRepositoryAdmin;
@Inject
protected ProxyConnectorAdmin proxyConnectorAdmin;
protected AuditInformation getFakeAuditInformation() protected AuditInformation getFakeAuditInformation()
{ {
AuditInformation auditInformation = new AuditInformation( getFakeUser(), "archiva-localhost" ); AuditInformation auditInformation = new AuditInformation( getFakeUser(), "archiva-localhost" );
@ -115,4 +120,21 @@ public abstract class AbstractRepositoryAdminTest
} }
return null; 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;
}
} }

View File

@ -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;
}
} }

View File

@ -74,6 +74,13 @@
<groupId>org.apache.archiva</groupId> <groupId>org.apache.archiva</groupId>
<artifactId>archiva-core-consumers</artifactId> <artifactId>archiva-core-consumers</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-configuration</artifactId>
<!-- TODO uncomment when repository admin will be finished
<scope>runtime</scope>
-->
</dependency>
<dependency> <dependency>
<groupId>org.apache.archiva</groupId> <groupId>org.apache.archiva</groupId>
<artifactId>archiva-metadata-consumer</artifactId> <artifactId>archiva-metadata-consumer</artifactId>
@ -739,7 +746,7 @@
</goals> </goals>
<configuration> <configuration>
<tasks> <tasks>
<copy overwrite="true" file="${basedir}/src/test/resources/log4j.xml" todir="${project.build.directory}/classes" /> <copy overwrite="true" file="${basedir}/src/test/tomcat/log4j.xml" todir="${project.build.directory}/classes" />
<delete dir="${basedir}/src/main/webapp/WEB-INF/lib" /> <delete dir="${basedir}/src/main/webapp/WEB-INF/lib" />
</tasks> </tasks>
</configuration> </configuration>

View File

@ -42,6 +42,9 @@
<dependency> <dependency>
<groupId>org.apache.archiva</groupId> <groupId>org.apache.archiva</groupId>
<artifactId>archiva-configuration</artifactId> <artifactId>archiva-configuration</artifactId>
<!-- TODO uncomment when repository admin will be finished
<scope>runtime</scope>
-->
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.archiva</groupId> <groupId>org.apache.archiva</groupId>

View File

@ -104,6 +104,12 @@ public class AuditEvent
public static final String REMOVE_PATTERN = "Removed File Type Pattern"; 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 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; private String repositoryId;