diff --git a/archiva-modules/archiva-base/archiva-maven2-common/pom.xml b/archiva-modules/archiva-base/archiva-maven2-common/pom.xml new file mode 100644 index 000000000..098121044 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-maven2-common/pom.xml @@ -0,0 +1,55 @@ + + + + + + archiva-base + org.apache.archiva + 3.0.0-SNAPSHOT + + 4.0.0 + + archiva-maven2-common + Archiva Base :: Maven2 Common + + + + org.apache.archiva + archiva-proxy-api + + + org.apache.maven.wagon + wagon-provider-api + + + org.apache.maven.wagon + wagon-file + test + + + commons-lang + commons-lang + + + + + \ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DebugTransferListener.java b/archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/DebugTransferListener.java similarity index 98% rename from archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DebugTransferListener.java rename to archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/DebugTransferListener.java index 322092f7c..f5ceaaea5 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DebugTransferListener.java +++ b/archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/DebugTransferListener.java @@ -1,4 +1,4 @@ -package org.apache.archiva.proxy.common; +package org.apache.archiva.proxy.maven; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java b/archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/DefaultWagonFactory.java similarity index 98% rename from archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java rename to archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/DefaultWagonFactory.java index 975781306..2e4d1d5b4 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/DefaultWagonFactory.java +++ b/archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/DefaultWagonFactory.java @@ -1,4 +1,4 @@ -package org.apache.archiva.proxy.common; +package org.apache.archiva.proxy.maven; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactory.java b/archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/WagonFactory.java similarity index 96% rename from archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactory.java rename to archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/WagonFactory.java index 6e00c4a32..379be7459 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactory.java +++ b/archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/WagonFactory.java @@ -1,4 +1,4 @@ -package org.apache.archiva.proxy.common; +package org.apache.archiva.proxy.maven; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryException.java b/archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/WagonFactoryException.java similarity index 96% rename from archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryException.java rename to archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/WagonFactoryException.java index 649e7eed7..2bb7e27c3 100755 --- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryException.java +++ b/archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/WagonFactoryException.java @@ -1,4 +1,4 @@ -package org.apache.archiva.proxy.common; +package org.apache.archiva.proxy.maven; /* * Licensed to the Apache Software Foundation (ASF) under one diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java b/archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/WagonFactoryRequest.java similarity index 97% rename from archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java rename to archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/WagonFactoryRequest.java index e348899ef..e51070c96 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/java/org/apache/archiva/proxy/common/WagonFactoryRequest.java +++ b/archiva-modules/archiva-base/archiva-maven2-common/src/main/java/org/apache/archiva/proxy/maven/WagonFactoryRequest.java @@ -1,4 +1,4 @@ -package org.apache.archiva.proxy.common; +package org.apache.archiva.proxy.maven; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -18,7 +18,7 @@ package org.apache.archiva.proxy.common; * under the License. */ -import org.apache.archiva.admin.model.beans.NetworkProxy; +import org.apache.archiva.proxy.model.NetworkProxy; import org.apache.commons.lang.StringUtils; import java.util.HashMap; diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml b/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml index 16df6c316..8911af1ad 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/pom.xml @@ -48,7 +48,11 @@ org.apache.archiva - archiva-proxy-common + archiva-proxy + + + org.apache.archiva + archiva-maven2-common org.springframework diff --git a/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java index cc7cef0eb..375f726eb 100644 --- a/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java +++ b/archiva-modules/archiva-base/archiva-maven2-indexer/src/main/java/org/apache/archiva/indexer/maven/MavenIndexManager.java @@ -20,8 +20,6 @@ package org.apache.archiva.indexer.maven; */ import org.apache.archiva.admin.model.RepositoryAdminException; -import org.apache.archiva.admin.model.beans.NetworkProxy; -import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin; import org.apache.archiva.common.utils.FileUtils; import org.apache.archiva.common.utils.PathUtil; import org.apache.archiva.configuration.ArchivaConfiguration; @@ -30,9 +28,11 @@ import org.apache.archiva.indexer.ArchivaIndexingContext; import org.apache.archiva.indexer.IndexCreationFailedException; import org.apache.archiva.indexer.IndexUpdateFailedException; import org.apache.archiva.indexer.UnsupportedBaseContextException; -import org.apache.archiva.proxy.common.WagonFactory; -import org.apache.archiva.proxy.common.WagonFactoryException; -import org.apache.archiva.proxy.common.WagonFactoryRequest; +import org.apache.archiva.proxy.ProxyRegistry; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactoryException; +import org.apache.archiva.proxy.maven.WagonFactoryRequest; +import org.apache.archiva.proxy.model.NetworkProxy; import org.apache.archiva.repository.EditableRepository; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.PasswordCredentials; @@ -125,15 +125,15 @@ public class MavenIndexManager implements ArchivaIndexManager { @Inject private WagonFactory wagonFactory; - @Inject - private NetworkProxyAdmin networkProxyAdmin; - @Inject private IndexUpdater indexUpdater; @Inject private ArtifactContextProducer artifactContextProducer; + @Inject + private ProxyRegistry proxyRegistry; + public static final String DEFAULT_INDEXER_DIR = ".indexer"; public static final String DEFAULT_PACKED_INDEX_DIR = ".index"; @@ -291,14 +291,7 @@ public class MavenIndexManager implements ArchivaIndexManager { RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); if ( StringUtils.isNotBlank( rif.getProxyId( ) ) ) { - try - { - networkProxy = networkProxyAdmin.getNetworkProxy( rif.getProxyId( ) ); - } - catch ( RepositoryAdminException e ) - { - log.error( "Error occured while retrieving proxy {}", e.getMessage( ) ); - } + networkProxy = proxyRegistry.getNetworkProxy( rif.getProxyId( ) ); if ( networkProxy == null ) { log.warn( diff --git a/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/NetworkProxy.java b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/NetworkProxy.java new file mode 100644 index 000000000..849a89384 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/NetworkProxy.java @@ -0,0 +1,192 @@ +package org.apache.archiva.proxy.model; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.Serializable; + +public class NetworkProxy + implements Serializable +{ + private String id; + + /** + * The network protocol to use with this proxy: "http", "socks-4" + * . + */ + private String protocol = "http"; + + /** + * The proxy host. + */ + private String host; + + /** + * The proxy port. + */ + private int port = 8080; + + /** + * The proxy user. + */ + private String username; + + /** + * The proxy password. + */ + private String password; + + /** + * @since 1.4-M3 + * + * use NTLM proxy + */ + private boolean useNtlm; + + public NetworkProxy() + { + // no op + } + + public NetworkProxy( String id, String protocol, String host, int port, String username, String password ) + { + this.id = id; + this.protocol = protocol; + this.host = host; + this.port = port; + this.username = username; + this.password = password; + } + + public String getId() + { + return id; + } + + public void setId( String id ) + { + this.id = id; + } + + public String getProtocol() + { + return protocol; + } + + public void setProtocol( String protocol ) + { + this.protocol = protocol; + } + + public String getHost() + { + return host; + } + + public void setHost( String host ) + { + this.host = host; + } + + public int getPort() + { + return port; + } + + public void setPort( int port ) + { + this.port = port; + } + + public String getUsername() + { + return username; + } + + public void setUsername( String username ) + { + this.username = username; + } + + public String getPassword() + { + return password; + } + + public void setPassword( String password ) + { + this.password = password; + } + + public boolean isUseNtlm() + { + return useNtlm; + } + + public void setUseNtlm( boolean useNtlm ) + { + this.useNtlm = useNtlm; + } + + @Override + public boolean equals( Object o ) + { + if ( this == o ) + { + return true; + } + if ( o == null || getClass() != o.getClass() ) + { + return false; + } + + NetworkProxy that = (NetworkProxy) o; + + if ( id != null ? !id.equals( that.id ) : that.id != null ) + { + return false; + } + + return true; + } + + @Override + public int hashCode() + { + int result = 629 + ( id != null ? id.hashCode() : 0 ); + return result; + } + + @Override + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append( "NetworkProxy" ); + sb.append( "{id='" ).append( id ).append( '\'' ); + sb.append( ", protocol='" ).append( protocol ).append( '\'' ); + sb.append( ", host='" ).append( host ).append( '\'' ); + sb.append( ", port=" ).append( port ); + sb.append( ", username='" ).append( username ).append( '\'' ); + //sb.append( ", password='" ).append( password ).append( '\'' ); + sb.append( ", useNtlm=" ).append( useNtlm ); + sb.append( '}' ); + return sb.toString(); + } +} + diff --git a/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnector.java b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnector.java index d653de572..8e8887b94 100644 --- a/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnector.java +++ b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnector.java @@ -49,6 +49,8 @@ public class ProxyConnector private boolean disabled; + private Map properties; + public ProxyConnector() { // no op @@ -167,4 +169,13 @@ public class ProxyConnector { this.order = order; } + + + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRuleType.java b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnectorRuleType.java similarity index 97% rename from archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRuleType.java rename to archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnectorRuleType.java index 4eaf6fdba..4f8417d37 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRuleType.java +++ b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/ProxyConnectorRuleType.java @@ -1,4 +1,4 @@ -package org.apache.archiva.admin.model.beans; +package org.apache.archiva.proxy.model; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/RepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/RepositoryProxyHandler.java similarity index 91% rename from archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/RepositoryProxyConnectors.java rename to archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/RepositoryProxyHandler.java index 1216fe253..eee2d86d2 100644 --- a/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/RepositoryProxyConnectors.java +++ b/archiva-modules/archiva-base/archiva-proxy-api/src/main/java/org/apache/archiva/proxy/model/RepositoryProxyHandler.java @@ -22,17 +22,22 @@ package org.apache.archiva.proxy.model; import org.apache.archiva.model.ArtifactReference; import org.apache.archiva.policies.ProxyDownloadException; import org.apache.archiva.repository.ManagedRepositoryContent; +import org.apache.archiva.repository.RepositoryType; import java.nio.file.Path; import java.util.List; +import java.util.Map; /** * Handler for potential repository proxy connectors. * * */ -public interface RepositoryProxyConnectors +public interface RepositoryProxyHandler { + + List supports(); + /** * Performs the artifact fetch operation against the target repositories * of the provided source repository. @@ -88,4 +93,12 @@ public interface RepositoryProxyConnectors * repository as a source repository. */ boolean hasProxies( ManagedRepositoryContent repository ); + + void setNetworkProxies(Map proxies); + + Map getNetworkProxies(); + + NetworkProxy getNetworkProxy(String id); + + } diff --git a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml b/archiva-modules/archiva-base/archiva-proxy-maven/pom.xml similarity index 58% rename from archiva-modules/archiva-base/archiva-proxy-common/pom.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/pom.xml index fa95a18cf..a6d77c3fd 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy-maven/pom.xml @@ -24,14 +24,18 @@ org.apache.archiva 3.0.0-SNAPSHOT - archiva-proxy-common - Archiva Base :: Proxy Common + archiva-proxy-maven + Archiva Base :: Proxy Maven ${project.parent.parent.basedir} + + org.apache.archiva + archiva-maven2-common + org.apache.archiva archiva-plexus-bridge @@ -44,6 +48,10 @@ org.apache.maven.archetype archetype-common + + org.apache.archiva + archiva-proxy + org.apache.maven.wagon wagon-provider-api @@ -75,6 +83,13 @@ commons-logging commons-logging + org.apache.archiva archiva-test-utils @@ -86,5 +101,64 @@ asm test + + org.eclipse.jetty + jetty-server + test + + + org.assertj + assertj-core + test + + + org.hsqldb + hsqldb + test + + + org.apache.archiva.redback.components.registry + spring-registry-commons + test + + + org.apache.archiva + archiva-test-utils + ${project.version} + test + + + org.apache.archiva + archiva-mock + test + + + org.assertj + assertj-core + test + + + org.hsqldb + hsqldb + test + + + org.apache.archiva.redback + redback-rbac-cached + test + + + org.apache.derby + derby + test + + + org.apache.archiva.redback + redback-common-test-resources + test + + + + diff --git a/archiva-modules/archiva-base/archiva-proxy-maven/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java new file mode 100644 index 000000000..2ab724389 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy-maven/src/main/java/org/apache/archiva/proxy/maven/MavenRepositoryProxyHandler.java @@ -0,0 +1,427 @@ +package org.apache.archiva.proxy.maven; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.archiva.configuration.NetworkProxyConfiguration; +import org.apache.archiva.model.RepositoryURL; +import org.apache.archiva.proxy.DefaultRepositoryProxyHandler; +import org.apache.archiva.proxy.NotFoundException; +import org.apache.archiva.proxy.NotModifiedException; +import org.apache.archiva.proxy.ProxyException; +import org.apache.archiva.proxy.model.NetworkProxy; +import org.apache.archiva.proxy.model.ProxyConnector; +import org.apache.archiva.repository.*; +import org.apache.commons.lang.StringUtils; +import org.apache.maven.wagon.ConnectionException; +import org.apache.maven.wagon.ResourceDoesNotExistException; +import org.apache.maven.wagon.Wagon; +import org.apache.maven.wagon.WagonException; +import org.apache.maven.wagon.authentication.AuthenticationException; +import org.apache.maven.wagon.authentication.AuthenticationInfo; +import org.apache.maven.wagon.proxy.ProxyInfo; +import org.apache.maven.wagon.repository.Repository; +import org.springframework.stereotype.Service; + +import javax.inject.Inject; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +/** + * DefaultRepositoryProxyHandler + * TODO exception handling needs work - "not modified" is not really an exceptional case, and it has more layers than + * your average brown onion + */ +@Service("repositoryProxyConnectors#maven") +public class MavenRepositoryProxyHandler extends DefaultRepositoryProxyHandler { + + private static final List REPOSITORY_TYPES = new ArrayList<>(); + static { + REPOSITORY_TYPES.add(RepositoryType.MAVEN); + } + + @Inject + private WagonFactory wagonFactory; + + private ConcurrentMap networkProxyMap = new ConcurrentHashMap<>(); + + @Override + public void initialize() { + super.initialize(); + } + + private void updateWagonProxyInfo(Map proxyList) { + this.networkProxyMap.clear(); + List networkProxies = getArchivaConfiguration().getConfiguration().getNetworkProxies(); + for ( Map.Entry proxyEntry: proxyList.entrySet() ) + { + String key = proxyEntry.getKey(); + NetworkProxy networkProxyDef = proxyEntry.getValue(); + + ProxyInfo proxy = new ProxyInfo(); + + proxy.setType( networkProxyDef.getProtocol() ); + proxy.setHost( networkProxyDef.getHost() ); + proxy.setPort( networkProxyDef.getPort() ); + proxy.setUserName( networkProxyDef.getUsername() ); + proxy.setPassword( networkProxyDef.getPassword() ); + + this.networkProxyMap.put( key, proxy ); + } + } + + @Override + public void setNetworkProxies(Map proxies) { + super.setNetworkProxies(proxies); + updateWagonProxyInfo(proxies); + } + + /** + * @param connector + * @param remoteRepository + * @param tmpMd5 + * @param tmpSha1 + * @param tmpResource + * @param url + * @param remotePath + * @param resource + * @param workingDirectory + * @param repository + * @throws ProxyException + * @throws NotModifiedException + * + */ + protected void transferResources( ProxyConnector connector, RemoteRepositoryContent remoteRepository, Path tmpMd5, + Path tmpSha1, Path tmpResource, String url, String remotePath, Path resource, + Path workingDirectory, ManagedRepositoryContent repository ) + throws ProxyException, NotModifiedException + { + Wagon wagon = null; + try + { + RepositoryURL repoUrl = remoteRepository.getURL(); + String protocol = repoUrl.getProtocol(); + NetworkProxy networkProxy = null; + String proxyId = connector.getProxyId(); + if ( StringUtils.isNotBlank( proxyId ) ) + { + + networkProxy = getNetworkProxy( proxyId ); + } + if (networkProxy==null) { + throw new ProxyException("No network proxy configurations found for id "+proxyId); + } + WagonFactoryRequest wagonFactoryRequest = new WagonFactoryRequest( "wagon#" + protocol, + remoteRepository.getRepository().getExtraHeaders() ).networkProxy( + networkProxy ); + wagon = wagonFactory.getWagon( wagonFactoryRequest ); + if ( wagon == null ) + { + throw new ProxyException( "Unsupported target repository protocol: " + protocol ); + } + + if ( wagon == null ) + { + throw new ProxyException( "Unsupported target repository protocol: " + protocol ); + } + + boolean connected = connectToRepository( connector, wagon, remoteRepository ); + if ( connected ) + { + transferArtifact( wagon, remoteRepository, remotePath, repository, resource, workingDirectory, + tmpResource ); + + // TODO: these should be used to validate the download based on the policies, not always downloaded + // to + // save on connections since md5 is rarely used + transferChecksum( wagon, remoteRepository, remotePath, repository, resource, workingDirectory, ".sha1", + tmpSha1 ); + transferChecksum( wagon, remoteRepository, remotePath, repository, resource, workingDirectory, ".md5", + tmpMd5 ); + } + } + catch ( NotFoundException e ) + { + urlFailureCache.cacheFailure( url ); + throw e; + } + catch ( NotModifiedException e ) + { + // Do not cache url here. + throw e; + } + catch ( ProxyException e ) + { + urlFailureCache.cacheFailure( url ); + throw e; + } + catch ( WagonFactoryException e ) + { + throw new ProxyException( e.getMessage(), e ); + } + finally + { + if ( wagon != null ) + { + try + { + wagon.disconnect(); + } + catch ( ConnectionException e ) + { + log.warn( "Unable to disconnect wagon.", e ); + } + } + } + } + + protected void transferArtifact( Wagon wagon, RemoteRepositoryContent remoteRepository, String remotePath, + ManagedRepositoryContent repository, Path resource, Path tmpDirectory, + Path destFile ) + throws ProxyException + { + transferSimpleFile( wagon, remoteRepository, remotePath, repository, resource, destFile ); + } + + /** + *

+ * Quietly transfer the checksum file from the remote repository to the local file. + *

+ * + * @param wagon the wagon instance (should already be connected) to use. + * @param remoteRepository the remote repository to transfer from. + * @param remotePath the remote path to the resource to get. + * @param repository the managed repository that will hold the file + * @param resource the local file that should contain the downloaded contents + * @param tmpDirectory the temporary directory to download to + * @param ext the type of checksum to transfer (example: ".md5" or ".sha1") + * @throws ProxyException if copying the downloaded file into place did not succeed. + */ + protected void transferChecksum( Wagon wagon, RemoteRepositoryContent remoteRepository, String remotePath, + ManagedRepositoryContent repository, Path resource, Path tmpDirectory, String ext, + Path destFile ) + throws ProxyException + { + String url = remoteRepository.getURL().getUrl() + remotePath + ext; + + // Transfer checksum does not use the policy. + if ( urlFailureCache.hasFailedBefore( url ) ) + { + return; + } + + try + { + transferSimpleFile( wagon, remoteRepository, remotePath + ext, repository, resource, destFile ); + log.debug( "Checksum {} Downloaded: {} to move to {}", url, destFile, resource ); + } + catch ( NotFoundException e ) + { + urlFailureCache.cacheFailure( url ); + log.debug( "Transfer failed, checksum not found: {}", url ); + // Consume it, do not pass this on. + } + catch ( NotModifiedException e ) + { + log.debug( "Transfer skipped, checksum not modified: {}", url ); + // Consume it, do not pass this on. + } + catch ( ProxyException e ) + { + urlFailureCache.cacheFailure( url ); + log.warn( "Transfer failed on checksum: {} : {}", url, e.getMessage(), e ); + // Critical issue, pass it on. + throw e; + } + } + + /** + * Perform the transfer of the remote file to the local file specified. + * + * @param wagon the wagon instance to use. + * @param remoteRepository the remote repository to use + * @param remotePath the remote path to attempt to get + * @param repository the managed repository that will hold the file + * @param origFile the local file to save to + * @throws ProxyException if there was a problem moving the downloaded file into place. + */ + protected void transferSimpleFile( Wagon wagon, RemoteRepositoryContent remoteRepository, String remotePath, + ManagedRepositoryContent repository, Path origFile, Path destFile ) + throws ProxyException + { + assert ( remotePath != null ); + + // Transfer the file. + try + { + boolean success = false; + + if ( !Files.exists(origFile)) + { + log.debug( "Retrieving {} from {}", remotePath, remoteRepository.getRepository().getName() ); + wagon.get( addParameters( remotePath, remoteRepository.getRepository() ), destFile.toFile() ); + success = true; + + // You wouldn't get here on failure, a WagonException would have been thrown. + log.debug( "Downloaded successfully." ); + } + else + { + log.debug( "Retrieving {} from {} if updated", remotePath, remoteRepository.getRepository().getName() ); + try + { + success = wagon.getIfNewer( addParameters( remotePath, remoteRepository.getRepository() ), destFile.toFile(), + Files.getLastModifiedTime(origFile).toMillis()); + } + catch ( IOException e ) + { + throw new ProxyException( "Failed to the modification time of "+origFile.toAbsolutePath() ); + } + if ( !success ) + { + throw new NotModifiedException( + "Not downloaded, as local file is newer than remote side: " + origFile.toAbsolutePath() ); + } + + if ( Files.exists(destFile)) + { + log.debug( "Downloaded successfully." ); + } + } + } + catch ( ResourceDoesNotExistException e ) + { + throw new NotFoundException( + "Resource [" + remoteRepository.getURL() + "/" + remotePath + "] does not exist: " + e.getMessage(), + e ); + } + catch ( WagonException e ) + { + // TODO: shouldn't have to drill into the cause, but TransferFailedException is often not descriptive enough + + String msg = + "Download failure on resource [" + remoteRepository.getURL() + "/" + remotePath + "]:" + e.getMessage(); + if ( e.getCause() != null ) + { + msg += " (cause: " + e.getCause() + ")"; + } + throw new ProxyException( msg, e ); + } + } + + /** + * Using wagon, connect to the remote repository. + * + * @param connector the connector configuration to utilize (for obtaining network proxy configuration from) + * @param wagon the wagon instance to establish the connection on. + * @param remoteRepository the remote repository to connect to. + * @return true if the connection was successful. false if not connected. + */ + protected boolean connectToRepository( ProxyConnector connector, Wagon wagon, + RemoteRepositoryContent remoteRepository ) + { + boolean connected = false; + + final ProxyInfo networkProxy = + connector.getProxyId() == null ? null : this.networkProxyMap.get( connector.getProxyId() ); + + if ( log.isDebugEnabled() ) + { + if ( networkProxy != null ) + { + // TODO: move to proxyInfo.toString() + String msg = "Using network proxy " + networkProxy.getHost() + ":" + networkProxy.getPort() + + " to connect to remote repository " + remoteRepository.getURL(); + if ( networkProxy.getNonProxyHosts() != null ) + { + msg += "; excluding hosts: " + networkProxy.getNonProxyHosts(); + } + if ( StringUtils.isNotBlank( networkProxy.getUserName() ) ) + { + msg += "; as user: " + networkProxy.getUserName(); + } + log.debug( msg ); + } + } + + AuthenticationInfo authInfo = null; + String username = ""; + String password = ""; + RepositoryCredentials repCred = remoteRepository.getRepository().getLoginCredentials(); + if (repCred!=null && repCred instanceof PasswordCredentials) { + PasswordCredentials pwdCred = (PasswordCredentials) repCred; + username = pwdCred.getUsername(); + password = pwdCred.getPassword()==null ? "" : new String(pwdCred.getPassword()); + } + + if ( StringUtils.isNotBlank( username ) && StringUtils.isNotBlank( password ) ) + { + log.debug( "Using username {} to connect to remote repository {}", username, remoteRepository.getURL() ); + authInfo = new AuthenticationInfo(); + authInfo.setUserName( username ); + authInfo.setPassword( password ); + } + + // Convert seconds to milliseconds + + long timeoutInMilliseconds = remoteRepository.getRepository().getTimeout().toMillis(); + + // Set timeout read and connect + // FIXME olamy having 2 config values + wagon.setReadTimeout( (int) timeoutInMilliseconds ); + wagon.setTimeout( (int) timeoutInMilliseconds ); + + try + { + Repository wagonRepository = + new Repository( remoteRepository.getId(), remoteRepository.getURL().toString() ); + wagon.connect( wagonRepository, authInfo, networkProxy ); + connected = true; + } + catch ( ConnectionException | AuthenticationException e ) + { + log.warn( "Could not connect to {}: {}", remoteRepository.getRepository().getName(), e.getMessage() ); + connected = false; + } + + return connected; + } + + + public WagonFactory getWagonFactory() + { + return wagonFactory; + } + + public void setWagonFactory( WagonFactory wagonFactory ) + { + this.wagonFactory = wagonFactory; + } + + @Override + public List supports() { + return REPOSITORY_TYPES; + } +} diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/main/resources/META-INF/spring-context.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/main/resources/META-INF/spring-context.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/MockRepositoryArchivaTaskScheduler.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/metadata/repository/MockRepositoryArchivaTaskScheduler.java similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/MockRepositoryArchivaTaskScheduler.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/metadata/repository/MockRepositoryArchivaTaskScheduler.java diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java similarity index 94% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java index 30e17f92b..4813ddd8b 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java @@ -20,8 +20,6 @@ package org.apache.archiva.proxy; */ import net.sf.ehcache.CacheManager; -import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; -import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.configuration.ProxyConnectorConfiguration; @@ -32,11 +30,8 @@ import org.apache.archiva.policies.PropagateErrorsDownloadPolicy; import org.apache.archiva.policies.PropagateErrorsOnUpdateDownloadPolicy; import org.apache.archiva.policies.ReleasesPolicy; import org.apache.archiva.policies.SnapshotsPolicy; -import org.apache.archiva.proxy.model.RepositoryProxyConnectors; -import org.apache.archiva.repository.ManagedRepositoryContent; -import org.apache.archiva.repository.RepositoryContentProvider; -import org.apache.archiva.repository.RepositoryRegistry; -import org.apache.archiva.repository.maven2.MavenManagedRepository; +import org.apache.archiva.proxy.model.RepositoryProxyHandler; +import org.apache.archiva.repository.*; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.maven.wagon.Wagon; import org.easymock.EasyMock; @@ -52,7 +47,6 @@ import javax.inject.Inject; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; -import java.net.URI; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; @@ -110,7 +104,7 @@ public abstract class AbstractProxyTestCase protected Wagon wagonMock; - protected RepositoryProxyConnectors proxyHandler; + protected RepositoryProxyHandler proxyHandler; protected ManagedRepositoryContent managedDefaultRepository; @@ -142,10 +136,7 @@ public abstract class AbstractProxyTestCase managedDefaultDir = Paths.get( managedDefaultRepository.getRepoRoot() ); - org.apache.archiva.repository.ManagedRepository repoConfig = managedDefaultRepository.getRepository(); - - ( (DefaultManagedRepositoryAdmin) applicationContext.getBean( - ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config ); + org.apache.archiva.repository.ManagedRepository repoConfig = repositoryRegistry.getManagedRepository(ID_DEFAULT_MANAGED); applicationContext.getBean( RepositoryRegistry.class ).putRepository( repoConfig ); @@ -172,9 +163,9 @@ public abstract class AbstractProxyTestCase // Setup the proxy handler. - //proxyHandler = applicationContext.getBean (RepositoryProxyConnectors) lookup( RepositoryProxyConnectors.class.getName() ); + //proxyHandler = applicationContext.getBean (RepositoryProxyHandler) lookup( RepositoryProxyHandler.class.getName() ); - proxyHandler = applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyConnectors.class ); + proxyHandler = applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyHandler.class ); // Setup the wagon mock. @@ -328,14 +319,9 @@ public abstract class AbstractProxyTestCase protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout ) throws Exception { - MavenManagedRepository repo = new MavenManagedRepository(id, name, Paths.get(path).getParent()); - repo.setLocation( new URI(path) ); - repo.setLayout( layout ); - - RepositoryContentProvider provider = applicationContext.getBean( "repositoryContentProvider#maven", RepositoryContentProvider.class ); - ManagedRepositoryContent repoContent = - provider.createManagedContent( repo ); - return repoContent; + ManagedRepository repo = new BasicManagedRepository(id, name, Paths.get(path)); + repositoryRegistry.putRepository(repo); + return repositoryRegistry.getManagedRepository(id).getContent(); } /** diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/ChecksumTransferTest.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/ChecksumTransferTest.java similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/ChecksumTransferTest.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/ChecksumTransferTest.java diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/ErrorHandlingTest.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/ErrorHandlingTest.java similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/ErrorHandlingTest.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/ErrorHandlingTest.java diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java similarity index 85% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java index 6978fde22..d3e207af9 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java +++ b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java @@ -19,8 +19,6 @@ package org.apache.archiva.proxy; * under the License. */ -import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; -import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.NetworkProxyConfiguration; import org.apache.archiva.configuration.ProxyConnectorConfiguration; @@ -32,11 +30,8 @@ import org.apache.archiva.policies.PropagateErrorsDownloadPolicy; import org.apache.archiva.policies.PropagateErrorsOnUpdateDownloadPolicy; import org.apache.archiva.policies.ReleasesPolicy; import org.apache.archiva.policies.SnapshotsPolicy; -import org.apache.archiva.proxy.model.RepositoryProxyConnectors; -import org.apache.archiva.repository.ManagedRepositoryContent; -import org.apache.archiva.repository.RepositoryContentProvider; -import org.apache.archiva.repository.RepositoryRegistry; -import org.apache.archiva.repository.maven2.MavenManagedRepository; +import org.apache.archiva.proxy.model.RepositoryProxyHandler; +import org.apache.archiva.repository.*; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.io.FileUtils; import org.assertj.core.api.Assertions; @@ -58,7 +53,6 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.net.URI; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; @@ -83,7 +77,7 @@ public class HttpProxyTransferTest private static final String PROXIED_BASEDIR = "src/test/repositories/proxied1"; - private RepositoryProxyConnectors proxyHandler; + private RepositoryProxyHandler proxyHandler; private ArchivaConfiguration config; @@ -92,13 +86,24 @@ public class HttpProxyTransferTest @Inject private ApplicationContext applicationContext; + @Inject + private RepositoryRegistry repositoryRegistry; + private Server server; + protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout ) + throws Exception + { + ManagedRepository repo = new BasicManagedRepository(id, name, Paths.get(path)); + repositoryRegistry.putRepository(repo); + return repositoryRegistry.getManagedRepository(id).getContent(); + } + @Before public void setUp() throws Exception { - proxyHandler = applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyConnectors.class ); + proxyHandler = applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyHandler.class ); config = applicationContext.getBean( "archivaConfiguration#mock", ArchivaConfiguration.class ); @@ -120,26 +125,7 @@ public class HttpProxyTransferTest // Make the destination dir. Files.createDirectories(destRepoDir); - MavenManagedRepository repo = new MavenManagedRepository( MANAGED_ID, "Default Managed Repository", Paths.get(repoPath).getParent() ); - repo.setLocation( new URI(repoPath) ); - repo.setLayout( "default" ); - - RepositoryContentProvider provider = applicationContext.getBean( "repositoryContentProvider#maven", RepositoryContentProvider.class ); - ManagedRepositoryContent repoContent = - provider.createManagedContent( repo ); - - managedDefaultRepository = repoContent; - - ( (DefaultManagedRepositoryAdmin) applicationContext.getBean( - ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config ); - - RepositoryRegistry managedRepositoryAdmin = applicationContext.getBean( RepositoryRegistry.class ); - if ( managedRepositoryAdmin.getManagedRepository( repo.getId() ) == null ) - { - managedRepositoryAdmin.putRepository( repo ); - } - - //config.getConfiguration().addManagedRepository( repo ); + managedDefaultRepository = createRepository(MANAGED_ID, "Default Managed Repository", repoPath, "default"); Handler handler = new AbstractHandler() { diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/MockConfiguration.java similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/MockConfiguration.java diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/WagonDelegate.java similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/WagonDelegate.java diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java similarity index 81% rename from archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java index 4937a56da..f7289383c 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java +++ b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java @@ -20,6 +20,8 @@ package org.apache.archiva.proxy.common; */ import junit.framework.TestCase; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactoryRequest; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.maven.wagon.Wagon; import org.junit.Test; @@ -29,7 +31,7 @@ import org.springframework.test.context.ContextConfiguration; import javax.inject.Inject; /** - * Test the WagonFactory works through Spring to be bound into the RepositoryProxyConnectors implementation. + * Test the WagonFactory works through Spring to be bound into the RepositoryProxyHandler implementation. */ @RunWith ( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml" } ) @@ -45,9 +47,9 @@ public class WagonFactoryTest throws Exception { - Wagon first = factory.getWagon( new WagonFactoryRequest().protocol( "wagon#file" ) ); + Wagon first = factory.getWagon( new org.apache.archiva.proxy.maven.WagonFactoryRequest().protocol( "wagon#file" ) ); - Wagon second = factory.getWagon( new WagonFactoryRequest().protocol( "wagon#file" ) ); + Wagon second = factory.getWagon( new org.apache.archiva.proxy.maven.WagonFactoryRequest().protocol( "wagon#file" ) ); // ensure we support only protocol name too Wagon third = factory.getWagon( new WagonFactoryRequest().protocol( "file" ) ); diff --git a/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/ArchivaIndexManagerMock.java new file mode 100644 index 000000000..65d8196b9 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/ArchivaIndexManagerMock.java @@ -0,0 +1,90 @@ +package org.apache.archiva.repository.mock; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.archiva.indexer.ArchivaIndexManager; +import org.apache.archiva.indexer.ArchivaIndexingContext; +import org.apache.archiva.indexer.IndexCreationFailedException; +import org.apache.archiva.indexer.IndexUpdateFailedException; +import org.apache.archiva.repository.Repository; +import org.apache.archiva.repository.RepositoryType; +import org.springframework.stereotype.Service; + +import java.net.URI; +import java.util.Collection; + +/** + * @author Martin Stockhammer + */ +@Service("archivaIndexManager#maven") +public class ArchivaIndexManagerMock implements ArchivaIndexManager { + + + + @Override + public void pack(ArchivaIndexingContext context) throws IndexUpdateFailedException { + + } + + @Override + public void scan(ArchivaIndexingContext context) throws IndexUpdateFailedException { + + } + + @Override + public void update(ArchivaIndexingContext context, boolean fullUpdate) throws IndexUpdateFailedException { + + } + + @Override + public void addArtifactsToIndex(ArchivaIndexingContext context, Collection artifactReference) throws IndexUpdateFailedException { + + } + + @Override + public void removeArtifactsFromIndex(ArchivaIndexingContext context, Collection artifactReference) throws IndexUpdateFailedException { + + } + + @Override + public boolean supportsRepository(RepositoryType type) { + return true; + } + + @Override + public ArchivaIndexingContext createContext(Repository repository) throws IndexCreationFailedException { + return null; + } + + @Override + public ArchivaIndexingContext reset(ArchivaIndexingContext context) throws IndexUpdateFailedException { + return null; + } + + @Override + public ArchivaIndexingContext move(ArchivaIndexingContext context, Repository repo) throws IndexCreationFailedException { + return null; + } + + @Override + public void updateLocalIndexPath(Repository repo) { + + } +} diff --git a/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java new file mode 100644 index 000000000..2b06667a8 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java @@ -0,0 +1,166 @@ +package org.apache.archiva.repository.mock; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.archiva.model.ArchivaArtifact; +import org.apache.archiva.model.ArtifactReference; +import org.apache.archiva.model.ProjectReference; +import org.apache.archiva.model.VersionedReference; +import org.apache.archiva.repository.*; +import org.springframework.stereotype.Service; + +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Set; + +/** + * @author Martin Stockhammer + */ +@Service("managedRepositoryContent#mock") +public class ManagedRepositoryContentMock implements ManagedRepositoryContent +{ + private ManagedRepository repository; + + @Override + public void deleteVersion( VersionedReference reference ) throws ContentNotFoundException + { + + } + + @Override + public void deleteArtifact( ArtifactReference artifactReference ) throws ContentNotFoundException + { + + } + + @Override + public void deleteGroupId( String groupId ) throws ContentNotFoundException + { + + } + + @Override + public void deleteProject( String namespace, String projectId ) throws RepositoryException + { + + } + + @Override + public String getId( ) + { + return null; + } + + @Override + public Set getRelatedArtifacts( ArtifactReference reference ) throws ContentNotFoundException + { + return null; + } + + @Override + public String getRepoRoot( ) + { + return Paths.get("", "target", "test-repository", "managed").toString(); + } + + @Override + public ManagedRepository getRepository( ) + { + return repository; + } + + @Override + public Set getVersions( ProjectReference reference ) throws ContentNotFoundException, LayoutException + { + return null; + } + + @Override + public Set getVersions( VersionedReference reference ) throws ContentNotFoundException + { + return null; + } + + @Override + public boolean hasContent( ArtifactReference reference ) + { + return false; + } + + @Override + public boolean hasContent( ProjectReference reference ) + { + return false; + } + + @Override + public boolean hasContent( VersionedReference reference ) + { + return false; + } + + @Override + public void setRepository( ManagedRepository repo ) + { + this.repository = repo; + } + + @Override + public ArtifactReference toArtifactReference( String path ) throws LayoutException + { + return null; + } + + @Override + public Path toFile( ArtifactReference reference ) + { + return null; + } + + @Override + public Path toFile( ArchivaArtifact reference ) + { + return null; + } + + @Override + public String toMetadataPath( ProjectReference reference ) + { + return null; + } + + @Override + public String toMetadataPath( VersionedReference reference ) + { + return null; + } + + @Override + public String toPath( ArtifactReference reference ) + { + return null; + } + + @Override + public String toPath( ArchivaArtifact reference ) + { + return null; + } +} diff --git a/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java new file mode 100644 index 000000000..c797b5686 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java @@ -0,0 +1,78 @@ +package org.apache.archiva.repository.mock; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.archiva.model.ArtifactReference; +import org.apache.archiva.model.RepositoryURL; +import org.apache.archiva.repository.LayoutException; +import org.apache.archiva.repository.RemoteRepository; +import org.apache.archiva.repository.RemoteRepositoryContent; +import org.springframework.stereotype.Service; + +/** + * @author Martin Stockhammer + */ +@Service("remoteRepositoryContent#mock") +public class RemoteRepositoryContentMock implements RemoteRepositoryContent +{ + RemoteRepository repository; + + @Override + public String getId( ) + { + return null; + } + + @Override + public RemoteRepository getRepository( ) + { + return null; + } + + @Override + public RepositoryURL getURL( ) + { + return null; + } + + @Override + public void setRepository( RemoteRepository repo ) + { + this.repository = repo; + } + + @Override + public ArtifactReference toArtifactReference( String path ) throws LayoutException + { + return null; + } + + @Override + public String toPath( ArtifactReference reference ) + { + return null; + } + + @Override + public RepositoryURL toURL( ArtifactReference reference ) + { + return null; + } +} diff --git a/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/RepositoryContentProviderMock.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/RepositoryContentProviderMock.java new file mode 100644 index 000000000..3693e0725 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/RepositoryContentProviderMock.java @@ -0,0 +1,66 @@ +package org.apache.archiva.repository.mock; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.archiva.repository.*; +import org.springframework.stereotype.Service; + +import java.util.HashSet; +import java.util.Set; + +@Service("repositoryContentProvider#mock") +public class RepositoryContentProviderMock implements RepositoryContentProvider { + + private static final Set REPOSITORY_TYPES = new HashSet<>(); + static { + REPOSITORY_TYPES.add(RepositoryType.MAVEN); + REPOSITORY_TYPES.add(RepositoryType.NPM); + } + + @Override + public boolean supportsLayout(String layout) { + return true; + } + + @Override + public Set getSupportedRepositoryTypes() { + return REPOSITORY_TYPES; + } + + @Override + public boolean supports(RepositoryType type) { + return true; + } + + @Override + public RemoteRepositoryContent createRemoteContent(RemoteRepository repository) throws RepositoryException { + return new RemoteRepositoryContentMock(); + } + + @Override + public ManagedRepositoryContent createManagedContent(ManagedRepository repository) throws RepositoryException { + return new ManagedRepositoryContentMock(); + } + + @Override + public T createContent(Class clazz, V repository) throws RepositoryException { + return null; + } +} diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/create-managed-to-proxy-map.sh b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/create-managed-to-proxy-map.sh similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/create-managed-to-proxy-map.sh rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/create-managed-to-proxy-map.sh diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed-to-proxy-map.txt b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed-to-proxy-map.txt similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed-to-proxy-map.txt rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed-to-proxy-map.txt diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.md5 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.md5 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.md5 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.md5 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.sha1 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.sha1 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.sha1 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.sha1 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.pom b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.pom similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.pom rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.pom diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md5 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md5 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md5 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md5 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/get-default-metadata-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/get-default-metadata-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/get-default-metadata-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/get-default-metadata-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-merged-metadata/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-merged-metadata/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-merged-metadata/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-merged-metadata/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/get-not-on-remotes-1.0-beta-2.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/get-not-on-remotes-1.0-beta-2.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/get-not-on-remotes-1.0-beta-2.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/get-not-on-remotes-1.0-beta-2.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/get-on-local-on-remote-1.0.22.pom b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/get-on-local-on-remote-1.0.22.pom similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/get-on-local-on-remote-1.0.22.pom rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/get-on-local-on-remote-1.0.22.pom diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.8/get-on-local-on-remote-1.0.8.pom b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.8/get-on-local-on-remote-1.0.8.pom similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.8/get-on-local-on-remote-1.0.8.pom rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.8/get-on-local-on-remote-1.0.8.pom diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/get-on-multiple-repos-1.0.pom b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/get-on-multiple-repos-1.0.pom similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/get-on-multiple-repos-1.0.pom rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/get-on-multiple-repos-1.0.pom diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.0/get-project-metadata-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.0/get-project-metadata-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.0/get-project-metadata-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.0/get-project-metadata-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.1/get-project-metadata-1.1.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.1/get-project-metadata-1.1.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.1/get-project-metadata-1.1.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.1/get-project-metadata-1.1.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/2.0/get-project-metadata-2.0.pom b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/2.0/get-project-metadata-2.0.pom similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/2.0/get-project-metadata-2.0.pom rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/2.0/get-project-metadata-2.0.pom diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/get-release-metadata-2.2.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/get-release-metadata-2.2.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/get-release-metadata-2.2.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/get-release-metadata-2.2.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact-with-pom/1.0/get-relocated-artefact-with-pom-1.0.pom b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact-with-pom/1.0/get-relocated-artefact-with-pom-1.0.pom similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact-with-pom/1.0/get-relocated-artefact-with-pom-1.0.pom rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact-with-pom/1.0/get-relocated-artefact-with-pom-1.0.pom diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-from-proxies/1.0/get-removed-from-proxies-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-removed-from-proxies/1.0/get-removed-from-proxies-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-from-proxies/1.0/get-removed-from-proxies-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-removed-from-proxies/1.0/get-removed-from-proxies-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-metadata/1.0/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-removed-metadata/1.0/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-metadata/1.0/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-removed-metadata/1.0/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/get-snapshot-on-local-not-remote-2.0-alpha-2-20070821.123456-1.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/get-snapshot-on-local-not-remote-2.0-alpha-2-20070821.123456-1.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/get-snapshot-on-local-not-remote-2.0-alpha-2-20070821.123456-1.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/get-snapshot-on-local-not-remote-2.0-alpha-2-20070821.123456-1.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/get-snapshot-on-local-not-remote-2.0-alpha-2-20070821.220304-2.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/get-snapshot-on-local-not-remote-2.0-alpha-2-20070821.220304-2.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/get-snapshot-on-local-not-remote-2.0-alpha-2-20070821.220304-2.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/get-snapshot-on-local-not-remote-2.0-alpha-2-20070821.220304-2.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.102030-1.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.102030-1.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.102030-1.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.102030-1.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.185701-2.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.185701-2.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.185701-2.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.185701-2.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.021008-3.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.021008-3.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.021008-3.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.021008-3.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/.metadata-proxied1 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/.metadata-proxied1 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/.metadata-proxied1 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/.metadata-proxied1 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/.metadata-proxied1 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/.metadata-proxied1 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/.metadata-proxied1 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/.metadata-proxied1 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.md5 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.md5 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.md5 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.md5 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.sha1 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.sha1 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.sha1 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.sha1 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.md5 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.md5 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.md5 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.md5 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.sha1 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.sha1 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.sha1 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.sha1 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.md5 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.md5 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.md5 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.md5 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.sha1 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.sha1 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.sha1 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.sha1 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar.md5 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar.md5 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar.md5 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar.md5 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.md5 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.md5 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.md5 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.md5 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.sha1 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.sha1 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.sha1 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.sha1 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar.sha1 b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar.sha1 similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar.sha1 rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar.sha1 diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar.asc b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar.asc similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar.asc rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar.asc diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/1.0.5/get-found-in-proxy-1.0.5-javadoc.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/1.0.5/get-found-in-proxy-1.0.5-javadoc.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/1.0.5/get-found-in-proxy-1.0.5-javadoc.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/1.0.5/get-found-in-proxy-1.0.5-javadoc.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-merged-metadata/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-merged-metadata/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-merged-metadata/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-merged-metadata/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/get-metadata-snapshot-1.0-20050831.101112-1.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/get-metadata-snapshot-1.0-20050831.101112-1.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/get-metadata-snapshot-1.0-20050831.101112-1.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/get-metadata-snapshot-1.0-20050831.101112-1.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070819.040004-1.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070819.040004-1.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070819.040004-1.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070819.040004-1.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.145534-9.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.145534-9.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.145534-9.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.145534-9.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061222.034118-1.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061222.034118-1.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061222.034118-1.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061222.034118-1.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061227.112101-2.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061227.112101-2.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061227.112101-2.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061227.112101-2.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0.1/get-default-layout-1.0.1.pom b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0.1/get-default-layout-1.0.1.pom similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0.1/get-default-layout-1.0.1.pom rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0.1/get-default-layout-1.0.1.pom diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-merged-metadata/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-merged-metadata/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-merged-metadata/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-merged-metadata/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.102030-1.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.102030-1.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.102030-1.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.102030-1.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.111741-5.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.111741-5.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.111741-5.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.111741-5.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.212711-6.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.212711-6.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.212711-6.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.212711-6.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061222.034118-1.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061222.034118-1.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061222.034118-1.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061222.034118-1.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20070101.000103-2.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20070101.000103-2.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20070101.000103-2.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20070101.000103-2.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/resources/META-INF/spring-context.xml similarity index 100% rename from archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml rename to archiva-modules/archiva-base/archiva-proxy-maven/src/test/resources/META-INF/spring-context.xml diff --git a/archiva-modules/archiva-base/archiva-proxy-maven/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/resources/spring-context.xml new file mode 100755 index 000000000..f10fb3e86 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy-maven/src/test/resources/spring-context.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + scheduler1 + org.quartz.simpl.SimpleThreadPool + 1 + 4 + org.quartz.simpl.RAMJobStore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index d55959f3a..cafe868f7 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -67,24 +67,11 @@ org.apache.archiva archiva-scheduler-repository-api
- - org.apache.archiva - maven2-repository - org.apache.archiva archiva-proxy-api - - org.apache.archiva - archiva-proxy-common - - - commons-logging - commons-logging-api - - - + commons-io commons-io @@ -118,27 +105,6 @@ org.apache.archiva archiva-plexus-bridge - - org.apache.maven.wagon - wagon-file - test - - - org.apache.maven.wagon - wagon-provider-api - - org.apache.archiva.redback.components.registry spring-registry-commons @@ -149,11 +115,7 @@ xmlunit test - - org.eclipse.jetty - jetty-server - test - + org.apache.maven.wagon wagon-http @@ -176,11 +138,6 @@ ${project.version} test - - org.apache.archiva - archiva-repository-admin-default - test - org.apache.archiva archiva-mock @@ -221,11 +178,6 @@ test - - org.apache.archiva - archiva-maven2-indexer - test - diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java new file mode 100644 index 000000000..73316145b --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ArchivaProxyRegistry.java @@ -0,0 +1,169 @@ +package org.apache.archiva.proxy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.archiva.configuration.*; +import org.apache.archiva.proxy.model.NetworkProxy; +import org.apache.archiva.proxy.model.ProxyConnector; +import org.apache.archiva.proxy.model.RepositoryProxyHandler; +import org.apache.archiva.repository.ManagedRepositoryContent; +import org.apache.archiva.repository.RemoteRepositoryContent; +import org.apache.archiva.repository.RepositoryRegistry; +import org.apache.archiva.repository.RepositoryType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import javax.inject.Inject; +import java.util.*; +import java.util.stream.Collectors; + +@Service("proxyRegistry#default") +public class ArchivaProxyRegistry implements ProxyRegistry, ConfigurationListener { + + private final Logger log = LoggerFactory.getLogger(ArchivaProxyRegistry.class); + + @Inject + ArchivaConfiguration archivaConfiguration; + + @Inject + List repositoryProxyHandlers; + + @Inject + RepositoryRegistry repositoryRegistry; + + private Map networkProxyMap = new HashMap<>(); + private Map> handlerMap = new HashMap<>(); + private ProxyConnectorOrderComparator comparator = ProxyConnectorOrderComparator.getInstance(); + + private Map> connectorMap = new HashMap<>(); + private List connectorList = new ArrayList<>(); + + + @PostConstruct + private void init() { + if (repositoryProxyHandlers == null) { + repositoryProxyHandlers = new ArrayList<>(); + } + updateHandler(); + updateNetworkProxies(); + } + + private ArchivaConfiguration getArchivaConfiguration() { + return archivaConfiguration; + } + + private void updateNetworkProxies() { + this.networkProxyMap.clear(); + List networkProxies = getArchivaConfiguration().getConfiguration().getNetworkProxies(); + for (NetworkProxyConfiguration networkProxyConfig : networkProxies) { + String key = networkProxyConfig.getId(); + + NetworkProxy proxy = new NetworkProxy(); + + proxy.setProtocol(networkProxyConfig.getProtocol()); + proxy.setHost(networkProxyConfig.getHost()); + proxy.setPort(networkProxyConfig.getPort()); + proxy.setUsername(networkProxyConfig.getUsername()); + proxy.setPassword(networkProxyConfig.getPassword()); + proxy.setUseNtlm(networkProxyConfig.isUseNtlm()); + + this.networkProxyMap.put(key, proxy); + } + for (RepositoryProxyHandler connectors : repositoryProxyHandlers) { + connectors.setNetworkProxies(this.networkProxyMap); + } + } + + private void updateHandler() { + for (RepositoryProxyHandler handler : repositoryProxyHandlers) { + List types = handler.supports(); + for (RepositoryType type : types) { + if (!handlerMap.containsKey(type)) { + handlerMap.put(type, new ArrayList<>()); + } + handlerMap.get(type).add(handler); + } + } + } + + private void updateConnectors() { + List proxyConnectorConfigurations = + getArchivaConfiguration().getConfiguration().getProxyConnectors(); + connectorList = proxyConnectorConfigurations.stream() + .map(configuration -> buildProxyConnector(configuration)) + .sorted(comparator).collect(Collectors.toList()); + connectorMap = connectorList.stream().collect(Collectors.groupingBy(a -> a.getSourceRepository().getId())); + } + + private ProxyConnector buildProxyConnector(ProxyConnectorConfiguration configuration) { + ProxyConnector proxyConnector = new ProxyConnector(); + proxyConnector.setOrder(configuration.getOrder()); + proxyConnector.setBlacklist(configuration.getBlackListPatterns()); + proxyConnector.setWhitelist(configuration.getWhiteListPatterns()); + proxyConnector.setDisabled(configuration.isDisabled()); + proxyConnector.setPolicies(configuration.getPolicies()); + proxyConnector.setProperties(configuration.getProperties()); + proxyConnector.setProxyId(configuration.getProxyId()); + ManagedRepositoryContent srcRepo = repositoryRegistry.getManagedRepository(configuration.getSourceRepoId()).getContent(); + proxyConnector.setSourceRepository(srcRepo); + RemoteRepositoryContent targetRepo = repositoryRegistry.getRemoteRepository(configuration.getTargetRepoId()).getContent(); + proxyConnector.setTargetRepository(targetRepo); + return proxyConnector; + } + + @Override + public NetworkProxy getNetworkProxy(String id) { + return this.networkProxyMap.get(id); + } + + @Override + public Map> getAllHandler() { + return this.handlerMap; + } + + @Override + public List getHandler(RepositoryType type) { + if (this.handlerMap.containsKey(type)) { + return this.handlerMap.get(type); + } else { + return new ArrayList<>(); + } + } + + @Override + public void configurationEvent(ConfigurationEvent event) { + log.debug("Config changed updating proxy list"); + updateNetworkProxies(); + updateConnectors(); + } + + @Override + public List getProxyConnectors() { + return connectorList; + + } + + @Override + public Map> getProxyConnectorAsMap() { + return connectorMap; + } +} diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java similarity index 63% rename from archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java rename to archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java index 94fb690ae..3f6bfe66d 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyHandler.java @@ -19,48 +19,24 @@ package org.apache.archiva.proxy; * under the License. */ -import org.apache.archiva.admin.model.RepositoryAdminException; -import org.apache.archiva.admin.model.beans.NetworkProxy; -import org.apache.archiva.admin.model.beans.ProxyConnectorRuleType; -import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin; +import org.apache.archiva.proxy.model.ProxyConnectorRuleType; import org.apache.archiva.common.filelock.FileLockException; import org.apache.archiva.common.filelock.FileLockManager; import org.apache.archiva.common.filelock.FileLockTimeoutException; import org.apache.archiva.common.filelock.Lock; -import org.apache.archiva.configuration.ArchivaConfiguration; -import org.apache.archiva.configuration.Configuration; -import org.apache.archiva.configuration.ConfigurationNames; -import org.apache.archiva.configuration.NetworkProxyConfiguration; -import org.apache.archiva.configuration.ProxyConnectorConfiguration; -import org.apache.archiva.configuration.ProxyConnectorRuleConfiguration; +import org.apache.archiva.configuration.*; import org.apache.archiva.model.ArtifactReference; import org.apache.archiva.model.Keys; -import org.apache.archiva.model.RepositoryURL; -import org.apache.archiva.policies.DownloadErrorPolicy; -import org.apache.archiva.policies.DownloadPolicy; -import org.apache.archiva.policies.PolicyConfigurationException; -import org.apache.archiva.policies.PolicyViolationException; -import org.apache.archiva.policies.PostDownloadPolicy; -import org.apache.archiva.policies.PreDownloadPolicy; -import org.apache.archiva.policies.ProxyDownloadException; +import org.apache.archiva.policies.*; import org.apache.archiva.policies.urlcache.UrlFailureCache; -import org.apache.archiva.proxy.common.WagonFactory; -import org.apache.archiva.proxy.common.WagonFactoryException; -import org.apache.archiva.proxy.common.WagonFactoryRequest; +import org.apache.archiva.proxy.model.NetworkProxy; import org.apache.archiva.proxy.model.ProxyConnector; import org.apache.archiva.proxy.model.ProxyFetchResult; -import org.apache.archiva.proxy.model.RepositoryProxyConnectors; +import org.apache.archiva.proxy.model.RepositoryProxyHandler; import org.apache.archiva.redback.components.registry.Registry; import org.apache.archiva.redback.components.registry.RegistryListener; import org.apache.archiva.redback.components.taskqueue.TaskQueueException; -import org.apache.archiva.repository.ManagedRepository; -import org.apache.archiva.repository.ManagedRepositoryContent; -import org.apache.archiva.repository.PasswordCredentials; -import org.apache.archiva.repository.RemoteRepository; -import org.apache.archiva.repository.RemoteRepositoryContent; -import org.apache.archiva.repository.RepositoryContentFactory; -import org.apache.archiva.repository.RepositoryCredentials; -import org.apache.archiva.repository.RepositoryRegistry; +import org.apache.archiva.repository.*; import org.apache.archiva.repository.metadata.MetadataTools; import org.apache.archiva.repository.metadata.RepositoryMetadataException; import org.apache.archiva.scheduler.ArchivaTaskScheduler; @@ -69,19 +45,10 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.SystemUtils; -import org.apache.maven.wagon.ConnectionException; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.WagonException; -import org.apache.maven.wagon.authentication.AuthenticationException; -import org.apache.maven.wagon.authentication.AuthenticationInfo; -import org.apache.maven.wagon.proxy.ProxyInfo; -import org.apache.maven.wagon.repository.Repository; import org.apache.tools.ant.types.selectors.SelectorUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MarkerFactory; -import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import javax.inject.Inject; @@ -90,72 +57,43 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Properties; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -/** - * DefaultRepositoryProxyConnectors - * TODO exception handling needs work - "not modified" is not really an exceptional case, and it has more layers than - * your average brown onion - */ -@Service("repositoryProxyConnectors#default") -public class DefaultRepositoryProxyConnectors - implements RepositoryProxyConnectors, RegistryListener -{ - private Logger log = LoggerFactory.getLogger( DefaultRepositoryProxyConnectors.class ); +public abstract class DefaultRepositoryProxyHandler implements RepositoryProxyHandler, RegistryListener { + + protected Logger log = LoggerFactory.getLogger( DefaultRepositoryProxyHandler.class ); + @Inject + protected UrlFailureCache urlFailureCache; @Inject @Named(value = "archivaConfiguration#default") private ArchivaConfiguration archivaConfiguration; - @Inject @Named(value = "repositoryContentFactory#default") private RepositoryContentFactory repositoryFactory; - @Inject @Named(value = "metadataTools#default") private MetadataTools metadataTools; - @Inject private Map preDownloadPolicies; - @Inject private Map postDownloadPolicies; - @Inject private Map downloadErrorPolicies; - - @Inject - private UrlFailureCache urlFailureCache; - private ConcurrentMap> proxyConnectorMap = new ConcurrentHashMap<>(); - - private ConcurrentMap networkProxyMap = new ConcurrentHashMap<>(); - - @Inject - private WagonFactory wagonFactory; - @Inject @Named(value = "archivaTaskScheduler#repository") private ArchivaTaskScheduler scheduler; - @Inject private RepositoryRegistry repositoryRegistry; - - @Inject - private NetworkProxyAdmin networkProxyAdmin; - @Inject @Named(value = "fileLockManager#default") private FileLockManager fileLockManager; + private Map networkProxyMap = new ConcurrentHashMap<>(); + @PostConstruct public void initialize() { @@ -261,29 +199,15 @@ public class DefaultRepositoryProxyConnectors } - this.networkProxyMap.clear(); - List networkProxies = archivaConfiguration.getConfiguration().getNetworkProxies(); - for ( NetworkProxyConfiguration networkProxyConfig : networkProxies ) - { - String key = networkProxyConfig.getId(); - ProxyInfo proxy = new ProxyInfo(); - proxy.setType( networkProxyConfig.getProtocol() ); - proxy.setHost( networkProxyConfig.getHost() ); - proxy.setPort( networkProxyConfig.getPort() ); - proxy.setUserName( networkProxyConfig.getUsername() ); - proxy.setPassword( networkProxyConfig.getPassword() ); - - this.networkProxyMap.put( key, proxy ); - } } - private List findProxyConnectorRules( String sourceRepository, - String targetRepository, - List all ) + private List findProxyConnectorRules(String sourceRepository, + String targetRepository, + List all ) { List proxyConnectorRuleConfigurations = new ArrayList<>(); @@ -303,7 +227,7 @@ public class DefaultRepositoryProxyConnectors } @Override - public Path fetchFromProxies( ManagedRepositoryContent repository, ArtifactReference artifact ) + public Path fetchFromProxies(ManagedRepositoryContent repository, ArtifactReference artifact ) throws ProxyDownloadException { Path localFile = toLocalFile( repository, artifact ); @@ -355,7 +279,7 @@ public class DefaultRepositoryProxyConnectors log.debug( "Artifact {} not updated on repository \"{}\".", Keys.toKey( artifact ), targetRepository.getRepository().getId() ); } - catch ( ProxyException | RepositoryAdminException e ) + catch ( ProxyException e ) { validatePolicies( this.downloadErrorPolicies, connector.getPolicies(), requestProperties, artifact, targetRepository, localFile, e, previousExceptions ); @@ -433,13 +357,7 @@ public class DefaultRepositoryProxyConnectors + "\" for resource {}, continuing to next repository. Error message: {}", targetRepository.getRepository().getId(), path, e.getMessage(), e ); } - catch ( RepositoryAdminException e ) - { - log.debug( MarkerFactory.getDetachedMarker( "transfer.error" ), - "Transfer error from repository {} for resource {}, continuing to next repository. Error message: {}", - targetRepository.getRepository().getId(), path, e.getMessage(), e ); - log.debug( MarkerFactory.getDetachedMarker( "transfer.error" ), "Full stack trace", e ); - } + } log.debug( "Exhausted all target repositories, resource {} not found.", path ); @@ -448,7 +366,7 @@ public class DefaultRepositoryProxyConnectors } @Override - public ProxyFetchResult fetchMetadataFromProxies( ManagedRepositoryContent repository, String logicalPath ) + public ProxyFetchResult fetchMetadataFromProxies(ManagedRepositoryContent repository, String logicalPath ) { Path localFile = Paths.get( repository.getRepoRoot(), logicalPath ); @@ -494,7 +412,7 @@ public class DefaultRepositoryProxyConnectors targetRepository.getRepository().getId(), e ); } - catch ( ProxyException | RepositoryAdminException e ) + catch ( ProxyException e ) { log.warn( "Transfer error from repository {} for versioned Metadata {}, continuing to next repository. Error message: {}", @@ -529,109 +447,7 @@ public class DefaultRepositoryProxyConnectors return new ProxyFetchResult( null, false ); } - /** - * @param connector - * @param remoteRepository - * @param tmpMd5 - * @param tmpSha1 - * @param tmpResource - * @param url - * @param remotePath - * @param resource - * @param workingDirectory - * @param repository - * @throws ProxyException - * @throws NotModifiedException - * @throws org.apache.archiva.admin.model.RepositoryAdminException - */ - protected void transferResources( ProxyConnector connector, RemoteRepositoryContent remoteRepository, Path tmpMd5, - Path tmpSha1, Path tmpResource, String url, String remotePath, Path resource, - Path workingDirectory, ManagedRepositoryContent repository ) - throws ProxyException, NotModifiedException, RepositoryAdminException - { - Wagon wagon = null; - try - { - RepositoryURL repoUrl = remoteRepository.getURL(); - String protocol = repoUrl.getProtocol(); - NetworkProxy networkProxy = null; - if ( StringUtils.isNotBlank( connector.getProxyId() ) ) - { - networkProxy = networkProxyAdmin.getNetworkProxy( connector.getProxyId() ); - } - WagonFactoryRequest wagonFactoryRequest = new WagonFactoryRequest( "wagon#" + protocol, - remoteRepository.getRepository().getExtraHeaders() ).networkProxy( - networkProxy ); - wagon = wagonFactory.getWagon( wagonFactoryRequest ); - if ( wagon == null ) - { - throw new ProxyException( "Unsupported target repository protocol: " + protocol ); - } - - if ( wagon == null ) - { - throw new ProxyException( "Unsupported target repository protocol: " + protocol ); - } - - boolean connected = connectToRepository( connector, wagon, remoteRepository ); - if ( connected ) - { - transferArtifact( wagon, remoteRepository, remotePath, repository, resource, workingDirectory, - tmpResource ); - - // TODO: these should be used to validate the download based on the policies, not always downloaded - // to - // save on connections since md5 is rarely used - transferChecksum( wagon, remoteRepository, remotePath, repository, resource, workingDirectory, ".sha1", - tmpSha1 ); - transferChecksum( wagon, remoteRepository, remotePath, repository, resource, workingDirectory, ".md5", - tmpMd5 ); - } - } - catch ( NotFoundException e ) - { - urlFailureCache.cacheFailure( url ); - throw e; - } - catch ( NotModifiedException e ) - { - // Do not cache url here. - throw e; - } - catch ( ProxyException e ) - { - urlFailureCache.cacheFailure( url ); - throw e; - } - catch ( WagonFactoryException e ) - { - throw new ProxyException( e.getMessage(), e ); - } - finally - { - if ( wagon != null ) - { - try - { - wagon.disconnect(); - } - catch ( ConnectionException e ) - { - log.warn( "Unable to disconnect wagon.", e ); - } - } - } - } - - private void transferArtifact( Wagon wagon, RemoteRepositoryContent remoteRepository, String remotePath, - ManagedRepositoryContent repository, Path resource, Path tmpDirectory, - Path destFile ) - throws ProxyException - { - transferSimpleFile( wagon, remoteRepository, remotePath, repository, resource, destFile ); - } - - private long getLastModified( Path file ) + private long getLastModified(Path file ) { if ( !Files.exists(file) || !Files.isRegularFile(file) ) { @@ -649,7 +465,7 @@ public class DefaultRepositoryProxyConnectors } } - private boolean hasBeenUpdated( Path file, long originalLastModified ) + private boolean hasBeenUpdated(Path file, long originalLastModified ) { if ( !Files.exists(file) || !Files.isRegularFile(file) ) { @@ -660,8 +476,8 @@ public class DefaultRepositoryProxyConnectors return ( currentLastModified > originalLastModified ); } - private Path toLocalRepoFile( ManagedRepositoryContent repository, RemoteRepositoryContent targetRepository, - String targetPath ) + private Path toLocalRepoFile(ManagedRepositoryContent repository, RemoteRepositoryContent targetRepository, + String targetPath ) { String repoPath = metadataTools.getRepositorySpecificName( targetRepository, targetPath ); return Paths.get( repository.getRepoRoot(), repoPath ); @@ -679,7 +495,7 @@ public class DefaultRepositoryProxyConnectors } } - private Path toLocalFile( ManagedRepositoryContent repository, ArtifactReference artifact ) + private Path toLocalFile(ManagedRepositoryContent repository, ArtifactReference artifact ) { return repository.toFile( artifact ); } @@ -721,10 +537,10 @@ public class DefaultRepositoryProxyConnectors * the remote resource is not newer than the local File. * @throws ProxyException if transfer was unsuccessful. */ - private Path transferFile( ProxyConnector connector, RemoteRepositoryContent remoteRepository, String remotePath, + protected Path transferFile( ProxyConnector connector, RemoteRepositoryContent remoteRepository, String remotePath, ManagedRepositoryContent repository, Path resource, Properties requestProperties, boolean executeConsumers ) - throws ProxyException, NotModifiedException, RepositoryAdminException + throws ProxyException, NotModifiedException { String url = remoteRepository.getURL().getUrl(); if ( !url.endsWith( "/" ) ) @@ -824,7 +640,11 @@ public class DefaultRepositoryProxyConnectors return resource; } - private void queueRepositoryTask( String repositoryId, Path localFile ) + protected abstract void transferResources(ProxyConnector connector, RemoteRepositoryContent remoteRepository, Path tmpMd5, Path tmpSha1, + Path tmpResource, String url, String remotePath, Path resource, Path workingDirectory, + ManagedRepositoryContent repository) throws ProxyException, NotModifiedException; + + private void queueRepositoryTask(String repositoryId, Path localFile ) { RepositoryTask task = new RepositoryTask(); task.setRepositoryId( repositoryId ); @@ -859,132 +679,6 @@ public class DefaultRepositoryProxyConnectors } } - /** - *

- * Quietly transfer the checksum file from the remote repository to the local file. - *

- * - * @param wagon the wagon instance (should already be connected) to use. - * @param remoteRepository the remote repository to transfer from. - * @param remotePath the remote path to the resource to get. - * @param repository the managed repository that will hold the file - * @param resource the local file that should contain the downloaded contents - * @param tmpDirectory the temporary directory to download to - * @param ext the type of checksum to transfer (example: ".md5" or ".sha1") - * @throws ProxyException if copying the downloaded file into place did not succeed. - */ - private void transferChecksum( Wagon wagon, RemoteRepositoryContent remoteRepository, String remotePath, - ManagedRepositoryContent repository, Path resource, Path tmpDirectory, String ext, - Path destFile ) - throws ProxyException - { - String url = remoteRepository.getURL().getUrl() + remotePath + ext; - - // Transfer checksum does not use the policy. - if ( urlFailureCache.hasFailedBefore( url ) ) - { - return; - } - - try - { - transferSimpleFile( wagon, remoteRepository, remotePath + ext, repository, resource, destFile ); - log.debug( "Checksum {} Downloaded: {} to move to {}", url, destFile, resource ); - } - catch ( NotFoundException e ) - { - urlFailureCache.cacheFailure( url ); - log.debug( "Transfer failed, checksum not found: {}", url ); - // Consume it, do not pass this on. - } - catch ( NotModifiedException e ) - { - log.debug( "Transfer skipped, checksum not modified: {}", url ); - // Consume it, do not pass this on. - } - catch ( ProxyException e ) - { - urlFailureCache.cacheFailure( url ); - log.warn( "Transfer failed on checksum: {} : {}", url, e.getMessage(), e ); - // Critical issue, pass it on. - throw e; - } - } - - /** - * Perform the transfer of the remote file to the local file specified. - * - * @param wagon the wagon instance to use. - * @param remoteRepository the remote repository to use - * @param remotePath the remote path to attempt to get - * @param repository the managed repository that will hold the file - * @param origFile the local file to save to - * @throws ProxyException if there was a problem moving the downloaded file into place. - */ - private void transferSimpleFile( Wagon wagon, RemoteRepositoryContent remoteRepository, String remotePath, - ManagedRepositoryContent repository, Path origFile, Path destFile ) - throws ProxyException - { - assert ( remotePath != null ); - - // Transfer the file. - try - { - boolean success = false; - - if ( !Files.exists(origFile)) - { - log.debug( "Retrieving {} from {}", remotePath, remoteRepository.getRepository().getName() ); - wagon.get( addParameters( remotePath, remoteRepository.getRepository() ), destFile.toFile() ); - success = true; - - // You wouldn't get here on failure, a WagonException would have been thrown. - log.debug( "Downloaded successfully." ); - } - else - { - log.debug( "Retrieving {} from {} if updated", remotePath, remoteRepository.getRepository().getName() ); - try - { - success = wagon.getIfNewer( addParameters( remotePath, remoteRepository.getRepository() ), destFile.toFile(), - Files.getLastModifiedTime(origFile).toMillis()); - } - catch ( IOException e ) - { - throw new ProxyException( "Failed to the modification time of "+origFile.toAbsolutePath() ); - } - if ( !success ) - { - throw new NotModifiedException( - "Not downloaded, as local file is newer than remote side: " + origFile.toAbsolutePath() ); - } - - if ( Files.exists(destFile)) - { - log.debug( "Downloaded successfully." ); - } - } - } - catch ( ResourceDoesNotExistException e ) - { - throw new NotFoundException( - "Resource [" + remoteRepository.getURL() + "/" + remotePath + "] does not exist: " + e.getMessage(), - e ); - } - catch ( WagonException e ) - { - // TODO: shouldn't have to drill into the cause, but TransferFailedException is often not descriptive enough - - String msg = - "Download failure on resource [" + remoteRepository.getURL() + "/" + remotePath + "]:" + e.getMessage(); - if ( e.getCause() != null ) - { - msg += " (cause: " + e.getCause() + ")"; - } - throw new ProxyException( msg, e ); - } - } - /** * Apply the policies. * @@ -1000,7 +694,7 @@ public class DefaultRepositoryProxyConnectors Properties request, Path localFile ) throws PolicyViolationException { - for ( Entry entry : policies.entrySet() ) + for ( Map.Entry entry : policies.entrySet() ) { // olamy with spring rolehint is now downloadPolicy#hint // so substring after last # to get the hint as with plexus @@ -1022,13 +716,13 @@ public class DefaultRepositoryProxyConnectors } } - private void validatePolicies( Map policies, Map settings, - Properties request, ArtifactReference artifact, RemoteRepositoryContent content, - Path localFile, Exception exception, Map previousExceptions ) + private void validatePolicies(Map policies, Map settings, + Properties request, ArtifactReference artifact, RemoteRepositoryContent content, + Path localFile, Exception exception, Map previousExceptions ) throws ProxyDownloadException { boolean process = true; - for ( Entry entry : policies.entrySet() ) + for ( Map.Entry entry : policies.entrySet() ) { // olamy with spring rolehint is now downloadPolicy#hint @@ -1161,84 +855,6 @@ public class DefaultRepositoryProxyConnectors } } - /** - * Using wagon, connect to the remote repository. - * - * @param connector the connector configuration to utilize (for obtaining network proxy configuration from) - * @param wagon the wagon instance to establish the connection on. - * @param remoteRepository the remote repository to connect to. - * @return true if the connection was successful. false if not connected. - */ - private boolean connectToRepository( ProxyConnector connector, Wagon wagon, - RemoteRepositoryContent remoteRepository ) - { - boolean connected = false; - - final ProxyInfo networkProxy = - connector.getProxyId() == null ? null : this.networkProxyMap.get( connector.getProxyId() ); - - if ( log.isDebugEnabled() ) - { - if ( networkProxy != null ) - { - // TODO: move to proxyInfo.toString() - String msg = "Using network proxy " + networkProxy.getHost() + ":" + networkProxy.getPort() - + " to connect to remote repository " + remoteRepository.getURL(); - if ( networkProxy.getNonProxyHosts() != null ) - { - msg += "; excluding hosts: " + networkProxy.getNonProxyHosts(); - } - if ( StringUtils.isNotBlank( networkProxy.getUserName() ) ) - { - msg += "; as user: " + networkProxy.getUserName(); - } - log.debug( msg ); - } - } - - AuthenticationInfo authInfo = null; - String username = ""; - String password = ""; - RepositoryCredentials repCred = remoteRepository.getRepository().getLoginCredentials(); - if (repCred!=null && repCred instanceof PasswordCredentials) { - PasswordCredentials pwdCred = (PasswordCredentials) repCred; - username = pwdCred.getUsername(); - password = pwdCred.getPassword()==null ? "" : new String(pwdCred.getPassword()); - } - - if ( StringUtils.isNotBlank( username ) && StringUtils.isNotBlank( password ) ) - { - log.debug( "Using username {} to connect to remote repository {}", username, remoteRepository.getURL() ); - authInfo = new AuthenticationInfo(); - authInfo.setUserName( username ); - authInfo.setPassword( password ); - } - - // Convert seconds to milliseconds - - long timeoutInMilliseconds = remoteRepository.getRepository().getTimeout().toMillis(); - - // Set timeout read and connect - // FIXME olamy having 2 config values - wagon.setReadTimeout( (int) timeoutInMilliseconds ); - wagon.setTimeout( (int) timeoutInMilliseconds ); - - try - { - Repository wagonRepository = - new Repository( remoteRepository.getId(), remoteRepository.getURL().toString() ); - wagon.connect( wagonRepository, authInfo, networkProxy ); - connected = true; - } - catch ( ConnectionException | AuthenticationException e ) - { - log.warn( "Could not connect to {}: {}", remoteRepository.getRepository().getName(), e.getMessage() ); - connected = false; - } - - return connected; - } - /** * Tests whitelist and blacklist patterns against path. * @@ -1293,7 +909,7 @@ public class DefaultRepositoryProxyConnectors } @Override - public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue ) + public void afterConfigurationChange(Registry registry, String propertyName, Object propertyValue ) { if ( ConfigurationNames.isNetworkProxy( propertyName ) // || ConfigurationNames.isManagedRepositories( propertyName ) // @@ -1304,7 +920,7 @@ public class DefaultRepositoryProxyConnectors } } - protected String addParameters( String path, RemoteRepository remoteRepository ) + protected String addParameters(String path, RemoteRepository remoteRepository ) { if ( remoteRepository.getExtraParameters().isEmpty() ) { @@ -1315,7 +931,7 @@ public class DefaultRepositoryProxyConnectors StringBuilder res = new StringBuilder( path == null ? "" : path ); - for ( Entry entry : remoteRepository.getExtraParameters().entrySet() ) + for ( Map.Entry entry : remoteRepository.getExtraParameters().entrySet() ) { if ( !question ) { @@ -1326,7 +942,6 @@ public class DefaultRepositoryProxyConnectors return res.toString(); } - @Override public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue ) { @@ -1338,7 +953,7 @@ public class DefaultRepositoryProxyConnectors return archivaConfiguration; } - public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration ) + public void setArchivaConfiguration(ArchivaConfiguration archivaConfiguration ) { this.archivaConfiguration = archivaConfiguration; } @@ -1348,7 +963,7 @@ public class DefaultRepositoryProxyConnectors return repositoryFactory; } - public void setRepositoryFactory( RepositoryContentFactory repositoryFactory ) + public void setRepositoryFactory(RepositoryContentFactory repositoryFactory ) { this.repositoryFactory = repositoryFactory; } @@ -1358,7 +973,7 @@ public class DefaultRepositoryProxyConnectors return metadataTools; } - public void setMetadataTools( MetadataTools metadataTools ) + public void setMetadataTools(MetadataTools metadataTools ) { this.metadataTools = metadataTools; } @@ -1368,27 +983,17 @@ public class DefaultRepositoryProxyConnectors return urlFailureCache; } - public void setUrlFailureCache( UrlFailureCache urlFailureCache ) + public void setUrlFailureCache(UrlFailureCache urlFailureCache ) { this.urlFailureCache = urlFailureCache; } - public WagonFactory getWagonFactory() - { - return wagonFactory; - } - - public void setWagonFactory( WagonFactory wagonFactory ) - { - this.wagonFactory = wagonFactory; - } - public Map getPreDownloadPolicies() { return preDownloadPolicies; } - public void setPreDownloadPolicies( Map preDownloadPolicies ) + public void setPreDownloadPolicies(Map preDownloadPolicies ) { this.preDownloadPolicies = preDownloadPolicies; } @@ -1398,7 +1003,7 @@ public class DefaultRepositoryProxyConnectors return postDownloadPolicies; } - public void setPostDownloadPolicies( Map postDownloadPolicies ) + public void setPostDownloadPolicies(Map postDownloadPolicies ) { this.postDownloadPolicies = postDownloadPolicies; } @@ -1408,8 +1013,27 @@ public class DefaultRepositoryProxyConnectors return downloadErrorPolicies; } - public void setDownloadErrorPolicies( Map downloadErrorPolicies ) + public void setDownloadErrorPolicies(Map downloadErrorPolicies ) { this.downloadErrorPolicies = downloadErrorPolicies; } + + @Override + public void setNetworkProxies(Map proxies) { + this.networkProxyMap.clear(); + this.networkProxyMap.putAll(proxies); + } + + @Override + public NetworkProxy getNetworkProxy(String id) { + return this.networkProxyMap.get(id); + } + + @Override + public Map getNetworkProxies() { + return this.networkProxyMap; + } + + @Override + public abstract List supports(); } diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java new file mode 100644 index 000000000..56f3d518b --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/ProxyRegistry.java @@ -0,0 +1,65 @@ +package org.apache.archiva.proxy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.archiva.proxy.model.NetworkProxy; +import org.apache.archiva.proxy.model.ProxyConnector; +import org.apache.archiva.proxy.model.RepositoryProxyHandler; +import org.apache.archiva.repository.RepositoryType; + +import java.util.List; +import java.util.Map; + +public interface ProxyRegistry { + + /** + * Returns the network proxy that is configured for the given id (repository id). + * + * @param id The proxy id + * @return The network proxy object if defined, otherwise null. + */ + NetworkProxy getNetworkProxy(String id); + + /** + * Returns a map that contains a list of repository handlers for each repository type. + * @return The map with the repository type as key and a list of handler objects as value. + */ + Map> getAllHandler(); + + /** + * Returns the repository handler that are defined for the given repository type. + * + * @param type The repository type + * @return Returns the list of the handler objects, or a empty list, if none defined. + */ + List getHandler(RepositoryType type); + + /** + * Returns the list of all proxy connectors. + * @return + */ + public List getProxyConnectors(); + + /** + * Returns a map of connector lists with the source repository id as key + * @return A map with source repository ids as key and list of corresponding proxy connector objects as value. + */ + public Map> getProxyConnectorAsMap(); +} diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml index e8781bc86..9917806a0 100755 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/spring-context.xml @@ -52,7 +52,8 @@ - + + diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml index 7b1604ae8..02249592f 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml @@ -37,6 +37,10 @@ org.apache.archiva archiva-repository-layer
+ + org.apache.archiva + archiva-proxy-api + org.apache.commons commons-collections4 diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRule.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRule.java index b4e710195..3fa5d3735 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRule.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/ProxyConnectorRule.java @@ -18,6 +18,8 @@ package org.apache.archiva.admin.model.beans; * under the License. */ +import org.apache.archiva.proxy.model.ProxyConnectorRuleType; + import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; import java.util.ArrayList; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnectorrule/DefaultProxyConnectorRuleAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnectorrule/DefaultProxyConnectorRuleAdmin.java index 041e66450..15d011d7e 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnectorrule/DefaultProxyConnectorRuleAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnectorrule/DefaultProxyConnectorRuleAdmin.java @@ -22,7 +22,7 @@ import org.apache.archiva.admin.model.AuditInformation; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.ProxyConnector; import org.apache.archiva.admin.model.beans.ProxyConnectorRule; -import org.apache.archiva.admin.model.beans.ProxyConnectorRuleType; +import org.apache.archiva.proxy.model.ProxyConnectorRuleType; import org.apache.archiva.admin.model.proxyconnectorrule.ProxyConnectorRuleAdmin; import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; import org.apache.archiva.configuration.Configuration; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java index d2b8de8d0..126f421cb 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/ArchivaIndexManagerMock.java @@ -20,8 +20,6 @@ package org.apache.archiva.admin.mock; */ import org.apache.archiva.admin.model.RepositoryAdminException; -import org.apache.archiva.admin.model.beans.NetworkProxy; -import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin; import org.apache.archiva.common.utils.FileUtils; import org.apache.archiva.common.utils.PathUtil; import org.apache.archiva.configuration.ArchivaConfiguration; @@ -30,9 +28,11 @@ import org.apache.archiva.indexer.ArchivaIndexingContext; import org.apache.archiva.indexer.IndexCreationFailedException; import org.apache.archiva.indexer.IndexUpdateFailedException; import org.apache.archiva.indexer.UnsupportedBaseContextException; -import org.apache.archiva.proxy.common.WagonFactory; -import org.apache.archiva.proxy.common.WagonFactoryException; -import org.apache.archiva.proxy.common.WagonFactoryRequest; +import org.apache.archiva.proxy.ProxyRegistry; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactoryException; +import org.apache.archiva.proxy.maven.WagonFactoryRequest; +import org.apache.archiva.proxy.model.NetworkProxy; import org.apache.archiva.repository.EditableRepository; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.PasswordCredentials; @@ -118,8 +118,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { private WagonFactory wagonFactory; @Inject - private NetworkProxyAdmin networkProxyAdmin; - + ProxyRegistry proxyRegistry; @Inject private ArtifactContextProducer artifactContextProducer; @@ -277,14 +276,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); if ( StringUtils.isNotBlank( rif.getProxyId( ) ) ) { - try - { - networkProxy = networkProxyAdmin.getNetworkProxy( rif.getProxyId( ) ); - } - catch ( RepositoryAdminException e ) - { - log.error( "Error occured while retrieving proxy {}", e.getMessage( ) ); - } + networkProxy = proxyRegistry.getNetworkProxy( rif.getProxyId( ) ); if ( networkProxy == null ) { log.warn( diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/proxyconnectorrule/ProxyConnectorRuleAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/proxyconnectorrule/ProxyConnectorRuleAdminTest.java index a9d4b9710..54087d720 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/proxyconnectorrule/ProxyConnectorRuleAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/proxyconnectorrule/ProxyConnectorRuleAdminTest.java @@ -20,7 +20,7 @@ package org.apache.archiva.admin.repository.proxyconnectorrule; import org.apache.archiva.admin.model.beans.ProxyConnector; import org.apache.archiva.admin.model.beans.ProxyConnectorRule; -import org.apache.archiva.admin.model.beans.ProxyConnectorRuleType; +import org.apache.archiva.proxy.model.ProxyConnectorRuleType; import org.apache.archiva.admin.model.beans.RemoteRepository; import org.apache.archiva.admin.repository.AbstractRepositoryAdminTest; import org.junit.Test; diff --git a/archiva-modules/archiva-base/pom.xml b/archiva-modules/archiva-base/pom.xml index 4b20b63d1..13009cb88 100644 --- a/archiva-modules/archiva-base/pom.xml +++ b/archiva-modules/archiva-base/pom.xml @@ -43,12 +43,13 @@ archiva-plexus-bridge archiva-policies archiva-repository-api + archiva-maven2-common archiva-maven2-indexer archiva-consumers archiva-repository-layer archiva-xml-tools archiva-proxy-api - archiva-proxy-common + archiva-proxy-maven archiva-proxy archiva-transaction archiva-converter diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/pom.xml index f1f04f2e9..fe377f571 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/pom.xml @@ -58,7 +58,7 @@ org.apache.archiva - archiva-proxy-common + archiva-proxy-maven diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DefaultDownloadRemoteIndexScheduler.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DefaultDownloadRemoteIndexScheduler.java index 685478830..2496c1d81 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DefaultDownloadRemoteIndexScheduler.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DefaultDownloadRemoteIndexScheduler.java @@ -18,16 +18,16 @@ package org.apache.archiva.scheduler.indexing.maven; * under the License. */ +import org.apache.archiva.proxy.ProxyRegistry; +import org.apache.archiva.proxy.model.NetworkProxy; import org.apache.archiva.scheduler.indexing.DownloadRemoteIndexException; import org.apache.archiva.scheduler.indexing.DownloadRemoteIndexScheduler; import org.apache.archiva.admin.model.RepositoryAdminException; -import org.apache.archiva.admin.model.beans.NetworkProxy; -import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.ConfigurationEvent; import org.apache.archiva.configuration.ConfigurationListener; import org.apache.archiva.indexer.UnsupportedBaseContextException; -import org.apache.archiva.proxy.common.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactory; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.repository.features.RemoteIndexFeature; import org.apache.commons.lang.StringUtils; @@ -71,15 +71,15 @@ public class DefaultDownloadRemoteIndexScheduler @Inject private WagonFactory wagonFactory; - @Inject - private NetworkProxyAdmin networkProxyAdmin; - @Inject private IndexUpdater indexUpdater; @Inject private IndexPacker indexPacker; + @Inject + private ProxyRegistry proxyRegistry; + // store ids about currently running remote download : updated in DownloadRemoteIndexTask private List runningRemoteDownloadIds = new CopyOnWriteArrayList(); @@ -124,81 +124,73 @@ public class DefaultDownloadRemoteIndexScheduler public void scheduleDownloadRemote( String repositoryId, boolean now, boolean fullDownload ) throws DownloadRemoteIndexException { - try + org.apache.archiva.repository.RemoteRepository remoteRepo = repositoryRegistry.getRemoteRepository(repositoryId); + + if ( remoteRepo == null ) { - org.apache.archiva.repository.RemoteRepository remoteRepo = repositoryRegistry.getRemoteRepository(repositoryId); + log.warn( "ignore scheduleDownloadRemote for repo with id {} as not exists", repositoryId ); + return; + } + if (!remoteRepo.supportsFeature(RemoteIndexFeature.class)) { + log.warn("ignore scheduleDownloadRemote for repo with id {}. Does not support remote index.", repositoryId); + return; + } + RemoteIndexFeature rif = remoteRepo.getFeature(RemoteIndexFeature.class).get(); + NetworkProxy networkProxy = null; + if ( StringUtils.isNotBlank( rif.getProxyId() ) ) + { + networkProxy = proxyRegistry.getNetworkProxy( rif.getProxyId() ); + if ( networkProxy == null ) + { + log.warn( + "your remote repository is configured to download remote index trought a proxy we cannot find id:{}", + rif.getProxyId() ); + } + } - if ( remoteRepo == null ) + DownloadRemoteIndexTaskRequest downloadRemoteIndexTaskRequest = new DownloadRemoteIndexTaskRequest() // + .setRemoteRepository( remoteRepo ) // + .setNetworkProxy( networkProxy ) // + .setFullDownload( fullDownload ) // + .setWagonFactory( wagonFactory ) // + .setIndexUpdater( indexUpdater ) // + .setIndexPacker( this.indexPacker ); + + if ( now ) + { + log.info( "schedule download remote index for repository {}", remoteRepo.getId() ); + // do it now + taskScheduler.schedule( + new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ), + new Date() ); + } + else + { + log.info( "schedule download remote index for repository {} with cron expression {}", + remoteRepo.getId(), remoteRepo.getSchedulingDefinition()); + try { - log.warn( "ignore scheduleDownloadRemote for repo with id {} as not exists", repositoryId ); - return; + CronTrigger cronTrigger = new CronTrigger( remoteRepo.getSchedulingDefinition()); + taskScheduler.schedule( + new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ), + cronTrigger ); } - if (!remoteRepo.supportsFeature(RemoteIndexFeature.class)) { - log.warn("ignore scheduleDownloadRemote for repo with id {}. Does not support remote index.", repositoryId); - return; - } - RemoteIndexFeature rif = remoteRepo.getFeature(RemoteIndexFeature.class).get(); - NetworkProxy networkProxy = null; - if ( StringUtils.isNotBlank( rif.getProxyId() ) ) + catch ( IllegalArgumentException e ) { - networkProxy = networkProxyAdmin.getNetworkProxy( rif.getProxyId() ); - if ( networkProxy == null ) - { - log.warn( - "your remote repository is configured to download remote index trought a proxy we cannot find id:{}", - rif.getProxyId() ); - } + log.warn( "Unable to schedule remote index download: {}", e.getLocalizedMessage() ); } - DownloadRemoteIndexTaskRequest downloadRemoteIndexTaskRequest = new DownloadRemoteIndexTaskRequest() // - .setRemoteRepository( remoteRepo ) // - .setNetworkProxy( networkProxy ) // - .setFullDownload( fullDownload ) // - .setWagonFactory( wagonFactory ) // - .setIndexUpdater( indexUpdater ) // - .setIndexPacker( this.indexPacker ); - - if ( now ) + if ( rif.isDownloadRemoteIndexOnStartup() ) { - log.info( "schedule download remote index for repository {}", remoteRepo.getId() ); - // do it now + log.info( + "remote repository {} configured with downloadRemoteIndexOnStartup schedule now a download", + remoteRepo.getId() ); taskScheduler.schedule( new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ), new Date() ); } - else - { - log.info( "schedule download remote index for repository {} with cron expression {}", - remoteRepo.getId(), remoteRepo.getSchedulingDefinition()); - try - { - CronTrigger cronTrigger = new CronTrigger( remoteRepo.getSchedulingDefinition()); - taskScheduler.schedule( - new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ), - cronTrigger ); - } - catch ( IllegalArgumentException e ) - { - log.warn( "Unable to schedule remote index download: {}", e.getLocalizedMessage() ); - } - - if ( rif.isDownloadRemoteIndexOnStartup() ) - { - log.info( - "remote repository {} configured with downloadRemoteIndexOnStartup schedule now a download", - remoteRepo.getId() ); - taskScheduler.schedule( - new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ), - new Date() ); - } - } - - } - catch ( RepositoryAdminException e ) - { - log.error( e.getMessage(), e ); - throw new DownloadRemoteIndexException( e.getMessage(), e ); } + } public TaskScheduler getTaskScheduler() diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTask.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTask.java index f141f43a5..3f794019e 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTask.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTask.java @@ -18,9 +18,9 @@ package org.apache.archiva.scheduler.indexing.maven; * under the License. */ -import org.apache.archiva.admin.model.beans.NetworkProxy; -import org.apache.archiva.proxy.common.WagonFactory; -import org.apache.archiva.proxy.common.WagonFactoryRequest; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactoryRequest; +import org.apache.archiva.proxy.model.NetworkProxy; import org.apache.archiva.repository.PasswordCredentials; import org.apache.archiva.repository.RemoteRepository; import org.apache.archiva.repository.RepositoryException; diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTaskRequest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTaskRequest.java index 732bc7ed8..784709345 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTaskRequest.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing-maven2/src/main/java/org/apache/archiva/scheduler/indexing/maven/DownloadRemoteIndexTaskRequest.java @@ -18,8 +18,8 @@ package org.apache.archiva.scheduler.indexing.maven; * under the License. */ -import org.apache.archiva.admin.model.beans.NetworkProxy; -import org.apache.archiva.proxy.common.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.model.NetworkProxy; import org.apache.archiva.repository.RemoteRepository; import org.apache.maven.index.packer.IndexPacker; import org.apache.maven.index.updater.IndexUpdater; diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml index 4a46d4745..b80e6b4b6 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml @@ -105,6 +105,11 @@ archiva-model + + org.apache.archiva + archiva-proxy-maven + + org.jsoup jsoup diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java index 9bbc81659..c1ffe625c 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java @@ -35,7 +35,7 @@ import org.apache.archiva.metadata.repository.storage.maven2.ArtifactMetadataVer import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet; import org.apache.archiva.model.ArchivaArtifact; import org.apache.archiva.model.ArchivaRepositoryMetadata; -import org.apache.archiva.proxy.model.RepositoryProxyConnectors; +import org.apache.archiva.proxy.model.RepositoryProxyHandler; import org.apache.archiva.redback.components.cache.Cache; import org.apache.archiva.repository.ManagedRepositoryContent; import org.apache.archiva.repository.ReleaseScheme; @@ -83,7 +83,7 @@ public class DefaultBrowseService @Inject @Named( value = "repositoryProxyConnectors#default" ) - private RepositoryProxyConnectors connectors; + private RepositoryProxyHandler connectors; @Inject @Named( value = "browse#versionMetadata" ) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java index 64ec39c72..74b568805 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java @@ -20,12 +20,12 @@ package org.apache.archiva.rest.services; */ import org.apache.archiva.admin.model.RepositoryAdminException; -import org.apache.archiva.admin.model.beans.NetworkProxy; import org.apache.archiva.admin.model.beans.RemoteRepository; -import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin; import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin; -import org.apache.archiva.proxy.common.WagonFactory; -import org.apache.archiva.proxy.common.WagonFactoryRequest; +import org.apache.archiva.proxy.ProxyRegistry; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactoryRequest; +import org.apache.archiva.proxy.model.NetworkProxy; import org.apache.archiva.rest.api.services.ArchivaRestServiceException; import org.apache.archiva.rest.api.services.RemoteRepositoriesService; import org.apache.commons.lang.StringUtils; @@ -58,9 +58,8 @@ public class DefaultRemoteRepositoriesService @Inject private WagonFactory wagonFactory; - @Inject - private NetworkProxyAdmin networkProxyAdmin; + private ProxyRegistry proxyRegistry; int checkReadTimeout = 10000; int checkTimeout = 9000; @@ -135,7 +134,7 @@ public class DefaultRemoteRepositoriesService } NetworkProxy networkProxy = null; if (StringUtils.isNotBlank(remoteRepository.getRemoteDownloadNetworkProxyId())) { - networkProxy = networkProxyAdmin.getNetworkProxy(remoteRepository.getRemoteDownloadNetworkProxyId()); + networkProxy = proxyRegistry.getNetworkProxy(remoteRepository.getRemoteDownloadNetworkProxyId()); if (networkProxy == null) { log.warn( "your remote repository is configured to download remote index trought a proxy we cannot find id:{}", diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ProxyConnectorRuleServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ProxyConnectorRuleServiceTest.java index 04d26d09f..8904e821f 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ProxyConnectorRuleServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ProxyConnectorRuleServiceTest.java @@ -20,7 +20,7 @@ package org.apache.archiva.rest.services; import org.apache.archiva.admin.model.beans.ProxyConnector; import org.apache.archiva.admin.model.beans.ProxyConnectorRule; -import org.apache.archiva.admin.model.beans.ProxyConnectorRuleType; +import org.apache.archiva.proxy.model.ProxyConnectorRuleType; import org.apache.archiva.rest.api.services.ProxyConnectorRuleService; import org.junit.Test; diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml index 6cd7c0a0f..0da5b2e0f 100644 --- a/archiva-modules/archiva-web/archiva-webdav/pom.xml +++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml @@ -59,6 +59,10 @@ runtime --> + + org.apache.archiva + maven2-repository + org.apache.archiva archiva-repository-admin-api diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java index c48231b1a..3abf50c3a 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java @@ -46,7 +46,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryStorage; import org.apache.archiva.model.ArchivaRepositoryMetadata; import org.apache.archiva.model.ArtifactReference; import org.apache.archiva.policies.ProxyDownloadException; -import org.apache.archiva.proxy.model.RepositoryProxyConnectors; +import org.apache.archiva.proxy.model.RepositoryProxyHandler; import org.apache.archiva.redback.authentication.AuthenticationException; import org.apache.archiva.redback.authentication.AuthenticationResult; import org.apache.archiva.redback.authorization.AuthorizationException; @@ -138,7 +138,7 @@ public class ArchivaDavResourceFactory @Inject @Named( value = "repositoryProxyConnectors#default" ) - private RepositoryProxyConnectors connectors; + private RepositoryProxyHandler connectors; @Inject private MetadataTools metadataTools; @@ -1416,7 +1416,7 @@ public class ArchivaDavResourceFactory this.repositoryRequest = repositoryRequest; } - public void setConnectors( RepositoryProxyConnectors connectors ) + public void setConnectors( RepositoryProxyHandler connectors ) { this.connectors = connectors; } diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java index 9b5bb7f18..b568076a0 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java @@ -34,7 +34,7 @@ import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.FileTypes; import org.apache.archiva.configuration.RepositoryGroupConfiguration; import org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider; -import org.apache.archiva.proxy.DefaultRepositoryProxyConnectors; +import org.apache.archiva.proxy.maven.MavenRepositoryProxyHandler; import org.apache.archiva.proxy.model.ProxyFetchResult; import org.apache.archiva.repository.EditableManagedRepository; import org.apache.archiva.repository.ManagedRepositoryContent; @@ -229,7 +229,7 @@ public class ArchivaDavResourceFactoryTest resourceFactory.setArchivaConfiguration( archivaConfiguration ); resourceFactory.setRepositoryFactory( repoFactory ); resourceFactory.setRepositoryRequest( repoRequest ); - resourceFactory.setConnectors( new OverridingRepositoryProxyConnectors() ); + resourceFactory.setConnectors( new OverridingRepositoryProxyHandler() ); resourceFactory.setRemoteRepositoryAdmin( remoteRepositoryAdmin ); resourceFactory.setManagedRepositoryAdmin( defaultManagedRepositoryAdmin ); resourceFactory.setRepositoryRegistry( repositoryRegistry ); @@ -749,8 +749,8 @@ public class ArchivaDavResourceFactoryTest } } - class OverridingRepositoryProxyConnectors - extends DefaultRepositoryProxyConnectors + class OverridingRepositoryProxyHandler + extends MavenRepositoryProxyHandler { @Override public ProxyFetchResult fetchMetadataFromProxies( ManagedRepositoryContent repository, String logicalPath ) diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml index d91003805..0691eb7dc 100644 --- a/archiva-modules/plugins/maven2-repository/pom.xml +++ b/archiva-modules/plugins/maven2-repository/pom.xml @@ -54,7 +54,7 @@ org.apache.archiva - archiva-proxy-common + archiva-proxy-maven commons-logging diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java index 317638730..45a699acd 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java @@ -19,11 +19,6 @@ package org.apache.archiva.metadata.repository.storage.maven2; * under the License. */ -import org.apache.archiva.admin.model.RepositoryAdminException; -import org.apache.archiva.admin.model.beans.NetworkProxy; -import org.apache.archiva.admin.model.beans.ProxyConnector; -import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin; -import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin; import org.apache.archiva.checksum.ChecksumAlgorithm; import org.apache.archiva.checksum.ChecksummedFile; import org.apache.archiva.common.Try; @@ -45,8 +40,11 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata; import org.apache.archiva.model.ArtifactReference; import org.apache.archiva.model.SnapshotVersion; import org.apache.archiva.policies.ProxyDownloadException; -import org.apache.archiva.proxy.common.WagonFactory; -import org.apache.archiva.proxy.model.RepositoryProxyConnectors; +import org.apache.archiva.proxy.ProxyRegistry; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.model.NetworkProxy; +import org.apache.archiva.proxy.model.ProxyConnector; +import org.apache.archiva.proxy.model.RepositoryProxyHandler; import org.apache.archiva.repository.LayoutException; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.ManagedRepositoryContent; @@ -76,7 +74,6 @@ import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.model.building.ModelProblem; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; -import org.eclipse.aether.impl.VersionRangeResolver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; @@ -118,12 +115,11 @@ import java.util.stream.Stream; * within the session in the context of a single managed repository's resolution needs. *

*/ -@Service( "repositoryStorage#maven2" ) +@Service("repositoryStorage#maven2") public class Maven2RepositoryStorage - implements RepositoryStorage -{ + implements RepositoryStorage { - private static final Logger LOGGER = LoggerFactory.getLogger( Maven2RepositoryStorage.class ); + private static final Logger LOGGER = LoggerFactory.getLogger(Maven2RepositoryStorage.class); private ModelBuilder builder; @@ -131,13 +127,7 @@ public class Maven2RepositoryStorage RepositoryRegistry repositoryRegistry; @Inject - private ProxyConnectorAdmin proxyConnectorAdmin; - - @Inject - private NetworkProxyAdmin networkProxyAdmin; - - @Inject - @Named( "repositoryPathTranslator#maven2" ) + @Named("repositoryPathTranslator#maven2") private RepositoryPathTranslator pathTranslator; @Inject @@ -147,9 +137,12 @@ public class Maven2RepositoryStorage private ApplicationContext applicationContext; @Inject - @Named( "pathParser#default" ) + @Named("pathParser#default") private PathParser pathParser; + @Inject + private ProxyRegistry proxyRegistry; + @Inject private MavenSystemManager mavenSystemManager; @@ -158,410 +151,357 @@ public class Maven2RepositoryStorage private static final String METADATA_FILENAME = METADATA_FILENAME_START + ".xml"; // This array must be lexically sorted - private static final String[] IGNORED_FILES = { METADATA_FILENAME, "resolver-status.properties" }; + private static final String[] IGNORED_FILES = {METADATA_FILENAME, "resolver-status.properties"}; private static final MavenXpp3Reader MAVEN_XPP_3_READER = new MavenXpp3Reader(); @PostConstruct - public void initialize() - { + public void initialize() { builder = new DefaultModelBuilderFactory().newInstance(); } @Override - public ProjectMetadata readProjectMetadata( String repoId, String namespace, String projectId ) - { + public ProjectMetadata readProjectMetadata(String repoId, String namespace, String projectId) { // TODO: could natively implement the "shared model" concept from the browse action to avoid needing it there? return null; } @Override - public ProjectVersionMetadata readProjectVersionMetadata( ReadMetadataRequest readMetadataRequest ) - throws RepositoryStorageMetadataNotFoundException, RepositoryStorageMetadataInvalidException, - RepositoryStorageRuntimeException - { - try - { - ManagedRepository managedRepository = repositoryRegistry.getManagedRepository(readMetadataRequest.getRepositoryId()); - boolean isReleases = managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE); - boolean isSnapshots = managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT); - String artifactVersion = readMetadataRequest.getProjectVersion(); - // olamy: in case of browsing via the ui we can mix repos (parent of a SNAPSHOT can come from release repo) - if ( !readMetadataRequest.isBrowsingRequest() ) - { - if ( VersionUtil.isSnapshot( artifactVersion ) ) - { - // skygo trying to improve speed by honoring managed configuration MRM-1658 - if ( isReleases && !isSnapshots ) - { - throw new RepositoryStorageRuntimeException( "lookforsnaponreleaseonly", - "managed repo is configured for release only" ); - } + public ProjectVersionMetadata readProjectVersionMetadata(ReadMetadataRequest readMetadataRequest) + throws RepositoryStorageMetadataNotFoundException, RepositoryStorageMetadataInvalidException, + RepositoryStorageRuntimeException { + + ManagedRepository managedRepository = repositoryRegistry.getManagedRepository(readMetadataRequest.getRepositoryId()); + boolean isReleases = managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE); + boolean isSnapshots = managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT); + String artifactVersion = readMetadataRequest.getProjectVersion(); + // olamy: in case of browsing via the ui we can mix repos (parent of a SNAPSHOT can come from release repo) + if (!readMetadataRequest.isBrowsingRequest()) { + if (VersionUtil.isSnapshot(artifactVersion)) { + // skygo trying to improve speed by honoring managed configuration MRM-1658 + if (isReleases && !isSnapshots) { + throw new RepositoryStorageRuntimeException("lookforsnaponreleaseonly", + "managed repo is configured for release only"); } - else - { - if ( !isReleases && isSnapshots) - { - throw new RepositoryStorageRuntimeException( "lookforsreleaseonsneponly", - "managed repo is configured for snapshot only" ); - } + } else { + if (!isReleases && isSnapshots) { + throw new RepositoryStorageRuntimeException("lookforsreleaseonsneponly", + "managed repo is configured for snapshot only"); } } - Path basedir = Paths.get( managedRepository.getLocation() ); - if ( VersionUtil.isSnapshot( artifactVersion ) ) - { - Path metadataFile = pathTranslator.toFile( basedir, readMetadataRequest.getNamespace(), - readMetadataRequest.getProjectId(), artifactVersion, - METADATA_FILENAME ); - try - { - ArchivaRepositoryMetadata metadata = MavenMetadataReader.read( metadataFile ); + } + Path basedir = Paths.get(managedRepository.getLocation()); + if (VersionUtil.isSnapshot(artifactVersion)) { + Path metadataFile = pathTranslator.toFile(basedir, readMetadataRequest.getNamespace(), + readMetadataRequest.getProjectId(), artifactVersion, + METADATA_FILENAME); + try { + ArchivaRepositoryMetadata metadata = MavenMetadataReader.read(metadataFile); - // re-adjust to timestamp if present, otherwise retain the original -SNAPSHOT filename - SnapshotVersion snapshotVersion = metadata.getSnapshotVersion(); - if ( snapshotVersion != null ) - { - artifactVersion = - artifactVersion.substring( 0, artifactVersion.length() - 8 ); // remove SNAPSHOT from end - artifactVersion = + // re-adjust to timestamp if present, otherwise retain the original -SNAPSHOT filename + SnapshotVersion snapshotVersion = metadata.getSnapshotVersion(); + if (snapshotVersion != null) { + artifactVersion = + artifactVersion.substring(0, artifactVersion.length() - 8); // remove SNAPSHOT from end + artifactVersion = artifactVersion + snapshotVersion.getTimestamp() + "-" + snapshotVersion.getBuildNumber(); - } - } - catch ( XMLException e ) - { - // unable to parse metadata - LOGGER it, and continue with the version as the original SNAPSHOT version - LOGGER.warn( "Invalid metadata: {} - {}", metadataFile, e.getMessage() ); } + } catch (XMLException e) { + // unable to parse metadata - LOGGER it, and continue with the version as the original SNAPSHOT version + LOGGER.warn("Invalid metadata: {} - {}", metadataFile, e.getMessage()); } + } - // TODO: won't work well with some other layouts, might need to convert artifact parts to ID by path translator - String id = readMetadataRequest.getProjectId() + "-" + artifactVersion + ".pom"; - Path file = - pathTranslator.toFile( basedir, readMetadataRequest.getNamespace(), readMetadataRequest.getProjectId(), - readMetadataRequest.getProjectVersion(), id ); + // TODO: won't work well with some other layouts, might need to convert artifact parts to ID by path translator + String id = readMetadataRequest.getProjectId() + "-" + artifactVersion + ".pom"; + Path file = + pathTranslator.toFile(basedir, readMetadataRequest.getNamespace(), readMetadataRequest.getProjectId(), + readMetadataRequest.getProjectVersion(), id); - if ( !Files.exists(file) ) - { - // metadata could not be resolved - throw new RepositoryStorageMetadataNotFoundException( - "The artifact's POM file '" + file.toAbsolutePath() + "' was missing" ); - } + if (!Files.exists(file)) { + // metadata could not be resolved + throw new RepositoryStorageMetadataNotFoundException( + "The artifact's POM file '" + file.toAbsolutePath() + "' was missing"); + } - // TODO: this is a workaround until we can properly resolve using proxies as well - this doesn't cache - // anything locally! - List remoteRepositories = new ArrayList<>(); - Map networkProxies = new HashMap<>(); + // TODO: this is a workaround until we can properly resolve using proxies as well - this doesn't cache + // anything locally! + List remoteRepositories = new ArrayList<>(); + Map networkProxies = new HashMap<>(); - Map> proxyConnectorsMap = proxyConnectorAdmin.getProxyConnectorAsMap(); - List proxyConnectors = proxyConnectorsMap.get( readMetadataRequest.getRepositoryId() ); - if ( proxyConnectors != null ) - { - for ( ProxyConnector proxyConnector : proxyConnectors ) - { - RemoteRepository remoteRepoConfig = - repositoryRegistry.getRemoteRepository( proxyConnector.getTargetRepoId() ); + Map> proxyConnectorsMap = proxyRegistry.getProxyConnectorAsMap(); + List proxyConnectors = proxyConnectorsMap.get(readMetadataRequest.getRepositoryId()); + if (proxyConnectors != null) { + for (ProxyConnector proxyConnector : proxyConnectors) { + RemoteRepository remoteRepoConfig = + repositoryRegistry.getRemoteRepository(proxyConnector.getTargetRepository().getId()); - if ( remoteRepoConfig != null ) - { - remoteRepositories.add( remoteRepoConfig ); + if (remoteRepoConfig != null) { + remoteRepositories.add(remoteRepoConfig); - NetworkProxy networkProxyConfig = - networkProxyAdmin.getNetworkProxy( proxyConnector.getProxyId() ); + NetworkProxy networkProxyConfig = + proxyRegistry.getNetworkProxy(proxyConnector.getProxyId()); - if ( networkProxyConfig != null ) - { - // key/value: remote repo ID/proxy info - networkProxies.put( proxyConnector.getTargetRepoId(), networkProxyConfig ); - } + if (networkProxyConfig != null) { + // key/value: remote repo ID/proxy info + networkProxies.put(proxyConnector.getTargetRepository().getId(), networkProxyConfig); } } } + } - // That's a browsing request so we can a mix of SNAPSHOT and release artifacts (especially with snapshots which - // can have released parent pom - if ( readMetadataRequest.isBrowsingRequest() ) - { - remoteRepositories.addAll( repositoryRegistry.getRemoteRepositories() ); - } + // That's a browsing request so we can a mix of SNAPSHOT and release artifacts (especially with snapshots which + // can have released parent pom + if (readMetadataRequest.isBrowsingRequest()) { + remoteRepositories.addAll(repositoryRegistry.getRemoteRepositories()); + } - ModelBuildingRequest req = - new DefaultModelBuildingRequest().setProcessPlugins( false ).setPomFile( file.toFile() ).setTwoPhaseBuilding( - false ).setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); + ModelBuildingRequest req = + new DefaultModelBuildingRequest().setProcessPlugins(false).setPomFile(file.toFile()).setTwoPhaseBuilding( + false).setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL); - //MRM-1607. olamy this will resolve jdk profiles on the current running archiva jvm - req.setSystemProperties( System.getProperties() ); + //MRM-1607. olamy this will resolve jdk profiles on the current running archiva jvm + req.setSystemProperties(System.getProperties()); - // MRM-1411 - req.setModelResolver( - new RepositoryModelResolver( managedRepository, pathTranslator, wagonFactory, remoteRepositories, - networkProxies, managedRepository , mavenSystemManager)); + // MRM-1411 + req.setModelResolver( + new RepositoryModelResolver(managedRepository, pathTranslator, wagonFactory, remoteRepositories, + networkProxies, managedRepository, mavenSystemManager)); - Model model; - try - { - model = builder.build( req ).getEffectiveModel(); - } - catch ( ModelBuildingException e ) - { - String msg = "The artifact's POM file '" + file + "' was invalid: " + e.getMessage(); + Model model; + try { + model = builder.build(req).getEffectiveModel(); + } catch (ModelBuildingException e) { + String msg = "The artifact's POM file '" + file + "' was invalid: " + e.getMessage(); - List modelProblems = e.getProblems(); - for ( ModelProblem problem : modelProblems ) - { - // MRM-1411, related to MRM-1335 - // this means that the problem was that the parent wasn't resolved! - // olamy really hackhish but fail with java profile so use error message - // || ( StringUtils.startsWith( problem.getMessage(), "Failed to determine Java version for profile" ) ) - // but setTwoPhaseBuilding(true) fix that - if ( ( (problem.getException() instanceof FileNotFoundException + List modelProblems = e.getProblems(); + for (ModelProblem problem : modelProblems) { + // MRM-1411, related to MRM-1335 + // this means that the problem was that the parent wasn't resolved! + // olamy really hackhish but fail with java profile so use error message + // || ( StringUtils.startsWith( problem.getMessage(), "Failed to determine Java version for profile" ) ) + // but setTwoPhaseBuilding(true) fix that + if (((problem.getException() instanceof FileNotFoundException || problem.getException() instanceof NoSuchFileException - ) && e.getModelId() != null && - !e.getModelId().equals( problem.getModelId() ) ) ) - { - LOGGER.warn( "The artifact's parent POM file '{}' cannot be resolved. " - + "Using defaults for project version metadata..", file ); + ) && e.getModelId() != null && + !e.getModelId().equals(problem.getModelId()))) { + LOGGER.warn("The artifact's parent POM file '{}' cannot be resolved. " + + "Using defaults for project version metadata..", file); - ProjectVersionMetadata metadata = new ProjectVersionMetadata(); - metadata.setId( readMetadataRequest.getProjectVersion() ); + ProjectVersionMetadata metadata = new ProjectVersionMetadata(); + metadata.setId(readMetadataRequest.getProjectVersion()); - MavenProjectFacet facet = new MavenProjectFacet(); - facet.setGroupId( readMetadataRequest.getNamespace() ); - facet.setArtifactId( readMetadataRequest.getProjectId() ); - facet.setPackaging( "jar" ); - metadata.addFacet( facet ); + MavenProjectFacet facet = new MavenProjectFacet(); + facet.setGroupId(readMetadataRequest.getNamespace()); + facet.setArtifactId(readMetadataRequest.getProjectId()); + facet.setPackaging("jar"); + metadata.addFacet(facet); - String errMsg = - "Error in resolving artifact's parent POM file. " + ( problem.getException() == null - ? problem.getMessage() - : problem.getException().getMessage() ); - RepositoryProblemFacet repoProblemFacet = new RepositoryProblemFacet(); - repoProblemFacet.setRepositoryId( readMetadataRequest.getRepositoryId() ); - repoProblemFacet.setId( readMetadataRequest.getRepositoryId() ); - repoProblemFacet.setMessage( errMsg ); - repoProblemFacet.setProblem( errMsg ); - repoProblemFacet.setProject( readMetadataRequest.getProjectId() ); - repoProblemFacet.setVersion( readMetadataRequest.getProjectVersion() ); - repoProblemFacet.setNamespace( readMetadataRequest.getNamespace() ); + String errMsg = + "Error in resolving artifact's parent POM file. " + (problem.getException() == null + ? problem.getMessage() + : problem.getException().getMessage()); + RepositoryProblemFacet repoProblemFacet = new RepositoryProblemFacet(); + repoProblemFacet.setRepositoryId(readMetadataRequest.getRepositoryId()); + repoProblemFacet.setId(readMetadataRequest.getRepositoryId()); + repoProblemFacet.setMessage(errMsg); + repoProblemFacet.setProblem(errMsg); + repoProblemFacet.setProject(readMetadataRequest.getProjectId()); + repoProblemFacet.setVersion(readMetadataRequest.getProjectVersion()); + repoProblemFacet.setNamespace(readMetadataRequest.getNamespace()); - metadata.addFacet( repoProblemFacet ); + metadata.addFacet(repoProblemFacet); - return metadata; - } + return metadata; } - - throw new RepositoryStorageMetadataInvalidException( "invalid-pom", msg, e ); } - // Check if the POM is in the correct location - boolean correctGroupId = readMetadataRequest.getNamespace().equals( model.getGroupId() ); - boolean correctArtifactId = readMetadataRequest.getProjectId().equals( model.getArtifactId() ); - boolean correctVersion = readMetadataRequest.getProjectVersion().equals( model.getVersion() ); - if ( !correctGroupId || !correctArtifactId || !correctVersion ) - { - StringBuilder message = new StringBuilder( "Incorrect POM coordinates in '" + file + "':" ); - if ( !correctGroupId ) - { - message.append( "\nIncorrect group ID: " ).append( model.getGroupId() ); - } - if ( !correctArtifactId ) - { - message.append( "\nIncorrect artifact ID: " ).append( model.getArtifactId() ); - } - if ( !correctVersion ) - { - message.append( "\nIncorrect version: " ).append( model.getVersion() ); - } - - throw new RepositoryStorageMetadataInvalidException( "mislocated-pom", message.toString() ); - } - - ProjectVersionMetadata metadata = new ProjectVersionMetadata(); - metadata.setCiManagement( convertCiManagement( model.getCiManagement() ) ); - metadata.setDescription( model.getDescription() ); - metadata.setId( readMetadataRequest.getProjectVersion() ); - metadata.setIssueManagement( convertIssueManagement( model.getIssueManagement() ) ); - metadata.setLicenses( convertLicenses( model.getLicenses() ) ); - metadata.setMailingLists( convertMailingLists( model.getMailingLists() ) ); - metadata.setDependencies( convertDependencies( model.getDependencies() ) ); - metadata.setName( model.getName() ); - metadata.setOrganization( convertOrganization( model.getOrganization() ) ); - metadata.setScm( convertScm( model.getScm() ) ); - metadata.setUrl( model.getUrl() ); - metadata.setProperties( model.getProperties() ); - - MavenProjectFacet facet = new MavenProjectFacet(); - facet.setGroupId( model.getGroupId() != null ? model.getGroupId() : model.getParent().getGroupId() ); - facet.setArtifactId( model.getArtifactId() ); - facet.setPackaging( model.getPackaging() ); - if ( model.getParent() != null ) - { - MavenProjectParent parent = new MavenProjectParent(); - parent.setGroupId( model.getParent().getGroupId() ); - parent.setArtifactId( model.getParent().getArtifactId() ); - parent.setVersion( model.getParent().getVersion() ); - facet.setParent( parent ); - } - metadata.addFacet( facet ); - - return metadata; + throw new RepositoryStorageMetadataInvalidException("invalid-pom", msg, e); } - catch ( RepositoryAdminException e ) - { - throw new RepositoryStorageRuntimeException( "repo-admin", e.getMessage(), e ); + + // Check if the POM is in the correct location + boolean correctGroupId = readMetadataRequest.getNamespace().equals(model.getGroupId()); + boolean correctArtifactId = readMetadataRequest.getProjectId().equals(model.getArtifactId()); + boolean correctVersion = readMetadataRequest.getProjectVersion().equals(model.getVersion()); + if (!correctGroupId || !correctArtifactId || !correctVersion) { + StringBuilder message = new StringBuilder("Incorrect POM coordinates in '" + file + "':"); + if (!correctGroupId) { + message.append("\nIncorrect group ID: ").append(model.getGroupId()); + } + if (!correctArtifactId) { + message.append("\nIncorrect artifact ID: ").append(model.getArtifactId()); + } + if (!correctVersion) { + message.append("\nIncorrect version: ").append(model.getVersion()); + } + + throw new RepositoryStorageMetadataInvalidException("mislocated-pom", message.toString()); } + + ProjectVersionMetadata metadata = new ProjectVersionMetadata(); + metadata.setCiManagement(convertCiManagement(model.getCiManagement())); + metadata.setDescription(model.getDescription()); + metadata.setId(readMetadataRequest.getProjectVersion()); + metadata.setIssueManagement(convertIssueManagement(model.getIssueManagement())); + metadata.setLicenses(convertLicenses(model.getLicenses())); + metadata.setMailingLists(convertMailingLists(model.getMailingLists())); + metadata.setDependencies(convertDependencies(model.getDependencies())); + metadata.setName(model.getName()); + metadata.setOrganization(convertOrganization(model.getOrganization())); + metadata.setScm(convertScm(model.getScm())); + metadata.setUrl(model.getUrl()); + metadata.setProperties(model.getProperties()); + + MavenProjectFacet facet = new MavenProjectFacet(); + facet.setGroupId(model.getGroupId() != null ? model.getGroupId() : model.getParent().getGroupId()); + facet.setArtifactId(model.getArtifactId()); + facet.setPackaging(model.getPackaging()); + if (model.getParent() != null) { + MavenProjectParent parent = new MavenProjectParent(); + parent.setGroupId(model.getParent().getGroupId()); + parent.setArtifactId(model.getParent().getArtifactId()); + parent.setVersion(model.getParent().getVersion()); + facet.setParent(parent); + } + metadata.addFacet(facet); + + return metadata; + + } - public void setWagonFactory( WagonFactory wagonFactory ) - { + public void setWagonFactory(WagonFactory wagonFactory) { this.wagonFactory = wagonFactory; } - private List convertDependencies( List dependencies ) - { + private List convertDependencies(List dependencies) { List l = new ArrayList<>(); - for ( Dependency dependency : dependencies ) - { + for (Dependency dependency : dependencies) { org.apache.archiva.metadata.model.Dependency newDependency = - new org.apache.archiva.metadata.model.Dependency(); - newDependency.setArtifactId( dependency.getArtifactId() ); - newDependency.setClassifier( dependency.getClassifier() ); - newDependency.setGroupId( dependency.getGroupId() ); - newDependency.setOptional( dependency.isOptional() ); - newDependency.setScope( dependency.getScope() ); - newDependency.setSystemPath( dependency.getSystemPath() ); - newDependency.setType( dependency.getType() ); - newDependency.setVersion( dependency.getVersion() ); - l.add( newDependency ); + new org.apache.archiva.metadata.model.Dependency(); + newDependency.setArtifactId(dependency.getArtifactId()); + newDependency.setClassifier(dependency.getClassifier()); + newDependency.setGroupId(dependency.getGroupId()); + newDependency.setOptional(dependency.isOptional()); + newDependency.setScope(dependency.getScope()); + newDependency.setSystemPath(dependency.getSystemPath()); + newDependency.setType(dependency.getType()); + newDependency.setVersion(dependency.getVersion()); + l.add(newDependency); } return l; } - private org.apache.archiva.metadata.model.Scm convertScm( Scm scm ) - { + private org.apache.archiva.metadata.model.Scm convertScm(Scm scm) { org.apache.archiva.metadata.model.Scm newScm = null; - if ( scm != null ) - { + if (scm != null) { newScm = new org.apache.archiva.metadata.model.Scm(); - newScm.setConnection( scm.getConnection() ); - newScm.setDeveloperConnection( scm.getDeveloperConnection() ); - newScm.setUrl( scm.getUrl() ); + newScm.setConnection(scm.getConnection()); + newScm.setDeveloperConnection(scm.getDeveloperConnection()); + newScm.setUrl(scm.getUrl()); } return newScm; } - private org.apache.archiva.metadata.model.Organization convertOrganization( Organization organization ) - { + private org.apache.archiva.metadata.model.Organization convertOrganization(Organization organization) { org.apache.archiva.metadata.model.Organization org = null; - if ( organization != null ) - { + if (organization != null) { org = new org.apache.archiva.metadata.model.Organization(); - org.setName( organization.getName() ); - org.setUrl( organization.getUrl() ); + org.setName(organization.getName()); + org.setUrl(organization.getUrl()); } return org; } - private List convertLicenses( List licenses ) - { + private List convertLicenses(List licenses) { List l = new ArrayList<>(); - for ( License license : licenses ) - { + for (License license : licenses) { org.apache.archiva.metadata.model.License newLicense = new org.apache.archiva.metadata.model.License(); - newLicense.setName( license.getName() ); - newLicense.setUrl( license.getUrl() ); - l.add( newLicense ); + newLicense.setName(license.getName()); + newLicense.setUrl(license.getUrl()); + l.add(newLicense); } return l; } - private List convertMailingLists( List mailingLists ) - { + private List convertMailingLists(List mailingLists) { List l = new ArrayList<>(); - for ( MailingList mailingList : mailingLists ) - { + for (MailingList mailingList : mailingLists) { org.apache.archiva.metadata.model.MailingList newMailingList = - new org.apache.archiva.metadata.model.MailingList(); - newMailingList.setName( mailingList.getName() ); - newMailingList.setMainArchiveUrl( mailingList.getArchive() ); - newMailingList.setPostAddress( mailingList.getPost() ); - newMailingList.setSubscribeAddress( mailingList.getSubscribe() ); - newMailingList.setUnsubscribeAddress( mailingList.getUnsubscribe() ); - newMailingList.setOtherArchives( mailingList.getOtherArchives() ); - l.add( newMailingList ); + new org.apache.archiva.metadata.model.MailingList(); + newMailingList.setName(mailingList.getName()); + newMailingList.setMainArchiveUrl(mailingList.getArchive()); + newMailingList.setPostAddress(mailingList.getPost()); + newMailingList.setSubscribeAddress(mailingList.getSubscribe()); + newMailingList.setUnsubscribeAddress(mailingList.getUnsubscribe()); + newMailingList.setOtherArchives(mailingList.getOtherArchives()); + l.add(newMailingList); } return l; } - private org.apache.archiva.metadata.model.IssueManagement convertIssueManagement( IssueManagement issueManagement ) - { + private org.apache.archiva.metadata.model.IssueManagement convertIssueManagement(IssueManagement issueManagement) { org.apache.archiva.metadata.model.IssueManagement im = null; - if ( issueManagement != null ) - { + if (issueManagement != null) { im = new org.apache.archiva.metadata.model.IssueManagement(); - im.setSystem( issueManagement.getSystem() ); - im.setUrl( issueManagement.getUrl() ); + im.setSystem(issueManagement.getSystem()); + im.setUrl(issueManagement.getUrl()); } return im; } - private org.apache.archiva.metadata.model.CiManagement convertCiManagement( CiManagement ciManagement ) - { + private org.apache.archiva.metadata.model.CiManagement convertCiManagement(CiManagement ciManagement) { org.apache.archiva.metadata.model.CiManagement ci = null; - if ( ciManagement != null ) - { + if (ciManagement != null) { ci = new org.apache.archiva.metadata.model.CiManagement(); - ci.setSystem( ciManagement.getSystem() ); - ci.setUrl( ciManagement.getUrl() ); + ci.setSystem(ciManagement.getSystem()); + ci.setUrl(ciManagement.getUrl()); } return ci; } @Override - public Collection listRootNamespaces( String repoId, Filter filter ) - throws RepositoryStorageRuntimeException - { - Path dir = getRepositoryBasedir( repoId ); + public Collection listRootNamespaces(String repoId, Filter filter) + throws RepositoryStorageRuntimeException { + Path dir = getRepositoryBasedir(repoId); - return getSortedFiles( dir, filter ); + return getSortedFiles(dir, filter); } - private static Collection getSortedFiles( Path dir, Filter filter ) - { + private static Collection getSortedFiles(Path dir, Filter filter) { - try(Stream stream = Files.list(dir)) { - final Predicate dFilter = new DirectoryFilter( filter ); + try (Stream stream = Files.list(dir)) { + final Predicate dFilter = new DirectoryFilter(filter); return stream.filter(Files::isDirectory) .filter(dFilter) .map(path -> path.getFileName().toString()) .sorted().collect(Collectors.toList()); } catch (IOException e) { - LOGGER.error("Could not read directory list {}: {}", dir, e.getMessage(),e); + LOGGER.error("Could not read directory list {}: {}", dir, e.getMessage(), e); return Collections.emptyList(); } } - private Path getRepositoryBasedir( String repoId ) - throws RepositoryStorageRuntimeException - { - ManagedRepository repositoryConfiguration = repositoryRegistry.getManagedRepository( repoId ); + private Path getRepositoryBasedir(String repoId) + throws RepositoryStorageRuntimeException { + ManagedRepository repositoryConfiguration = repositoryRegistry.getManagedRepository(repoId); - return Paths.get( repositoryConfiguration.getLocation() ); + return Paths.get(repositoryConfiguration.getLocation()); } @Override - public Collection listNamespaces( String repoId, String namespace, Filter filter ) - throws RepositoryStorageRuntimeException - { - Path dir = pathTranslator.toFile( getRepositoryBasedir( repoId ), namespace ); + public Collection listNamespaces(String repoId, String namespace, Filter filter) + throws RepositoryStorageRuntimeException { + Path dir = pathTranslator.toFile(getRepositoryBasedir(repoId), namespace); if (!(Files.exists(dir) && Files.isDirectory(dir))) { return Collections.emptyList(); } // scan all the directories which are potential namespaces. Any directories known to be projects are excluded Predicate dFilter = new DirectoryFilter(filter); - try(Stream stream = Files.list(dir)) { + try (Stream stream = Files.list(dir)) { return stream.filter(dFilter).filter(path -> !isProject(path, filter)).map(path -> path.getFileName().toString()) .sorted().collect(Collectors.toList()); } catch (IOException e) { @@ -571,16 +511,15 @@ public class Maven2RepositoryStorage } @Override - public Collection listProjects( String repoId, String namespace, Filter filter ) - throws RepositoryStorageRuntimeException - { - Path dir = pathTranslator.toFile( getRepositoryBasedir( repoId ), namespace ); + public Collection listProjects(String repoId, String namespace, Filter filter) + throws RepositoryStorageRuntimeException { + Path dir = pathTranslator.toFile(getRepositoryBasedir(repoId), namespace); if (!(Files.exists(dir) && Files.isDirectory(dir))) { return Collections.emptyList(); } // scan all directories in the namespace, and only include those that are known to be projects final Predicate dFilter = new DirectoryFilter(filter); - try(Stream stream = Files.list(dir)) { + try (Stream stream = Files.list(dir)) { return stream.filter(dFilter).filter(path -> isProject(path, filter)).map(path -> path.getFileName().toString()) .sorted().collect(Collectors.toList()); } catch (IOException e) { @@ -591,33 +530,31 @@ public class Maven2RepositoryStorage } @Override - public Collection listProjectVersions( String repoId, String namespace, String projectId, - Filter filter ) - throws RepositoryStorageRuntimeException - { - Path dir = pathTranslator.toFile( getRepositoryBasedir( repoId ), namespace, projectId ); + public Collection listProjectVersions(String repoId, String namespace, String projectId, + Filter filter) + throws RepositoryStorageRuntimeException { + Path dir = pathTranslator.toFile(getRepositoryBasedir(repoId), namespace, projectId); if (!(Files.exists(dir) && Files.isDirectory(dir))) { return Collections.emptyList(); } // all directories in a project directory can be considered a version - return getSortedFiles( dir, filter ); + return getSortedFiles(dir, filter); } @Override - public Collection readArtifactsMetadata( ReadMetadataRequest readMetadataRequest ) - throws RepositoryStorageRuntimeException - { - Path dir = pathTranslator.toFile( getRepositoryBasedir( readMetadataRequest.getRepositoryId() ), - readMetadataRequest.getNamespace(), readMetadataRequest.getProjectId(), - readMetadataRequest.getProjectVersion() ); + public Collection readArtifactsMetadata(ReadMetadataRequest readMetadataRequest) + throws RepositoryStorageRuntimeException { + Path dir = pathTranslator.toFile(getRepositoryBasedir(readMetadataRequest.getRepositoryId()), + readMetadataRequest.getNamespace(), readMetadataRequest.getProjectId(), + readMetadataRequest.getProjectVersion()); if (!(Files.exists(dir) && Files.isDirectory(dir))) { return Collections.emptyList(); } // all files that are not metadata and not a checksum / signature are considered artifacts final Predicate dFilter = new ArtifactDirectoryFilter(readMetadataRequest.getFilter()); - try(Stream stream = Files.list(dir)) { + try (Stream stream = Files.list(dir)) { // Returns a map TRUE -> (success values), FALSE -> (Exceptions) Map>> result = stream.filter(dFilter).map(path -> { try { @@ -630,7 +567,7 @@ public class Maven2RepositoryStorage } } ).collect(Collectors.groupingBy(Try::isSuccess)); - if (result.containsKey(Boolean.FALSE) && result.get(Boolean.FALSE).size()>0 && (!result.containsKey(Boolean.TRUE) || result.get(Boolean.TRUE).size()==0)) { + if (result.containsKey(Boolean.FALSE) && result.get(Boolean.FALSE).size() > 0 && (!result.containsKey(Boolean.TRUE) || result.get(Boolean.TRUE).size() == 0)) { LOGGER.error("Could not get artifact metadata. Directory: {}. Number of errors {}.", dir, result.get(Boolean.FALSE).size()); Try failure = result.get(Boolean.FALSE).get(0); LOGGER.error("Sample exception {}", failure.getError().getMessage(), failure.getError()); @@ -649,144 +586,121 @@ public class Maven2RepositoryStorage } @Override - public ArtifactMetadata readArtifactMetadataFromPath( String repoId, String path ) - throws RepositoryStorageRuntimeException - { - ArtifactMetadata metadata = pathTranslator.getArtifactForPath( repoId, path ); + public ArtifactMetadata readArtifactMetadataFromPath(String repoId, String path) + throws RepositoryStorageRuntimeException { + ArtifactMetadata metadata = pathTranslator.getArtifactForPath(repoId, path); try { - populateArtifactMetadataFromFile( metadata, getRepositoryBasedir( repoId ).resolve( path ) ); + populateArtifactMetadataFromFile(metadata, getRepositoryBasedir(repoId).resolve(path)); } catch (IOException e) { - throw new RepositoryStorageRuntimeException(repoId, "Error during metadata retrieval of "+path+" :"+e.getMessage(), e); + throw new RepositoryStorageRuntimeException(repoId, "Error during metadata retrieval of " + path + " :" + e.getMessage(), e); } return metadata; } - private ArtifactMetadata getArtifactFromFile( String repoId, String namespace, String projectId, - String projectVersion, Path file ) throws IOException { + private ArtifactMetadata getArtifactFromFile(String repoId, String namespace, String projectId, + String projectVersion, Path file) throws IOException { ArtifactMetadata metadata = - pathTranslator.getArtifactFromId( repoId, namespace, projectId, projectVersion, file.getFileName().toString() ); + pathTranslator.getArtifactFromId(repoId, namespace, projectId, projectVersion, file.getFileName().toString()); - populateArtifactMetadataFromFile( metadata, file ); + populateArtifactMetadataFromFile(metadata, file); return metadata; } @Override - public void applyServerSideRelocation( ManagedRepositoryContent managedRepository, ArtifactReference artifact ) - throws ProxyDownloadException - { - if ( "pom".equals( artifact.getType() ) ) - { + public void applyServerSideRelocation(ManagedRepositoryContent managedRepository, ArtifactReference artifact) + throws ProxyDownloadException { + if ("pom".equals(artifact.getType())) { return; } // Build the artifact POM reference ArtifactReference pomReference = new ArtifactReference(); - pomReference.setGroupId( artifact.getGroupId() ); - pomReference.setArtifactId( artifact.getArtifactId() ); - pomReference.setVersion( artifact.getVersion() ); - pomReference.setType( "pom" ); + pomReference.setGroupId(artifact.getGroupId()); + pomReference.setArtifactId(artifact.getArtifactId()); + pomReference.setVersion(artifact.getVersion()); + pomReference.setType("pom"); - RepositoryProxyConnectors connectors = - applicationContext.getBean( "repositoryProxyConnectors#default", RepositoryProxyConnectors.class ); + RepositoryProxyHandler connectors = + applicationContext.getBean("repositoryProxyConnectors#default", RepositoryProxyHandler.class); // Get the artifact POM from proxied repositories if needed - connectors.fetchFromProxies( managedRepository, pomReference ); + connectors.fetchFromProxies(managedRepository, pomReference); // Open and read the POM from the managed repo - Path pom = managedRepository.toFile( pomReference ); + Path pom = managedRepository.toFile(pomReference); - if ( !Files.exists(pom) ) - { + if (!Files.exists(pom)) { return; } - try - { + try { // MavenXpp3Reader leaves the file open, so we need to close it ourselves. Model model = null; - try (Reader reader = Files.newBufferedReader( pom, Charset.defaultCharset() )) - { - model = MAVEN_XPP_3_READER.read( reader ); + try (Reader reader = Files.newBufferedReader(pom, Charset.defaultCharset())) { + model = MAVEN_XPP_3_READER.read(reader); } DistributionManagement dist = model.getDistributionManagement(); - if ( dist != null ) - { + if (dist != null) { Relocation relocation = dist.getRelocation(); - if ( relocation != null ) - { + if (relocation != null) { // artifact is relocated : update the repositoryPath - if ( relocation.getGroupId() != null ) - { - artifact.setGroupId( relocation.getGroupId() ); + if (relocation.getGroupId() != null) { + artifact.setGroupId(relocation.getGroupId()); } - if ( relocation.getArtifactId() != null ) - { - artifact.setArtifactId( relocation.getArtifactId() ); + if (relocation.getArtifactId() != null) { + artifact.setArtifactId(relocation.getArtifactId()); } - if ( relocation.getVersion() != null ) - { - artifact.setVersion( relocation.getVersion() ); + if (relocation.getVersion() != null) { + artifact.setVersion(relocation.getVersion()); } } } - } - catch ( IOException e ) - { + } catch (IOException e) { // Unable to read POM : ignore. - } - catch ( XmlPullParserException e ) - { + } catch (XmlPullParserException e) { // Invalid POM : ignore } } @Override - public String getFilePath( String requestPath, org.apache.archiva.repository.ManagedRepository managedRepository ) - { + public String getFilePath(String requestPath, org.apache.archiva.repository.ManagedRepository managedRepository) { // managedRepository can be null // extract artifact reference from url // groupId:artifactId:version:packaging:classifier //org/apache/archiva/archiva-checksum/1.4-M4-SNAPSHOT/archiva-checksum-1.4-M4-SNAPSHOT.jar String logicalResource = null; - String requestPathInfo = StringUtils.defaultString( requestPath ); + String requestPathInfo = StringUtils.defaultString(requestPath); //remove prefix ie /repository/blah becomes /blah - requestPathInfo = removePrefix( requestPathInfo ); + requestPathInfo = removePrefix(requestPathInfo); // Remove prefixing slash as the repository id doesn't contain it; - if ( requestPathInfo.startsWith( "/" ) ) - { - requestPathInfo = requestPathInfo.substring( 1 ); + if (requestPathInfo.startsWith("/")) { + requestPathInfo = requestPathInfo.substring(1); } - int slash = requestPathInfo.indexOf( '/' ); - if ( slash > 0 ) - { - logicalResource = requestPathInfo.substring( slash ); + int slash = requestPathInfo.indexOf('/'); + if (slash > 0) { + logicalResource = requestPathInfo.substring(slash); - if ( logicalResource.endsWith( "/.." ) ) - { + if (logicalResource.endsWith("/..")) { logicalResource += "/"; } - if ( logicalResource != null && logicalResource.startsWith( "//" ) ) - { - logicalResource = logicalResource.substring( 1 ); + if (logicalResource != null && logicalResource.startsWith("//")) { + logicalResource = logicalResource.substring(1); } - if ( logicalResource == null ) - { + if (logicalResource == null) { logicalResource = "/"; } - } - else - { + } else { logicalResource = "/"; } return logicalResource; @@ -794,65 +708,56 @@ public class Maven2RepositoryStorage } @Override - public String getFilePathWithVersion( final String requestPath, ManagedRepositoryContent managedRepositoryContent ) - throws XMLException, RelocationException - { + public String getFilePathWithVersion(final String requestPath, ManagedRepositoryContent managedRepositoryContent) + throws XMLException, RelocationException { - if ( StringUtils.endsWith( requestPath, METADATA_FILENAME ) ) - { - return getFilePath( requestPath, managedRepositoryContent.getRepository() ); + if (StringUtils.endsWith(requestPath, METADATA_FILENAME)) { + return getFilePath(requestPath, managedRepositoryContent.getRepository()); } - String filePath = getFilePath( requestPath, managedRepositoryContent.getRepository() ); + String filePath = getFilePath(requestPath, managedRepositoryContent.getRepository()); ArtifactReference artifactReference = null; - try - { - artifactReference = pathParser.toArtifactReference( filePath ); - } - catch ( LayoutException e ) - { + try { + artifactReference = pathParser.toArtifactReference(filePath); + } catch (LayoutException e) { return filePath; } - if ( StringUtils.endsWith( artifactReference.getVersion(), VersionUtil.SNAPSHOT ) ) - { + if (StringUtils.endsWith(artifactReference.getVersion(), VersionUtil.SNAPSHOT)) { // read maven metadata to get last timestamp - Path metadataDir = Paths.get( managedRepositoryContent.getRepoRoot(), filePath ).getParent(); - if ( !Files.exists(metadataDir) ) - { + Path metadataDir = Paths.get(managedRepositoryContent.getRepoRoot(), filePath).getParent(); + if (!Files.exists(metadataDir)) { return filePath; } - Path metadataFile = metadataDir.resolve( METADATA_FILENAME ); - if ( !Files.exists(metadataFile) ) - { + Path metadataFile = metadataDir.resolve(METADATA_FILENAME); + if (!Files.exists(metadataFile)) { return filePath; } - ArchivaRepositoryMetadata archivaRepositoryMetadata = MavenMetadataReader.read( metadataFile ); + ArchivaRepositoryMetadata archivaRepositoryMetadata = MavenMetadataReader.read(metadataFile); int buildNumber = archivaRepositoryMetadata.getSnapshotVersion().getBuildNumber(); String timestamp = archivaRepositoryMetadata.getSnapshotVersion().getTimestamp(); // MRM-1846 - if ( buildNumber < 1 && timestamp == null ) - { + if (buildNumber < 1 && timestamp == null) { return filePath; } // org/apache/archiva/archiva-checksum/1.4-M4-SNAPSHOT/archiva-checksum-1.4-M4-SNAPSHOT.jar // -> archiva-checksum-1.4-M4-20130425.081822-1.jar - filePath = StringUtils.replace( filePath, // - artifactReference.getArtifactId() // - + "-" + artifactReference.getVersion(), // - artifactReference.getArtifactId() // - + "-" + StringUtils.remove( artifactReference.getVersion(), - "-" + VersionUtil.SNAPSHOT ) // - + "-" + timestamp // - + "-" + buildNumber ); + filePath = StringUtils.replace(filePath, // + artifactReference.getArtifactId() // + + "-" + artifactReference.getVersion(), // + artifactReference.getArtifactId() // + + "-" + StringUtils.remove(artifactReference.getVersion(), + "-" + VersionUtil.SNAPSHOT) // + + "-" + timestamp // + + "-" + buildNumber); - throw new RelocationException( "/repository/" + managedRepositoryContent.getRepository().getId() + - ( StringUtils.startsWith( filePath, "/" ) ? "" : "/" ) + filePath, - RelocationException.RelocationType.TEMPORARY ); + throw new RelocationException("/repository/" + managedRepositoryContent.getRepository().getId() + + (StringUtils.startsWith(filePath, "/") ? "" : "/") + filePath, + RelocationException.RelocationType.TEMPORARY); } @@ -869,52 +774,42 @@ public class Maven2RepositoryStorage * @param href * @return */ - private static String removePrefix( final String href ) - { - String[] parts = StringUtils.split( href, '/' ); - parts = (String[]) ArrayUtils.subarray( parts, 1, parts.length ); - if ( parts == null || parts.length == 0 ) - { + private static String removePrefix(final String href) { + String[] parts = StringUtils.split(href, '/'); + parts = (String[]) ArrayUtils.subarray(parts, 1, parts.length); + if (parts == null || parts.length == 0) { return "/"; } - String joinedString = StringUtils.join( parts, '/' ); - if ( href.endsWith( "/" ) ) - { + String joinedString = StringUtils.join(parts, '/'); + if (href.endsWith("/")) { joinedString = joinedString + "/"; } return joinedString; } - private static void populateArtifactMetadataFromFile( ArtifactMetadata metadata, Path file ) throws IOException { - metadata.setWhenGathered( new Date() ); - metadata.setFileLastModified( Files.getLastModifiedTime(file).toMillis() ); - ChecksummedFile checksummedFile = new ChecksummedFile( file ); - try - { - metadata.setMd5( checksummedFile.calculateChecksum( ChecksumAlgorithm.MD5 ) ); + private static void populateArtifactMetadataFromFile(ArtifactMetadata metadata, Path file) throws IOException { + metadata.setWhenGathered(new Date()); + metadata.setFileLastModified(Files.getLastModifiedTime(file).toMillis()); + ChecksummedFile checksummedFile = new ChecksummedFile(file); + try { + metadata.setMd5(checksummedFile.calculateChecksum(ChecksumAlgorithm.MD5)); + } catch (IOException e) { + LOGGER.error("Unable to checksum file {}: {},MD5", file, e.getMessage()); } - catch ( IOException e ) - { - LOGGER.error( "Unable to checksum file {}: {},MD5", file, e.getMessage() ); + try { + metadata.setSha1(checksummedFile.calculateChecksum(ChecksumAlgorithm.SHA1)); + } catch (IOException e) { + LOGGER.error("Unable to checksum file {}: {},SHA1", file, e.getMessage()); } - try - { - metadata.setSha1( checksummedFile.calculateChecksum( ChecksumAlgorithm.SHA1 ) ); - } - catch ( IOException e ) - { - LOGGER.error( "Unable to checksum file {}: {},SHA1", file, e.getMessage() ); - } - metadata.setSize( Files.size(file) ); + metadata.setSize(Files.size(file)); } - private boolean isProject( Path dir, Filter filter ) - { + private boolean isProject(Path dir, Filter filter) { // scan directories for a valid project version subdirectory, meaning this must be a project directory final Predicate dFilter = new DirectoryFilter(filter); - try(Stream stream = Files.list(dir)) { + try (Stream stream = Files.list(dir)) { boolean projFound = stream.filter(dFilter) .anyMatch(path -> isProjectVersion(path)); if (projFound) { @@ -925,34 +820,29 @@ public class Maven2RepositoryStorage } // if a metadata file is present, check if this is the "artifactId" directory, marking it as a project - ArchivaRepositoryMetadata metadata = readMetadata( dir ); - if ( metadata != null && dir.getFileName().toString().equals( metadata.getArtifactId() ) ) - { + ArchivaRepositoryMetadata metadata = readMetadata(dir); + if (metadata != null && dir.getFileName().toString().equals(metadata.getArtifactId())) { return true; } return false; } - private boolean isProjectVersion( Path dir ) - { + private boolean isProjectVersion(Path dir) { final String artifactId = dir.getParent().getFileName().toString(); final String projectVersion = dir.getFileName().toString(); // check if there is a POM artifact file to ensure it is a version directory Predicate filter; - if ( VersionUtil.isSnapshot( projectVersion ) ) - { + if (VersionUtil.isSnapshot(projectVersion)) { filter = new PomFilenameFilter(artifactId, projectVersion); - } - else - { + } else { final String pomFile = artifactId + "-" + projectVersion + ".pom"; filter = new PomFileFilter(pomFile); } - try(Stream stream = Files.list(dir)) { - if (stream.filter(Files::isRegularFile).anyMatch(filter)){ + try (Stream stream = Files.list(dir)) { + if (stream.filter(Files::isRegularFile).anyMatch(filter)) { return true; } } catch (IOException e) { @@ -960,27 +850,21 @@ public class Maven2RepositoryStorage } // if a metadata file is present, check if this is the "version" directory, marking it as a project version - ArchivaRepositoryMetadata metadata = readMetadata( dir ); - if ( metadata != null && projectVersion.equals( metadata.getVersion() ) ) - { + ArchivaRepositoryMetadata metadata = readMetadata(dir); + if (metadata != null && projectVersion.equals(metadata.getVersion())) { return true; } return false; } - private ArchivaRepositoryMetadata readMetadata( Path directory ) - { + private ArchivaRepositoryMetadata readMetadata(Path directory) { ArchivaRepositoryMetadata metadata = null; - Path metadataFile = directory.resolve( METADATA_FILENAME ); - if ( Files.exists(metadataFile) ) - { - try - { - metadata = MavenMetadataReader.read( metadataFile ); - } - catch ( XMLException e ) - { + Path metadataFile = directory.resolve(METADATA_FILENAME); + if (Files.exists(metadataFile)) { + try { + metadata = MavenMetadataReader.read(metadataFile); + } catch (XMLException e) { // ignore missing or invalid metadata } } @@ -988,29 +872,21 @@ public class Maven2RepositoryStorage } private static class DirectoryFilter - implements Predicate - { + implements Predicate { private final Filter filter; - public DirectoryFilter( Filter filter ) - { + public DirectoryFilter(Filter filter) { this.filter = filter; } @Override - public boolean test( Path dir ) - { + public boolean test(Path dir) { final String name = dir.getFileName().toString(); - if ( !filter.accept( name ) ) - { + if (!filter.accept(name)) { return false; - } - else if ( name.startsWith( "." ) ) - { + } else if (name.startsWith(".")) { return false; - } - else if ( !Files.isDirectory(dir)) - { + } else if (!Files.isDirectory(dir)) { return false; } return true; @@ -1018,43 +894,30 @@ public class Maven2RepositoryStorage } private static class ArtifactDirectoryFilter - implements Predicate - { + implements Predicate { private final Filter filter; - private ArtifactDirectoryFilter( Filter filter ) - { + private ArtifactDirectoryFilter(Filter filter) { this.filter = filter; } @Override - public boolean test( Path dir ) - { + public boolean test(Path dir) { final String name = dir.getFileName().toString(); // TODO compare to logic in maven-repository-layer - if ( !filter.accept( name ) ) - { + if (!filter.accept(name)) { return false; - } - else if ( name.startsWith( "." ) ) - { + } else if (name.startsWith(".")) { return false; - } - else if ( name.endsWith( ".md5" ) || name.endsWith( ".sha1" ) || name.endsWith( ".asc" ) ) - { + } else if (name.endsWith(".md5") || name.endsWith(".sha1") || name.endsWith(".asc")) { return false; - } - else if ( Arrays.binarySearch(IGNORED_FILES, name)>=0 ) - { + } else if (Arrays.binarySearch(IGNORED_FILES, name) >= 0) { return false; - } - else if ( Files.isDirectory(dir) ) - { + } else if (Files.isDirectory(dir)) { return false; } // some files from remote repositories can have name like maven-metadata-archiva-vm-all-public.xml - else if ( StringUtils.startsWith( name, METADATA_FILENAME_START ) && StringUtils.endsWith( name, ".xml" ) ) - { + else if (StringUtils.startsWith(name, METADATA_FILENAME_START) && StringUtils.endsWith(name, ".xml")) { return false; } @@ -1065,27 +928,22 @@ public class Maven2RepositoryStorage private static final class PomFilenameFilter - implements Predicate - { + implements Predicate { private final String artifactId, projectVersion; - private PomFilenameFilter( String artifactId, String projectVersion ) - { + private PomFilenameFilter(String artifactId, String projectVersion) { this.artifactId = artifactId; this.projectVersion = projectVersion; } @Override - public boolean test( Path dir ) - { + public boolean test(Path dir) { final String name = dir.getFileName().toString(); - if ( name.startsWith( artifactId + "-" ) && name.endsWith( ".pom" ) ) - { - String v = name.substring( artifactId.length() + 1, name.length() - 4 ); - v = VersionUtil.getBaseVersion( v ); - if ( v.equals( projectVersion ) ) - { + if (name.startsWith(artifactId + "-") && name.endsWith(".pom")) { + String v = name.substring(artifactId.length() + 1, name.length() - 4); + v = VersionUtil.getBaseVersion(v); + if (v.equals(projectVersion)) { return true; } } @@ -1095,30 +953,25 @@ public class Maven2RepositoryStorage } private static class PomFileFilter - implements Predicate - { + implements Predicate { private final String pomFile; - private PomFileFilter( String pomFile ) - { + private PomFileFilter(String pomFile) { this.pomFile = pomFile; } @Override - public boolean test( Path dir ) - { - return pomFile.equals( dir.getFileName().toString()); + public boolean test(Path dir) { + return pomFile.equals(dir.getFileName().toString()); } } - public PathParser getPathParser() - { + public PathParser getPathParser() { return pathParser; } - public void setPathParser( PathParser pathParser ) - { + public void setPathParser(PathParser pathParser) { this.pathParser = pathParser; } } diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java index 92ef88bf8..c214a5051 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java @@ -19,16 +19,15 @@ package org.apache.archiva.metadata.repository.storage.maven2; * under the License. */ -import org.apache.archiva.admin.model.beans.NetworkProxy; import org.apache.archiva.common.utils.VersionUtil; -import org.apache.archiva.dependency.tree.maven2.ArchivaRepositoryConnectorFactory; import org.apache.archiva.maven2.metadata.MavenMetadataReader; import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; import org.apache.archiva.model.ArchivaRepositoryMetadata; import org.apache.archiva.model.SnapshotVersion; -import org.apache.archiva.proxy.common.WagonFactory; -import org.apache.archiva.proxy.common.WagonFactoryException; -import org.apache.archiva.proxy.common.WagonFactoryRequest; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactoryException; +import org.apache.archiva.proxy.maven.WagonFactoryRequest; +import org.apache.archiva.proxy.model.NetworkProxy; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.RemoteRepository; import org.apache.archiva.repository.RepositoryCredentials; @@ -44,10 +43,6 @@ import org.apache.maven.model.building.ModelSource; import org.apache.maven.model.resolution.InvalidRepositoryException; import org.apache.maven.model.resolution.ModelResolver; import org.apache.maven.model.resolution.UnresolvableModelException; -import org.apache.maven.repository.internal.DefaultArtifactDescriptorReader; -import org.apache.maven.repository.internal.DefaultVersionRangeResolver; -import org.apache.maven.repository.internal.DefaultVersionResolver; -import org.apache.maven.repository.internal.MavenRepositorySystemUtils; import org.apache.maven.wagon.ConnectionException; import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.TransferFailedException; @@ -59,22 +54,18 @@ import org.apache.maven.wagon.proxy.ProxyInfo; import org.eclipse.aether.RepositorySystemSession; import org.eclipse.aether.artifact.Artifact; import org.eclipse.aether.artifact.DefaultArtifact; -import org.eclipse.aether.impl.ArtifactDescriptorReader; -import org.eclipse.aether.impl.DefaultServiceLocator; import org.eclipse.aether.impl.VersionRangeResolver; -import org.eclipse.aether.impl.VersionResolver; import org.eclipse.aether.resolution.VersionRangeRequest; import org.eclipse.aether.resolution.VersionRangeResolutionException; import org.eclipse.aether.resolution.VersionRangeResult; -import org.eclipse.aether.spi.connector.RepositoryConnectorFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.inject.Inject; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -82,6 +73,8 @@ public class RepositoryModelResolver implements ModelResolver { + private final Map networkProxyMap = new HashMap<>(); + private RepositorySystemSession session; private VersionRangeResolver versionRangeResolver; @@ -101,8 +94,7 @@ public class RepositoryModelResolver private MavenSystemManager mavenSystemManager; - // key/value: remote repo ID/network proxy - Map networkProxyMap; + private ManagedRepository managedRepository; @@ -113,10 +105,10 @@ public class RepositoryModelResolver this.pathTranslator = pathTranslator; } - public RepositoryModelResolver( ManagedRepository managedRepository, RepositoryPathTranslator pathTranslator, - WagonFactory wagonFactory, List remoteRepositories, - Map networkProxiesMap, ManagedRepository targetRepository, - MavenSystemManager mavenSystemManager) + public RepositoryModelResolver(ManagedRepository managedRepository, RepositoryPathTranslator pathTranslator, + WagonFactory wagonFactory, List remoteRepositories, + Map networkProxiesMap, ManagedRepository targetRepository, + MavenSystemManager mavenSystemManager) { this( Paths.get( managedRepository.getLocation() ), pathTranslator ); @@ -126,7 +118,8 @@ public class RepositoryModelResolver this.remoteRepositories = remoteRepositories; - this.networkProxyMap = networkProxiesMap; + this.networkProxyMap.clear(); + this.networkProxyMap.putAll(networkProxiesMap); this.targetRepository = targetRepository; diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411RepoGroupTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411RepoGroupTest.java index 79a2c52b0..6594fdaa0 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411RepoGroupTest.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411RepoGroupTest.java @@ -34,8 +34,8 @@ import org.apache.archiva.metadata.model.ProjectVersionMetadata; import org.apache.archiva.metadata.repository.filter.AllFilter; import org.apache.archiva.metadata.repository.filter.Filter; import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest; -import org.apache.archiva.proxy.common.WagonFactory; -import org.apache.archiva.proxy.common.WagonFactoryRequest; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactoryRequest; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.io.FileUtils; diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411Test.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411Test.java index 81f5d1bb9..55ef89884 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411Test.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverMRM1411Test.java @@ -34,8 +34,8 @@ import org.apache.archiva.metadata.repository.filter.AllFilter; import org.apache.archiva.metadata.repository.filter.Filter; import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest; import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException; -import org.apache.archiva.proxy.common.WagonFactory; -import org.apache.archiva.proxy.common.WagonFactoryRequest; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactoryRequest; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.io.FileUtils; diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverManagedReleaseTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverManagedReleaseTest.java index bda26dc28..a5dc3491c 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverManagedReleaseTest.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverManagedReleaseTest.java @@ -24,7 +24,7 @@ import org.apache.archiva.metadata.repository.filter.AllFilter; import org.apache.archiva.metadata.repository.filter.Filter; import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest; import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException; -import org.apache.archiva.proxy.common.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactory; import org.apache.archiva.repository.RepositoryRegistry; import org.junit.Before; import org.junit.Test; diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java index 338c2272a..9f1b4c523 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java @@ -38,8 +38,8 @@ import org.apache.archiva.metadata.repository.filter.Filter; import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException; import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; -import org.apache.archiva.proxy.common.WagonFactory; -import org.apache.archiva.proxy.common.WagonFactoryRequest; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactoryRequest; import org.apache.archiva.repository.RepositoryRegistry; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.io.FileUtils; diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java index 7ce74c00d..de3ea76a1 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/repository/index/mock/ArchivaIndexManagerMock.java @@ -20,8 +20,6 @@ package org.apache.archiva.repository.index.mock; */ import org.apache.archiva.admin.model.RepositoryAdminException; -import org.apache.archiva.admin.model.beans.NetworkProxy; -import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin; import org.apache.archiva.common.utils.FileUtils; import org.apache.archiva.common.utils.PathUtil; import org.apache.archiva.configuration.ArchivaConfiguration; @@ -30,9 +28,11 @@ import org.apache.archiva.indexer.ArchivaIndexingContext; import org.apache.archiva.indexer.IndexCreationFailedException; import org.apache.archiva.indexer.IndexUpdateFailedException; import org.apache.archiva.indexer.UnsupportedBaseContextException; -import org.apache.archiva.proxy.common.WagonFactory; -import org.apache.archiva.proxy.common.WagonFactoryException; -import org.apache.archiva.proxy.common.WagonFactoryRequest; +import org.apache.archiva.proxy.ProxyRegistry; +import org.apache.archiva.proxy.maven.WagonFactory; +import org.apache.archiva.proxy.maven.WagonFactoryException; +import org.apache.archiva.proxy.maven.WagonFactoryRequest; +import org.apache.archiva.proxy.model.NetworkProxy; import org.apache.archiva.repository.EditableRepository; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.PasswordCredentials; @@ -120,11 +120,10 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { private WagonFactory wagonFactory; @Inject - private NetworkProxyAdmin networkProxyAdmin; - + private ArtifactContextProducer artifactContextProducer; @Inject - private ArtifactContextProducer artifactContextProducer; + private ProxyRegistry proxyRegistry; private ConcurrentSkipListSet activeContexts = new ConcurrentSkipListSet<>( ); @@ -279,14 +278,7 @@ public class ArchivaIndexManagerMock implements ArchivaIndexManager { RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( ); if ( StringUtils.isNotBlank( rif.getProxyId( ) ) ) { - try - { - networkProxy = networkProxyAdmin.getNetworkProxy( rif.getProxyId( ) ); - } - catch ( RepositoryAdminException e ) - { - log.error( "Error occured while retrieving proxy {}", e.getMessage( ) ); - } + networkProxy = proxyRegistry.getNetworkProxy( rif.getProxyId( ) ); if ( networkProxy == null ) { log.warn( diff --git a/pom.xml b/pom.xml index efeb6eb12..3ca7dfb12 100644 --- a/pom.xml +++ b/pom.xml @@ -158,6 +158,11 @@ activation 1.1 + + org.apache.archiva + archiva-maven2-common + ${project.version} + org.apache.archiva archiva-maven2-metadata @@ -447,7 +452,7 @@ org.apache.archiva - archiva-proxy-common + archiva-proxy-maven ${project.version}