aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-base/archiva-proxy
diff options
context:
space:
mode:
authorJoakim Erdfelt <joakime@apache.org>2007-08-30 01:22:19 +0000
committerJoakim Erdfelt <joakime@apache.org>2007-08-30 01:22:19 +0000
commit3b5e25770ceb3b50bae8e2571120ec98a524391e (patch)
tree9423f70de8067f00dc2f08e6e51eb64ccfcb7202 /archiva-base/archiva-proxy
parentc522cae2b458b53d8f040f8b2a88a7fb3fe42008 (diff)
downloadarchiva-3b5e25770ceb3b50bae8e2571120ec98a524391e.tar.gz
archiva-3b5e25770ceb3b50bae8e2571120ec98a524391e.zip
[MRM-463] Metadata merging doesn't work.
Bug fixes to MetadataTool. New Proxying features. Proxying Unit Testing Updates. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@571008 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base/archiva-proxy')
-rw-r--r--archiva-base/archiva-proxy/pom.xml6
-rw-r--r--archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java449
-rw-r--r--archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java75
-rw-r--r--archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java37
-rw-r--r--archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java24
-rw-r--r--archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java1029
-rw-r--r--archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java28
-rwxr-xr-xarchiva-base/archiva-proxy/src/test/repositories/create-managed-to-proxy-map.sh60
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed-to-proxy-map.txt89
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/get-default-metadata-1.0.jar0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml24
-rw-r--r--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.jar0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/maven-metadata.xml24
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/maven-metadata.xml28
-rw-r--r--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.pom0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml24
-rw-r--r--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.pom0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml29
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/get-on-multiple-repos-1.0.pom0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml24
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml28
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.0/get-project-metadata-1.0.jar0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.1/get-project-metadata-1.1.jar0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/2.0/get-project-metadata-2.0.pom0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/maven-metadata.xml28
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/get-release-metadata-2.2.jar0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/maven-metadata.xml24
-rw-r--r--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.jar0
-rw-r--r--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.jar0
-rw-r--r--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.xml31
-rw-r--r--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.jar0
-rw-r--r--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.jar0
-rw-r--r--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.jar0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml24
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/maven-metadata.xml28
-rw-r--r--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.jar0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/maven-metadata.xml28
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml24
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml29
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml24
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml29
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--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.jar0
-rw-r--r--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.jar0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--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.jar0
-rw-r--r--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.jar0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0.1/get-default-layout-1.0.1.pom0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar2
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml24
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/maven-metadata.xml28
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml24
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml29
-rw-r--r--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.jar0
-rw-r--r--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.jar0
-rw-r--r--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.jar0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--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.jar0
-rw-r--r--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.jar0
-rw-r--r--archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-base/archiva-proxy/src/test/resources/log4j.xml2
-rw-r--r--archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml2
-rw-r--r--archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ChecksumTransferTest.xml22
-rw-r--r--archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.xml22
-rw-r--r--archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.xml22
-rw-r--r--archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/MetadataTransferTest.xml48
-rw-r--r--archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/RelocateTransferTest.xml26
-rw-r--r--archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/SnapshotTransferTest.xml22
72 files changed, 2417 insertions, 351 deletions
diff --git a/archiva-base/archiva-proxy/pom.xml b/archiva-base/archiva-proxy/pom.xml
index a1610ff2f..b4f301b7f 100644
--- a/archiva-base/archiva-proxy/pom.xml
+++ b/archiva-base/archiva-proxy/pom.xml
@@ -72,6 +72,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
@@ -100,7 +105,6 @@
<exclude>**/*TestCase.java</exclude>
<exclude>**/*Tests.java</exclude>
<exclude>**/*TestSuite.java</exclude>
- <exclude>**/MetadataTransfer*</exclude>
<exclude>**/RelocateTransfer*</exclude>
</excludes>
</configuration>
diff --git a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
index e3d0c09dd..9808be7cc 100644
--- a/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
+++ b/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java
@@ -35,6 +35,8 @@ import org.apache.maven.archiva.policies.urlcache.UrlFailureCache;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.apache.maven.archiva.repository.metadata.MetadataTools;
+import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
import org.apache.maven.wagon.ConnectionException;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.Wagon;
@@ -89,6 +91,11 @@ public class DefaultRepositoryProxyConnectors
private BidirectionalRepositoryLayoutFactory layoutFactory;
/**
+ * @plexus.requirement
+ */
+ private MetadataTools metadataTools;
+
+ /**
* @plexus.requirement role="org.apache.maven.archiva.policies.PreDownloadPolicy"
*/
private Map preDownloadPolicies;
@@ -107,26 +114,21 @@ public class DefaultRepositoryProxyConnectors
private Map networkProxyMap = new HashMap();
+ /**
+ * Fetch an artifact from a remote repository.
+ *
+ * @param repository the managed repository to utilize for the request.
+ * @param artifact the artifact reference to fetch.
+ * @return the local file in the managed repository that was fetched, or null if the artifact was not (or
+ * could not be) fetched.
+ * @throws ProxyException if there was a problem fetching the artifact.
+ */
public File fetchFromProxies( ArchivaRepository repository, ArtifactReference artifact )
throws ProxyException
{
- if ( !repository.isManaged() )
- {
- throw new ProxyException( "Can only proxy managed repositories." );
- }
+ assertProxyCapable( repository );
- File localFile;
- try
- {
- BidirectionalRepositoryLayout sourceLayout = layoutFactory.getLayout( repository.getLayoutType() );
- String sourcePath = sourceLayout.toPath( artifact );
- localFile = new File( repository.getUrl().getPath(), sourcePath );
- }
- catch ( LayoutException e )
- {
- throw new ProxyException( "Unable to proxy due to bad source repository layout definition: "
- + e.getMessage(), e );
- }
+ File localFile = toLocalFile( repository, artifact );
Properties requestProperties = new Properties();
requestProperties.setProperty( "version", artifact.getVersion() );
@@ -136,58 +138,35 @@ public class DefaultRepositoryProxyConnectors
while ( it.hasNext() )
{
ProxyConnector connector = (ProxyConnector) it.next();
- getLogger().debug( "Attempting connector: " + connector );
ArchivaRepository targetRepository = connector.getTargetRepository();
- try
- {
- BidirectionalRepositoryLayout targetLayout = layoutFactory.getLayout( targetRepository.getLayoutType() );
- String targetPath = targetLayout.toPath( artifact );
+ String targetPath = getLayout( targetRepository ).toPath( artifact );
- getLogger().debug(
- "Using target repository: " + targetRepository.getId() + " - layout: "
- + targetRepository.getLayoutType() + " - targetPath: " + targetPath );
+ File downloadedFile = transferFile( connector, targetRepository, targetPath, localFile, requestProperties );
- File downloadedFile = transferFile( connector, targetRepository, targetPath, localFile,
- requestProperties );
-
- if ( fileExists( downloadedFile ) )
- {
- getLogger().info( "Successfully transfered: " + downloadedFile.getAbsolutePath() );
- return downloadedFile;
- }
- }
- catch ( LayoutException e )
+ if ( fileExists( downloadedFile ) )
{
- getLogger().error( "Unable to proxy due to bad layout definition: " + e.getMessage(), e );
- return null;
+ getLogger().info( "Successfully transfered: " + downloadedFile.getAbsolutePath() );
+ return downloadedFile;
}
}
return null;
}
+ /**
+ * Fetch, from the proxies, a metadata.xml file for the groupId:artifactId:version metadata contents.
+ *
+ * @return the (local) metadata file that was fetched/merged/updated, or null if no metadata file exists.
+ */
public File fetchFromProxies( ArchivaRepository repository, VersionedReference metadata )
throws ProxyException
{
- if ( !repository.isManaged() )
- {
- throw new ProxyException( "Can only proxy managed repositories." );
- }
+ assertProxyCapable( repository );
- File localFile;
- try
- {
- BidirectionalRepositoryLayout sourceLayout = layoutFactory.getLayout( repository.getLayoutType() );
- String sourcePath = sourceLayout.toPath( metadata );
- localFile = new File( repository.getUrl().getPath(), sourcePath );
- }
- catch ( LayoutException e )
- {
- throw new ProxyException( "Unable to proxy due to bad source repository layout definition: "
- + e.getMessage(), e );
- }
+ File localFile = toLocalFile( repository, metadata );
Properties requestProperties = new Properties();
+ boolean hasFetched = false;
List connectors = getProxyConnectors( repository );
Iterator it = connectors.iterator();
@@ -195,52 +174,65 @@ public class DefaultRepositoryProxyConnectors
{
ProxyConnector connector = (ProxyConnector) it.next();
ArchivaRepository targetRepository = connector.getTargetRepository();
- try
- {
- BidirectionalRepositoryLayout targetLayout = layoutFactory.getLayout( targetRepository.getLayoutType() );
- String targetPath = targetLayout.toPath( metadata );
+ String targetPath = getLayout( targetRepository ).toPath( metadata );
+
+ File localRepoFile = toLocalRepoFile( repository, targetRepository, targetPath );
+ File downloadedFile = transferFile( connector, targetRepository, targetPath, localRepoFile, requestProperties );
- File downloadedFile = transferFile( connector, targetRepository, targetPath, localFile,
- requestProperties );
+ if ( fileExists( downloadedFile ) )
+ {
+ getLogger().info( "Successfully transfered: " + downloadedFile.getAbsolutePath() );
+ hasFetched = true;
+ }
+ }
- if ( fileExists( downloadedFile ) )
- {
- getLogger().info( "Successfully transfered: " + downloadedFile.getAbsolutePath() );
- return downloadedFile;
- }
+ if ( hasFetched || fileExists( localFile ) )
+ {
+ try
+ {
+ metadataTools.updateMetadata( repository, metadata );
}
catch ( LayoutException e )
{
- getLogger().error( "Unable to proxy due to bad layout definition: " + e.getMessage(), e );
- return null;
+ getLogger().warn( "Unable to update metadata " + localFile.getAbsolutePath() + ": " + e.getMessage() );
+ // TODO: add into repository report?
}
+ catch ( RepositoryMetadataException e )
+ {
+ getLogger()
+ .warn( "Unable to update metadata " + localFile.getAbsolutePath() + ": " + e.getMessage(), e );
+ // TODO: add into repository report?
+ }
+ catch ( IOException e )
+ {
+ getLogger()
+ .warn( "Unable to update metadata " + localFile.getAbsolutePath() + ": " + e.getMessage(), e );
+ // TODO: add into repository report?
+ }
+ }
+
+ if ( fileExists( localFile ) )
+ {
+ return localFile;
}
return null;
}
+ /**
+ * Fetch from the proxies a metadata.xml file for the groupId:artifactId metadata contents.
+ *
+ * @return the (local) metadata file that was fetched/merged/updated, or null if no metadata file exists.
+ */
public File fetchFromProxies( ArchivaRepository repository, ProjectReference metadata )
throws ProxyException
{
- if ( !repository.isManaged() )
- {
- throw new ProxyException( "Can only proxy managed repositories." );
- }
+ assertProxyCapable( repository );
- File localFile;
- try
- {
- BidirectionalRepositoryLayout sourceLayout = layoutFactory.getLayout( repository.getLayoutType() );
- String sourcePath = sourceLayout.toPath( metadata );
- localFile = new File( repository.getUrl().getPath(), sourcePath );
- }
- catch ( LayoutException e )
- {
- throw new ProxyException( "Unable to proxy due to bad source repository layout definition: "
- + e.getMessage(), e );
- }
+ File localFile = toLocalFile( repository, metadata );
Properties requestProperties = new Properties();
+ boolean hasFetched = false;
List connectors = getProxyConnectors( repository );
Iterator it = connectors.iterator();
@@ -248,30 +240,135 @@ public class DefaultRepositoryProxyConnectors
{
ProxyConnector connector = (ProxyConnector) it.next();
ArchivaRepository targetRepository = connector.getTargetRepository();
- try
- {
- BidirectionalRepositoryLayout targetLayout = layoutFactory.getLayout( targetRepository.getLayoutType() );
- String targetPath = targetLayout.toPath( metadata );
+ String targetPath = getLayout( targetRepository ).toPath( metadata );
- File downloadedFile = transferFile( connector, targetRepository, targetPath, localFile,
- requestProperties );
+ File localRepoFile = toLocalRepoFile( repository, targetRepository, targetPath );
+ File downloadedFile = transferFile( connector, targetRepository, targetPath, localRepoFile, requestProperties );
- if ( fileExists( downloadedFile ) )
- {
- getLogger().info( "Successfully transfered: " + downloadedFile.getAbsolutePath() );
- return downloadedFile;
- }
+ if ( fileExists( downloadedFile ) )
+ {
+ getLogger().info( "Successfully transfered: " + downloadedFile.getAbsolutePath() );
+ hasFetched = true;
+ }
+ }
+
+ if ( hasFetched || fileExists( localFile ) )
+ {
+ try
+ {
+ metadataTools.updateMetadata( repository, metadata );
}
catch ( LayoutException e )
{
- getLogger().error( "Unable to proxy due to bad layout definition: " + e.getMessage(), e );
- return null;
+ getLogger().warn( "Unable to update metadata " + localFile.getAbsolutePath() + ": " + e.getMessage() );
+ // TODO: add into repository report?
+ }
+ catch ( RepositoryMetadataException e )
+ {
+ getLogger()
+ .warn( "Unable to update metadata " + localFile.getAbsolutePath() + ": " + e.getMessage(), e );
+ // TODO: add into repository report?
}
+ catch ( IOException e )
+ {
+ getLogger()
+ .warn( "Unable to update metadata " + localFile.getAbsolutePath() + ": " + e.getMessage(), e );
+ // TODO: add into repository report?
+ }
+ }
+
+ if ( fileExists( localFile ) )
+ {
+ return localFile;
}
return null;
}
+ private File toLocalRepoFile( ArchivaRepository repository, ArchivaRepository targetRepository, String targetPath )
+ {
+ String repoPath = metadataTools.getRepositorySpecificName( targetRepository, targetPath );
+ return new File( repository.getUrl().getPath(), repoPath );
+ }
+
+ /**
+ * Test if the provided ArchivaRepository has any proxies configured for it.
+ */
+ public boolean hasProxies( ArchivaRepository repository )
+ {
+ synchronized ( this.proxyConnectorMap )
+ {
+ return this.proxyConnectorMap.containsKey( repository.getId() );
+ }
+ }
+
+ /**
+ * Test the repository to see if it is proxy capable.
+ *
+ * @param repository the repository to test.
+ * @throws ProxyException if the repository is not proxy capable.
+ */
+ private void assertProxyCapable( ArchivaRepository repository )
+ throws ProxyException
+ {
+ if ( !repository.isManaged() )
+ {
+ throw new ProxyException( "Can only proxy managed repositories." );
+ }
+ }
+
+ private File toLocalFile( ArchivaRepository repository, ArtifactReference artifact )
+ throws ProxyException
+ {
+ BidirectionalRepositoryLayout sourceLayout = getLayout( repository );
+ String sourcePath = sourceLayout.toPath( artifact );
+ return new File( repository.getUrl().getPath(), sourcePath );
+ }
+
+ private File toLocalFile( ArchivaRepository repository, ProjectReference metadata )
+ throws ProxyException
+ {
+ BidirectionalRepositoryLayout sourceLayout = getLayout( repository );
+ String sourcePath = sourceLayout.toPath( metadata );
+ return new File( repository.getUrl().getPath(), sourcePath );
+ }
+
+ private File toLocalFile( ArchivaRepository repository, VersionedReference metadata )
+ throws ProxyException
+ {
+ BidirectionalRepositoryLayout sourceLayout = getLayout( repository );
+ String sourcePath = sourceLayout.toPath( metadata );
+ return new File( repository.getUrl().getPath(), sourcePath );
+ }
+
+ /**
+ * Get the layout for the repository.
+ *
+ * @param repository the repository to get the layout from.
+ * @return the layout
+ * @throws ProxyException if there was a problem obtaining the layout from the repository (usually due to a bad
+ * configuration of the repository)
+ */
+ private BidirectionalRepositoryLayout getLayout( ArchivaRepository repository )
+ throws ProxyException
+ {
+ try
+ {
+ return layoutFactory.getLayout( repository.getLayoutType() );
+ }
+ catch ( LayoutException e )
+ {
+ throw new ProxyException( "Unable to proxy due to bad repository layout definition [" + repository.getId()
+ + "] had a layout defined as [" + repository.getLayoutType() + "] : " + e.getMessage(), e );
+ }
+ }
+
+ /**
+ * Simple method to test if the file exists on the local disk.
+ *
+ * @param file the file to test. (may be null)
+ * @return true if file exists. false if the file param is null, doesn't exist, or is not of type File.
+ */
private boolean fileExists( File file )
{
if ( file == null )
@@ -295,69 +392,69 @@ public class DefaultRepositoryProxyConnectors
/**
* Perform the transfer of the file.
*
- * @param connector
- * @param targetRepository
- * @param targetPath
- * @param localFile
- * @param requestProperties
- * @return
- * @throws ProxyException
+ * @param connector the connector configuration to use.
+ * @param remoteRepository the remote repository get the resource from.
+ * @param remotePath the path in the remote repository to the resource to get.
+ * @param localFile the local file to place the downloaded resource into
+ * @param requestProperties the request properties to utilize for policy handling.
+ * @return the local file that was downloaded, or null if not downloaded.
+ * @throws ProxyException if transfer was unsuccessful.
*/
- private File transferFile( ProxyConnector connector, ArchivaRepository targetRepository, String targetPath,
+ private File transferFile( ProxyConnector connector, ArchivaRepository remoteRepository, String remotePath,
File localFile, Properties requestProperties )
throws ProxyException
{
- String url = targetRepository.getUrl().toString() + targetPath;
+ String url = remoteRepository.getUrl().toString() + remotePath;
requestProperties.setProperty( "url", url );
- // Handle pre-download policy
- if ( !applyPolicies( connector.getPolicies(), this.preDownloadPolicies, requestProperties, localFile ) )
- {
- getLogger().info( "Failed pre-download policies - " + localFile.getAbsolutePath() );
-
- if ( fileExists( localFile ) )
- {
- return localFile;
- }
-
- return null;
- }
-
// Is a whitelist defined?
if ( !isEmpty( connector.getWhitelist() ) )
{
// Path must belong to whitelist.
- if ( !matchesPattern( targetPath, connector.getWhitelist() ) )
+ if ( !matchesPattern( remotePath, connector.getWhitelist() ) )
{
- getLogger().debug( "Path [" + targetPath + "] is not part of defined whitelist (skipping transfer)." );
+ getLogger().debug( "Path [" + remotePath + "] is not part of defined whitelist (skipping transfer)." );
return null;
}
}
// Is target path part of blacklist?
- if ( matchesPattern( targetPath, connector.getBlacklist() ) )
+ if ( matchesPattern( remotePath, connector.getBlacklist() ) )
+ {
+ getLogger().debug( "Path [" + remotePath + "] is part of blacklist (skipping transfer)." );
+ return null;
+ }
+
+ // Handle pre-download policy
+ if ( !applyPolicies( this.preDownloadPolicies, connector.getPolicies(), requestProperties, localFile ) )
{
- getLogger().debug( "Path [" + targetPath + "] is part of blacklist (skipping transfer)." );
+ getLogger().info( "Failed pre-download policies - " + localFile.getAbsolutePath() );
+
+ if ( fileExists( localFile ) )
+ {
+ return localFile;
+ }
+
return null;
}
Wagon wagon = null;
try
{
- String protocol = targetRepository.getUrl().getProtocol();
+ String protocol = remoteRepository.getUrl().getProtocol();
wagon = (Wagon) wagons.get( protocol );
if ( wagon == null )
{
throw new ProxyException( "Unsupported target repository protocol: " + protocol );
}
- boolean connected = connectToRepository( connector, wagon, targetRepository );
+ boolean connected = connectToRepository( connector, wagon, remoteRepository );
if ( connected )
{
- localFile = transferSimpleFile( wagon, targetRepository, targetPath, localFile );
+ localFile = transferSimpleFile( wagon, remoteRepository, remotePath, localFile );
- transferChecksum( wagon, targetRepository, targetPath, localFile, ".sha1" );
- transferChecksum( wagon, targetRepository, targetPath, localFile, ".md5" );
+ transferChecksum( wagon, remoteRepository, remotePath, localFile, ".sha1" );
+ transferChecksum( wagon, remoteRepository, remotePath, localFile, ".md5" );
}
}
catch ( ResourceDoesNotExistException e )
@@ -386,7 +483,7 @@ public class DefaultRepositoryProxyConnectors
}
// Handle post-download policies.
- if ( !applyPolicies( connector.getPolicies(), this.postDownloadPolicies, requestProperties, localFile ) )
+ if ( !applyPolicies( this.postDownloadPolicies, connector.getPolicies(), requestProperties, localFile ) )
{
getLogger().info( "Failed post-download policies - " + localFile.getAbsolutePath() );
@@ -402,11 +499,23 @@ public class DefaultRepositoryProxyConnectors
return localFile;
}
- private void transferChecksum( Wagon wagon, ArchivaRepository targetRepository, String targetPath, File localFile,
+ /**
+ * Quietly transfer the checksum file from the remote repository to the local file.
+ *
+ * NOTE: This will not throw a WagonException if the checksum is unable to be downloaded.
+ *
+ * @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 localFile the local file that should contain the downloaded contents
+ * @param type 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, ArchivaRepository remoteRepository, String remotePath, File localFile,
String type )
throws ProxyException
{
- String url = targetRepository.getUrl().toString() + targetPath;
+ String url = remoteRepository.getUrl().toString() + remotePath;
// Transfer checksum does not use the policy.
if ( urlFailureCache.hasFailedBefore( url + type ) )
@@ -417,7 +526,7 @@ public class DefaultRepositoryProxyConnectors
try
{
File hashFile = new File( localFile.getAbsolutePath() + type );
- transferSimpleFile( wagon, targetRepository, targetPath + type, hashFile );
+ transferSimpleFile( wagon, remoteRepository, remotePath + type, hashFile );
getLogger().debug( "Checksum" + type + " Downloaded: " + hashFile );
}
catch ( ResourceDoesNotExistException e )
@@ -431,9 +540,22 @@ public class DefaultRepositoryProxyConnectors
}
}
- private File transferSimpleFile( Wagon wagon, ArchivaRepository targetRepository, String targetPath, File localFile )
+ /**
+ * 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 localFile the local file to save to
+ * @return The local file that was transfered.
+ * @throws ProxyException if there was a problem moving the downloaded file into place.
+ * @throws WagonException if there was a problem tranfering the file.
+ */
+ private File transferSimpleFile( Wagon wagon, ArchivaRepository remoteRepository, String remotePath, File localFile )
throws ProxyException, WagonException
{
+ assert ( remotePath != null );
+
// Transfer the file.
File temp = null;
@@ -445,8 +567,8 @@ public class DefaultRepositoryProxyConnectors
if ( localFile.exists() )
{
- getLogger().debug( "Retrieving " + targetPath + " from " + targetRepository.getName() );
- wagon.get( targetPath, temp );
+ getLogger().debug( "Retrieving " + remotePath + " from " + remoteRepository.getName() );
+ wagon.get( remotePath, temp );
success = true;
if ( temp.exists() )
@@ -459,13 +581,13 @@ public class DefaultRepositoryProxyConnectors
}
else
{
- getLogger().debug( "Retrieving " + targetPath + " from " + targetRepository.getName() + " if updated" );
- success = wagon.getIfNewer( targetPath, temp, localFile.lastModified() );
+ getLogger().debug( "Retrieving " + remotePath + " from " + remoteRepository.getName() + " if updated" );
+ success = wagon.getIfNewer( remotePath, temp, localFile.lastModified() );
if ( !success )
{
- getLogger().debug(
- "Not downloaded, as local file is newer than remote side: "
- + localFile.getAbsolutePath() );
+ getLogger().info(
+ "Not downloaded, as local file is newer than remote side: "
+ + localFile.getAbsolutePath() );
}
else if ( temp.exists() )
{
@@ -495,21 +617,30 @@ public class DefaultRepositoryProxyConnectors
}
}
- private boolean applyPolicies( Map policySettings, Map downloadPolicies, Properties request, File localFile )
+ /**
+ * Apply the policies.
+ * @param policies the map of policies to execute. (Map of String policy keys, to {@link DownloadPolicy} objects)
+ * @param settings the map of settings for the policies to execute. (Map of String policy keys, to String policy setting)
+ * @param request the request properties (utilized by the {@link DownloadPolicy#applyPolicy(String, Properties, File)})
+ * @param localFile the local file (utilized by the {@link DownloadPolicy#applyPolicy(String, Properties, File)})
+ *
+ * @return true if all of the policies passed, false if a policy failed.
+ */
+ private boolean applyPolicies( Map policies, Map settings, Properties request, File localFile )
{
- Iterator it = downloadPolicies.entrySet().iterator();
+ Iterator it = policies.entrySet().iterator();
while ( it.hasNext() )
{
Map.Entry entry = (Entry) it.next();
String key = (String) entry.getKey();
DownloadPolicy policy = (DownloadPolicy) entry.getValue();
String defaultSetting = policy.getDefaultOption();
- String setting = StringUtils.defaultString( (String) policySettings.get( key ), defaultSetting );
+ String setting = StringUtils.defaultString( (String) settings.get( key ), defaultSetting );
getLogger().debug( "Applying [" + key + "] policy with [" + setting + "]" );
if ( !policy.applyPolicy( setting, request, localFile ) )
{
- getLogger().debug( "Didn't pass the [" + key + "] policy." );
+ getLogger().info( "Didn't pass the [" + key + "] policy." );
return false;
}
}
@@ -551,7 +682,15 @@ public class DefaultRepositoryProxyConnectors
}
}
- private boolean connectToRepository( ProxyConnector connector, Wagon wagon, ArchivaRepository targetRepository )
+ /**
+ * 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, ArchivaRepository remoteRepository )
{
boolean connected = false;
@@ -563,7 +702,7 @@ public class DefaultRepositoryProxyConnectors
try
{
- Repository wagonRepository = new Repository( targetRepository.getId(), targetRepository.getUrl().toString() );
+ Repository wagonRepository = new Repository( remoteRepository.getId(), remoteRepository.getUrl().toString() );
if ( networkProxy != null )
{
wagon.connect( wagonRepository, networkProxy );
@@ -576,16 +715,25 @@ public class DefaultRepositoryProxyConnectors
}
catch ( ConnectionException e )
{
- getLogger().info( "Could not connect to " + targetRepository.getName() + ": " + e.getMessage() );
+ getLogger().info( "Could not connect to " + remoteRepository.getName() + ": " + e.getMessage() );
+ connected = false;
}
catch ( AuthenticationException e )
{
- getLogger().info( "Could not connect to " + targetRepository.getName() + ": " + e.getMessage() );
+ getLogger().info( "Could not connect to " + remoteRepository.getName() + ": " + e.getMessage() );
+ connected = false;
}
return connected;
}
+ /**
+ * Tests whitelist and blacklist patterns against path.
+ *
+ * @param path the path to test.
+ * @param patterns the list of patterns to check.
+ * @return true if the path matches at least 1 pattern in the provided patterns list.
+ */
private boolean matchesPattern( String path, List patterns )
{
if ( isEmpty( patterns ) )
@@ -606,6 +754,9 @@ public class DefaultRepositoryProxyConnectors
return false;
}
+ /**
+ * TODO: Ensure that list is correctly ordered based on configuration. See MRM-477
+ */
public List getProxyConnectors( ArchivaRepository repository )
{
synchronized ( this.proxyConnectorMap )
@@ -619,14 +770,6 @@ public class DefaultRepositoryProxyConnectors
}
}
- public boolean hasProxies( ArchivaRepository repository )
- {
- synchronized ( this.proxyConnectorMap )
- {
- return this.proxyConnectorMap.containsKey( repository.getId() );
- }
- }
-
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
{
if ( ConfigurationNames.isNetworkProxy( propertyName ) || ConfigurationNames.isRepositories( propertyName )
diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
index 105be975f..73077e926 100644
--- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
+++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/AbstractProxyTestCase.java
@@ -28,6 +28,7 @@ import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.model.ProjectReference;
+import org.apache.maven.archiva.model.VersionedReference;
import org.apache.maven.archiva.policies.urlcache.UrlFailureCache;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
@@ -82,7 +83,7 @@ public class AbstractProxyTestCase
protected static final String REPOPATH_DEFAULT_MANAGED = "src/test/repositories/managed";
- protected static final String REPOPATH_DEFAULT_MANAGED_TARGET = "target/test-repository/managed";
+ // protected static final String REPOPATH_DEFAULT_MANAGED_TARGET = "target/test-repository/managed";
protected static final String REPOPATH_LEGACY_MANAGED = "src/test/repositories/legacy-managed";
@@ -255,7 +256,7 @@ public class AbstractProxyTestCase
"Test Managed (Legacy) Repository", "legacy" );
}
- protected ProjectReference createMetadataReference( String layoutType, String path )
+ protected ProjectReference createProjectReference( String layoutType, String path )
throws Exception
{
BidirectionalRepositoryLayout layout = layoutFactory.getLayout( layoutType );
@@ -263,6 +264,14 @@ public class AbstractProxyTestCase
return metadata;
}
+ protected VersionedReference createVersionedReference( String layoutType, String path )
+ throws Exception
+ {
+ BidirectionalRepositoryLayout layout = layoutFactory.getLayout( layoutType );
+ VersionedReference metadata = layout.toVersionedReference( path );
+ return metadata;
+ }
+
protected ArchivaRepository createProxiedLegacyRepository()
{
return createRepository( "src/test/repositories/legacy-proxied", "testProxiedLegacyRepo",
@@ -402,13 +411,11 @@ public class AbstractProxyTestCase
RepositoryConfiguration repoConfig;
// Setup source repository (using default layout)
- File repoLocation = getTestFile( REPOPATH_DEFAULT_MANAGED_TARGET );
- // faster only to delete this one before copying, the others are done case by case
- FileUtils.deleteDirectory( new File( repoLocation, "org/apache/maven/test/get-merged-metadata" ) );
- copyDirectoryStructure( getTestFile( REPOPATH_DEFAULT_MANAGED ), repoLocation );
+ String repoPath = "target/test-repository/managed/" + getName();
+ File repoLocation = getTestFile( repoPath );
- managedDefaultRepository = createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository",
- REPOPATH_DEFAULT_MANAGED_TARGET, "default" );
+ managedDefaultRepository = createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath,
+ "default" );
managedDefaultDir = new File( managedDefaultRepository.getUrl().getPath() );
@@ -451,6 +458,58 @@ public class AbstractProxyTestCase
System.out.println( "\n.\\ " + getName() + "() \\._________________________________________\n" );
}
+ /**
+ * Copy the specified resource directory from the src/test/repository/managed/ to
+ * the testable directory under target/test-repository/managed/${testName}/
+ *
+ * @param resourceDir
+ * @throws IOException
+ */
+ protected void setupTestableManagedRepository( String resourcePath )
+ throws IOException
+ {
+ String resourceDir = resourcePath;
+
+ if( !resourcePath.endsWith( "/" ) )
+ {
+ int idx = resourcePath.lastIndexOf( '/' );
+ resourceDir = resourcePath.substring( 0, idx );
+ }
+
+ File sourceRepoDir = new File( REPOPATH_DEFAULT_MANAGED );
+ File sourceDir = new File( sourceRepoDir, resourceDir );
+
+ File destRepoDir = managedDefaultDir;
+ File destDir = new File( destRepoDir, resourceDir );
+
+ // Cleanout destination dirs.
+ if ( destDir.exists() )
+ {
+ FileUtils.deleteDirectory( destDir );
+ }
+
+ // Test the source dir.
+ if ( !sourceDir.exists() )
+ {
+ // This is just a warning.
+ System.err.println( "Skipping setup of testable managed repsoitory, source dir does not exist: "
+ + sourceDir );
+ return;
+ }
+
+ // Test that the source is a dir.
+ if ( !sourceDir.isDirectory() )
+ {
+ fail( "Unable to setup testable managed repository, source is not a directory: " + sourceDir );
+ }
+
+ // Make the destination dir.
+ destDir.mkdirs();
+
+ // Copy directory structure.
+ copyDirectoryStructure( sourceDir, destDir );
+ }
+
protected static Date getFutureDate()
throws ParseException
{
diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java
index dad2634a9..62e3f0e30 100644
--- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java
+++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ChecksumTransferTest.java
@@ -43,6 +43,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -66,6 +68,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -88,6 +92,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -110,6 +116,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -132,6 +140,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -154,6 +164,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -174,6 +186,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -197,6 +211,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -217,6 +233,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -240,6 +258,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -260,6 +280,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -283,6 +305,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -306,6 +330,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -329,6 +355,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -352,6 +380,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -394,6 +424,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -416,6 +448,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -438,6 +472,8 @@ public class ChecksumTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -455,5 +491,4 @@ public class ChecksumTransferTest
assertChecksums( expectedFile, "96a08dc80a108cba8efd3b20aec91b32a0b2cbd4 get-bad-local-checksum-1.0.jar",
"46fdd6ca55bf1d7a7eb0c858f41e0ccd get-bad-local-checksum-1.0.jar" );
}
-
}
diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java
index 066abd271..1807d0f77 100644
--- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java
+++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.java
@@ -44,6 +44,8 @@ public class ManagedDefaultTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -74,6 +76,8 @@ public class ManagedDefaultTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -102,6 +106,8 @@ public class ManagedDefaultTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
long originalModificationTime = expectedFile.lastModified();
@@ -154,6 +160,8 @@ public class ManagedDefaultTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -176,6 +184,8 @@ public class ManagedDefaultTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -207,6 +217,8 @@ public class ManagedDefaultTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -231,6 +243,8 @@ public class ManagedDefaultTransferTest
throws Exception
{
String path = "org/apache/maven/test/does-not-exist/1.0/does-not-exist-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -255,6 +269,8 @@ public class ManagedDefaultTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -288,6 +304,8 @@ public class ManagedDefaultTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -327,6 +345,8 @@ public class ManagedDefaultTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -352,6 +372,8 @@ public class ManagedDefaultTransferTest
String legacyPath = "org.apache.maven.test/jars/get-default-layout-present-1.0.jar";
String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -373,6 +395,8 @@ public class ManagedDefaultTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java
index 062a973a5..52e9605e2 100644
--- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java
+++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/MetadataTransferTest.java
@@ -19,344 +19,1011 @@ package org.apache.maven.archiva.proxy;
* under the License.
*/
-import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.common.utils.VersionUtil;
import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
import org.apache.maven.archiva.model.ProjectReference;
import org.apache.maven.archiva.model.SnapshotVersion;
+import org.apache.maven.archiva.model.VersionedReference;
import org.apache.maven.archiva.policies.CachedFailuresPolicy;
import org.apache.maven.archiva.policies.ChecksumPolicy;
import org.apache.maven.archiva.policies.ReleasesPolicy;
import org.apache.maven.archiva.policies.SnapshotsPolicy;
+import org.apache.maven.archiva.repository.metadata.MetadataTools;
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter;
+import org.custommonkey.xmlunit.DetailedDiff;
+import org.custommonkey.xmlunit.Diff;
import java.io.File;
import java.io.StringWriter;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import java.util.Arrays;
-import java.util.Date;
-import java.util.Locale;
-import java.util.TimeZone;
/**
- * MetadataTransferTest
+ * MetadataTransferTest - Tests the various fetching / merging concepts surrounding the maven-metadata.xml files
+ * present in the repository.
+ *
+ * Test Case Naming is as follows.
+ *
+ * <code>
+ * public void testGet[Release|Snapshot|Project]Metadata[Not]Proxied[Not|On]Local[Not|On|Multiple]Remote
+ * </code>
+ *
+ * <pre>
+ * Which should leave the following matrix of test cases.
+ *
+ * Metadata | Proxied | Local | Remote
+ * ----------+----------+-------+---------
+ * Release | Not | Not | n/a (1)
+ * Release | Not | On | n/a (1)
+ * Release | | Not | Not
+ * Release | | Not | On
+ * Release | | Not | Multiple
+ * Release | | On | Not
+ * Release | | On | On
+ * Release | | On | Multiple
+ * Snapshot | Not | Not | n/a (1)
+ * Snapshot | Not | On | n/a (1)
+ * Snapshot | | Not | Not
+ * Snapshot | | Not | On
+ * Snapshot | | Not | Multiple
+ * Snapshot | | On | Not
+ * Snapshot | | On | On
+ * Snapshot | | On | Multiple
+ * Project | Not | Not | n/a (1)
+ * Project | Not | On | n/a (1)
+ * Project | | Not | Not
+ * Project | | Not | On
+ * Project | | Not | Multiple
+ * Project | | On | Not
+ * Project | | On | On
+ * Project | | On | Multiple
+ *
+ * (1) If it isn't proxied, no point in having a remote.
+ * </pre>
*
- * @author Brett Porter
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* @version $Id$
*/
public class MetadataTransferTest
extends AbstractProxyTestCase
{
- public void testGetMetadataNotPresent()
+ /**
+ * @plexus.requirement
+ */
+ private MetadataTools metadataTools;
+
+ /**
+ * Attempt to get the project metadata for non-existant artifact.
+ *
+ * Expected result: the maven-metadata.xml file is not created on the managed repository, nor returned
+ * to the requesting client.
+ */
+ public void testGetProjectMetadataNotProxiedNotLocal()
+ throws Exception
+ {
+ // The artifactId "get-default-metadata-nonexistant" does not exist (intentionally).
+ String requestedResource = "org/apache/maven/test/get-default-metadata-nonexistant/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ assertResourceNotFound( requestedResource );
+
+ // No proxy setup, nothing fetched, failure expected.
+ assertFetchProjectFailed( requestedResource );
+
+ // No local artifactId, and no fetch, should equal no metadata file downloaded / created / updated.
+ assertResourceNotFound( requestedResource );
+ }
+
+ public void testGetProjectMetadataNotProxiedOnLocal()
throws Exception
{
- String path = "org/apache/maven/test/dummy-artifact/1.0/maven-metadata.xml";
- File expectedFile = new File( managedDefaultDir, path );
- ProjectReference metadata = createMetadataReference( "default", path );
+ // Project metadata that exists and has multiple versions
+ String requestedResource = "org/apache/maven/test/get-project-metadata/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ assertResourceExists( requestedResource );
+
+ // No proxy setup, nothing fetched from remote, but local exists.
+ assertFetchProject( requestedResource );
+
+ // Nothing fetched. Should only contain contents of what is in the repository.
+ assertProjectMetadataContents( requestedResource, new String[] { "1.0", "1.1", "2.0" } );
+ }
+
+ public void testGetProjectMetadataProxiedNotLocalMultipleRemotes()
+ throws Exception
+ {
+ // Project metadata that does not exist locally, but has multiple versions in remote repos
+ String requestedResource = "org/apache/maven/test/get-default-layout/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ setupTestableManagedRepository( requestedResource );
// Configure Connector (usually done within archiva.xml configuration)
saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
- File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
- assertNotDownloaded( downloadedFile );
- assertNoTempFiles( expectedFile );
+ // Two proxies setup, metadata fetched from both remotes.
+ assertFetchProject( requestedResource );
+
+ // Nothing fetched. Should only contain contents of what is in the repository.
+ assertProjectMetadataContents( requestedResource, new String[] { "1.0", "1.0.1" } );
+ assertRepoProjectMetadata( ID_PROXIED1, requestedResource, new String[] { "1.0" } );
+ assertRepoProjectMetadata( ID_PROXIED2, requestedResource, new String[] { "1.0.1" } );
}
- private String getExpectedMetadata( String artifactId, String version )
- throws RepositoryMetadataException
+ public void testGetProjectMetadataProxiedNotLocalNotRemote()
+ throws Exception
{
- return getExpectedMetadata( artifactId, version, (SnapshotVersion) null, null );
- }
+ // Non-existant project metadata that does not exist locally and doesn't exist on remotes.
+ String requestedResource = "org/apache/maven/test/get-bogus-artifact/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
- private static final TimeZone UTC_TIMEZONE = TimeZone.getTimeZone( "UTC" );
+ setupTestableManagedRepository( requestedResource );
- private static String getLastUpdatedTimestamp( File file )
- {
- DateFormat fmt = new SimpleDateFormat( "yyyyMMddHHmmss", Locale.US );
- fmt.setTimeZone( UTC_TIMEZONE );
- return fmt.format( new Date( file.lastModified() ) );
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // Two proxies setup, nothing fetched from remotes, local does not exist.
+ assertFetchProjectFailed( requestedResource );
+
+ // Nothing fetched. Nothing should exist.
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
}
- private String getExpectedMetadata( String artifactId, String[] availableVersions, File file )
- throws RepositoryMetadataException
+ public void testGetProjectMetadataProxiedNotLocalOnRemote()
+ throws Exception
{
- return getExpectedMetadata( artifactId, null, availableVersions, file );
+ // New project metadata that does not exist locally but exists on remote.
+ String requestedResource = "org/apache/maven/test/get-found-in-proxy/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+ // One proxy setup, metadata fetched from remote, local does not exist.
+ assertFetchProject( requestedResource );
+
+ // Remote fetched. Local created/updated.
+ assertProjectMetadataContents( requestedResource, new String[] { "1.0.5" } );
+ assertRepoProjectMetadata( ID_PROXIED1, requestedResource, new String[] { "1.0.5" } );
}
- private SnapshotVersion getSnapshotVersion( String timestamp, int buildNumber )
+ public void testGetProjectMetadataProxiedOnLocalMultipleRemote()
+ throws Exception
{
- SnapshotVersion snapshot = new SnapshotVersion();
+ // Project metadata that exist locally, and has multiple versions in remote repos
+ String requestedResource = "org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
- snapshot.setTimestamp( timestamp );
- snapshot.setBuildNumber( buildNumber );
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+
+ assertProjectMetadataContents( requestedResource, new String[] { "1.0" } );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
- return snapshot;
+ // Two proxies setup, metadata fetched from both remotes.
+ assertFetchProject( requestedResource );
+
+ // metadata fetched from both repos, and merged with local version.
+ assertProjectMetadataContents( requestedResource, new String[] { "1.0", "1.0.1", "2.0" } );
+ assertRepoProjectMetadata( ID_PROXIED1, requestedResource, new String[] { "1.0", "2.0" } );
+ assertRepoProjectMetadata( ID_PROXIED2, requestedResource, new String[] { "1.0", "1.0.1" } );
}
- private String getExpectedMetadata( String artifactId, String version, SnapshotVersion snapshot, File file )
- throws RepositoryMetadataException
+ public void testGetProjectMetadataProxiedOnLocalNotRemote()
+ throws Exception
{
- StringWriter expectedContents = new StringWriter();
+ // Project metadata that exist locally, and does not exist in remote repos.
+ String requestedResource = "org/apache/maven/test/get-not-on-remotes/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
- ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
- m.setGroupId( "org.apache.maven.test" );
- m.setArtifactId( artifactId );
- m.setVersion( version );
- m.setSnapshotVersion( snapshot );
- if ( file != null )
- {
- m.setLastUpdated( getLastUpdatedTimestamp( file ) );
- }
- m.setModelEncoding( null );
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+
+ assertProjectMetadataContents( requestedResource, new String[] { "1.0-beta-2" } );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
- RepositoryMetadataWriter.write( m, expectedContents );
- return expectedContents.toString();
+ // Two proxies setup, metadata fetch from remotes fail (because they dont exist).
+ assertFetchProject( requestedResource );
+
+ // metadata not fetched from both repos, and local version exists.
+ assertProjectMetadataContents( requestedResource, new String[] { "1.0-beta-2" } );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
}
- private String getExpectedMetadata( String artifactId, String version, String[] availableVersions, File file )
- throws RepositoryMetadataException
+ public void testGetProjectMetadataProxiedOnLocalOnRemote()
+ throws Exception
{
- StringWriter expectedContents = new StringWriter();
+ // Project metadata that exist locally and exists on remote.
+ String requestedResource = "org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
- ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
- m.setGroupId( "org.apache.maven.test" );
- m.setArtifactId( artifactId );
- m.setVersion( version );
- if ( file != null )
- {
- m.setLastUpdated( getLastUpdatedTimestamp( file ) );
- }
- if ( availableVersions != null )
- {
- m.getAvailableVersions().addAll( Arrays.asList( availableVersions ) );
- }
- m.setModelEncoding( null );
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+
+ assertProjectMetadataContents( requestedResource, new String[] { "1.0.8", "1.0.22" } );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
- RepositoryMetadataWriter.write( m, expectedContents );
- return expectedContents.toString();
+ // One proxy setup, metadata fetched from remote, local exists.
+ assertFetchProject( requestedResource );
+
+ // Remote fetched. Local updated.
+ assertProjectMetadataContents( requestedResource, new String[] { "1.0.8", "1.0.22", "2.0" } );
+ assertRepoProjectMetadata( ID_PROXIED1, requestedResource, new String[] { "1.0.22", "2.0" } );
}
- private void assertMetadataEquals( File expectedFile, File downloadedFile, String expectedMetadata )
+ /**
+ * A request for a release maven-metadata.xml file that does not exist locally, and the managed
+ * repository has no proxied repositories set up.
+ *
+ * Expected result: the maven-metadata.xml file is not created on the managed repository, nor returned
+ * to the requesting client.
+ */
+ public void testGetReleaseMetadataNotProxiedNotLocal()
throws Exception
{
- assertNotNull( "Expected File should not be null.", expectedFile );
- assertNotNull( "Downloaded File should not be null.", downloadedFile );
+ // The artifactId "get-default-metadata-nonexistant" does not exist (intentionally).
+ String requestedResource = "org/apache/maven/test/get-default-metadata-nonexistant/1.0/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
- assertTrue( "Check downloaded file exists.", downloadedFile.exists() );
- assertEquals( "Check file path matches.", expectedFile.getAbsolutePath(), downloadedFile.getAbsolutePath() );
+ assertNoMetadata( requestedResource );
- StringWriter actualContents = new StringWriter();
- RepositoryMetadataReader metadataReader = new RepositoryMetadataReader();
- ArchivaRepositoryMetadata metadata = metadataReader.read( downloadedFile );
- RepositoryMetadataWriter.write( metadata, actualContents );
- assertEquals( "Check file contents.", expectedMetadata, actualContents );
+ // No proxy setup, nothing fetched, failure expected.
+ assertFetchVersionedFailed( requestedResource );
+
+ // No local artifactId, and no fetch, should equal no metadata file downloaded / created / updated.
+ assertNoMetadata( requestedResource );
}
- public void testGetMetadataProxied()
+ /**
+ * A request for a maven-metadata.xml file that does exist locally, and the managed
+ * repository has no proxied repositories set up.
+ *
+ * Expected result: the maven-metadata.xml file is updated locally, based off of the managed repository
+ * information, and then returned to the client.
+ */
+ public void testGetReleaseMetadataNotProxiedOnLocal()
throws Exception
{
- String path = "org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml";
- File expectedFile = new File( managedDefaultDir, path );
- ProjectReference metadata = createMetadataReference( "default", path );
+ String requestedResource = "org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
- FileUtils.deleteDirectory( expectedFile.getParentFile() );
- assertFalse( expectedFile.exists() );
+ assertResourceExists( requestedResource );
+
+ assertFetchVersioned( requestedResource );
+
+ assertReleaseMetadataContents( requestedResource );
+ }
+
+ /**
+ * A request for a release maven-metadata.xml file that does not exist on the managed repository, but
+ * exists on multiple remote repositories.
+ *
+ * Expected result: the maven-metadata.xml file is downloaded from the remote into the repository specific
+ * file location on the managed repository, a merge of the contents to the requested
+ * maven-metadata.xml is performed, and then the merged maven-metadata.xml file is
+ * returned to the client.
+ */
+ public void testGetReleaseMetadataProxiedNotLocalMultipleRemotes()
+ throws Exception
+ {
+ String requestedResource = "org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
// Configure Connector (usually done within archiva.xml configuration)
saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
- File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
- String expectedMetadata = getExpectedMetadata( "get-default-metadata", "1.0" );
- assertMetadataEquals( expectedFile, downloadedFile, expectedMetadata );
- assertNoTempFiles( expectedFile );
+ assertFetchVersioned( requestedResource );
+
+ assertReleaseMetadataContents( requestedResource );
+ assertRepoReleaseMetadataContents( ID_PROXIED1, requestedResource );
+ assertRepoReleaseMetadataContents( ID_PROXIED2, requestedResource );
}
- public void testGetMetadataMergeRepos()
+ /**
+ * A request for a maven-metadata.xml file that does not exist locally, nor does it exist in a remote
+ * proxied repository.
+ *
+ * Expected result: the maven-metadata.xml file is created locally, based off of managed repository
+ * information, and then return to the client.
+ */
+ public void testGetReleaseMetadataProxiedNotLocalNotRemote()
throws Exception
{
- String path = "org/apache/maven/test/get-merged-metadata/maven-metadata.xml";
- File expectedFile = new File( managedDefaultDir, path );
- ProjectReference metadata = createMetadataReference( "default", path );
-
- assertTrue( expectedFile.exists() );
+ String requestedResource = "org/apache/maven/test/get-bad-metadata/1.0/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
// Configure Connector (usually done within archiva.xml configuration)
saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
- File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
+ assertResourceNotFound( requestedResource );
- String expectedMetadata = getExpectedMetadata( "get-merged-metadata", new String[] {
- "0.9",
- "1.0",
- "2.0",
- "3.0",
- "5.0",
- "4.0" }, downloadedFile );
- assertMetadataEquals( expectedFile, downloadedFile, expectedMetadata );
- assertNoTempFiles( expectedFile );
+ assertFetchProjectFailed( requestedResource );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
}
- public void testGetMetadataRemovedFromProxies()
+ /**
+ * A request for a maven-metadata.xml file that does not exist on the managed repository, but
+ * exists on 1 remote repository.
+ *
+ * Expected result: the maven-metadata.xml file is downloaded from the remote into the repository specific
+ * file location on the managed repository, a merge of the contents to the requested
+ * maven-metadata.xml is performed, and then the merged maven-metadata.xml file is
+ * returned to the client.
+ */
+ public void testGetReleaseMetadataProxiedNotLocalOnRemote()
throws Exception
{
- String path = "org/apache/maven/test/get-removed-metadata/1.0/maven-metadata.xml";
- File expectedFile = new File( managedDefaultDir, path );
- ProjectReference metadata = createMetadataReference( "default", path );
+ String requestedResource = "org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+ assertFetchVersioned( requestedResource );
- assertTrue( expectedFile.exists() );
+ assertReleaseMetadataContents( requestedResource );
+ assertRepoReleaseMetadataContents( ID_PROXIED1, requestedResource );
+ }
+
+ /**
+ * A request for a maven-metadata.xml file that exists in the managed repository, but
+ * not on any remote repository.
+ *
+ * Expected result: the maven-metadata.xml file does not exist on the remote proxied repository and
+ * is not downloaded. There is no repository specific metadata file on the managed
+ * repository. The managed repository maven-metadata.xml is returned to the
+ * client as-is.
+ */
+ public void testGetReleaseMetadataProxiedOnLocalNotRemote()
+ throws Exception
+ {
+ String requestedResource = "org/apache/maven/test/get-not-on-remotes/1.0-beta-2/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
// Configure Connector (usually done within archiva.xml configuration)
- saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
- File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
+ assertReleaseMetadataContents( requestedResource );
- File proxiedFile = new File( REPOPATH_PROXIED1, path );
- assertFileEquals( expectedFile, downloadedFile, proxiedFile );
- assertNoTempFiles( expectedFile );
+ assertFetchVersioned( requestedResource );
+
+ assertReleaseMetadataContents( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
}
- public void testGetReleaseMetadataNotExpired()
+ /**
+ * A request for a maven-metadata.xml file that exists in the managed repository, and on multiple
+ * remote repositories.
+ *
+ * Expected result: the maven-metadata.xml file on the remote proxied repository is downloaded
+ * and merged into the contents of the existing managed repository copy of
+ * the maven-metadata.xml file.
+ */
+ public void testGetReleaseMetadataProxiedOnLocalMultipleRemote()
throws Exception
{
- String path = "org/apache/maven/test/get-updated-metadata/maven-metadata.xml";
- File expectedFile = new File( managedDefaultDir, path );
- ProjectReference metadata = createMetadataReference( "default", path );
+ String requestedResource = "org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+
+ assertReleaseMetadataContents( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
- assertTrue( expectedFile.exists() );
+ assertFetchVersioned( requestedResource );
- new File( expectedFile.getParentFile(), ".metadata-proxied1" ).setLastModified( getPastDate().getTime() );
+ assertReleaseMetadataContents( requestedResource );
+ assertRepoReleaseMetadataContents( ID_PROXIED1, requestedResource );
+ assertRepoReleaseMetadataContents( ID_PROXIED2, requestedResource );
+ }
+
+ /**
+ * A request for a maven-metadata.xml file that exists in the managed repository, and on one
+ * remote repository.
+ *
+ * Expected result: the maven-metadata.xml file on the remote proxied repository is downloaded
+ * and merged into the contents of the existing managed repository copy of
+ * the maven-metadata.xml file.
+ */
+ public void testGetReleaseMetadataProxiedOnLocalOnRemote()
+ throws Exception
+ {
+ String requestedResource = "org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
// Configure Connector (usually done within archiva.xml configuration)
- saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
- File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
+ assertReleaseMetadataContents( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
- File proxiedFile = new File( REPOPATH_PROXIED1, path );
- assertFileEquals( expectedFile, downloadedFile, proxiedFile );
- assertNoTempFiles( expectedFile );
+ assertFetchVersioned( requestedResource );
+
+ assertReleaseMetadataContents( requestedResource );
+ assertRepoReleaseMetadataContents( ID_PROXIED1, requestedResource );
}
- public void testGetSnapshotMetadataNotExpired()
+ public void testGetSnapshotMetadataNotProxiedNotLocal()
throws Exception
{
- String path = "org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml";
- File expectedFile = new File( managedDefaultDir, path );
- ProjectReference metadata = createMetadataReference( "default", path );
+ // The artifactId "get-default-metadata-nonexistant" does not exist (intentionally).
+ String requestedResource = "org/apache/maven/test/get-default-metadata-nonexistant/1.0-SNAPSHOT/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
- assertTrue( expectedFile.exists() );
+ assertNoMetadata( requestedResource );
- new File( expectedFile.getParentFile(), ".metadata-proxied1" ).setLastModified( getPastDate().getTime() );
+ // No proxy setup, nothing fetched, no local file, failure expected.
+ assertFetchVersionedFailed( requestedResource );
- // Configure Connector (usually done within archiva.xml configuration)
- saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
- SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ // No local artifactId, and no fetch, should equal no metadata file downloaded / created / updated.
+ assertNoMetadata( requestedResource );
+ }
- File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
+ public void testGetSnapshotMetadataNotProxiedOnLocal()
+ throws Exception
+ {
+ // The artifactId exists locally (but not on a remote repo)
+ String requestedResource = "org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
- // Content should NOT match that from proxied 1.
- assertFileEquals( expectedFile, downloadedFile, expectedFile );
- assertNoTempFiles( expectedFile );
+ assertResourceExists( requestedResource );
+
+ // No proxy setup, nothing fetched from remote, local file exists, fetch should succeed.
+ assertFetchVersioned( requestedResource );
+
+ // Local metadata exists, should be updated to reflect the latest release.
+ assertSnapshotMetadataContents( requestedResource, "20070821", "220304", 2 );
}
- public void testGetReleaseMetadataExpired()
+ public void testGetSnapshotMetadataProxiedNotLocalMultipleRemotes()
throws Exception
{
- String path = "org/apache/maven/test/get-updated-metadata/maven-metadata.xml";
- File expectedFile = new File( managedDefaultDir, path );
- ProjectReference metadata = createMetadataReference( "default", path );
+ String requestedResource = "org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
- assertTrue( expectedFile.exists() );
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
- new File( expectedFile.getParentFile(), ".metadata-proxied1" ).setLastModified( getPastDate().getTime() );
+ // Proxying 2 repos, both have content, local file updated.
+ assertFetchVersioned( requestedResource );
+
+ assertSnapshotMetadataContents( requestedResource, "20070101", "000103", 2 );
+ assertRepoSnapshotMetadataContents( ID_PROXIED1, requestedResource, "20061227", "112101", 2 );
+ assertRepoSnapshotMetadataContents( ID_PROXIED2, requestedResource, "20070101", "000103", 2 );
+ }
+
+ public void testGetSnapshotMetadataProxiedNotLocalNotRemote()
+ throws Exception
+ {
+ // The artifactId "get-default-metadata-nonexistant" does not exist (intentionally).
+ String requestedResource = "org/apache/maven/test/get-default-metadata-nonexistant/1.0-SNAPSHOT/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
// Configure Connector (usually done within archiva.xml configuration)
- saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
- File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
+ assertNoMetadata( requestedResource );
- String expectedMetadata = getExpectedMetadata( "get-updated-metadata", new String[] { "1.0", "2.0", },
- downloadedFile );
- assertMetadataEquals( expectedFile, downloadedFile, expectedMetadata );
- assertNoTempFiles( expectedFile );
+ // One proxy setup, nothing fetched, no local file, failure expected.
+ assertFetchVersionedFailed( requestedResource );
+
+ // No local artifactId, and no fetch, should equal no metadata file downloaded / created / updated.
+ assertNoMetadata( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
}
- public void testGetSnapshotMetadataExpired()
+ public void testGetSnapshotMetadataProxiedNotLocalOnRemote()
throws Exception
{
- String path = "org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml";
- File expectedFile = new File( managedDefaultDir, path );
- ProjectReference metadata = createMetadataReference( "default", path );
+ // Artifact exists only in the proxied1 location.
+ String requestedResource = "org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
- assertTrue( expectedFile.exists() );
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+
+ assertResourceNotFound( requestedResource );
+
+ // One proxy setup, one metadata fetched, local file created/updated.
+ assertFetchVersioned( requestedResource );
- new File( expectedFile.getParentFile(), ".metadata-proxied1" ).setLastModified( getPastDate().getTime() );
+ // Local artifact Id should contain latest (which in this case is from proxied download)
+ assertSnapshotMetadataContents( requestedResource, "20050831", "101112", 1 );
+ assertRepoSnapshotMetadataContents( ID_PROXIED1, requestedResource, "20050831", "101112", 1 );
+ }
+
+ public void testGetSnapshotMetadataProxiedOnLocalMultipleRemote()
+ throws Exception
+ {
+ String requestedResource = "org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
// Configure Connector (usually done within archiva.xml configuration)
- saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
- File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
+ assertSnapshotMetadataContents( requestedResource, "20070822", "021008", 3 );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
- String expectedMetadata = getExpectedMetadata( "get-updated-metadata", "1.0-SNAPSHOT",
- getSnapshotVersion( "20050831.111213", 2 ), downloadedFile );
- assertMetadataEquals( expectedFile, downloadedFile, expectedMetadata );
- assertNoTempFiles( expectedFile );
+ // Proxying 2 repos, both have content, local file updated.
+ assertFetchVersioned( requestedResource );
+
+ assertSnapshotMetadataContents( requestedResource, "20070823", "212711", 6 );
+ assertRepoSnapshotMetadataContents( ID_PROXIED1, requestedResource, "20070822", "145534", 9 );
+ assertRepoSnapshotMetadataContents( ID_PROXIED2, requestedResource, "20070823", "212711", 6 );
}
- public void testGetMetadataNotUpdated()
+ public void testGetSnapshotMetadataProxiedOnLocalNotRemote()
throws Exception
{
- String path = "org/apache/maven/test/get-updated-metadata/maven-metadata.xml";
- File expectedFile = new File( managedDefaultDir, path );
- ProjectReference metadata = createMetadataReference( "default", path );
+ // The artifactId exists locally (but not on a remote repo)
+ String requestedResource = "org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
- assertTrue( expectedFile.exists() );
+ assertResourceExists( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
- File proxiedFile = new File( REPOPATH_PROXIED1, path );
- new File( expectedFile.getParentFile(), ".metadata-proxied1" ).setLastModified( proxiedFile.lastModified() );
+ // two proxies setup, nothing fetched from either remote, local file exists, fetch should succeed.
+ assertFetchVersioned( requestedResource );
+
+ // Local metadata exists, repo metadatas should not exist, local file updated.
+ assertSnapshotMetadataContents( requestedResource, "20070821", "220304", 2 );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+ }
+
+ public void testGetSnapshotMetadataProxiedOnLocalOnRemote()
+ throws Exception
+ {
+ // The artifactId exists locally (but not on a remote repo)
+ String requestedResource = "org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
// Configure Connector (usually done within archiva.xml configuration)
- saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ assertSnapshotMetadataContents( requestedResource, "20050831", "101112", 1 );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+ // two proxies setup, nothing fetched from either remote, local file exists, fetch should succeed.
+ assertFetchVersioned( requestedResource );
+
+ // Local metadata exists, repo metadata exists, local file updated.
+ assertSnapshotMetadataContents( requestedResource, "20050831", "101112", 1 );
+ assertRepoSnapshotMetadataContents( ID_PROXIED1, requestedResource, "20050831", "101112", 1 );
+ }
+
+ /**
+ * Transfer the metadata file.
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertFetchProject( String requestedResource )
+ throws Exception
+ {
+ File expectedFile = new File( managedDefaultDir, requestedResource );
+
+ ProjectReference metadata = createProjectReference( "default", requestedResource );
+
File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
- assertFileEquals( expectedFile, downloadedFile, expectedFile );
+ assertNotNull( "Should have downloaded a file.", downloadedFile );
assertNoTempFiles( expectedFile );
}
- public void testGetMetadataUpdated()
+ /**
+ * Transfer the metadata file, not expected to succeed.
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertFetchProjectFailed( String requestedResource )
throws Exception
{
- String path = "org/apache/maven/test/get-updated-metadata/maven-metadata.xml";
- File expectedFile = new File( managedDefaultDir, path );
- ProjectReference metadata = createMetadataReference( "default", path );
+ File expectedFile = new File( managedDefaultDir, requestedResource );
+ ProjectReference metadata = createProjectReference( "default", requestedResource );
- assertTrue( expectedFile.exists() );
+ File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
- new File( expectedFile.getParentFile(), ".metadata-proxied1" ).setLastModified( getPastDate().getTime() );
+ assertNull( downloadedFile );
+ assertNoTempFiles( expectedFile );
+ }
- // Configure Connector (usually done within archiva.xml configuration)
- saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.IGNORED,
- SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ /**
+ * Transfer the metadata file.
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertFetchVersioned( String requestedResource )
+ throws Exception
+ {
+ File expectedFile = new File( managedDefaultDir, requestedResource );
+
+ VersionedReference metadata = createVersionedReference( "default", requestedResource );
File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
- String expectedMetadata = getExpectedMetadata( "get-updated-metadata", new String[] { "1.0", "2.0" },
- downloadedFile );
+ assertNotNull( "Should have downloaded a file.", downloadedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ /**
+ * Transfer the metadata file, not expected to succeed.
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertFetchVersionedFailed( String requestedResource )
+ throws Exception
+ {
+ File expectedFile = new File( managedDefaultDir, requestedResource );
+ VersionedReference metadata = createVersionedReference( "default", requestedResource );
- assertMetadataEquals( expectedFile, downloadedFile, expectedMetadata );
+ File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, metadata );
+
+ assertNull( downloadedFile );
assertNoTempFiles( expectedFile );
}
+
+ /**
+ * Test for the existance of the requestedResource in the default managed repository.
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertResourceExists( String requestedResource )
+ throws Exception
+ {
+ File actualFile = new File( managedDefaultDir, requestedResource );
+ assertTrue( "Resource should exist: " + requestedResource, actualFile.exists() );
+ }
+
+ private void assertMetadataEquals( String expectedMetadataXml, File actualFile )
+ throws Exception
+ {
+ assertNotNull( "Actual File should not be null.", actualFile );
+
+ assertTrue( "Actual file exists.", actualFile.exists() );
+
+ StringWriter actualContents = new StringWriter();
+ ArchivaRepositoryMetadata metadata = RepositoryMetadataReader.read( actualFile );
+ RepositoryMetadataWriter.write( metadata, actualContents );
+
+ DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadataXml, actualContents.toString() ) );
+ if ( !detailedDiff.similar() )
+ {
+ assertEquals( expectedMetadataXml, actualContents );
+ }
+
+ // assertEquals( "Check file contents.", expectedMetadataXml, actualContents );
+ }
+
+ /**
+ * Ensures that the requested resource is not present in the managed repository.
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertNoMetadata( String requestedResource )
+ throws Exception
+ {
+ File expectedFile = new File( managedDefaultDir, requestedResource );
+ assertFalse( "metadata should not exist: " + expectedFile, expectedFile.exists() );
+ }
+
+ /**
+ * Ensures that the proxied repository specific maven metadata file does NOT exist in the
+ * managed repository.
+ * @param proxiedRepoId the proxied repository id to validate with.
+ * @param requestedResource the resource requested.
+ */
+ private void assertNoRepoMetadata( String proxiedRepoId, String requestedResource )
+ {
+ String proxiedFile = metadataTools.getRepositorySpecificName( proxiedRepoId, requestedResource );
+
+ File actualFile = new File( managedDefaultDir, proxiedFile );
+ assertFalse( "Repo specific metadata should not exist: " + actualFile, actualFile.exists() );
+ }
+
+ /**
+ * Test for the existance of the requestedResource in the default managed repository, and if it exists,
+ * does it contain the specified list of expected versions?
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertProjectMetadataContents( String requestedResource, String expectedVersions[] )
+ throws Exception
+ {
+ File actualFile = new File( managedDefaultDir, requestedResource );
+ assertTrue( actualFile.exists() );
+
+ ProjectReference metadata = createProjectReference( "default", requestedResource );
+
+ // Build expected metadata XML
+ StringWriter expectedMetadataXml = new StringWriter();
+ ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
+ m.setGroupId( metadata.getGroupId() );
+ m.setArtifactId( metadata.getArtifactId() );
+
+ if ( expectedVersions != null )
+ {
+ m.getAvailableVersions().addAll( Arrays.asList( expectedVersions ) );
+ }
+
+ m.setModelEncoding( null );
+ RepositoryMetadataWriter.write( m, expectedMetadataXml );
+
+ // Compare the file to the actual contents.
+ assertMetadataEquals( expectedMetadataXml.toString(), actualFile );
+ }
+
+ /**
+ * Test for the existance of the requestedResource in the default managed repository, and if it exists,
+ * does it contain the expected release maven-metadata.xml contents?
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertReleaseMetadataContents( String requestedResource )
+ throws Exception
+ {
+ File actualFile = new File( managedDefaultDir, requestedResource );
+ assertTrue( "Release Metadata should exist: " + requestedResource, actualFile.exists() );
+
+ VersionedReference metadata = createVersionedReference( "default", requestedResource );
+
+ // Build expected metadata XML
+ StringWriter expectedMetadataXml = new StringWriter();
+ ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
+ m.setGroupId( metadata.getGroupId() );
+ m.setArtifactId( metadata.getArtifactId() );
+ m.setVersion( metadata.getVersion() );
+ m.setModelEncoding( null );
+ RepositoryMetadataWriter.write( m, expectedMetadataXml );
+
+ // Compare the file to the actual contents.
+ assertMetadataEquals( expectedMetadataXml.toString(), actualFile );
+ }
+
+ /**
+ * Test for the existance of the snapshot metadata in the default managed repository, and if it exists,
+ * does it contain the expected release maven-metadata.xml contents?
+ *
+ * @param requestedResource the requested resource
+ * @param expectedDate the date in "yyyyMMdd" format
+ * @param expectedTime the time in "hhmmss" format
+ * @param expectedBuildnumber the build number
+ *
+ * @throws Exception
+ */
+ private void assertSnapshotMetadataContents( String requestedResource, String expectedDate, String expectedTime,
+ int expectedBuildnumber )
+ throws Exception
+ {
+ File actualFile = new File( managedDefaultDir, requestedResource );
+ assertTrue( "Snapshot Metadata should exist: " + requestedResource, actualFile.exists() );
+
+ VersionedReference actualMetadata = createVersionedReference( "default", requestedResource );
+
+ assertSnapshotMetadata( actualFile, actualMetadata, expectedDate, expectedTime, expectedBuildnumber );
+ }
+
+ /**
+ * Test for the existance of the proxied repository specific snapshot metadata in the default managed
+ * repository, and if it exists, does it contain the expected release maven-metadata.xml contents?
+ *
+ * @param proxiedRepoId the repository id of the proxied repository.
+ * @param requestedResource the requested resource
+ * @param expectedDate the date in "yyyyMMdd" format
+ * @param expectedTime the time in "hhmmss" format
+ * @param expectedBuildnumber the build number
+ *
+ * @throws Exception
+ */
+ private void assertRepoSnapshotMetadataContents( String proxiedRepoId, String requestedResource,
+ String expectedDate, String expectedTime, int expectedBuildnumber )
+ throws Exception
+ {
+ String proxiedFile = metadataTools.getRepositorySpecificName( proxiedRepoId, requestedResource );
+
+ File actualFile = new File( managedDefaultDir, proxiedFile );
+ assertTrue( "Repo Specific Snapshot Metadata should exist: " + requestedResource, actualFile.exists() );
+
+ VersionedReference actualMetadata = createVersionedReference( "default", requestedResource );
+
+ assertSnapshotMetadata( actualFile, actualMetadata, expectedDate, expectedTime, expectedBuildnumber );
+ }
+
+ private void assertSnapshotMetadata( File actualFile, VersionedReference actualMetadata, String expectedDate,
+ String expectedTime, int expectedBuildnumber )
+ throws RepositoryMetadataException, Exception
+ {
+ // Build expected metadata XML
+ StringWriter expectedMetadataXml = new StringWriter();
+ ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
+ m.setGroupId( actualMetadata.getGroupId() );
+ m.setArtifactId( actualMetadata.getArtifactId() );
+ m.setVersion( VersionUtil.getBaseVersion( actualMetadata.getVersion() ) );
+
+ m.setSnapshotVersion( new SnapshotVersion() );
+
+ if ( StringUtils.isNotBlank( expectedDate ) && StringUtils.isNotBlank( expectedTime ) )
+ {
+ m.getSnapshotVersion().setTimestamp( expectedDate + "." + expectedTime );
+ }
+
+ m.getSnapshotVersion().setBuildNumber( expectedBuildnumber );
+
+ m.setLastUpdated( expectedDate + expectedTime );
+
+ m.setModelEncoding( null );
+ RepositoryMetadataWriter.write( m, expectedMetadataXml );
+
+ // Compare the file to the actual contents.
+ assertMetadataEquals( expectedMetadataXml.toString(), actualFile );
+ }
+
+ /**
+ * Ensures that the repository specific maven metadata file exists, and contains the appropriate
+ * list of expected versions within.
+ * @param proxiedRepoId
+ * @param requestedResource
+ * @param expectedProxyVersions
+ */
+ private void assertRepoProjectMetadata( String proxiedRepoId, String requestedResource,
+ String[] expectedProxyVersions )
+ throws Exception
+ {
+ String proxiedFile = metadataTools.getRepositorySpecificName( proxiedRepoId, requestedResource );
+
+ File actualFile = new File( managedDefaultDir, proxiedFile );
+ assertTrue( actualFile.exists() );
+
+ ProjectReference metadata = createProjectReference( "default", requestedResource );
+
+ // Build expected metadata XML
+ StringWriter expectedMetadataXml = new StringWriter();
+ ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
+ m.setGroupId( metadata.getGroupId() );
+ m.setArtifactId( metadata.getArtifactId() );
+
+ if ( expectedProxyVersions != null )
+ {
+ m.getAvailableVersions().addAll( Arrays.asList( expectedProxyVersions ) );
+ }
+
+ m.setModelEncoding( null );
+ RepositoryMetadataWriter.write( m, expectedMetadataXml );
+
+ // Compare the file to the actual contents.
+ assertMetadataEquals( expectedMetadataXml.toString(), actualFile );
+ }
+
+ /**
+ * Ensures that the repository specific maven metadata file exists, and contains the appropriate
+ * list of expected versions within.
+ *
+ * @param proxiedRepoId
+ * @param requestedResource
+ */
+ private void assertRepoReleaseMetadataContents( String proxiedRepoId, String requestedResource )
+ throws Exception
+ {
+ String proxiedFile = metadataTools.getRepositorySpecificName( proxiedRepoId, requestedResource );
+
+ File actualFile = new File( managedDefaultDir, proxiedFile );
+ assertTrue( "Release metadata for repo should exist: " + actualFile, actualFile.exists() );
+
+ VersionedReference metadata = createVersionedReference( "default", requestedResource );
+
+ // Build expected metadata XML
+ StringWriter expectedMetadataXml = new StringWriter();
+ ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
+ m.setGroupId( metadata.getGroupId() );
+ m.setArtifactId( metadata.getArtifactId() );
+ m.setVersion( metadata.getVersion() );
+ m.setModelEncoding( null );
+ RepositoryMetadataWriter.write( m, expectedMetadataXml );
+
+ // Compare the file to the actual contents.
+ assertMetadataEquals( expectedMetadataXml.toString(), actualFile );
+ }
+
+ /**
+ * Test for the non-existance of the requestedResource in the default managed repository.
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertResourceNotFound( String requestedResource )
+ throws Exception
+ {
+ File actualFile = new File( managedDefaultDir, requestedResource );
+ assertFalse( "Resource should not exist: " + requestedResource, actualFile.exists() );
+ }
+
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ metadataTools = (MetadataTools) lookup( MetadataTools.class );
+ }
+
}
diff --git a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java
index de1b23610..c75c3f782 100644
--- a/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java
+++ b/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/SnapshotTransferTest.java
@@ -19,17 +19,13 @@ package org.apache.maven.archiva.proxy;
* under the License.
*/
-import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.policies.CachedFailuresPolicy;
import org.apache.maven.archiva.policies.ChecksumPolicy;
import org.apache.maven.archiva.policies.ReleasesPolicy;
import org.apache.maven.archiva.policies.SnapshotsPolicy;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
import java.io.File;
-import java.io.IOException;
-import java.text.ParseException;
/**
* SnapshotTransferTest
@@ -45,6 +41,8 @@ public class SnapshotTransferTest
throws Exception
{
String path = "org/apache/maven/test/does-not-exist/1.0-SNAPSHOT/does-not-exist-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -64,6 +62,8 @@ public class SnapshotTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -85,6 +85,8 @@ public class SnapshotTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -106,6 +108,8 @@ public class SnapshotTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -131,6 +135,8 @@ public class SnapshotTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -161,6 +167,8 @@ public class SnapshotTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -190,6 +198,8 @@ public class SnapshotTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -212,6 +222,8 @@ public class SnapshotTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -234,6 +246,8 @@ public class SnapshotTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -257,6 +271,8 @@ public class SnapshotTransferTest
throws Exception
{
String path = "org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/get-metadata-snapshot-1.0-20050831.101112-1.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
@@ -277,10 +293,12 @@ public class SnapshotTransferTest
public void testGetMetadataDrivenSnapshotRemoteUpdate()
throws Exception
{
- // Metadata driven snapshots (using a full timestamp) are treated like a release. It is the timing of the
+ // Metadata driven snapshots (using a full timestamp) are treated like a release. It is the timing of the
// updates to the metadata files that triggers which will be downloaded
String path = "org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar";
+ setupTestableManagedRepository( path );
+
File expectedFile = new File( managedDefaultDir, path );
ArtifactReference artifact = createArtifactReference( "default", path );
diff --git a/archiva-base/archiva-proxy/src/test/repositories/create-managed-to-proxy-map.sh b/archiva-base/archiva-proxy/src/test/repositories/create-managed-to-proxy-map.sh
new file mode 100755
index 000000000..ffaaa584b
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/create-managed-to-proxy-map.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+
+MYWD=`pwd`
+
+function makeListing()
+{
+ LISTID=$1
+
+ cd $MYWD/$LISTID
+ find . -type f -not -wholename "*/\.*" | sort > $MYWD/$LISTID.tmp
+}
+
+function isInRepo()
+{
+ LISTID=$1
+ FILEID=$2
+
+ grep -q "$FILEID" $MYWD/$LISTID.tmp
+ RETCODE=$?
+ if [ $RETCODE -eq 0 ] ; then
+ LISTID=${LISTID/proxied/}
+ echo "[${LISTID:0:1}]"
+ else
+ echo " "
+ fi
+}
+
+makeListing "managed"
+makeListing "proxied1"
+makeListing "proxied2"
+
+cd $MYWD
+
+TS=`date`
+
+echo "$0 - executed on $TS"
+echo ""
+echo "Determining location of files."
+echo " Key: [m] == managed"
+echo " [1] == proxy 1 (proxied1)"
+echo " [2] == proxy 2 (proxied2)"
+echo ""
+echo " -m- -1- -2- | -------------------------------------------- "
+
+FILELIST=`cat managed.tmp proxied1.tmp proxied2.tmp | sort -u`
+
+for FF in $FILELIST
+do
+ INMANAGED=`isInRepo "managed" "$FF"`
+ INPROXY1=`isInRepo "proxied1" "$FF"`
+ INPROXY2=`isInRepo "proxied2" "$FF"`
+
+ echo " $INMANAGED $INPROXY1 $INPROXY2 | $FF"
+done
+
+echo " --- --- --- | -------------------------------------------- "
+
+rm -f managed.tmp proxied1.tmp proxied2.tmp
+
diff --git a/archiva-base/archiva-proxy/src/test/repositories/managed-to-proxy-map.txt b/archiva-base/archiva-proxy/src/test/repositories/managed-to-proxy-map.txt
new file mode 100644
index 000000000..3b4967824
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed-to-proxy-map.txt
@@ -0,0 +1,89 @@
+./create-managed-to-proxy-map.sh - executed on Wed Aug 29 18:17:23 MST 2007
+
+Determining location of files.
+ Key: [m] == managed
+ [1] == proxy 1 (proxied1)
+ [2] == proxy 2 (proxied2)
+
+ -m- -1- -2- | --------------------------------------------
+ [m] [1] | ./org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar
+ [m] | ./org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.md5
+ [m] | ./org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.sha1
+ [1] | ./org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar
+ [1] | ./org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.md5
+ [1] | ./org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.sha1
+ [1] | ./org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar
+ [1] | ./org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.md5
+ [1] | ./org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.sha1
+ [m] [1] | ./org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1
+ [1] | ./org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar
+ [1] | ./org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.md5
+ [1] | ./org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.sha1
+ [1] | ./org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar
+ [1] | ./org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar.md5
+ [1] | ./org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar
+ [1] | ./org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.md5
+ [1] | ./org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.sha1
+ [1] | ./org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar
+ [1] | ./org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar.sha1
+ [2] | ./org/apache/maven/test/get-default-layout/1.0.1/get-default-layout-1.0.1.pom
+ [1] [2] | ./org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar
+ [1] [2] | ./org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml
+ [1] [2] | ./org/apache/maven/test/get-default-layout/maven-metadata.xml
+ [m] [1] | ./org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar
+ [m] | ./org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md5
+ [m] | ./org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.jar
+ [m] | ./org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.pom
+ [m] | ./org/apache/maven/test/get-default-metadata/1.0/get-default-metadata-1.0.jar
+ [m] [1] | ./org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml
+ [m] | ./org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom
+ [1] | ./org/apache/maven/test/get-found-in-proxy/1.0.5/get-found-in-proxy-1.0.5-javadoc.jar
+ [1] | ./org/apache/maven/test/get-found-in-proxy/maven-metadata.xml
+ [1] [2] | ./org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar
+ [2] | ./org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar
+ [m] [1] [2] | ./org/apache/maven/test/get-merged-metadata/maven-metadata.xml
+ [1] | ./org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/get-metadata-snapshot-1.0-20050831.101112-1.jar
+ [1] | ./org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml
+ [m] | ./org/apache/maven/test/get-not-on-remotes/1.0-beta-2/get-not-on-remotes-1.0-beta-2.jar
+ [m] | ./org/apache/maven/test/get-not-on-remotes/1.0-beta-2/maven-metadata.xml
+ [m] | ./org/apache/maven/test/get-not-on-remotes/maven-metadata.xml
+ [m] | ./org/apache/maven/test/get-on-local-on-remote/1.0.22/get-on-local-on-remote-1.0.22.pom
+ [m] [1] | ./org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml
+ [m] | ./org/apache/maven/test/get-on-local-on-remote/1.0.8/get-on-local-on-remote-1.0.8.pom
+ [m] [1] | ./org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml
+ [m] | ./org/apache/maven/test/get-on-multiple-repos/1.0/get-on-multiple-repos-1.0.pom
+ [m] [1] [2] | ./org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml
+ [m] [1] [2] | ./org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml
+ [m] [1] | ./org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar
+ [m] [1] | ./org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml
+ [m] [1] | ./org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar
+ [m] | ./org/apache/maven/test/get-project-metadata/1.0/get-project-metadata-1.0.jar
+ [m] | ./org/apache/maven/test/get-project-metadata/1.1/get-project-metadata-1.1.jar
+ [m] | ./org/apache/maven/test/get-project-metadata/2.0/get-project-metadata-2.0.pom
+ [m] | ./org/apache/maven/test/get-project-metadata/maven-metadata.xml
+ [m] | ./org/apache/maven/test/get-release-metadata/2.2/get-release-metadata-2.2.jar
+ [m] | ./org/apache/maven/test/get-release-metadata/2.2/maven-metadata.xml
+ [m] | ./org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom
+ [m] | ./org/apache/maven/test/get-relocated-artefact-with-pom/1.0/get-relocated-artefact-with-pom-1.0.pom
+ [m] | ./org/apache/maven/test/get-removed-from-proxies/1.0/get-removed-from-proxies-1.0.jar
+ [m] | ./org/apache/maven/test/get-removed-metadata/1.0/maven-metadata.xml
+ [m] | ./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
+ [m] | ./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
+ [m] | ./org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/maven-metadata.xml
+ [1] | ./org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070819.040004-1.jar
+ [m] [2] | ./org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.102030-1.jar
+ [m] | ./org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.185701-2.jar
+ [m] | ./org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.021008-3.jar
+ [1] | ./org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.145534-9.jar
+ [2] | ./org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.111741-5.jar
+ [2] | ./org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.212711-6.jar
+ [m] [1] [2] | ./org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml
+ [1] | ./org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar
+ [1] [2] | ./org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061222.034118-1.jar
+ [1] | ./org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061227.112101-2.jar
+ [2] | ./org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20070101.000103-2.jar
+ [1] [2] | ./org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar
+ [1] [2] | ./org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml
+ [m] [1] | ./org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml
+ [m] [1] | ./org/apache/maven/test/get-updated-metadata/maven-metadata.xml
+ --- --- --- | --------------------------------------------
diff --git a/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-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/get-default-metadata-1.0.jar
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/get-default-metadata-1.0.jar
diff --git a/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml
new file mode 100644
index 000000000..7f90f2a39
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-default-metadata</artifactId>
+ <version>1.0</version>
+</metadata> \ No newline at end of file
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/maven-metadata.xml
new file mode 100644
index 000000000..965b836c0
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/maven-metadata.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-not-on-remotes</artifactId>
+ <version>1.0-beta-2</version>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/maven-metadata.xml
new file mode 100644
index 000000000..4eef73fd4
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/maven-metadata.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-not-on-remotes</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0-beta-2</version>
+ </versions>
+ </versioning>
+</metadata>
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml
new file mode 100644
index 000000000..6fece769d
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-on-local-on-remote</artifactId>
+ <version>1.0.22</version>
+</metadata>
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml
new file mode 100644
index 000000000..9ae11e4d7
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml
@@ -0,0 +1,29 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-on-local-on-remote</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0.8</version>
+ <version>1.0.22</version>
+ </versions>
+ </versioning>
+</metadata>
diff --git a/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-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/get-on-multiple-repos-1.0.pom
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml
new file mode 100644
index 000000000..6bfd5dd9a
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-on-multiple-repos</artifactId>
+ <version>1.0</version>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml
new file mode 100644
index 000000000..04b49855d
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-on-multiple-repos</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0</version>
+ </versions>
+ </versioning>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 000000000..dd7496af5
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,31 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-present-metadata-snapshot</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20050831.101112</timestamp>
+ <buildNumber>1</buildNumber>
+ </snapshot>
+ <lastUpdated>20050831101112</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/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-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.0/get-project-metadata-1.0.jar
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.0/get-project-metadata-1.0.jar
diff --git a/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-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.1/get-project-metadata-1.1.jar
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.1/get-project-metadata-1.1.jar
diff --git a/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-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/2.0/get-project-metadata-2.0.pom
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/2.0/get-project-metadata-2.0.pom
diff --git a/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/maven-metadata.xml
new file mode 100644
index 000000000..a9fd6ef34
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/maven-metadata.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-project-metadata</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0</version>
+ </versions>
+ </versioning>
+</metadata>
diff --git a/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-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/get-release-metadata-2.2.jar
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/get-release-metadata-2.2.jar
diff --git a/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/maven-metadata.xml
new file mode 100644
index 000000000..8fc2a153f
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/maven-metadata.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-release-metadata</artifactId>
+ <version>2.2</version>
+</metadata>
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-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
new file mode 100644
index 000000000..55e1f3039
--- /dev/null
+++ b/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
@@ -0,0 +1,31 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-snapshot-on-local-not-remote</artifactId>
+ <version>2.0-alpha-2-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20070821.220304</timestamp>
+ <buildNumber>2</buildNumber>
+ </snapshot>
+ <lastUpdated>20070821220304</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 000000000..55e253e89
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,31 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-snapshot-popular</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20070822.021008</timestamp>
+ <buildNumber>3</buildNumber>
+ </snapshot>
+ <lastUpdated>20070822021008</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml
new file mode 100644
index 000000000..22dc39c2d
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-default-layout</artifactId>
+ <version>1.0</version>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/maven-metadata.xml
new file mode 100644
index 000000000..65d343154
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/maven-metadata.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-default-layout</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0</version>
+ </versions>
+ </versioning>
+</metadata>
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/maven-metadata.xml
new file mode 100644
index 000000000..10e06230c
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/maven-metadata.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-found-in-proxy</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0.5</version>
+ </versions>
+ </versioning>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 000000000..7ac63f44a
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,31 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-metadata-snapshot</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20050831.101112</timestamp>
+ <buildNumber>1</buildNumber>
+ </snapshot>
+ <lastUpdated>20050831101112</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/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-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml
new file mode 100644
index 000000000..6fece769d
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-on-local-on-remote</artifactId>
+ <version>1.0.22</version>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml
new file mode 100644
index 000000000..583a5e1cf
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml
@@ -0,0 +1,29 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-on-local-on-remote</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0.22</version>
+ <version>2.0</version>
+ </versions>
+ </versioning>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml
new file mode 100644
index 000000000..6bfd5dd9a
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-on-multiple-repos</artifactId>
+ <version>1.0</version>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml
new file mode 100644
index 000000000..0f4e941e8
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml
@@ -0,0 +1,29 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-on-multiple-repos</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0</version>
+ <version>2.0</version>
+ </versions>
+ </versioning>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 000000000..dd7496af5
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,31 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-present-metadata-snapshot</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20050831.101112</timestamp>
+ <buildNumber>1</buildNumber>
+ </snapshot>
+ <lastUpdated>20050831101112</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 000000000..c2c6983a9
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,31 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-snapshot-popular</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20070822.145534</timestamp>
+ <buildNumber>9</buildNumber>
+ </snapshot>
+ <lastUpdated>20070822145534</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 000000000..55b9bd28a
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,31 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-timestamped-snapshot-in-both</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20061227.112101</timestamp>
+ <buildNumber>2</buildNumber>
+ </snapshot>
+ <lastUpdated>20061227112101</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/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-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0.1/get-default-layout-1.0.1.pom
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar
new file mode 100644
index 000000000..a129891a7
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar
@@ -0,0 +1,2 @@
+get-default-layout-1.0.jar
+
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml
new file mode 100644
index 000000000..22dc39c2d
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-default-layout</artifactId>
+ <version>1.0</version>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/maven-metadata.xml
new file mode 100644
index 000000000..2d76cccb2
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/maven-metadata.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-default-layout</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0.1</version>
+ </versions>
+ </versioning>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml
new file mode 100644
index 000000000..6bfd5dd9a
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-on-multiple-repos</artifactId>
+ <version>1.0</version>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml
new file mode 100644
index 000000000..db3a24f18
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml
@@ -0,0 +1,29 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-on-multiple-repos</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0</version>
+ <version>1.0.1</version>
+ </versions>
+ </versioning>
+</metadata>
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 000000000..6b4f5894b
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,31 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-snapshot-popular</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20070823.212711</timestamp>
+ <buildNumber>6</buildNumber>
+ </snapshot>
+ <lastUpdated>20070823212711</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-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
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/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
diff --git a/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-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 000000000..78fbecc59
--- /dev/null
+++ b/archiva-base/archiva-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,31 @@
+<!--
+ ~ 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.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-timestamped-snapshot-in-both</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20070101.000103</timestamp>
+ <buildNumber>2</buildNumber>
+ </snapshot>
+ <lastUpdated>20070101000103</lastUpdated>
+ </versioning>
+</metadata>
diff --git a/archiva-base/archiva-proxy/src/test/resources/log4j.xml b/archiva-base/archiva-proxy/src/test/resources/log4j.xml
index 3c782b138..901c99f33 100644
--- a/archiva-base/archiva-proxy/src/test/resources/log4j.xml
+++ b/archiva-base/archiva-proxy/src/test/resources/log4j.xml
@@ -40,7 +40,7 @@
</logger>
<root>
- <priority value ="debug" />
+ <priority value ="info" />
<appender-ref ref="console" />
</root>
diff --git a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml
index 61b78d1ed..a17f85658 100644
--- a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml
+++ b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml
@@ -76,7 +76,7 @@
<eternal>false</eternal>
<max-elements-in-memory>1000</max-elements-in-memory>
<memory-eviction-policy>LRU</memory-eviction-policy>
- <name>cache</name>
+ <name>url-failures-cache</name>
<overflow-to-disk>false</overflow-to-disk>
<!-- 45 minutes = 2700 seconds -->
<time-to-idle-seconds>2700</time-to-idle-seconds>
diff --git a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ChecksumTransferTest.xml b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ChecksumTransferTest.xml
index 6daa370b8..4219308ab 100644
--- a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ChecksumTransferTest.xml
+++ b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ChecksumTransferTest.xml
@@ -63,6 +63,28 @@
</requirement>
</requirements>
</component>
+
+ <component>
+ <role>org.codehaus.plexus.cache.Cache</role>
+ <role-hint>url-failures-cache</role-hint>
+ <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
+ <description>URL Failure Cache</description>
+ <configuration>
+ <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
+ <disk-persistent>false</disk-persistent> <!--disabling disk persistence for unit testing. -->
+ <disk-store-path>${java.io.tmpdir}/archiva/urlcache</disk-store-path>
+ <eternal>false</eternal>
+ <max-elements-in-memory>1000</max-elements-in-memory>
+ <memory-eviction-policy>LRU</memory-eviction-policy>
+ <name>url-failures-cache</name>
+ <overflow-to-disk>false</overflow-to-disk>
+ <!-- 45 minutes = 2700 seconds -->
+ <time-to-idle-seconds>2700</time-to-idle-seconds>
+ <!-- 30 minutes = 1800 seconds -->
+ <time-to-live-seconds>1800</time-to-live-seconds>
+ </configuration>
+ </component>
+
<component>
<role>org.codehaus.plexus.logging.LoggerManager</role>
<implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation>
diff --git a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.xml b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.xml
index 6daa370b8..4219308ab 100644
--- a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.xml
+++ b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.xml
@@ -63,6 +63,28 @@
</requirement>
</requirements>
</component>
+
+ <component>
+ <role>org.codehaus.plexus.cache.Cache</role>
+ <role-hint>url-failures-cache</role-hint>
+ <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
+ <description>URL Failure Cache</description>
+ <configuration>
+ <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
+ <disk-persistent>false</disk-persistent> <!--disabling disk persistence for unit testing. -->
+ <disk-store-path>${java.io.tmpdir}/archiva/urlcache</disk-store-path>
+ <eternal>false</eternal>
+ <max-elements-in-memory>1000</max-elements-in-memory>
+ <memory-eviction-policy>LRU</memory-eviction-policy>
+ <name>url-failures-cache</name>
+ <overflow-to-disk>false</overflow-to-disk>
+ <!-- 45 minutes = 2700 seconds -->
+ <time-to-idle-seconds>2700</time-to-idle-seconds>
+ <!-- 30 minutes = 1800 seconds -->
+ <time-to-live-seconds>1800</time-to-live-seconds>
+ </configuration>
+ </component>
+
<component>
<role>org.codehaus.plexus.logging.LoggerManager</role>
<implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation>
diff --git a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.xml b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.xml
index 6daa370b8..4219308ab 100644
--- a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.xml
+++ b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.xml
@@ -63,6 +63,28 @@
</requirement>
</requirements>
</component>
+
+ <component>
+ <role>org.codehaus.plexus.cache.Cache</role>
+ <role-hint>url-failures-cache</role-hint>
+ <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
+ <description>URL Failure Cache</description>
+ <configuration>
+ <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
+ <disk-persistent>false</disk-persistent> <!--disabling disk persistence for unit testing. -->
+ <disk-store-path>${java.io.tmpdir}/archiva/urlcache</disk-store-path>
+ <eternal>false</eternal>
+ <max-elements-in-memory>1000</max-elements-in-memory>
+ <memory-eviction-policy>LRU</memory-eviction-policy>
+ <name>url-failures-cache</name>
+ <overflow-to-disk>false</overflow-to-disk>
+ <!-- 45 minutes = 2700 seconds -->
+ <time-to-idle-seconds>2700</time-to-idle-seconds>
+ <!-- 30 minutes = 1800 seconds -->
+ <time-to-live-seconds>1800</time-to-live-seconds>
+ </configuration>
+ </component>
+
<component>
<role>org.codehaus.plexus.logging.LoggerManager</role>
<implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation>
diff --git a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/MetadataTransferTest.xml b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/MetadataTransferTest.xml
index 6daa370b8..2926013c1 100644
--- a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/MetadataTransferTest.xml
+++ b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/MetadataTransferTest.xml
@@ -29,6 +29,28 @@
<role-hint>mock</role-hint>
<implementation>org.apache.maven.archiva.proxy.MockConfiguration</implementation>
</component>
+
+ <component>
+ <role>org.apache.maven.archiva.repository.metadata.MetadataTools</role>
+ <implementation>org.apache.maven.archiva.repository.metadata.MetadataTools</implementation>
+ <description>MetadataTools</description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory</role>
+ <field-name>layoutFactory</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.maven.archiva.configuration.FileTypes</role>
+ <field-name>filetypes</field-name>
+ </requirement>
+ <requirement>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <role-hint>mock</role-hint>
+ <field-name>configuration</field-name>
+ </requirement>
+ </requirements>
+ </component>
+
<component>
<role>org.apache.maven.archiva.proxy.RepositoryProxyConnectors</role>
<role-hint>default</role-hint>
@@ -49,6 +71,10 @@
<field-name>layoutFactory</field-name>
</requirement>
<requirement>
+ <role>org.apache.maven.archiva.repository.metadata.MetadataTools</role>
+ <field-name>metadataTools</field-name>
+ </requirement>
+ <requirement>
<role>org.apache.maven.archiva.policies.PreDownloadPolicy</role>
<field-name>preDownloadPolicies</field-name>
</requirement>
@@ -63,6 +89,28 @@
</requirement>
</requirements>
</component>
+
+ <component>
+ <role>org.codehaus.plexus.cache.Cache</role>
+ <role-hint>url-failures-cache</role-hint>
+ <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
+ <description>URL Failure Cache</description>
+ <configuration>
+ <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
+ <disk-persistent>false</disk-persistent> <!--disabling disk persistence for unit testing. -->
+ <disk-store-path>${java.io.tmpdir}/archiva/urlcache</disk-store-path>
+ <eternal>false</eternal>
+ <max-elements-in-memory>1000</max-elements-in-memory>
+ <memory-eviction-policy>LRU</memory-eviction-policy>
+ <name>url-failures-cache</name>
+ <overflow-to-disk>false</overflow-to-disk>
+ <!-- 45 minutes = 2700 seconds -->
+ <time-to-idle-seconds>2700</time-to-idle-seconds>
+ <!-- 30 minutes = 1800 seconds -->
+ <time-to-live-seconds>1800</time-to-live-seconds>
+ </configuration>
+ </component>
+
<component>
<role>org.codehaus.plexus.logging.LoggerManager</role>
<implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation>
diff --git a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/RelocateTransferTest.xml b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/RelocateTransferTest.xml
index 6daa370b8..bbb1fade7 100644
--- a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/RelocateTransferTest.xml
+++ b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/RelocateTransferTest.xml
@@ -49,6 +49,10 @@
<field-name>layoutFactory</field-name>
</requirement>
<requirement>
+ <role>org.apache.maven.archiva.repository.metadata.MetadataTools</role>
+ <field-name>metadataTools</field-name>
+ </requirement>
+ <requirement>
<role>org.apache.maven.archiva.policies.PreDownloadPolicy</role>
<field-name>preDownloadPolicies</field-name>
</requirement>
@@ -63,6 +67,28 @@
</requirement>
</requirements>
</component>
+
+ <component>
+ <role>org.codehaus.plexus.cache.Cache</role>
+ <role-hint>url-failures-cache</role-hint>
+ <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
+ <description>URL Failure Cache</description>
+ <configuration>
+ <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
+ <disk-persistent>false</disk-persistent> <!--disabling disk persistence for unit testing. -->
+ <disk-store-path>${java.io.tmpdir}/archiva/urlcache</disk-store-path>
+ <eternal>false</eternal>
+ <max-elements-in-memory>1000</max-elements-in-memory>
+ <memory-eviction-policy>LRU</memory-eviction-policy>
+ <name>url-failures-cache</name>
+ <overflow-to-disk>false</overflow-to-disk>
+ <!-- 45 minutes = 2700 seconds -->
+ <time-to-idle-seconds>2700</time-to-idle-seconds>
+ <!-- 30 minutes = 1800 seconds -->
+ <time-to-live-seconds>1800</time-to-live-seconds>
+ </configuration>
+ </component>
+
<component>
<role>org.codehaus.plexus.logging.LoggerManager</role>
<implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation>
diff --git a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/SnapshotTransferTest.xml b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/SnapshotTransferTest.xml
index 6daa370b8..4219308ab 100644
--- a/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/SnapshotTransferTest.xml
+++ b/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/SnapshotTransferTest.xml
@@ -63,6 +63,28 @@
</requirement>
</requirements>
</component>
+
+ <component>
+ <role>org.codehaus.plexus.cache.Cache</role>
+ <role-hint>url-failures-cache</role-hint>
+ <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
+ <description>URL Failure Cache</description>
+ <configuration>
+ <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
+ <disk-persistent>false</disk-persistent> <!--disabling disk persistence for unit testing. -->
+ <disk-store-path>${java.io.tmpdir}/archiva/urlcache</disk-store-path>
+ <eternal>false</eternal>
+ <max-elements-in-memory>1000</max-elements-in-memory>
+ <memory-eviction-policy>LRU</memory-eviction-policy>
+ <name>url-failures-cache</name>
+ <overflow-to-disk>false</overflow-to-disk>
+ <!-- 45 minutes = 2700 seconds -->
+ <time-to-idle-seconds>2700</time-to-idle-seconds>
+ <!-- 30 minutes = 1800 seconds -->
+ <time-to-live-seconds>1800</time-to-live-seconds>
+ </configuration>
+ </component>
+
<component>
<role>org.codehaus.plexus.logging.LoggerManager</role>
<implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation>