aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-proxy
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2006-09-01 04:21:20 +0000
committerBrett Porter <brett@apache.org>2006-09-01 04:21:20 +0000
commitb16695cf64c0fe6ff2a3b7fd9bff5adbbfe23db3 (patch)
tree345e70bf94e9336f5efea0be5bd777d847dc0902 /archiva-proxy
parent2102fd5298e06f0197d3eef290abf9f3b311409c (diff)
downloadarchiva-b16695cf64c0fe6ff2a3b7fd9bff5adbbfe23db3.tar.gz
archiva-b16695cf64c0fe6ff2a3b7fd9bff5adbbfe23db3.zip
[MRM-153] handle relocation of artifacts
Submitted by: Nicolas de Loof (applied with changes) git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@439168 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-proxy')
-rw-r--r--archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyRequestHandler.java291
-rw-r--r--archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ProxyRequestHandlerTest.java130
-rw-r--r--archiva-proxy/src/test/repositories/legacy-managed/org.apache.maven.test/jars/get-default-layout-present-1.0.jar.md51
-rw-r--r--archiva-proxy/src/test/repositories/legacy-managed/org.apache.maven.test/poms/get-relocated-artefact-1.0.pom29
-rw-r--r--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.jar3
-rw-r--r--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.pom21
-rw-r--r--archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md51
-rw-r--r--archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom29
-rw-r--r--archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact-with-pom/1.0/get-relocated-artefact-with-pom-1.0.pom29
-rw-r--r--archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom13
10 files changed, 473 insertions, 74 deletions
diff --git a/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyRequestHandler.java b/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyRequestHandler.java
index 892fd290c..74b0cc1f1 100644
--- a/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyRequestHandler.java
+++ b/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultProxyRequestHandler.java
@@ -21,11 +21,16 @@ import org.apache.maven.archiva.digest.DigesterException;
import org.apache.maven.archiva.discovery.ArtifactDiscoverer;
import org.apache.maven.archiva.discovery.DiscovererException;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.metadata.Metadata;
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Relocation;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.wagon.ConnectionException;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.TransferFailedException;
@@ -44,6 +49,7 @@ import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.Reader;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.Iterator;
@@ -68,6 +74,11 @@ public class DefaultProxyRequestHandler
implements ProxyRequestHandler
{
/**
+ * @plexus.requirement
+ */
+ private ArtifactFactory factory;
+
+ /**
* @plexus.requirement role-hint="default"
* @todo use a map, and have priorities in them
*/
@@ -114,17 +125,74 @@ public class DefaultProxyRequestHandler
{
File target = new File( managedRepository.getBasedir(), path );
- for ( Iterator i = proxiedRepositories.iterator(); i.hasNext(); )
+ if ( path.endsWith( "maven-metadata.xml" ) )
{
- ProxiedArtifactRepository repository = (ProxiedArtifactRepository) i.next();
+ // Request for managed repository metadatas
+ getMetadata( path, target, proxiedRepositories, managedRepository, wagonProxy, force );
+ }
+ else
+ {
+ boolean checksum = false;
+ String checksumExtension = null;
+ String artifactPath = path;
+ if ( path.endsWith( ".md5" ) || path.endsWith( ".sha1" ) )
+ {
+ int index = path.lastIndexOf( '.' );
+ checksumExtension = path.substring( index + 1 );
+ checksum = true;
+ artifactPath = path.substring( 0, index );
+ }
- if ( !force && repository.isCachedFailure( path ) )
+ // Request for artifact: parse the requested path to build an Artifact.
+ Artifact artifact = null;
+ try
{
- processCachedRepositoryFailure( repository, "Cached failure found for: " + path );
+ artifact = defaultArtifactDiscoverer.buildArtifact( artifactPath );
}
- else
+ catch ( DiscovererException e )
+ {
+ getLogger().debug( "Failed to build artifact using default layout with message: " + e.getMessage() );
+ }
+
+ if ( artifact == null )
+ {
+ try
+ {
+ artifact = legacyArtifactDiscoverer.buildArtifact( artifactPath );
+ }
+ catch ( DiscovererException e )
+ {
+ getLogger().debug( "Failed to build artifact using legacy layout with message: " + e.getMessage() );
+ }
+ }
+
+ if ( artifact != null )
+ {
+ applyRelocation( managedRepository, artifact, proxiedRepositories, wagonProxy, force );
+
+ if ( !checksum )
+ {
+ // Build the target file name
+ target = new File( managedRepository.getBasedir(), managedRepository.pathOf( artifact ) );
+
+ // Get the requested artifact from proxiedRepositories
+ getArtifactFromRepository( managedRepository, target, artifact, proxiedRepositories, wagonProxy,
+ force );
+ }
+ else
+ {
+ // Just adjust the filename for relocation, don't actualy get it
+ target = new File( managedRepository.getBasedir(),
+ managedRepository.pathOf( artifact ) + "." + checksumExtension );
+ }
+ }
+ else if ( !checksum )
{
- target = get( path, target, repository, managedRepository, wagonProxy, force );
+ // Some other unknown file in the repository, proxy as is, unless it was a checksum
+ if ( force || !target.exists() )
+ {
+ getFileFromRepository( managedRepository, target, path, proxiedRepositories, wagonProxy, force );
+ }
}
}
@@ -136,104 +204,178 @@ public class DefaultProxyRequestHandler
return target;
}
- /**
- * @return the target File may not be same as the target argument, if a
- * maven1 to maven2 path convertion occured.
- */
- private File get( String path, File target, ProxiedArtifactRepository repository,
- ArtifactRepository managedRepository, ProxyInfo wagonProxy, boolean force )
- throws ProxyException
+ private void getFileFromRepository( ArtifactRepository managedRepository, File target, String path,
+ List proxiedRepositories, ProxyInfo wagonProxy, boolean force )
+ throws ProxyException, ResourceDoesNotExistException
{
- ArtifactRepositoryPolicy policy;
-
- if ( path.endsWith( ".md5" ) || path.endsWith( ".sha1" ) )
+ for ( Iterator i = proxiedRepositories.iterator(); i.hasNext(); )
{
- // always read from the managed repository, no need to make remote request
+ ProxiedArtifactRepository repository = (ProxiedArtifactRepository) i.next();
+
+ if ( !force && repository.isCachedFailure( path ) )
+ {
+ processCachedRepositoryFailure( repository, "Cached failure found for: " + path );
+ }
+ else
+ {
+ ArtifactRepositoryPolicy policy = repository.getRepository().getReleases();
+ getFileFromRepository( path, repository, managedRepository.getBasedir(), wagonProxy, target, policy,
+ force );
+ }
}
- else if ( path.endsWith( "maven-metadata.xml" ) )
- {
- File metadataFile = new File( target.getParentFile(), ".metadata-" + repository.getRepository().getId() );
+ }
- policy = repository.getRepository().getReleases();
+ private void getArtifactFromRepository( ArtifactRepository managedRepository, File target, Artifact artifact,
+ List proxiedRepositories, ProxyInfo wagonProxy, boolean force )
+ throws ProxyException, ResourceDoesNotExistException
+ {
+ for ( Iterator i = proxiedRepositories.iterator(); i.hasNext(); )
+ {
+ ProxiedArtifactRepository repository = (ProxiedArtifactRepository) i.next();
+ String path = repository.getRepository().getLayout().pathOf( artifact );
- // if it is snapshot metadata, use a different policy
- if ( path.endsWith( "-SNAPSHOT/maven-metadata.xml" ) )
+ if ( !force && repository.isCachedFailure( path ) )
{
- policy = repository.getRepository().getSnapshots();
+ processCachedRepositoryFailure( repository, "Cached failure found for: " + path );
}
-
- if ( force || !metadataFile.exists() || isOutOfDate( policy, metadataFile ) )
+ else
{
- getFileFromRepository( path, repository, managedRepository.getBasedir(), wagonProxy, metadataFile,
- policy, force );
-
- mergeMetadataFiles( target, metadataFile );
+ get( artifact, target, repository, managedRepository, wagonProxy, force );
}
}
- else
+ }
+
+ private void applyRelocation( ArtifactRepository managedRepository, Artifact artifact, List proxiedRepositories,
+ ProxyInfo wagonProxy, boolean force )
+ {
+ Artifact pomArtifact =
+ factory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
+
+ File pomFile = new File( managedRepository.getBasedir(), managedRepository.pathOf( pomArtifact ) );
+ try
{
- Artifact artifact = null;
+ getArtifactFromRepository( managedRepository, pomFile, pomArtifact, proxiedRepositories, wagonProxy,
+ force );
+ }
+ catch ( ProxyException e )
+ {
+ getLogger().warn( "Error getting POM for artifact - not relocating: " + e.getMessage() );
+ getLogger().debug( "Cause", e );
+ }
+ catch ( ResourceDoesNotExistException e )
+ {
+ getLogger().debug( "Remote POM not found for artifact - not relocating" );
+ }
+
+ if ( pomFile.exists() )
+ {
+ Model model = null;
try
{
- artifact = defaultArtifactDiscoverer.buildArtifact( path );
+ // Parse the pom and look at relocation metadata
+ Reader reader = new FileReader( pomFile );
+ model = new MavenXpp3Reader().read( reader );
}
- catch ( DiscovererException e )
+ catch ( IOException e )
{
- getLogger().debug( "Failed to build artifact using default layout with message: " + e.getMessage() );
+ getLogger().warn( "Error reading POM for artifact - not relocating: " + e.getMessage() );
+ getLogger().debug( "Cause", e );
}
-
- if ( artifact == null )
+ catch ( XmlPullParserException e )
{
- try
- {
- artifact = legacyArtifactDiscoverer.buildArtifact( path );
- }
- catch ( DiscovererException e )
- {
- getLogger().debug( "Failed to build artifact using legacy layout with message: " + e.getMessage() );
- }
+ getLogger().warn( "Error parsing POM for artifact - not relocating: " + e.getMessage() );
+ getLogger().debug( "Cause", e );
}
- if ( artifact != null )
+ if ( model != null )
{
- target = new File( managedRepository.getBasedir(), managedRepository.pathOf( artifact ) );
+ DistributionManagement dist;
+ dist = model.getDistributionManagement();
- ArtifactRepository artifactRepository = repository.getRepository();
+ if ( dist != null )
+ {
+ Relocation relocation = dist.getRelocation();
+ if ( relocation != null )
+ {
+ String requestedId =
+ artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
- // we use the release policy for tracking failures, but only check for updates on snapshots
- // also, we don't look for updates on timestamp snapshot files, only non-unique-version ones
- policy = artifact.isSnapshot() ? artifactRepository.getSnapshots() : artifactRepository.getReleases();
+ // artifact is relocated : update the artifact
+ if ( relocation.getGroupId() != null )
+ {
+ artifact.setGroupId( relocation.getGroupId() );
+ }
+ if ( relocation.getArtifactId() != null )
+ {
+ artifact.setArtifactId( relocation.getArtifactId() );
+ }
+ if ( relocation.getVersion() != null )
+ {
+ artifact.setVersion( relocation.getVersion() );
+ }
- boolean needsUpdate = false;
- if ( artifact.getVersion().endsWith( "-SNAPSHOT" ) && isOutOfDate( policy, target ) )
- {
- needsUpdate = true;
- }
+ String relocatedId =
+ artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
- if ( needsUpdate || force || !target.exists() )
- {
- getFileFromRepository( artifactRepository.pathOf( artifact ), repository,
- managedRepository.getBasedir(), wagonProxy, target, policy, force );
+ getLogger().debug( "Artifact " + requestedId + " has been relocated to " + relocatedId +
+ ( relocation.getMessage() != null ? ": " + relocation.getMessage() : "" ) );
+
+ applyRelocation( managedRepository, artifact, proxiedRepositories, wagonProxy, force );
+ }
}
}
- else
+ }
+ }
+
+ private void getMetadata( String path, File target, List proxiedRepositories, ArtifactRepository managedRepository,
+ ProxyInfo wagonProxy, boolean force )
+ throws ProxyException
+ {
+ for ( Iterator i = proxiedRepositories.iterator(); i.hasNext(); )
+ {
+ ProxiedArtifactRepository repository = (ProxiedArtifactRepository) i.next();
+ File metadataFile = new File( target.getParentFile(), ".metadata-" + repository.getRepository().getId() );
+
+ ArtifactRepositoryPolicy policy = repository.getRepository().getReleases();
+
+ // if it is snapshot metadata, use a different policy
+ if ( path.endsWith( "-SNAPSHOT/maven-metadata.xml" ) )
{
- // Some other unknown file in the repository, proxy as is
- if ( force || !target.exists() )
- {
- policy = repository.getRepository().getReleases();
- getFileFromRepository( path, repository, managedRepository.getBasedir(), wagonProxy, target, policy,
- force );
- }
+ policy = repository.getRepository().getSnapshots();
+ }
+
+ if ( force || !metadataFile.exists() || isOutOfDate( policy, metadataFile ) )
+ {
+ getFileFromRepository( path, repository, managedRepository.getBasedir(), wagonProxy, metadataFile,
+ policy, force );
+
+ mergeMetadataFiles( target, metadataFile );
}
}
+ }
- if ( target.exists() )
+ private void get( Artifact artifact, File target, ProxiedArtifactRepository repository,
+ ArtifactRepository managedRepository, ProxyInfo wagonProxy, boolean force )
+ throws ProxyException
+ {
+ ArtifactRepository artifactRepository = repository.getRepository();
+
+ // we use the release policy for tracking failures, but only check for updates on snapshots
+ // also, we don't look for updates on timestamp snapshot files, only non-unique-version ones
+ ArtifactRepositoryPolicy policy =
+ artifact.isSnapshot() ? artifactRepository.getSnapshots() : artifactRepository.getReleases();
+
+ boolean needsUpdate = false;
+ if ( artifact.getVersion().endsWith( "-SNAPSHOT" ) && isOutOfDate( policy, target ) )
{
- // in case it previously failed and we've since found it
- repository.clearFailure( path );
+ needsUpdate = true;
+ }
+
+ if ( needsUpdate || force || !target.exists() )
+ {
+ getFileFromRepository( artifactRepository.pathOf( artifact ), repository, managedRepository.getBasedir(),
+ wagonProxy, target, policy, force );
}
- return target;
}
private void mergeMetadataFiles( File target, File metadataFile )
@@ -525,10 +667,11 @@ public class DefaultProxyRequestHandler
checksumExt.toUpperCase(),
path.substring( path.lastIndexOf( '/' ) ) );
- String actualChecksum = checksum.getActualChecksum().toUpperCase();
+ String actualChecksum = checksum.getActualChecksum();
+
remoteChecksum = remoteChecksum.toUpperCase();
- if ( remoteChecksum.equals( actualChecksum ) )
+ if ( actualChecksum != null && remoteChecksum.equals( actualChecksum.toUpperCase() ) )
{
moveTempToTarget( tempChecksumFile, checksumFile );
diff --git a/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ProxyRequestHandlerTest.java b/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ProxyRequestHandlerTest.java
index a1c9da8ff..c82a9bfc5 100644
--- a/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ProxyRequestHandlerTest.java
+++ b/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ProxyRequestHandlerTest.java
@@ -1624,6 +1624,136 @@ public class ProxyRequestHandlerTest
assertEquals( "Check file matches", expectedFile, file );
}
+ public void testRelocateMaven1Request()
+ throws IOException, ResourceDoesNotExistException, ProxyException
+ {
+ String path = "org.apache.maven.test/jars/get-relocated-artefact-1.0.jar";
+ String relocatedPath =
+ "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ File expectedFile = new File( defaultManagedRepository.getBasedir(), relocatedPath );
+
+ assertTrue( expectedFile.exists() );
+
+ File file = requestHandler.get( path, proxiedRepositories, defaultManagedRepository );
+
+ assertEquals( "Check file matches", expectedFile, file );
+ }
+
+ public void testDoublyRelocateMaven1Request()
+ throws IOException, ResourceDoesNotExistException, ProxyException
+ {
+ String path = "org.apache.maven.test/jars/get-doubly-relocated-artefact-1.0.jar";
+ String relocatedPath =
+ "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ File expectedFile = new File( defaultManagedRepository.getBasedir(), relocatedPath );
+
+ assertTrue( expectedFile.exists() );
+
+ File file = requestHandler.get( path, proxiedRepositories, defaultManagedRepository );
+
+ assertEquals( "Check file matches", expectedFile, file );
+ }
+
+ public void testRelocateMaven1PomRequest()
+ throws IOException, ResourceDoesNotExistException, ProxyException
+ {
+ String path = "org.apache.maven.test/poms/get-relocated-artefact-with-pom-1.0.pom";
+ String relocatedPath =
+ "org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.pom";
+ File expectedFile = new File( defaultManagedRepository.getBasedir(), relocatedPath );
+
+ assertTrue( expectedFile.exists() );
+
+ File file = requestHandler.get( path, proxiedRepositories, defaultManagedRepository );
+
+ assertEquals( "Check file matches", expectedFile, file );
+
+ assertTrue( expectedFile.exists() );
+ }
+
+ public void testRelocateMaven1PomRequestMissingTarget()
+ throws IOException, ResourceDoesNotExistException, ProxyException
+ {
+ String path = "org.apache.maven.test/poms/get-relocated-artefact-1.0.pom";
+ String relocatedPath =
+ "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.pom";
+ File expectedFile = new File( defaultManagedRepository.getBasedir(), relocatedPath );
+
+ assertFalse( expectedFile.exists() );
+
+ try
+ {
+ requestHandler.get( path, proxiedRepositories, defaultManagedRepository );
+ fail( "Should have failed to find target POM" );
+ }
+ catch ( ResourceDoesNotExistException e )
+ {
+ assertTrue( true );
+ }
+ }
+
+ public void testRelocateMaven1ChecksumRequest()
+ throws IOException, ResourceDoesNotExistException, ProxyException
+ {
+ String path = "org.apache.maven.test/jars/get-relocated-artefact-1.0.jar.md5";
+ String relocatedPath =
+ "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md5";
+ File expectedFile = new File( defaultManagedRepository.getBasedir(), relocatedPath );
+
+ assertTrue( expectedFile.exists() );
+
+ File file = requestHandler.get( path, proxiedRepositories, defaultManagedRepository );
+
+ assertEquals( "Check file matches", expectedFile, file );
+
+ assertTrue( expectedFile.exists() );
+
+ path = "org.apache.maven.test/jars/get-relocated-artefact-1.0.jar.sha1";
+ relocatedPath = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.sha1";
+ expectedFile = new File( defaultManagedRepository.getBasedir(), relocatedPath );
+
+ assertFalse( expectedFile.exists() );
+
+ try
+ {
+ requestHandler.get( path, proxiedRepositories, defaultManagedRepository );
+ fail( "Checksum was not present, should not be found" );
+ }
+ catch ( ResourceDoesNotExistException e )
+ {
+ assertTrue( true );
+ }
+ }
+
+ public void testRelocateMaven2Request()
+ throws IOException, ResourceDoesNotExistException, ProxyException
+ {
+ String path = "org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.jar";
+ String relocatedPath =
+ "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ File expectedFile = new File( defaultManagedRepository.getBasedir(), relocatedPath );
+
+ assertTrue( expectedFile.exists() );
+
+ File file = requestHandler.get( path, proxiedRepositories, defaultManagedRepository );
+
+ assertEquals( "Check file matches", expectedFile, file );
+ }
+
+ public void testRelocateMaven2RequestInLegacyManagedRepo()
+ throws IOException, ResourceDoesNotExistException, ProxyException
+ {
+ String path = "org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.jar";
+ String relocatedPath = "org.apache.maven.test/jars/get-default-layout-present-1.0.jar";
+ File expectedFile = new File( legacyManagedRepository.getBasedir(), relocatedPath );
+
+ assertTrue( expectedFile.exists() );
+
+ File file = requestHandler.get( path, proxiedRepositories, legacyManagedRepository );
+
+ assertEquals( "Check file matches", expectedFile, file );
+ }
+
private static Versioning getVersioning( List versions )
{
Versioning versioning = new Versioning();
diff --git a/archiva-proxy/src/test/repositories/legacy-managed/org.apache.maven.test/jars/get-default-layout-present-1.0.jar.md5 b/archiva-proxy/src/test/repositories/legacy-managed/org.apache.maven.test/jars/get-default-layout-present-1.0.jar.md5
new file mode 100644
index 000000000..b597d8ce4
--- /dev/null
+++ b/archiva-proxy/src/test/repositories/legacy-managed/org.apache.maven.test/jars/get-default-layout-present-1.0.jar.md5
@@ -0,0 +1 @@
+7dfb7ade9a8fa90bfbfac52d3090b8c2 *get-default-layout-present-1.0.jar
diff --git a/archiva-proxy/src/test/repositories/legacy-managed/org.apache.maven.test/poms/get-relocated-artefact-1.0.pom b/archiva-proxy/src/test/repositories/legacy-managed/org.apache.maven.test/poms/get-relocated-artefact-1.0.pom
new file mode 100644
index 000000000..a1f78ac5e
--- /dev/null
+++ b/archiva-proxy/src/test/repositories/legacy-managed/org.apache.maven.test/poms/get-relocated-artefact-1.0.pom
@@ -0,0 +1,29 @@
+<!--
+ ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-relocated-artefact</artifactId>
+ <version>1.0</version>
+
+ <distributionManagement>
+ <relocation>
+ <artifactId>get-default-layout-present</artifactId>
+ </relocation>
+ </distributionManagement>
+
+</project> \ No newline at end of file
diff --git a/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-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
new file mode 100644
index 000000000..a3b38382c
--- /dev/null
+++ b/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
@@ -0,0 +1,3 @@
+get-default-layout-present-1.0.jar
+(managed)
+
diff --git a/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-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
new file mode 100644
index 000000000..1806ff09f
--- /dev/null
+++ b/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
@@ -0,0 +1,21 @@
+<!--
+ ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed 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.
+ -->
+
+<project>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-default-layout-present-with-pom</artifactId>
+ <version>1.0</version>
+</project>
diff --git a/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-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md5
new file mode 100644
index 000000000..b597d8ce4
--- /dev/null
+++ b/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md5
@@ -0,0 +1 @@
+7dfb7ade9a8fa90bfbfac52d3090b8c2 *get-default-layout-present-1.0.jar
diff --git a/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-proxy/src/test/repositories/managed/org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom
new file mode 100644
index 000000000..fb10d7878
--- /dev/null
+++ b/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom
@@ -0,0 +1,29 @@
+<!--
+ ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-doubly-relocated-artefact</artifactId>
+ <version>1.0</version>
+
+ <distributionManagement>
+ <relocation>
+ <artifactId>get-relocated-artefact</artifactId>
+ </relocation>
+ </distributionManagement>
+
+</project> \ No newline at end of file
diff --git a/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-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact-with-pom/1.0/get-relocated-artefact-with-pom-1.0.pom
new file mode 100644
index 000000000..dd65f7b81
--- /dev/null
+++ b/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
@@ -0,0 +1,29 @@
+<!--
+ ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-relocated-artefact-with-pom</artifactId>
+ <version>1.0</version>
+
+ <distributionManagement>
+ <relocation>
+ <artifactId>get-default-layout-present-with-pom</artifactId>
+ </relocation>
+ </distributionManagement>
+
+</project> \ No newline at end of file
diff --git a/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom b/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom
new file mode 100644
index 000000000..48513de0b
--- /dev/null
+++ b/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom
@@ -0,0 +1,13 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-relocated-artefact</artifactId>
+ <version>1.0</version>
+
+ <distributionManagement>
+ <relocation>
+ <artifactId>get-default-layout-present</artifactId>
+ </relocation>
+ </distributionManagement>
+
+</project> \ No newline at end of file