aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-maven/archiva-maven-proxy/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-maven/archiva-maven-proxy/src/test')
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/metadata/repository/MockRepositoryArchivaTaskScheduler.java58
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java618
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java185
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ChecksumTransferTest.java555
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ErrorHandlingTest.java661
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java251
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java466
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java1405
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java193
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java329
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java286
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java61
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ArchivaIndexManagerMock.java90
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java387
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java92
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryContentProviderMock.java66
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java240
-rwxr-xr-xarchiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/create-managed-to-proxy-map.sh60
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed-to-proxy-map.txt89
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar3
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.md51
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.sha11
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha11
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.jar3
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.pom24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar3
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc7
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md51
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/get-default-metadata-1.0.jar0
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom32
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-merged-metadata/maven-metadata.xml33
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/maven-metadata.xml24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/maven-metadata.xml28
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml29
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml28
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.0/get-project-metadata-1.0.jar0
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.1/get-project-metadata-1.1.jar0
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/2.0/get-project-metadata-2.0.pom0
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/maven-metadata.xml28
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/get-release-metadata-2.2.jar0
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/maven-metadata.xml24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact-with-pom/1.0/get-relocated-artefact-with-pom-1.0.pom32
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom32
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-from-proxies/1.0/get-removed-from-proxies-1.0.jar3
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-metadata/1.0/maven-metadata.xml22
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/.metadata-proxied125
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/.metadata-proxied127
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml30
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/maven-metadata.xml28
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/maven-metadata.xml29
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml34
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml29
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/maven-metadata.xml29
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar3
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.md51
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.sha11
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar1
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.md51
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.sha11
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha12
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.md51
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.sha11
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar.md51
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.md51
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.sha11
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar.sha11
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar3
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc1
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar.asc7
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/maven-metadata.xml28
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/maven-metadata.xml28
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar3
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-merged-metadata/maven-metadata.xml33
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/get-metadata-snapshot-1.0-20050831.101112-1.jar1
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml29
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml29
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar1
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml30
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/maven-metadata.xml29
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml29
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/maven-metadata.xml29
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml34
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml34
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/maven-metadata.xml28
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar3
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-merged-metadata/maven-metadata.xml33
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml24
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml29
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar2
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml31
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml29
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml34
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/resources/META-INF/spring-context.xml68
-rwxr-xr-xarchiva-modules/archiva-maven/archiva-maven-proxy/src/test/resources/spring-context.xml127
143 files changed, 7920 insertions, 0 deletions
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/metadata/repository/MockRepositoryArchivaTaskScheduler.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/metadata/repository/MockRepositoryArchivaTaskScheduler.java
new file mode 100644
index 000000000..08bcd9640
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/metadata/repository/MockRepositoryArchivaTaskScheduler.java
@@ -0,0 +1,58 @@
+package org.apache.archiva.metadata.repository;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
+import org.apache.archiva.scheduler.repository.model.RepositoryArchivaTaskScheduler;
+import org.apache.archiva.scheduler.repository.model.RepositoryTask;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service ("archivaTaskScheduler#repositoryMock")
+public class MockRepositoryArchivaTaskScheduler
+ implements RepositoryArchivaTaskScheduler
+{
+ @Override
+ public boolean isProcessingRepositoryTask( String repositoryId )
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isProcessingRepositoryTask( RepositoryTask task )
+ {
+ return false;
+ }
+
+ @Override
+ public void queueTask( RepositoryTask task )
+ throws TaskQueueException
+ {
+ // no op
+ }
+
+ @Override
+ public boolean unQueueTask( RepositoryTask task )
+ throws TaskQueueException
+ {
+ return false;
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
new file mode 100644
index 000000000..30f780c70
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
@@ -0,0 +1,618 @@
+package org.apache.archiva.proxy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import net.sf.ehcache.CacheManager;
+import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.policies.CachedFailuresPolicy;
+import org.apache.archiva.policies.ChecksumPolicy;
+import org.apache.archiva.policies.PropagateErrorsDownloadPolicy;
+import org.apache.archiva.policies.PropagateErrorsOnUpdateDownloadPolicy;
+import org.apache.archiva.policies.ReleasesPolicy;
+import org.apache.archiva.policies.SnapshotsPolicy;
+import org.apache.archiva.proxy.model.RepositoryProxyHandler;
+import org.apache.archiva.repository.*;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
+import org.apache.maven.wagon.Wagon;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+
+import javax.inject.Inject;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.FileTime;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Locale;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+import static org.junit.Assert.*;
+
+/**
+ * AbstractProxyTestCase
+ */
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+public abstract class AbstractProxyTestCase
+{
+ @Inject
+ protected ApplicationContext applicationContext;
+
+ @Inject
+ RepositoryRegistry repositoryRegistry;
+
+ protected static final String ID_PROXIED1 = "proxied1";
+
+ protected static final String ID_PROXIED1_TARGET = "proxied1-target";
+
+ protected static final String ID_PROXIED2 = "proxied2";
+
+ protected static final String ID_PROXIED2_TARGET = "proxied2-target";
+
+ protected static final String ID_DEFAULT_MANAGED = "default-managed-repository";
+
+ protected static final String REPOPATH_PROXIED1 = "src/test/repositories/proxied1";
+
+ protected static final String REPOPATH_PROXIED1_TARGET = "target/test-repository/proxied1";
+
+ protected static final String REPOPATH_PROXIED2 = "src/test/repositories/proxied2";
+
+ protected static final String REPOPATH_PROXIED2_TARGET = "target/test-repository/proxied2";
+
+ protected static final String REPOPATH_DEFAULT_MANAGED = "src/test/repositories/managed";
+
+ // protected static final String REPOPATH_DEFAULT_MANAGED_TARGET = "target/test-repository/managed";
+
+ protected IMocksControl wagonMockControl;
+
+ protected Wagon wagonMock;
+
+
+ protected RepositoryProxyHandler proxyHandler;
+
+ protected ManagedRepositoryContent managedDefaultRepository;
+
+ protected Path managedDefaultDir;
+
+ protected MockConfiguration config;
+
+ protected Logger log = LoggerFactory.getLogger( getClass() );
+
+ WagonDelegate delegate;
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ config =
+ (MockConfiguration) applicationContext.getBean( "archivaConfiguration#mock", ArchivaConfiguration.class );
+
+ config.getConfiguration().setManagedRepositories( new ArrayList<ManagedRepositoryConfiguration>() );
+ config.getConfiguration().setRemoteRepositories( new ArrayList<RemoteRepositoryConfiguration>() );
+ config.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>() );
+
+ // Setup source repository (using default layout)
+ String name = getClass().getSimpleName();
+ String repoPath = "target/test-repository/managed/" + name;
+
+ managedDefaultRepository =
+ createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath, "default" );
+
+ managedDefaultDir = Paths.get( managedDefaultRepository.getRepoRoot() );
+
+ org.apache.archiva.repository.ManagedRepository repoConfig = repositoryRegistry.getManagedRepository(ID_DEFAULT_MANAGED);
+
+ applicationContext.getBean( RepositoryRegistry.class ).putRepository( repoConfig );
+
+ repositoryRegistry.setArchivaConfiguration( config );
+
+ // Setup target (proxied to) repository.
+ saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1",
+ Paths.get( REPOPATH_PROXIED1 ).toUri().toURL().toExternalForm(), "default" );
+
+ // Setup target (proxied to) repository.
+ saveRemoteRepositoryConfig( ID_PROXIED2, "Proxied Repository 2",
+ Paths.get( REPOPATH_PROXIED2 ).toUri().toURL().toExternalForm(), "default" );
+
+
+ repositoryRegistry.reload();
+
+ if ( repositoryRegistry.getManagedRepository( repoConfig.getId() ) != null )
+ {
+ org.apache.archiva.repository.ManagedRepository managedRepository = repositoryRegistry.getManagedRepository( repoConfig.getId() );
+ repositoryRegistry.removeRepository( managedRepository );
+ }
+
+ repositoryRegistry.putRepository( repoConfig );
+
+
+ // Setup the proxy handler.
+ //proxyHandler = applicationContext.getBean (RepositoryProxyHandler) lookup( RepositoryProxyHandler.class.getName() );
+
+ proxyHandler = applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyHandler.class );
+
+
+ // Setup the wagon mock.
+ wagonMockControl = EasyMock.createNiceControl();
+ wagonMock = wagonMockControl.createMock( Wagon.class );
+
+ delegate = (WagonDelegate) applicationContext.getBean( "wagon#test", Wagon.class );
+
+ delegate.setDelegate( wagonMock );
+
+ CacheManager.getInstance().clearAll();
+
+ log.info( "\n.\\ {}() \\._________________________________________\n", name );
+ }
+
+ protected void assertChecksums( Path expectedFile, String expectedSha1Contents, String expectedMd5Contents )
+ throws Exception
+ {
+ Path sha1File = expectedFile.toAbsolutePath().resolveSibling( expectedFile.getFileName().toString()+ ".sha1" );
+ Path md5File = expectedFile.toAbsolutePath().resolveSibling( expectedFile.getFileName().toString() + ".md5" );
+
+ if ( expectedSha1Contents == null )
+ {
+ assertFalse( "SHA1 File should NOT exist: " + sha1File.toAbsolutePath(), Files.exists(sha1File) );
+ }
+ else
+ {
+ assertTrue( "SHA1 File should exist: " + sha1File.toAbsolutePath(), Files.exists(sha1File) );
+ String actualSha1Contents = readChecksumFile( sha1File );
+ assertEquals( "SHA1 File contents: " + sha1File.toAbsolutePath(), expectedSha1Contents, actualSha1Contents );
+ }
+
+ if ( expectedMd5Contents == null )
+ {
+ assertFalse( "MD5 File should NOT exist: " + md5File.toAbsolutePath(), Files.exists(md5File) );
+ }
+ else
+ {
+ assertTrue( "MD5 File should exist: " + md5File.toAbsolutePath(), Files.exists(md5File) );
+ String actualMd5Contents = readChecksumFile( md5File );
+ assertEquals( "MD5 File contents: " + md5File.toAbsolutePath(), expectedMd5Contents, actualMd5Contents );
+ }
+ }
+
+ protected void assertFileEquals( Path expectedFile, Path actualFile, Path sourceFile )
+ throws Exception
+ {
+ assertNotNull( "Expected File should not be null.", expectedFile );
+ assertNotNull( "Actual File should not be null.", actualFile );
+
+ assertTrue( "Check actual file exists.", Files.exists(actualFile) );
+ assertTrue( "Check file is the same.", Files.isSameFile( expectedFile,
+ actualFile));
+ String expectedContents =
+ org.apache.commons.io.FileUtils.readFileToString( sourceFile.toFile(), Charset.defaultCharset() );
+ String actualContents =
+ org.apache.commons.io.FileUtils.readFileToString( actualFile.toFile(), Charset.defaultCharset() );
+ assertEquals( "Check file contents.", expectedContents, actualContents );
+ }
+
+ protected void assertNotDownloaded( Path downloadedFile )
+ {
+ assertNull( "Found file: " + downloadedFile + "; but was expecting a failure", downloadedFile );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ protected void assertNoTempFiles( Path expectedFile )
+ {
+ Path workingDir = expectedFile.getParent();
+ if ( ( workingDir == null ) || !Files.isDirectory( workingDir) )
+ {
+ return;
+ }
+
+ Collection<Path> tmpFiles = null;
+ try {
+ tmpFiles = Files.list(workingDir).filter(path -> Files.isRegularFile(path) && path.getFileName().toString().endsWith(".tmp")).collect(Collectors.toList());
+ } catch (IOException e) {
+ log.error("Could not retrieve tmpFiles {}", workingDir);
+ }
+ if ( tmpFiles!=null && !tmpFiles.isEmpty() )
+ {
+ StringBuilder emsg = new StringBuilder();
+ emsg.append( "Found Temp Files in dir: " ).append( workingDir.toString() );
+ for ( Path tfile : tmpFiles )
+ {
+ emsg.append( "\n " ).append( tfile.getFileName().toString());
+ }
+ fail( emsg.toString() );
+ }
+ }
+
+ /**
+ * A faster recursive copy that omits .svn directories.
+ *
+ * @param sourceDirectory the source directory to copy
+ * @param destDirectory the target location
+ * @throws java.io.IOException if there is a copying problem
+ * @todo get back into plexus-utils, share with converter module
+ */
+ protected void copyDirectoryStructure( Path sourceDirectory, Path destDirectory )
+ throws IOException
+ {
+ if ( !Files.exists(sourceDirectory) )
+ {
+ throw new IOException( "Source directory doesn't exists (" + sourceDirectory.toAbsolutePath() + ")." );
+ }
+
+ Path[] files = Files.list(sourceDirectory).filter(path -> Files.isRegularFile(path)).toArray(Path[]::new);
+
+ String sourcePath = sourceDirectory.toAbsolutePath().toString();
+
+ for ( int i = 0; i < files.length; i++ )
+ {
+ Path file = files[i];
+
+ String dest = file.toAbsolutePath().toString();
+
+ dest = dest.substring( sourcePath.length() + 1 );
+
+ Path destination = destDirectory.resolve( dest );
+
+ if ( Files.isRegularFile(file) )
+ {
+ destination = destination.getParent();
+
+ org.apache.commons.io.FileUtils.copyFile( file.toFile(), destination.resolve( file.getFileName() ).toFile(), false );
+ // TODO: Change when there is a FileUtils.copyFileToDirectory(file, destination, boolean) option
+ //FileUtils.copyFileToDirectory( file, destination );
+ }
+ else if ( Files.isDirectory(file) )
+ {
+ if ( !".svn".equals( file.getFileName().toString() ) )
+ {
+ if ( !Files.exists(destination))
+ {
+ Files.createDirectories(destination);
+ }
+
+ copyDirectoryStructure( file, destination );
+ }
+ }
+ else
+ {
+ throw new IOException( "Unknown file type: " + file.toAbsolutePath() );
+ }
+ }
+ }
+
+
+ protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout )
+ throws Exception
+ {
+ ManagedRepository repo = new BasicManagedRepository(id, name, Paths.get(path));
+ repositoryRegistry.putRepository(repo);
+ return repositoryRegistry.getManagedRepository(id).getContent();
+ }
+
+ /**
+ * Read the first line from the checksum file, and return it (trimmed).
+ */
+ protected String readChecksumFile( Path checksumFile )
+ throws Exception
+ {
+ FileReader freader = null;
+ BufferedReader buf = null;
+
+ try
+ {
+ freader = new FileReader( checksumFile.toFile() );
+ buf = new BufferedReader( freader );
+ return buf.readLine();
+ }
+ finally
+ {
+ if ( buf != null )
+ {
+ buf.close();
+ }
+
+ if ( freader != null )
+ {
+ freader.close();
+ }
+ }
+ }
+
+ protected void saveConnector( String sourceRepoId, String targetRepoId, boolean disabled )
+ {
+ saveConnector( sourceRepoId, targetRepoId, ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS,
+ CachedFailuresPolicy.NO, disabled );
+ }
+
+ protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy,
+ String snapshotPolicy, String cacheFailuresPolicy, boolean disabled )
+ {
+ saveConnector( sourceRepoId, targetRepoId, checksumPolicy, releasePolicy, snapshotPolicy, cacheFailuresPolicy,
+ PropagateErrorsDownloadPolicy.QUEUE, disabled );
+ }
+
+ protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy,
+ String snapshotPolicy, String cacheFailuresPolicy, String errorPolicy,
+ boolean disabled )
+ {
+ saveConnector( sourceRepoId, targetRepoId, checksumPolicy, releasePolicy, snapshotPolicy, cacheFailuresPolicy,
+ errorPolicy, PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT, disabled );
+ }
+
+ protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy,
+ String snapshotPolicy, String cacheFailuresPolicy, String errorPolicy,
+ String errorOnUpdatePolicy, boolean disabled )
+ {
+ ProxyConnectorConfiguration connectorConfig = new ProxyConnectorConfiguration();
+ connectorConfig.setSourceRepoId( sourceRepoId );
+ connectorConfig.setTargetRepoId( targetRepoId );
+ connectorConfig.setProxyId(sourceRepoId);
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CHECKSUM, checksumPolicy );
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, releasePolicy );
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, snapshotPolicy );
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CACHE_FAILURES, cacheFailuresPolicy );
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_PROPAGATE_ERRORS, errorPolicy );
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_PROPAGATE_ERRORS_ON_UPDATE, errorOnUpdatePolicy );
+ connectorConfig.setDisabled( disabled );
+
+ int count = config.getConfiguration().getProxyConnectors().size();
+ config.getConfiguration().addProxyConnector( connectorConfig );
+
+ // Proper Triggering ...
+ String prefix = "proxyConnectors.proxyConnector(" + count + ")";
+ config.triggerChange( prefix + ".sourceRepoId", connectorConfig.getSourceRepoId() );
+ config.triggerChange( prefix + ".targetRepoId", connectorConfig.getTargetRepoId() );
+ config.triggerChange( prefix + ".proxyId", connectorConfig.getProxyId() );
+ config.triggerChange( prefix + ".policies.releases", connectorConfig.getPolicy( "releases", "" ) );
+ config.triggerChange( prefix + ".policies.checksum", connectorConfig.getPolicy( "checksum", "" ) );
+ config.triggerChange( prefix + ".policies.snapshots", connectorConfig.getPolicy( "snapshots", "" ) );
+ config.triggerChange( prefix + ".policies.cache-failures", connectorConfig.getPolicy( "cache-failures", "" ) );
+ config.triggerChange( prefix + ".policies.propagate-errors",
+ connectorConfig.getPolicy( "propagate-errors", "" ) );
+ config.triggerChange( prefix + ".policies.propagate-errors-on-update",
+ connectorConfig.getPolicy( "propagate-errors-on-update", "" ) );
+ }
+
+ protected void saveManagedRepositoryConfig( String id, String name, String path, String layout )
+ {
+ ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
+
+ repoConfig.setId( id );
+ repoConfig.setName( name );
+ repoConfig.setLayout( layout );
+
+ repoConfig.setLocation( path );
+
+ int count = config.getConfiguration().getManagedRepositories().size();
+ config.getConfiguration().addManagedRepository( repoConfig );
+
+ String prefix = "managedRepositories.managedRepository(" + count + ")";
+ config.triggerChange( prefix + ".id", repoConfig.getId() );
+ config.triggerChange( prefix + ".name", repoConfig.getName() );
+ config.triggerChange( prefix + ".location", repoConfig.getLocation() );
+ config.triggerChange( prefix + ".layout", repoConfig.getLayout() );
+ }
+
+ protected void saveRemoteRepositoryConfig( String id, String name, String url, String layout )
+ {
+ RemoteRepositoryConfiguration repoConfig = new RemoteRepositoryConfiguration();
+
+ repoConfig.setId( id );
+ repoConfig.setName( name );
+ repoConfig.setLayout( layout );
+ repoConfig.setUrl( url );
+
+ int count = config.getConfiguration().getRemoteRepositories().size();
+ config.getConfiguration().addRemoteRepository( repoConfig );
+
+ String prefix = "remoteRepositories.remoteRepository(" + count + ")";
+ config.triggerChange( prefix + ".id", repoConfig.getId() );
+ config.triggerChange( prefix + ".name", repoConfig.getName() );
+ config.triggerChange( prefix + ".url", repoConfig.getUrl() );
+ config.triggerChange( prefix + ".layout", repoConfig.getLayout() );
+ repositoryRegistry.reload();
+ }
+
+ protected Path saveTargetedRepositoryConfig( String id, String originalPath, String targetPath, String layout )
+ throws IOException
+ {
+ Path repoLocation = Paths.get( targetPath );
+ org.apache.archiva.common.utils.FileUtils.deleteDirectory( repoLocation );
+ copyDirectoryStructure( Paths.get(originalPath) , repoLocation );
+
+ saveRemoteRepositoryConfig( id, "Target Repo-" + id, targetPath, layout );
+
+ return repoLocation;
+ }
+
+
+ /**
+ * Copy the specified resource directory from the src/test/repository/managed/ to
+ * the testable directory under target/test-repository/managed/${testName}/
+ *
+ * @param resourcePath
+ * @throws IOException
+ */
+ protected void setupTestableManagedRepository( String resourcePath )
+ throws IOException
+ {
+ String resourceDir = resourcePath;
+
+ if ( !resourcePath.endsWith( "/" ) )
+ {
+ int idx = resourcePath.lastIndexOf( '/' );
+ resourceDir = resourcePath.substring( 0, idx );
+ }
+
+ Path sourceRepoDir = Paths.get( REPOPATH_DEFAULT_MANAGED );
+ Path sourceDir = sourceRepoDir.resolve(resourceDir );
+
+ Path destRepoDir = managedDefaultDir;
+ Path destDir = destRepoDir.resolve(resourceDir );
+
+ // Cleanout destination dirs.
+ if ( Files.exists(destDir))
+ {
+ org.apache.archiva.common.utils.FileUtils.deleteDirectory( destDir );
+ }
+
+ // Make the destination dir.
+ Files.createDirectories(destDir);
+
+ // Test the source dir.
+ if ( !Files.exists(sourceDir) )
+ {
+ // This is just a warning.
+ log.error( "[WARN] Skipping setup of testable managed repository, source dir does not exist: {}", //
+ sourceDir );
+ }
+ else
+ {
+
+ // Test that the source is a dir.
+ if ( !Files.isDirectory( sourceDir) )
+ {
+ fail( "Unable to setup testable managed repository, source is not a directory: " + sourceDir );
+ }
+
+ // Copy directory structure.
+ copyDirectoryStructure( sourceDir, destDir );
+ }
+ }
+
+ protected void setManagedNewerThanRemote( Path managedFile, Path remoteFile )
+ {
+ setManagedNewerThanRemote( managedFile, remoteFile, 55000 );
+ }
+
+ protected void setManagedNewerThanRemote( Path managedFile, Path remoteFile, long time )
+ {
+ assertTrue( "Managed File should exist: ", Files.exists(managedFile) );
+ assertTrue( "Remote File should exist: ", Files.exists(remoteFile) );
+
+ try
+ {
+ Files.setLastModifiedTime( managedFile,
+ FileTime.from(Files.getLastModifiedTime( remoteFile ).toMillis() + time, TimeUnit.MILLISECONDS ));
+ }
+ catch ( IOException e )
+ {
+ e.printStackTrace( );
+ }
+
+ try
+ {
+ assertTrue( Files.getLastModifiedTime( managedFile).compareTo( Files.getLastModifiedTime( remoteFile )) > 0);
+ }
+ catch ( IOException e )
+ {
+ e.printStackTrace( );
+ }
+ }
+
+ protected void setManagedOlderThanRemote( Path managedFile, Path remoteFile )
+ {
+ setManagedOlderThanRemote( managedFile, remoteFile, 55000 );
+ }
+
+ protected void setManagedOlderThanRemote( Path managedFile, Path remoteFile, long time )
+ {
+ assertTrue( "Managed File should exist: ", Files.exists(managedFile) );
+ assertTrue( "Remote File should exist: ", Files.exists(remoteFile) );
+
+ try
+ {
+ Files.setLastModifiedTime( managedFile,
+ FileTime.from(Files.getLastModifiedTime( remoteFile ).toMillis() - time, TimeUnit.MILLISECONDS ));
+ }
+ catch ( IOException e )
+ {
+ e.printStackTrace( );
+ }
+
+ try
+ {
+ assertTrue( Files.getLastModifiedTime( managedFile ).compareTo(Files.getLastModifiedTime( remoteFile )) < 0 );
+ }
+ catch ( IOException e )
+ {
+ e.printStackTrace( );
+ }
+
+ }
+
+ protected void assertNotModified( Path file, long expectedModificationTime )
+ {
+ try
+ {
+ assertEquals( "File <" + file.toAbsolutePath() + "> not have been modified.", expectedModificationTime,
+ Files.getLastModifiedTime( file ).toMillis());
+ }
+ catch ( IOException e )
+ {
+ e.printStackTrace( );
+ }
+ }
+
+
+ protected void assertNotExistsInManagedDefaultRepo( Path testFile )
+ throws Exception
+ {
+ Path managedDefaultPath = managedDefaultDir;
+
+ assertTrue( "Unit Test Failure: File <" + testFile
+ + "> should be have been defined within the managed default path of <" + managedDefaultPath
+ + ">", testFile.startsWith( managedDefaultPath ) );
+
+ assertFalse( "File < " + testFile + "> should not exist in managed default repository.", Files.exists(testFile) );
+ }
+
+ protected static Date getFutureDate()
+ throws ParseException
+ {
+ Calendar cal = Calendar.getInstance();
+ cal.add( Calendar.YEAR, 1 );
+ return cal.getTime();
+ }
+
+ protected static Date getPastDate()
+ throws ParseException
+ {
+ return new SimpleDateFormat( "yyyy-MM-dd", Locale.US ).parse( "2000-01-01" );
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java
new file mode 100644
index 000000000..0061fa732
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java
@@ -0,0 +1,185 @@
+package org.apache.archiva.proxy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.common.utils.PathUtil;
+import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.policies.CachedFailuresPolicy;
+import org.apache.archiva.policies.ChecksumPolicy;
+import org.apache.archiva.policies.ReleasesPolicy;
+import org.apache.archiva.policies.SnapshotsPolicy;
+import org.apache.archiva.policies.urlcache.UrlFailureCache;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * CacheFailuresTransferTest
+ *
+ *
+ */
+public class CacheFailuresTransferTest
+ extends AbstractProxyTestCase
+{
+ // TODO: test some hard failures (eg TransferFailedException)
+ // TODO: test the various combinations of fetchFrom* (note: need only test when caching is enabled)
+
+ @Inject
+ UrlFailureCache urlFailureCache;
+
+ @Test
+ public void testGetWithCacheFailuresOn()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
+ Path expectedFile = managedDefaultDir.resolve( path );
+ setupTestableManagedRepository( path );
+
+ assertNotExistsInManagedDefaultRepo( expectedFile );
+
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ // Configure Repository (usually done within archiva.xml configuration)
+ saveRemoteRepositoryConfig( "badproxied1", "Bad Proxied 1", "test://bad.machine.com/repo/", "default" );
+ saveRemoteRepositoryConfig( "badproxied2", "Bad Proxied 2", "test://bad.machine.com/anotherrepo/", "default" );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES, false );
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES, false );
+
+ wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ));
+
+ EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "resource does not exist." ) ).times( 2 );
+
+
+ wagonMockControl.replay();
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ wagonMockControl.verify();
+
+ // Second attempt to download same artifact use cache
+ wagonMockControl.reset();
+ wagonMockControl.replay();
+ downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+ wagonMockControl.verify();
+
+ assertNotDownloaded( downloadedFile);
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testGetWithCacheFailuresOff()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
+ Path expectedFile = managedDefaultDir.resolve( path );
+ setupTestableManagedRepository( path );
+
+ assertNotExistsInManagedDefaultRepo( expectedFile );
+
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ // Configure Repository (usually done within archiva.xml configuration)
+ saveRemoteRepositoryConfig( "badproxied1", "Bad Proxied 1", "test://bad.machine.com/repo/", "default" );
+ saveRemoteRepositoryConfig( "badproxied2", "Bad Proxied 2", "test://bad.machine.com/anotherrepo/", "default" );
+
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied2", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ));
+ EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "resource does not exist." ) ).times( 2 );
+
+ wagonMockControl.replay();
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ wagonMockControl.verify();
+
+ // Second attempt to download same artifact DOES NOT use cache
+ wagonMockControl.reset();
+
+ wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ));
+ EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "resource does not exist." ) ).times( 2 );
+
+ wagonMockControl.replay();
+
+ downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ wagonMockControl.verify();
+
+ assertNotDownloaded( downloadedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testGetWhenInBothProxiedButFirstCacheFailure()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
+ setupTestableManagedRepository( path );
+ Path expectedFile = managedDefaultDir.resolve(path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ Files.deleteIfExists(expectedFile);
+ assertFalse( Files.exists(expectedFile) );
+
+ String url = PathUtil.toUrl( REPOPATH_PROXIED1 + "/" + path );
+
+ // Intentionally set failure on url in proxied1 (for test)
+ UrlFailureCache failurlCache = lookupUrlFailureCache();
+ failurlCache.cacheFailure( url );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES, false );
+ saveConnector( ID_DEFAULT_MANAGED, "proxied2", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ // Validate that file actually came from proxied2 (as intended).
+ Path proxied2File = Paths.get( REPOPATH_PROXIED2, path );
+ assertFileEquals( expectedFile, downloadedFile, proxied2File );
+ assertNoTempFiles( expectedFile );
+ }
+
+ protected UrlFailureCache lookupUrlFailureCache()
+ throws Exception
+ {
+ assertNotNull( "URL Failure Cache cannot be null.", urlFailureCache );
+ return urlFailureCache;
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ChecksumTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ChecksumTransferTest.java
new file mode 100644
index 000000000..e9ade0479
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ChecksumTransferTest.java
@@ -0,0 +1,555 @@
+package org.apache.archiva.proxy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.common.utils.FileUtils;
+import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.policies.CachedFailuresPolicy;
+import org.apache.archiva.policies.ChecksumPolicy;
+import org.apache.archiva.policies.ReleasesPolicy;
+import org.apache.archiva.policies.SnapshotsPolicy;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
+/**
+ * ChecksumTransferTest
+ *
+ *
+ */
+public class ChecksumTransferTest
+ extends AbstractProxyTestCase
+{
+ @Test
+ public void testGetChecksumWhenConnectorIsDisabled()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ org.apache.archiva.common.utils.FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, true );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ assertNull( downloadedFile );
+ }
+
+ @Test
+ public void testGetChecksumBothCorrect()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ org.apache.archiva.common.utils.FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get( REPOPATH_PROXIED1, path );
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, "066d76e459f7782c312c31e8a11b3c0f1e3e43a7 *get-checksum-both-right-1.0.jar",
+ "e58f30c6a150a2e843552438d18e15cb *get-checksum-both-right-1.0.jar" );
+ }
+
+ @Test
+ public void testGetChecksumCorrectSha1NoMd5()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get( REPOPATH_PROXIED1, path );
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, "748a3a013bf5eacf2bbb40a2ac7d37889b728837 *get-checksum-sha1-only-1.0.jar",
+ null );
+ }
+
+ @Test
+ public void testGetChecksumNoSha1CorrectMd5()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get( REPOPATH_PROXIED1, path );
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, null, "f3af5201bf8da801da37db8842846e1c *get-checksum-md5-only-1.0.jar" );
+ }
+
+ @Test
+ public void testGetWithNoChecksumsUsingIgnoredSetting()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get( REPOPATH_PROXIED1, path );
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, null, null );
+ }
+
+ @Test
+ public void testGetChecksumBadSha1BadMd5IgnoredSetting()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get( REPOPATH_PROXIED1, path );
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, "invalid checksum file", "invalid checksum file" );
+ }
+
+ @Test
+ public void testGetChecksumBadSha1BadMd5FailSetting()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ assertNotDownloaded( downloadedFile );
+ assertChecksums( expectedFile, null, null );
+ }
+
+ @Test
+ public void testGetChecksumBadSha1BadMd5FixSetting()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get( REPOPATH_PROXIED1, path );
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, "4ec20a12dc91557330bd0b39d1805be5e329ae56 get-checksum-both-bad-1.0.jar",
+ "a292491a35925465e693a44809a078b5 get-checksum-both-bad-1.0.jar" );
+ }
+
+ @Test
+ public void testGetChecksumCorrectSha1BadMd5UsingFailSetting()
+ 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 );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ assertNotDownloaded( downloadedFile );
+ assertChecksums( expectedFile, null, null );
+ }
+
+ @Test
+ public void testGetChecksumNoSha1CorrectMd5UsingFailSetting()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ // This is a success situation. No SHA1 with a Good MD5.
+ Path proxied1File = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, null, "f3af5201bf8da801da37db8842846e1c *get-checksum-md5-only-1.0.jar" );
+ }
+
+ @Test
+ public void testGetWithNoChecksumsUsingFailSetting()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ assertNotDownloaded( downloadedFile );
+ assertChecksums( expectedFile, null, null );
+ }
+
+ @Test
+ public void testGetChecksumCorrectSha1BadMd5UsingIgnoredSetting()
+ 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 );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, "3dd1a3a57b807d3ef3fbc6013d926c891cbb8670 *get-checksum-sha1-bad-md5-1.0.jar",
+ "invalid checksum file" );
+ }
+
+ @Test
+ public void testGetChecksumCorrectSha1BadMd5UsingFixSetting()
+ 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 );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, "3dd1a3a57b807d3ef3fbc6013d926c891cbb8670 *get-checksum-sha1-bad-md5-1.0.jar",
+ "c35f3b76268b73a4ba617f6f275c49ab get-checksum-sha1-bad-md5-1.0.jar" );
+ }
+
+ @Test
+ public void testGetChecksumNoSha1CorrectMd5UsingFixSetting()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, "71f7dc3f72053a3f2d9fdd6fef9db055ef957ffb get-checksum-md5-only-1.0.jar",
+ "f3af5201bf8da801da37db8842846e1c *get-checksum-md5-only-1.0.jar" );
+ }
+
+ @Test
+ public void testGetWithNoChecksumsUsingFixSetting()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, "1f12821c5e43e1a0b76b9564a6ddb0548ccb9486 get-default-layout-1.0.jar",
+ "3f7341545f21226b6f49a3c2704cb9be get-default-layout-1.0.jar" );
+ }
+
+ @Test
+ public void testGetChecksumNotFoundOnRemote()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ FileUtils.deleteDirectory( expectedFile.getParent() );
+ assertFalse( Files.exists(expectedFile.getParent()) );
+ assertFalse( Files.exists(expectedFile) );
+
+ saveRemoteRepositoryConfig( "badproxied", "Bad Proxied", "test://bad.machine.com/repo/", "default" );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ));
+ EasyMock.expectLastCall().once();
+
+ wagonMock.get( EasyMock.eq( path + ".sha1" ), EasyMock.anyObject( File.class ));
+ EasyMock.expectLastCall().once();
+
+ wagonMock.get( EasyMock.eq( path + ".md5" ), EasyMock.anyObject( File.class ));
+ EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "Resource does not exist." ) ).once();
+
+ wagonMockControl.replay();
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ wagonMockControl.verify();
+
+ // Do what the mock doesn't do.
+ Path proxyPath = Paths.get( REPOPATH_PROXIED1, path ).toAbsolutePath();
+ Path localPath = managedDefaultDir.resolve( path ).toAbsolutePath();
+ Files.copy( proxyPath, localPath, StandardCopyOption.REPLACE_EXISTING);
+ Files.copy( proxyPath.resolveSibling( proxyPath.getFileName() + ".sha1" ),
+ localPath.resolveSibling( localPath.getFileName() + ".sha1" ), StandardCopyOption.REPLACE_EXISTING );
+
+ // Test results.
+ Path proxied1File = Paths.get( REPOPATH_PROXIED1, path );
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, "748a3a013bf5eacf2bbb40a2ac7d37889b728837 *get-checksum-sha1-only-1.0.jar",
+ null );
+ }
+
+ @Test
+ public void testGetAlwaysBadChecksumPresentLocallyAbsentRemoteUsingIgnoredSetting()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ Path remoteFile = Paths.get( REPOPATH_PROXIED1, path );
+
+ setManagedOlderThanRemote( expectedFile, remoteFile );
+
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get( REPOPATH_PROXIED1, path );
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ // There are no hashcodes on the proxy side to download, hence the local ones should remain invalid.
+ assertChecksums( expectedFile, "invalid checksum file", "invalid checksum file" );
+ }
+
+ @Test
+ public void testGetAlwaysBadChecksumPresentLocallyAbsentRemoteUsingFailSetting()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ Path remoteFile = Paths.get( REPOPATH_PROXIED1, path );
+
+ setManagedOlderThanRemote( expectedFile, remoteFile );
+
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FAIL, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ assertNotDownloaded( downloadedFile );
+ assertNoTempFiles( expectedFile );
+ // There are no hashcodes on the proxy side to download.
+ // The FAIL policy will delete the checksums as bad.
+
+ assertChecksums( expectedFile, "invalid checksum file", "invalid checksum file" );
+ }
+
+ @Test
+ public void testGetAlwaysBadChecksumPresentLocallyAbsentRemoteUsingFixSetting()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ Path remoteFile = Paths.get(REPOPATH_PROXIED1, path);
+
+ setManagedOlderThanRemote( expectedFile, remoteFile );
+
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "proxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+ assertChecksums( expectedFile, "96a08dc80a108cba8efd3b20aec91b32a0b2cbd4 get-bad-local-checksum-1.0.jar",
+ "46fdd6ca55bf1d7a7eb0c858f41e0ccd get-bad-local-checksum-1.0.jar" );
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ErrorHandlingTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ErrorHandlingTest.java
new file mode 100644
index 000000000..cef7501b4
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ErrorHandlingTest.java
@@ -0,0 +1,661 @@
+package org.apache.archiva.proxy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.policies.CachedFailuresPolicy;
+import org.apache.archiva.policies.ChecksumPolicy;
+import org.apache.archiva.policies.PropagateErrorsDownloadPolicy;
+import org.apache.archiva.policies.PropagateErrorsOnUpdateDownloadPolicy;
+import org.apache.archiva.policies.ProxyDownloadException;
+import org.apache.archiva.policies.ReleasesPolicy;
+import org.apache.archiva.policies.SnapshotsPolicy;
+import org.apache.archiva.repository.LayoutException;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.apache.maven.wagon.TransferFailedException;
+import org.apache.maven.wagon.authorization.AuthorizationException;
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import static org.junit.Assert.*;
+
+/**
+ * ErrorHandlingTest
+ *
+ *
+ */
+public class ErrorHandlingTest
+ extends AbstractProxyTestCase
+{
+ private static final String PATH_IN_BOTH_REMOTES_NOT_LOCAL =
+ "org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar";
+
+ private static final String PATH_IN_BOTH_REMOTES_AND_LOCAL =
+ "org/apache/maven/test/get-on-multiple-repos/1.0/get-on-multiple-repos-1.0.pom";
+
+ private static final String ID_MOCKED_PROXIED1 = "badproxied1";
+
+ private static final String NAME_MOCKED_PROXIED1 = "Bad Proxied 1";
+
+ private static final String ID_MOCKED_PROXIED2 = "badproxied2";
+
+ private static final String NAME_MOCKED_PROXIED2 = "Bad Proxied 2";
+
+ @Test
+ public void testPropagateErrorImmediatelyWithErrorThenSuccess()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.STOP );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmSingleFailure( path, ID_MOCKED_PROXIED1 );
+ }
+
+ @Test
+ public void testPropagateErrorImmediatelyWithNotFoundThenError()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.STOP );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.STOP );
+
+ simulateGetError( path, expectedFile, createResourceNotFoundException() );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmSingleFailure( path, ID_MOCKED_PROXIED2 );
+ }
+
+ @Test
+ public void testPropagateErrorImmediatelyWithSuccessThenError()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.STOP );
+
+ confirmSuccess( path, expectedFile, REPOPATH_PROXIED1 );
+ }
+
+ @Test
+ public void testPropagateErrorImmediatelyWithNotFoundThenSuccess()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.STOP );
+
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false );
+
+ simulateGetError( path, expectedFile, createResourceNotFoundException() );
+
+ confirmSuccess( path, expectedFile, REPOPATH_PROXIED2 );
+ }
+
+ @Test
+ public void testPropagateErrorAtEndWithErrorThenSuccess()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.STOP );
+
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmSingleFailure( path, ID_MOCKED_PROXIED1 );
+ }
+
+ @Test
+ public void testPropagateErrorAtEndWithSuccessThenError()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.QUEUE );
+
+ confirmSuccess( path, expectedFile, REPOPATH_PROXIED1 );
+ }
+
+ @Test
+ public void testPropagateErrorAtEndWithNotFoundThenError()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.QUEUE );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.QUEUE );
+
+ simulateGetError( path, expectedFile, createResourceNotFoundException() );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmSingleFailure( path, ID_MOCKED_PROXIED2 );
+ }
+
+ @Test
+ public void testPropagateErrorAtEndWithErrorThenNotFound()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.QUEUE );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.QUEUE );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ simulateGetError( path, expectedFile, createResourceNotFoundException() );
+
+ confirmSingleFailure( path, ID_MOCKED_PROXIED1 );
+ }
+
+ @Test
+ public void testPropagateErrorAtEndWithErrorThenError()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.QUEUE );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.QUEUE );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmFailures( path, new String[]{ID_MOCKED_PROXIED1, ID_MOCKED_PROXIED2} );
+ }
+
+ @Test
+ public void testPropagateErrorAtEndWithNotFoundThenSuccess()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.QUEUE );
+
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false );
+
+ simulateGetError( path, expectedFile, createResourceNotFoundException() );
+
+ confirmSuccess( path, expectedFile, REPOPATH_PROXIED2 );
+ }
+
+ @Test
+ public void testIgnoreErrorWithErrorThenSuccess()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.IGNORE );
+
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmSuccess( path, expectedFile, REPOPATH_PROXIED2 );
+ }
+
+ @Test
+ public void testIgnoreErrorWithSuccessThenError()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.IGNORE );
+
+ confirmSuccess( path, expectedFile, REPOPATH_PROXIED1 );
+ }
+
+ @Test
+ public void testIgnoreErrorWithNotFoundThenError()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.IGNORE );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.IGNORE );
+
+ simulateGetError( path, expectedFile, createResourceNotFoundException() );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmNotDownloadedNoError( path );
+ }
+
+ @Test
+ public void testIgnoreErrorWithErrorThenNotFound()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.IGNORE );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.IGNORE );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ simulateGetError( path, expectedFile, createResourceNotFoundException() );
+
+ confirmNotDownloadedNoError( path );
+ }
+
+ @Test
+ public void testIgnoreErrorWithErrorThenError()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.IGNORE );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.IGNORE );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmNotDownloadedNoError( path );
+ }
+
+ @Test
+ public void testPropagateOnUpdateAlwaysArtifactNotPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.STOP,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.STOP,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmSingleFailure( path, ID_MOCKED_PROXIED1 );
+ }
+
+ @Test
+ public void testPropagateOnUpdateAlwaysArtifactPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_AND_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFilePresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.STOP,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.STOP,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+
+ simulateGetIfNewerError( path, expectedFile, createTransferException() );
+
+ confirmSingleFailure( path, ID_MOCKED_PROXIED1 );
+ }
+
+ @Test
+ public void testPropagateOnUpdateAlwaysQueueArtifactNotPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.QUEUE,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.QUEUE,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmFailures( path, new String[] { ID_MOCKED_PROXIED1, ID_MOCKED_PROXIED2 } );
+ }
+
+ @Test
+ public void testPropagateOnUpdateAlwaysQueueArtifactPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_AND_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFilePresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.QUEUE,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.QUEUE,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+
+ simulateGetIfNewerError( path, expectedFile, createTransferException() );
+ simulateGetIfNewerError( path, expectedFile, createTransferException() );
+
+ confirmFailures( path, new String[] { ID_MOCKED_PROXIED1, ID_MOCKED_PROXIED2 } );
+ }
+
+ @Test
+ public void testPropagateOnUpdateAlwaysIgnoreArtifactNotPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.IGNORE,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.IGNORE,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmNotDownloadedNoError( path );
+ }
+
+ @Test
+ public void testPropagateOnUpdateAlwaysIgnoreArtifactPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_AND_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFilePresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.IGNORE,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.IGNORE,
+ PropagateErrorsOnUpdateDownloadPolicy.ALWAYS );
+
+ simulateGetIfNewerError( path, expectedFile, createTransferException() );
+ simulateGetIfNewerError( path, expectedFile, createTransferException() );
+
+ confirmNotDownloadedNoError( path );
+ assertTrue( Files.exists(expectedFile) );
+ }
+
+ @Test
+ public void testPropagateOnUpdateNotPresentArtifactNotPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.STOP,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.STOP,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmSingleFailure( path, ID_MOCKED_PROXIED1 );
+ }
+
+ @Test
+ public void testPropagateOnUpdateNotPresentArtifactPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_AND_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFilePresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.STOP,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.STOP,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+
+ simulateGetIfNewerError( path, expectedFile, createTransferException() );
+
+ confirmNotDownloadedNoError( path );
+ assertTrue( Files.exists(expectedFile) );
+ }
+
+ @Test
+ public void testPropagateOnUpdateNotPresentQueueArtifactNotPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.QUEUE,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.QUEUE,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmFailures( path, new String[] { ID_MOCKED_PROXIED1, ID_MOCKED_PROXIED2 } );
+ }
+
+ @Test
+ public void testPropagateOnUpdateNotPresentQueueArtifactPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_AND_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFilePresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.QUEUE,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.QUEUE,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+
+ simulateGetIfNewerError( path, expectedFile, createTransferException() );
+ simulateGetIfNewerError( path, expectedFile, createTransferException() );
+
+ confirmNotDownloadedNoError( path );
+ assertTrue( Files.exists(expectedFile));
+ }
+
+ @Test
+ public void testPropagateOnUpdateNotPresentIgnoreArtifactNotPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_NOT_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFileNotPresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.IGNORE,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.IGNORE,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+
+ simulateGetError( path, expectedFile, createTransferException() );
+ simulateGetError( path, expectedFile, createTransferException() );
+
+ confirmNotDownloadedNoError( path );
+ }
+
+ @Test
+ public void testPropagateOnUpdateNotPresentIgnoreArtifactPresent()
+ throws Exception
+ {
+ String path = PATH_IN_BOTH_REMOTES_AND_LOCAL;
+ Path expectedFile = setupRepositoriesWithLocalFilePresent( path );
+
+ createMockedProxyConnector( ID_MOCKED_PROXIED1, NAME_MOCKED_PROXIED1, PropagateErrorsDownloadPolicy.IGNORE,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+ createMockedProxyConnector( ID_MOCKED_PROXIED2, NAME_MOCKED_PROXIED2, PropagateErrorsDownloadPolicy.IGNORE,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+
+ simulateGetIfNewerError( path, expectedFile, createTransferException() );
+ simulateGetIfNewerError( path, expectedFile, createTransferException() );
+
+ confirmNotDownloadedNoError( path );
+ assertTrue( Files.exists(expectedFile));
+ }
+
+ // ------------------------------------------
+ // HELPER METHODS
+ // ------------------------------------------
+
+ private void createMockedProxyConnector( String id, String name, String errorPolicy )
+ {
+ saveRemoteRepositoryConfig( id, name, "test://bad.machine.com/repo/", "default" );
+ saveConnector( ID_DEFAULT_MANAGED, id, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS,
+ CachedFailuresPolicy.NO, errorPolicy, false );
+ }
+
+ private void createMockedProxyConnector( String id, String name, String errorPolicy, String errorOnUpdatePolicy )
+ {
+ saveRemoteRepositoryConfig( id, name, "test://bad.machine.com/repo/", "default" );
+ saveConnector( ID_DEFAULT_MANAGED, id, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS,
+ CachedFailuresPolicy.NO, errorPolicy, errorOnUpdatePolicy, false );
+ }
+
+ private Path setupRepositoriesWithLocalFileNotPresent( String path )
+ throws Exception
+ {
+ setupTestableManagedRepository( path );
+
+ Path file = managedDefaultDir.resolve( path );
+
+ assertNotExistsInManagedDefaultRepo( file );
+
+ return file;
+ }
+
+ private Path setupRepositoriesWithLocalFilePresent( String path )
+ throws Exception
+ {
+ setupTestableManagedRepository( path );
+
+ Path file = managedDefaultDir.resolve( path );
+
+ assertTrue( Files.exists(file) );
+
+ return file;
+ }
+
+ private void simulateGetError( String path, Path expectedFile, Exception throwable )
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
+ {
+ wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ));
+ EasyMock.expectLastCall().andThrow(throwable );
+ }
+
+ private void simulateGetIfNewerError( String path, Path expectedFile, TransferFailedException exception )
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException, IOException
+ {
+ wagonMock.getIfNewer( EasyMock.eq( path ), EasyMock.anyObject( File.class ), EasyMock.eq( Files.getLastModifiedTime( expectedFile ).toMillis() ));
+ EasyMock.expectLastCall().andThrow( exception );
+ }
+
+ private Path createExpectedTempFile( Path expectedFile )
+ {
+ return managedDefaultDir.resolve(expectedFile.getFileName().toString() + ".tmp" ).toAbsolutePath();
+ }
+
+ private void confirmSingleFailure( String path, String id )
+ throws LayoutException
+ {
+ confirmFailures( path, new String[]{id} );
+ }
+
+ private void confirmFailures( String path, String[] ids )
+ throws LayoutException
+ {
+ wagonMockControl.replay();
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = null;
+ try
+ {
+ downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository,
+ managedDefaultRepository.toArtifactReference( path ) );
+ fail( "Proxy should not have succeeded" );
+ }
+ catch ( ProxyDownloadException e )
+ {
+ assertEquals( ids.length, e.getFailures().size() );
+ for ( String id : ids )
+ {
+ assertTrue( e.getFailures().keySet().contains( id ) );
+ }
+ }
+
+ wagonMockControl.verify();
+
+ assertNotDownloaded( downloadedFile );
+ }
+
+ private void confirmSuccess( String path, Path expectedFile, String basedir )
+ throws Exception
+ {
+ Path downloadedFile = performDownload( path );
+
+ Path proxied1File = Paths.get( basedir, path );
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ }
+
+ private void confirmNotDownloadedNoError( String path )
+ throws Exception
+ {
+ Path downloadedFile = performDownload( path );
+
+ assertNotDownloaded( downloadedFile );
+ }
+
+ private Path performDownload( String path )
+ throws ProxyDownloadException, LayoutException
+ {
+ wagonMockControl.replay();
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository,
+ managedDefaultRepository.toArtifactReference( path ) );
+
+ wagonMockControl.verify();
+ return downloadedFile;
+ }
+
+ private static TransferFailedException createTransferException()
+ {
+ return new TransferFailedException( "test download exception" );
+ }
+
+ private static ResourceDoesNotExistException createResourceNotFoundException()
+ {
+ return new ResourceDoesNotExistException( "test download not found" );
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
new file mode 100644
index 000000000..c3d7c1108
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/HttpProxyTransferTest.java
@@ -0,0 +1,251 @@
+package org.apache.archiva.proxy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.NetworkProxyConfiguration;
+import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.policies.CachedFailuresPolicy;
+import org.apache.archiva.policies.ChecksumPolicy;
+import org.apache.archiva.policies.PropagateErrorsDownloadPolicy;
+import org.apache.archiva.policies.PropagateErrorsOnUpdateDownloadPolicy;
+import org.apache.archiva.policies.ReleasesPolicy;
+import org.apache.archiva.policies.SnapshotsPolicy;
+import org.apache.archiva.proxy.model.RepositoryProxyHandler;
+import org.apache.archiva.repository.*;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
+import org.apache.commons.io.FileUtils;
+import org.assertj.core.api.Assertions;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.handler.AbstractHandler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+
+import javax.inject.Inject;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import static org.junit.Assert.*;
+
+/**
+ * Integration test for connecting over a HTTP proxy.
+ *
+ *
+ */
+@RunWith( ArchivaSpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
+public class HttpProxyTransferTest
+{
+ private static final String PROXY_ID = "proxy";
+
+ private static final String MANAGED_ID = "default-managed-repository";
+
+ private static final String PROXIED_ID = "proxied1";
+
+ private static final String PROXIED_BASEDIR = "src/test/repositories/proxied1";
+
+ private RepositoryProxyHandler proxyHandler;
+
+ private ArchivaConfiguration config;
+
+ private ManagedRepositoryContent managedDefaultRepository;
+
+ @Inject
+ private ApplicationContext applicationContext;
+
+ @Inject
+ private RepositoryRegistry repositoryRegistry;
+
+ private Server server;
+
+ protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout )
+ throws Exception
+ {
+ ManagedRepository repo = new BasicManagedRepository(id, name, Paths.get(path));
+ repositoryRegistry.putRepository(repo);
+ return repositoryRegistry.getManagedRepository(id).getContent();
+ }
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ proxyHandler = applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyHandler.class );
+
+ config = applicationContext.getBean( "archivaConfiguration#mock", ArchivaConfiguration.class );
+
+ // clear from previous tests - TODO the spring context should be initialised per test instead, or the config
+ // made a complete mock
+ config.getConfiguration().getProxyConnectors().clear();
+
+ // Setup source repository (using default layout)
+ String repoPath = "target/test-repository/managed/" + getClass().getSimpleName();
+
+ Path destRepoDir = Paths.get( repoPath );
+
+ // Cleanout destination dirs.
+ if ( Files.exists(destRepoDir))
+ {
+ FileUtils.deleteDirectory( destRepoDir.toFile() );
+ }
+
+ // Make the destination dir.
+ Files.createDirectories(destRepoDir);
+
+
+ Handler handler = new AbstractHandler()
+ {
+ @Override
+ public void handle( String s, Request request, HttpServletRequest httpServletRequest,
+ HttpServletResponse response )
+ throws IOException, ServletException
+ {
+ response.setContentType( "text/plain" );
+ response.setStatus( HttpServletResponse.SC_OK );
+ response.getWriter().print( "get-default-layout-1.0.jar\n\n" );
+ assertNotNull( request.getHeader( "Proxy-Connection" ) );
+
+ ( (Request) request ).setHandled( true );
+ }
+
+ public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch )
+ throws IOException, ServletException
+ {
+ response.setContentType( "text/plain" );
+ response.setStatus( HttpServletResponse.SC_OK );
+ response.getWriter().print( "get-default-layout-1.0.jar\n\n" );
+ assertNotNull( request.getHeader( "Proxy-Connection" ) );
+
+ ( (Request) request ).setHandled( true );
+ }
+ };
+
+ server = new Server( );
+ ServerConnector serverConnector = new ServerConnector( server, new HttpConnectionFactory());
+ server.addConnector( serverConnector );
+ server.setHandler( handler );
+ server.start();
+
+ int port = serverConnector.getLocalPort();
+
+ NetworkProxyConfiguration proxyConfig = new NetworkProxyConfiguration();
+ proxyConfig.setHost( "localhost" );
+ proxyConfig.setPort( port );
+ proxyConfig.setProtocol( "http" );
+ proxyConfig.setId( PROXY_ID );
+ config.getConfiguration().addNetworkProxy( proxyConfig );
+ ( (MockConfiguration) config ).triggerChange("networkProxies.networkProxy(0).host", "localhost");
+
+ // Setup target (proxied to) repository.
+ RemoteRepositoryConfiguration repoConfig = new RemoteRepositoryConfiguration();
+
+ repoConfig.setId( PROXIED_ID );
+ repoConfig.setName( "Proxied Repository 1" );
+ repoConfig.setLayout( "default" );
+ repoConfig.setUrl( "http://www.example.com/" );
+
+ config.getConfiguration().addRemoteRepository( repoConfig );
+
+ repositoryRegistry.reload();
+
+ managedDefaultRepository = createRepository(MANAGED_ID, "Default Managed Repository", repoPath, "default");
+
+ }
+
+ @After
+ public void tearDown()
+ throws Exception
+ {
+ server.stop();
+ }
+
+ @Test
+ public void testGetOverHttpProxy()
+ throws Exception
+ {
+ Assertions.assertThat( System.getProperty( "http.proxyHost", "" ) ).isEmpty();
+ Assertions.assertThat( System.getProperty( "http.proxyPort", "" ) ).isEmpty();
+
+ String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ addConnector();
+
+ Path expectedFile = Paths.get( managedDefaultRepository.getRepoRoot() ).resolve( path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path sourceFile = Paths.get( PROXIED_BASEDIR, path );
+ assertNotNull( "Expected File should not be null.", expectedFile );
+ assertNotNull( "Actual File should not be null.", downloadedFile );
+
+ assertTrue( "Check actual file exists.", Files.exists(downloadedFile));
+ assertTrue( "Check filename path is appropriate.", Files.isSameFile( expectedFile, downloadedFile));
+ assertTrue( "Check file path matches.", Files.isSameFile( expectedFile, downloadedFile));
+
+ String expectedContents = FileUtils.readFileToString( sourceFile.toFile(), Charset.defaultCharset() );
+ String actualContents = FileUtils.readFileToString( downloadedFile.toFile(), Charset.defaultCharset() );
+ assertEquals( "Check file contents.", expectedContents, actualContents );
+
+ Assertions.assertThat( System.getProperty( "http.proxyHost" , "") ).isEmpty();
+ Assertions.assertThat( System.getProperty( "http.proxyPort" , "") ).isEmpty();
+ }
+
+ private void addConnector()
+ {
+ ProxyConnectorConfiguration connectorConfig = new ProxyConnectorConfiguration();
+ connectorConfig.setProxyId( PROXY_ID );
+ connectorConfig.setSourceRepoId( MANAGED_ID );
+ connectorConfig.setTargetRepoId( PROXIED_ID );
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CHECKSUM, ChecksumPolicy.FIX );
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, ReleasesPolicy.ONCE );
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, SnapshotsPolicy.ONCE );
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CACHE_FAILURES, CachedFailuresPolicy.NO );
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_PROPAGATE_ERRORS,
+ PropagateErrorsDownloadPolicy.QUEUE );
+ connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_PROPAGATE_ERRORS_ON_UPDATE,
+ PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT );
+
+ int count = config.getConfiguration().getProxyConnectors().size();
+ config.getConfiguration().addProxyConnector( connectorConfig );
+
+ // Proper Triggering ...
+ String prefix = "proxyConnectors.proxyConnector(" + count + ")";
+ ( (MockConfiguration) config ).triggerChange( prefix + ".sourceRepoId", connectorConfig.getSourceRepoId() );
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java
new file mode 100644
index 000000000..017594374
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/ManagedDefaultTransferTest.java
@@ -0,0 +1,466 @@
+package org.apache.archiva.proxy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.policies.CachedFailuresPolicy;
+import org.apache.archiva.policies.ChecksumPolicy;
+import org.apache.archiva.policies.ReleasesPolicy;
+import org.apache.archiva.policies.SnapshotsPolicy;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.FileTime;
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.Assert.*;
+
+/**
+ * ManagedDefaultTransferTest
+ */
+public class ManagedDefaultTransferTest
+ extends AbstractProxyTestCase
+{
+ @Test
+ public void testGetDefaultLayoutNotPresentConnectorOffline()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ // Ensure file isn't present first.
+ assertNotExistsInManagedDefaultRepo( expectedFile );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE,
+ CachedFailuresPolicy.NO, true );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+ assertNull( "File should not have been downloaded", downloadedFile );
+ }
+
+ @Test
+ public void testGetDefaultLayoutNotPresent()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ // Ensure file isn't present first.
+ assertNotExistsInManagedDefaultRepo( expectedFile );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE,
+ CachedFailuresPolicy.NO, false );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path sourceFile = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, sourceFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testGetDefaultLayoutNotPresentPassthrough()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar.asc";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+
+ // Ensure file isn't present first.
+ assertNotExistsInManagedDefaultRepo( expectedFile );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE,
+ CachedFailuresPolicy.NO, false );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, path );
+
+ Path sourceFile = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, sourceFile );
+ assertFalse( Files.exists( downloadedFile.getParent().resolve(downloadedFile.getFileName() + ".sha1" )) );
+ assertFalse( Files.exists(downloadedFile.getParent().resolve(downloadedFile.getFileName() + ".md5" ) ));
+ assertFalse( Files.exists( downloadedFile.getParent().resolve(downloadedFile.getFileName() + ".asc" ) ));
+ assertNoTempFiles( expectedFile );
+ }
+
+ /**
+ * The attempt here should result in no file being transferred.
+ * <p/>
+ * The file exists locally, and the policy is ONCE.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetDefaultLayoutAlreadyPresentPolicyOnce()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertTrue( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE,
+ CachedFailuresPolicy.NO, false );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ assertFileEquals( expectedFile, downloadedFile, expectedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ /**
+ * The attempt here should result in no file being transferred.
+ * <p/>
+ * The file exists locally, and the policy is ONCE.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetDefaultLayoutAlreadyPresentPassthrough()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ Path remoteFile = Paths.get(REPOPATH_PROXIED1, path);
+
+ assertTrue( Files.exists(expectedFile) );
+
+ // Set the managed File to be newer than local.
+ setManagedOlderThanRemote( expectedFile, remoteFile );
+ long originalModificationTime = Files.getLastModifiedTime(expectedFile).toMillis();
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ONCE, SnapshotsPolicy.ONCE,
+ CachedFailuresPolicy.NO, false );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, path );
+
+ assertNotDownloaded( downloadedFile );
+ assertNotModified( expectedFile, originalModificationTime );
+ assertNoTempFiles( expectedFile );
+ }
+
+ /**
+ * <p>
+ * Request a file, that exists locally, and remotely.
+ * </p>
+ * <p>
+ * All policies are set to IGNORE.
+ * </p>
+ * <p>
+ * Managed file is newer than remote file.
+ * </p>
+ * <p>
+ * Transfer should not have occured, as managed file is newer.
+ * </p>
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetDefaultLayoutAlreadyPresentNewerThanRemotePolicyIgnored()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ Path remoteFile = Paths.get(REPOPATH_PROXIED1, path);
+
+ // Set the managed File to be newer than local.
+ setManagedNewerThanRemote( expectedFile, remoteFile );
+
+ long originalModificationTime = Files.getLastModifiedTime( expectedFile).toMillis();
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertTrue( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ assertNotDownloaded( downloadedFile );
+ assertNotModified( expectedFile, originalModificationTime );
+ assertNoTempFiles( expectedFile );
+ }
+
+ /**
+ * <p>
+ * Request a file, that exists locally, and remotely.
+ * </p>
+ * <p>
+ * All policies are set to IGNORE.
+ * </p>
+ * <p>
+ * Managed file is older than Remote file.
+ * </p>
+ * <p>
+ * Transfer should have occured, as managed file is older than remote.
+ * </p>
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetDefaultLayoutAlreadyPresentOlderThanRemotePolicyIgnored()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ Path remoteFile = Paths.get(REPOPATH_PROXIED1, path);
+
+ // Set the managed file to be newer than remote file.
+ setManagedOlderThanRemote( expectedFile, remoteFile );
+
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertTrue( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxiedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ /**
+ * The attempt here should result in file being transferred.
+ * <p/>
+ * The file exists locally, is over 6 years old, and the policy is DAILY.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetDefaultLayoutRemoteUpdate()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertTrue( Files.exists(expectedFile) );
+ Files.setLastModifiedTime( expectedFile, FileTime.from(getPastDate().getTime(), TimeUnit.MILLISECONDS ));
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.DAILY, SnapshotsPolicy.DAILY,
+ CachedFailuresPolicy.NO, false );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxiedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testGetWhenInBothProxiedRepos()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertNotExistsInManagedDefaultRepo( expectedFile );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied1File = Paths.get(REPOPATH_PROXIED1, path);
+ Path proxied2File = Paths.get(REPOPATH_PROXIED2, path);
+ assertFileEquals( expectedFile, downloadedFile, proxied1File );
+ assertNoTempFiles( expectedFile );
+
+ // TODO: is this check even needed if it passes above?
+ String actualContents = FileUtils.readFileToString( downloadedFile.toFile(), Charset.defaultCharset() );
+ String badContents = FileUtils.readFileToString( proxied2File.toFile(), Charset.defaultCharset() );
+ assertFalse( "Downloaded file contents should not be that of proxy 2",
+ StringUtils.equals( actualContents, badContents ) );
+ }
+
+ @Test
+ public void testGetInSecondProxiedRepo()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertNotExistsInManagedDefaultRepo( expectedFile );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxied2File = Paths.get(REPOPATH_PROXIED2, path);
+ assertFileEquals( expectedFile, downloadedFile, proxied2File );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testNotFoundInAnyProxies()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/does-not-exist/1.0/does-not-exist-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertNotExistsInManagedDefaultRepo( expectedFile );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ assertNull( "File returned was: " + downloadedFile + "; should have got a not found exception",
+ downloadedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testGetInSecondProxiedRepoFirstFails()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertNotExistsInManagedDefaultRepo( expectedFile );
+
+ // Configure Repository (usually done within archiva.xml configuration)
+ saveRemoteRepositoryConfig( "badproxied", "Bad Proxied", "test://bad.machine.com/repo/", "default" );
+
+ wagonMock.get( EasyMock.eq( path), EasyMock.anyObject( File.class ) );
+ EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "transfer failed" ) );
+ wagonMockControl.replay();
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied", false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, false );
+
+ // Attempt the proxy fetch.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ wagonMockControl.verify();
+
+ Path proxied2File = Paths.get(REPOPATH_PROXIED2, path);
+ assertFileEquals( expectedFile, downloadedFile, proxied2File );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testGetAllRepositoriesFail()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve( path );
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertNotExistsInManagedDefaultRepo( expectedFile );
+
+ // Configure Repository (usually done within archiva.xml configuration)
+ saveRemoteRepositoryConfig( "badproxied1", "Bad Proxied 1", "test://bad.machine.com/repo/", "default" );
+ saveRemoteRepositoryConfig( "badproxied2", "Bad Proxied 2", "test://dead.machine.com/repo/", "default" );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied1", false );
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied2", false );
+
+ Path tmpFile = expectedFile.getParent().resolve(expectedFile.getFileName() + ".tmp" );
+
+ wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ) );
+ EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "Can't find resource." ) );
+
+ wagonMock.get( EasyMock.eq( path ), EasyMock.anyObject( File.class ) );
+ EasyMock.expectLastCall().andThrow( new ResourceDoesNotExistException( "Can't find resource." ) );
+
+ wagonMockControl.replay();
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ assertNotDownloaded( downloadedFile );
+
+ wagonMockControl.verify();
+ assertNoTempFiles( expectedFile );
+
+ // TODO: do not want failures to present as a not found [MRM-492]
+ // TODO: How much information on each failure should we pass back to the user vs. logging in the proxy?
+ }
+
+
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java
new file mode 100644
index 000000000..23bfb8503
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java
@@ -0,0 +1,1405 @@
+package org.apache.archiva.proxy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.common.utils.VersionUtil;
+import org.apache.archiva.configuration.ProxyConnectorConfiguration;
+import org.apache.archiva.maven2.metadata.MavenMetadataReader;
+import org.apache.archiva.model.ArchivaRepositoryMetadata;
+import org.apache.archiva.model.Plugin;
+import org.apache.archiva.model.ProjectReference;
+import org.apache.archiva.model.SnapshotVersion;
+import org.apache.archiva.model.VersionedReference;
+import org.apache.archiva.policies.CachedFailuresPolicy;
+import org.apache.archiva.policies.ChecksumPolicy;
+import org.apache.archiva.policies.ReleasesPolicy;
+import org.apache.archiva.policies.SnapshotsPolicy;
+import org.apache.archiva.repository.metadata.MetadataTools;
+import org.apache.archiva.repository.metadata.RepositoryMetadataException;
+import org.apache.archiva.repository.metadata.RepositoryMetadataWriter;
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.wagon.TransferFailedException;
+import org.custommonkey.xmlunit.DetailedDiff;
+import org.custommonkey.xmlunit.Diff;
+import org.easymock.EasyMock;
+import org.junit.Test;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.File;
+import java.io.StringWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import static org.junit.Assert.*;
+
+/**
+ * MetadataTransferTest - Tests the various fetching / merging concepts surrounding the maven-metadata.xml files
+ * present in the repository.
+ * <p/>
+ * Test Case Naming is as follows.
+ * <p/>
+ * <code>
+ * public void testGet[Release|Snapshot|Project]Metadata[Not]Proxied[Not|On]Local[Not|On|Multiple]Remote
+ * </code>
+ * <p/>
+ * <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>
+ *
+ *
+ */
+public class MetadataTransferTest
+ extends AbstractProxyTestCase
+{
+
+ @Inject
+ @Named(value = "metadataTools#mocked")
+ private MetadataTools metadataTools;
+
+
+ @Test
+ public void testGetProjectMetadataProxiedNotLocalOnRemoteConnectoDisabled()
+ throws Exception
+ {
+ // 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.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, true );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+ Path expectedFile = managedDefaultDir.resolve(requestedResource);
+
+ ProjectReference metadata = createProjectReference( requestedResource );
+
+ Path downloadedFile = proxyHandler.fetchMetadataFromProxies( managedDefaultRepository,
+ managedDefaultRepository.toMetadataPath(
+ metadata ) ).getFile();
+
+ assertNull( "Should not have downloaded a file.", downloadedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ // TODO: same test for other fetch* methods
+ @Test
+ public void testFetchFromTwoProxiesWhenFirstConnectionFails()
+ 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 );
+
+ saveRemoteRepositoryConfig( "badproxied1", "Bad Proxied 1", "test://bad.machine.com/repo/", "default" );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, "badproxied1", ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( "badproxied1", requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // ensure that a hard failure in the first proxy connector is skipped and the second repository checked
+ Path expectedFile = managedDefaultDir.resolve(
+ metadataTools.getRepositorySpecificName( "badproxied1", requestedResource ) );
+
+ wagonMock.get( EasyMock.eq( requestedResource ), EasyMock.anyObject( File.class ));
+ EasyMock.expectLastCall().andThrow( new TransferFailedException( "can't connect" ) );
+
+
+ wagonMockControl.replay();
+
+ assertFetchProjectOrGroup( requestedResource );
+
+ wagonMockControl.verify();
+
+ assertProjectMetadataContents( requestedResource, new String[]{ "1.0.1" }, "1.0.1", "1.0.1" );
+ assertNoRepoMetadata( "badproxied1", requestedResource );
+ assertRepoProjectMetadata( ID_PROXIED2, requestedResource, new String[]{ "1.0.1" } );
+ }
+
+ /**
+ * Attempt to get the project metadata for non-existant artifact.
+ * <p/>
+ * Expected result: the maven-metadata.xml file is not created on the managed repository, nor returned
+ * to the requesting client.
+ */
+ @Test
+ 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 );
+
+ config.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>( ) );
+
+ assertResourceNotFound( requestedResource );
+
+ // No proxy setup, nothing fetched, failure expected.
+ assertFetchProjectOrGroupFailed( requestedResource );
+
+ // No local artifactId, and no fetch, should equal no metadata file downloaded / created / updated.
+ assertResourceNotFound( requestedResource );
+ }
+
+ @Test
+ public void testGetProjectMetadataNotProxiedOnLocal()
+ throws Exception
+ {
+
+ // Project metadata that exists and has multiple versions
+ String requestedResource = "org/apache/maven/test/get-project-metadata/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ config.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>( ) );
+
+ assertResourceExists( requestedResource );
+
+ // No proxy setup, nothing fetched from remote, but local exists.
+ assertFetchProjectOrGroup( requestedResource );
+
+ // Nothing fetched. Should only contain contents of what is in the repository.
+ // A metadata update is not performed in this use case. Local metadata content is only
+ // updated via the metadata updater consumer.
+ assertProjectMetadataContents( requestedResource, new String[]{ "1.0" }, null, null );
+ }
+
+ @Test
+ 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 );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // Two proxies setup, metadata fetched from both remotes.
+ assertFetchProjectOrGroup( requestedResource );
+
+ // Nothing fetched. Should only contain contents of what is in the repository.
+ assertProjectMetadataContents( requestedResource, new String[]{ "1.0", "1.0.1" }, "1.0.1", "1.0.1" );
+ assertRepoProjectMetadata( ID_PROXIED1, requestedResource, new String[]{ "1.0" } );
+ assertRepoProjectMetadata( ID_PROXIED2, requestedResource, new String[]{ "1.0.1" } );
+ }
+
+ @Test
+ public void testGetProjectMetadataProxiedNotLocalNotRemote()
+ throws Exception
+ {
+ // 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 );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // Two proxies setup, nothing fetched from remotes, local does not exist.
+ assertFetchProjectOrGroupFailed( requestedResource );
+
+ // Nothing fetched. Nothing should exist.
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+ }
+
+ @Test
+ public void testGetProjectMetadataProxiedNotLocalOnRemote()
+ throws Exception
+ {
+ // 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.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+ // One proxy setup, metadata fetched from remote, local does not exist.
+ assertFetchProjectOrGroup( requestedResource );
+
+ // Remote fetched. Local created/updated.
+ assertProjectMetadataContents( requestedResource, new String[]{ "1.0.5" }, "1.0.5", "1.0.5" );
+ assertRepoProjectMetadata( ID_PROXIED1, requestedResource, new String[]{ "1.0.5" } );
+ }
+
+ @Test
+ public void testGetProjectMetadataProxiedOnLocalMultipleRemote()
+ throws Exception
+ {
+ // 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 );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertProjectMetadataContents( requestedResource, new String[]{ "1.0" }, null, null );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // Two proxies setup, metadata fetched from both remotes.
+ assertFetchProjectOrGroup( requestedResource );
+
+ // metadata fetched from both repos, and merged with local version.
+ assertProjectMetadataContents( requestedResource, new String[]{ "1.0", "1.0.1", "2.0" }, "2.0", "2.0" );
+ assertRepoProjectMetadata( ID_PROXIED1, requestedResource, new String[]{ "1.0", "2.0" } );
+ assertRepoProjectMetadata( ID_PROXIED2, requestedResource, new String[]{ "1.0", "1.0.1" } );
+ }
+
+ @Test
+ public void testGetProjectMetadataProxiedOnLocalNotRemote()
+ throws Exception
+ {
+
+ // 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 );
+
+
+ config.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>( ) );
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertProjectMetadataContents( requestedResource, new String[]{ "1.0-beta-2" }, null, null );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // Two proxies setup, metadata fetch from remotes fail (because they dont exist).
+ assertFetchProjectOrGroup( requestedResource );
+
+ // metadata not fetched from both repos, and local version exists.
+ // Since there was no updated metadata content from a remote/proxy, a metadata update on
+ // the local file never ran. Local only updates are performed via the metadata updater consumer.
+ assertProjectMetadataContents( requestedResource, new String[]{ "1.0-beta-2" }, null, null );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+ }
+
+ @Test
+ public void testGetProjectMetadataProxiedOnLocalOnRemote()
+ throws Exception
+ {
+ // 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 );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertProjectMetadataContents( requestedResource, new String[]{ "1.0.8", "1.0.22" }, null, null );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+ // One proxy setup, metadata fetched from remote, local exists.
+ assertFetchProjectOrGroup( requestedResource );
+
+ // Remote fetched. Local updated.
+ assertProjectMetadataContents( requestedResource, new String[]{ "1.0.8", "1.0.22", "2.0" }, "2.0", "2.0" );
+ assertRepoProjectMetadata( ID_PROXIED1, requestedResource, new String[]{ "1.0.22", "2.0" } );
+ }
+
+ /**
+ * A request for a release maven-metadata.xml file that does not exist locally, and the managed
+ * repository has no proxied repositories set up.
+ * <p/>
+ * Expected result: the maven-metadata.xml file is not created on the managed repository, nor returned
+ * to the requesting client.
+ */
+ @Test
+ public void testGetReleaseMetadataNotProxiedNotLocal()
+ throws Exception
+ {
+ // 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 );
+
+ assertNoMetadata( requestedResource );
+
+ // 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 );
+ }
+
+ /**
+ * A request for a maven-metadata.xml file that does exist locally, and the managed
+ * repository has no proxied repositories set up.
+ * <p/>
+ * Expected result: the maven-metadata.xml file is updated locally, based off of the managed repository
+ * information, and then returned to the client.
+ */
+ @Test
+ public void testGetReleaseMetadataNotProxiedOnLocal()
+ throws Exception
+ {
+ String requestedResource = "org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ 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.
+ * <p/>
+ * 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.
+ */
+ @Test
+ 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.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ assertFetchVersioned( requestedResource );
+
+ assertReleaseMetadataContents( requestedResource );
+ assertRepoReleaseMetadataContents( ID_PROXIED1, requestedResource );
+ assertRepoReleaseMetadataContents( ID_PROXIED2, requestedResource );
+ }
+
+ /**
+ * A request for a maven-metadata.xml file that does not exist locally, nor does it exist in a remote
+ * proxied repository.
+ * <p/>
+ * Expected result: the maven-metadata.xml file is created locally, based off of managed repository
+ * information, and then return to the client.
+ */
+ @Test
+ public void testGetReleaseMetadataProxiedNotLocalNotRemote()
+ throws Exception
+ {
+ 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.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceNotFound( requestedResource );
+
+ assertFetchProjectOrGroupFailed( requestedResource );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ }
+
+ /**
+ * A request for a maven-metadata.xml file that does not exist on the managed repository, but
+ * exists on 1 remote repository.
+ * <p/>
+ * 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.
+ */
+ @Test
+ public void testGetReleaseMetadataProxiedNotLocalOnRemote()
+ 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.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+ assertFetchVersioned( requestedResource );
+
+ 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.
+ * <p/>
+ * 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.
+ */
+ @Test
+ 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, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertReleaseMetadataContents( requestedResource );
+
+ assertFetchVersioned( requestedResource );
+
+ assertReleaseMetadataContents( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ }
+
+ /**
+ * A request for a maven-metadata.xml file that exists in the managed repository, and on multiple
+ * remote repositories.
+ * <p/>
+ * 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.
+ */
+ @Test
+ public void testGetReleaseMetadataProxiedOnLocalMultipleRemote()
+ throws Exception
+ {
+ 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.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertReleaseMetadataContents( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ assertFetchVersioned( requestedResource );
+
+ 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.
+ * <p/>
+ * 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.
+ */
+ @Test
+ 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, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertReleaseMetadataContents( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+ assertFetchVersioned( requestedResource );
+
+ assertReleaseMetadataContents( requestedResource );
+ assertRepoReleaseMetadataContents( ID_PROXIED1, requestedResource );
+ }
+
+ @Test
+ public void testGetSnapshotMetadataNotProxiedNotLocal()
+ 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 );
+
+ assertNoMetadata( requestedResource );
+
+ // No 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 );
+ }
+
+ @Test
+ 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 );
+
+ 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 );
+ }
+
+ @Test
+ public void testGetSnapshotMetadataProxiedNotLocalMultipleRemotes()
+ throws Exception
+ {
+ 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.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // 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 );
+ }
+
+ @Test
+ 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, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertNoMetadata( requestedResource );
+
+ // 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 );
+ }
+
+ @Test
+ public void testGetSnapshotMetadataProxiedNotLocalOnRemote()
+ throws Exception
+ {
+ // Artifact exists only in the proxied1 location.
+ String requestedResource = "org/apache/maven/test/get-metadata-snapshot/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.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceNotFound( requestedResource );
+
+ // One proxy setup, one metadata fetched, local file created/updated.
+ assertFetchVersioned( requestedResource );
+
+ // 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 );
+ }
+
+ @Test
+ 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, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertSnapshotMetadataContents( requestedResource, "20070822", "021008", 3 );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // 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 );
+ }
+
+ @Test
+ public void testGetSnapshotMetadataProxiedOnLocalNotRemote()
+ 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 );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceExists( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // 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 );
+ }
+
+ @Test
+ 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, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ 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 );
+ }
+
+ @Test
+ public void testGetGroupMetadataNotProxiedNotLocal()
+ throws Exception
+ {
+ // The artifactId "get-default-metadata-nonexistant" does not exist (intentionally).
+ String requestedResource = "org/apache/maven/test/groups/get-default-metadata-nonexistant/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ assertResourceNotFound( requestedResource );
+
+ // No proxy setup, nothing fetched, failure expected.
+ assertFetchProjectOrGroupFailed( requestedResource );
+
+ // No local artifactId, and no fetch, should equal no metadata file downloaded / created / updated.
+ assertResourceNotFound( requestedResource );
+ }
+
+ @Test
+ public void testGetGroupMetadataNotProxiedOnLocal()
+ throws Exception
+ {
+ // Project metadata that exists and has multiple versions
+ String requestedResource = "org/apache/maven/test/groups/get-project-metadata/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ assertResourceExists( requestedResource );
+
+ // No proxy setup, nothing fetched from remote, but local exists.
+ assertFetchProjectOrGroup( requestedResource );
+
+ // Nothing fetched. Should only contain contents of what is in the repository.
+ // A metadata update is not performed in this use case. Local metadata content is only
+ // updated via the metadata updater consumer.
+ assertGroupMetadataContents( requestedResource, new String[]{ "plugin1" } );
+ }
+
+ @Test
+ public void testGetGroupMetadataProxiedNotLocalMultipleRemotes()
+ throws Exception
+ {
+ // Project metadata that does not exist locally, but has multiple versions in remote repos
+ String requestedResource = "org/apache/maven/test/groups/get-default-layout/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // Two proxies setup, metadata fetched from both remotes.
+ assertFetchProjectOrGroup( requestedResource );
+
+ // Nothing fetched. Should only contain contents of what is in the repository.
+ assertGroupMetadataContents( requestedResource, new String[]{ "plugin2", "plugin1" } );
+ assertRepoGroupMetadataContents( ID_PROXIED1, requestedResource, new String[]{ "plugin1" } );
+ assertRepoGroupMetadataContents( ID_PROXIED2, requestedResource, new String[]{ "plugin2" } );
+ }
+
+ @Test
+ public void testGetGroupsMetadataProxiedNotLocalNotRemote()
+ throws Exception
+ {
+ // Non-existant project metadata that does not exist locally and doesn't exist on remotes.
+ String requestedResource = "org/apache/maven/test/groups/get-bogus-artifact/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // Two proxies setup, nothing fetched from remotes, local does not exist.
+ assertFetchProjectOrGroupFailed( requestedResource );
+
+ // Nothing fetched. Nothing should exist.
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+ }
+
+ @Test
+ public void testGetGroupMetadataProxiedNotLocalOnRemote()
+ throws Exception
+ {
+ // New project metadata that does not exist locally but exists on remote.
+ String requestedResource = "org/apache/maven/test/groups/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.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertResourceNotFound( requestedResource );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+ // One proxy setup, metadata fetched from remote, local does not exist.
+ assertFetchProjectOrGroup( requestedResource );
+
+ // Remote fetched. Local created/updated.
+ assertGroupMetadataContents( requestedResource, new String[]{ "plugin3" } );
+ assertRepoGroupMetadataContents( ID_PROXIED1, requestedResource, new String[]{ "plugin3" } );
+ }
+
+ @Test
+ public void testGetGroupMetadataProxiedOnLocalMultipleRemote()
+ throws Exception
+ {
+ // Project metadata that exist locally, and has multiple versions in remote repos
+ String requestedResource = "org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertGroupMetadataContents( requestedResource, new String[]{ "plugin1" } );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // Two proxies setup, metadata fetched from both remotes.
+ assertFetchProjectOrGroup( requestedResource );
+
+ // metadata fetched from both repos, and merged with local version.
+ assertGroupMetadataContents( requestedResource, new String[]{ "plugin1", "plugin2", "plugin4" } );
+ assertRepoGroupMetadataContents( ID_PROXIED1, requestedResource, new String[]{ "plugin1", "plugin4" } );
+ assertRepoGroupMetadataContents( ID_PROXIED2, requestedResource, new String[]{ "plugin1", "plugin2" } );
+ }
+
+ @Test
+ public void testGetGroupMetadataProxiedOnLocalNotRemote()
+ throws Exception
+ {
+ // Project metadata that exist locally, and does not exist in remote repos.
+ String requestedResource = "org/apache/maven/test/groups/get-not-on-remotes/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertGroupMetadataContents( requestedResource, new String[]{ "plugin5" } );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+
+ // Two proxies setup, metadata fetch from remotes fail (because they dont exist).
+ assertFetchProjectOrGroup( requestedResource );
+
+ // metadata not fetched from both repos, and local version exists.
+ // Since there was no updated metadata content from a remote/proxy, a metadata update on
+ // the local file never ran. Local only updates are performed via the metadata updater consumer.
+ assertGroupMetadataContents( requestedResource, new String[]{ "plugin5" } );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+ assertNoRepoMetadata( ID_PROXIED2, requestedResource );
+ }
+
+ @Test
+ public void testGetGroupMetadataProxiedOnLocalOnRemote()
+ throws Exception
+ {
+ // Project metadata that exist locally and exists on remote.
+ String requestedResource = "org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml";
+ setupTestableManagedRepository( requestedResource );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.FIX, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.NO, false );
+
+ assertGroupMetadataContents( requestedResource, new String[]{ "plugin6", "plugin7" } );
+ assertNoRepoMetadata( ID_PROXIED1, requestedResource );
+
+ // One proxy setup, metadata fetched from remote, local exists.
+ assertFetchProjectOrGroup( requestedResource );
+
+ // Remote fetched. Local updated.
+ assertGroupMetadataContents( requestedResource, new String[]{ "plugin6", "plugin7", "plugin4" } );
+ assertRepoGroupMetadataContents( ID_PROXIED1, requestedResource, new String[]{ "plugin7", "plugin4" } );
+ }
+
+ /**
+ * Transfer the metadata file.
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertFetchProjectOrGroup( String requestedResource )
+ throws Exception
+ {
+ Path expectedFile = managedDefaultDir.resolve(requestedResource);
+
+ ProjectReference metadata = createProjectReference( requestedResource );
+
+ Path downloadedFile = proxyHandler.fetchMetadataFromProxies( managedDefaultRepository,
+ managedDefaultRepository.toMetadataPath(
+ metadata ) ).getFile();
+
+ assertNotNull( "Should have downloaded a file.", downloadedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ private ProjectReference createProjectReference( String path )
+ throws RepositoryMetadataException
+ {
+ return metadataTools.toProjectReference( path );
+ }
+
+ /**
+ * Transfer the metadata file, not expected to succeed.
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertFetchProjectOrGroupFailed( String requestedResource )
+ throws Exception
+ {
+ Path expectedFile = managedDefaultDir.resolve(requestedResource);
+ ProjectReference metadata = createProjectReference( requestedResource );
+
+ Path downloadedFile = proxyHandler.fetchMetadataFromProxies( managedDefaultRepository,
+ managedDefaultRepository.toMetadataPath(
+ metadata ) ).getFile();
+
+ assertNull( downloadedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ /**
+ * Transfer the metadata file.
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertFetchVersioned( String requestedResource )
+ throws Exception
+ {
+ Path expectedFile = managedDefaultDir.resolve(requestedResource);
+
+ VersionedReference metadata = createVersionedReference( requestedResource );
+
+ Path downloadedFile = proxyHandler.fetchMetadataFromProxies( managedDefaultRepository,
+ managedDefaultRepository.toMetadataPath(
+ metadata ) ).getFile();
+
+ assertNotNull( "Should have downloaded a file.", downloadedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ private VersionedReference createVersionedReference( String path )
+ throws RepositoryMetadataException
+ {
+ return metadataTools.toVersionedReference( path );
+ }
+
+ /**
+ * Transfer the metadata file, not expected to succeed.
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertFetchVersionedFailed( String requestedResource )
+ throws Exception
+ {
+ Path expectedFile = managedDefaultDir.resolve(requestedResource);
+ VersionedReference metadata = createVersionedReference( requestedResource );
+
+ Path downloadedFile = proxyHandler.fetchMetadataFromProxies( managedDefaultRepository,
+ managedDefaultRepository.toMetadataPath(
+ metadata ) ).getFile();
+
+ 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
+ {
+ Path actualFile = managedDefaultDir.resolve(requestedResource);
+ assertTrue( "Resource should exist: " + requestedResource, Files.exists(actualFile) );
+ }
+
+ private void assertMetadataEquals( String expectedMetadataXml, Path actualFile )
+ throws Exception
+ {
+ assertNotNull( "Actual File should not be null.", actualFile );
+
+ assertTrue( "Actual file exists.", Files.exists(actualFile) );
+
+ StringWriter actualContents = new StringWriter();
+ ArchivaRepositoryMetadata metadata = MavenMetadataReader.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
+ {
+ Path expectedFile = managedDefaultDir.resolve(requestedResource);
+ assertFalse( "metadata should not exist: " + expectedFile, Files.exists(expectedFile) );
+ }
+
+ /**
+ * 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 );
+
+ Path actualFile = managedDefaultDir.resolve(proxiedFile);
+ assertFalse( "Repo specific metadata should not exist: " + actualFile, Files.exists(actualFile) );
+ }
+
+ private void assertGroupMetadataContents( String requestedResource, String expectedPlugins[] )
+ throws Exception
+ {
+ Path actualFile = managedDefaultDir.resolve(requestedResource);
+ assertTrue( "Snapshot Metadata should exist: " + requestedResource, Files.exists(actualFile) );
+
+ ProjectReference actualMetadata = createGroupReference( requestedResource );
+
+ assertGroupMetadata( actualFile, actualMetadata, expectedPlugins );
+ }
+
+ private ProjectReference createGroupReference( String requestedResource )
+ throws RepositoryMetadataException
+ {
+ ProjectReference projectReference = createProjectReference( requestedResource );
+ projectReference.setGroupId( projectReference.getGroupId() + "." + projectReference.getArtifactId() );
+ projectReference.setArtifactId( null );
+ return projectReference;
+ }
+
+ private void assertRepoGroupMetadataContents( String proxiedRepoId, String requestedResource,
+ String expectedPlugins[] )
+ throws Exception
+ {
+ String proxiedFile = metadataTools.getRepositorySpecificName( proxiedRepoId, requestedResource );
+
+ Path actualFile = managedDefaultDir.resolve(proxiedFile);
+ assertTrue( "Repo Specific Group Metadata should exist: " + requestedResource, Files.exists(actualFile) );
+
+ ProjectReference actualMetadata = createGroupReference( requestedResource );
+
+ assertGroupMetadata( actualFile, actualMetadata, expectedPlugins );
+ }
+
+ private void assertGroupMetadata( Path actualFile, ProjectReference actualMetadata, String expectedPlugins[] )
+ throws Exception
+ {
+ // Build expected metadata XML
+ StringWriter expectedMetadataXml = new StringWriter();
+ ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
+ m.setGroupId( actualMetadata.getGroupId() );
+
+ for ( String pluginId : expectedPlugins )
+ {
+ Plugin p = new Plugin();
+ p.setPrefix( pluginId );
+ p.setArtifactId( pluginId + "-maven-plugin" );
+ p.setName( "The " + pluginId + " Plugin" );
+ m.getPlugins().add( p );
+ }
+
+ 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 specified list of expected versions?
+ *
+ * @param requestedResource the requested resource
+ * @throws Exception
+ */
+ private void assertProjectMetadataContents( String requestedResource, String expectedVersions[],
+ String latestVersion, String releaseVersion )
+ throws Exception
+ {
+ Path actualFile = managedDefaultDir.resolve(requestedResource);
+ assertTrue( Files.exists(actualFile) );
+
+ ProjectReference metadata = createProjectReference( requestedResource );
+
+ // Build expected metadata XML
+ StringWriter expectedMetadataXml = new StringWriter();
+ ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
+ m.setGroupId( metadata.getGroupId() );
+ m.setArtifactId( metadata.getArtifactId() );
+ m.setLatestVersion( latestVersion );
+ m.setReleasedVersion( releaseVersion );
+
+ if ( expectedVersions != null )
+ {
+ m.getAvailableVersions().addAll( Arrays.asList( expectedVersions ) );
+ }
+
+ 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
+ {
+ Path actualFile = managedDefaultDir.resolve(requestedResource);
+ assertTrue( "Release Metadata should exist: " + requestedResource, Files.exists(actualFile) );
+
+ VersionedReference metadata = createVersionedReference( 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() );
+ 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
+ {
+ Path actualFile = managedDefaultDir.resolve(requestedResource);
+ assertTrue( "Snapshot Metadata should exist: " + requestedResource, Files.exists(actualFile) );
+
+ VersionedReference actualMetadata = createVersionedReference( 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 );
+
+ Path actualFile = managedDefaultDir.resolve(proxiedFile);
+ assertTrue( "Repo Specific Snapshot Metadata should exist: " + requestedResource, Files.exists(actualFile) );
+
+ VersionedReference actualMetadata = createVersionedReference( requestedResource );
+
+ assertSnapshotMetadata( actualFile, actualMetadata, expectedDate, expectedTime, expectedBuildnumber );
+ }
+
+ private void assertSnapshotMetadata( Path 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 );
+
+ 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 );
+
+ Path actualFile = managedDefaultDir.resolve(proxiedFile);
+ assertTrue( Files.exists(actualFile) );
+
+ ProjectReference metadata = createProjectReference( 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 ) );
+ }
+
+ 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 );
+
+ Path actualFile = managedDefaultDir.resolve(proxiedFile);
+ assertTrue( "Release metadata for repo should exist: " + actualFile, Files.exists(actualFile) );
+
+ VersionedReference metadata = createVersionedReference( 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() );
+ 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
+ {
+ Path actualFile = managedDefaultDir.resolve(requestedResource);
+ assertFalse( "Resource should not exist: " + requestedResource, Files.exists(actualFile) );
+ }
+
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java
new file mode 100644
index 000000000..fd6e66eb2
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MockConfiguration.java
@@ -0,0 +1,193 @@
+package org.apache.archiva.proxy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.Configuration;
+import org.apache.archiva.configuration.ConfigurationListener;
+import org.apache.archiva.configuration.FileType;
+import org.apache.archiva.configuration.FileTypes;
+import org.apache.archiva.configuration.RepositoryScanningConfiguration;
+import org.apache.archiva.redback.components.registry.Registry;
+import org.apache.archiva.redback.components.registry.RegistryException;
+import org.apache.archiva.redback.components.registry.RegistryListener;
+import org.apache.commons.lang.StringUtils;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+/**
+ * MockConfiguration
+ *
+ *
+ */
+@Service( "archivaConfiguration#mock" )
+public class MockConfiguration
+ implements ArchivaConfiguration
+{
+
+ private Configuration configuration = new Configuration();
+
+ private Set<RegistryListener> registryListeners = new HashSet<RegistryListener>();
+
+ private Set<ConfigurationListener> configListeners = new HashSet<ConfigurationListener>();
+
+ private IMocksControl registryControl;
+
+ private Registry registryMock;
+
+ public MockConfiguration()
+ {
+ registryControl = EasyMock.createNiceControl( );
+ registryMock = registryControl.createMock( Registry.class );
+ }
+
+ @PostConstruct
+ public void initialize()
+ throws Exception
+ {
+
+ configuration.setRepositoryScanning( new RepositoryScanningConfiguration()
+ {
+ @Override
+ public List<FileType> getFileTypes()
+ {
+ FileType fileType = new FileType();
+ fileType.setId( FileTypes.ARTIFACTS );
+ fileType.setPatterns( Collections.singletonList( "**/*" ) );
+ return Collections.singletonList( fileType );
+ }
+ } );
+ }
+
+ @Override
+ public void addChangeListener( org.apache.archiva.redback.components.registry.RegistryListener listener )
+ {
+ registryListeners.add( listener );
+ }
+
+ @Override
+ public void removeChangeListener( RegistryListener listener )
+ {
+ registryListeners.remove( listener );
+ }
+
+ @Override
+ public Configuration getConfiguration()
+ {
+ return configuration;
+ }
+
+ @Override
+ public void save( Configuration configuration )
+ throws RegistryException
+ {
+ /* do nothing */
+ }
+
+ public void triggerChange( String name, String value )
+ {
+ for ( org.apache.archiva.redback.components.registry.RegistryListener listener : registryListeners )
+ {
+ try
+ {
+ listener.afterConfigurationChange( registryMock, name, value );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public void addListener( ConfigurationListener listener )
+ {
+ configListeners.add( listener );
+ }
+
+ @Override
+ public void removeListener( ConfigurationListener listener )
+ {
+ configListeners.remove( listener );
+ }
+
+ @Override
+ public boolean isDefaulted()
+ {
+ return false;
+ }
+
+ @Override
+ public void reload()
+ {
+ // no op
+ }
+
+ @Override
+ public Locale getDefaultLocale( )
+ {
+ return Locale.getDefault();
+ }
+
+ @Override
+ public List<Locale.LanguageRange> getLanguagePriorities( )
+ {
+ return Locale.LanguageRange.parse( "en,fr,de" );
+ }
+
+ @Override
+ public Path getAppServerBaseDir() {
+ if (System.getProperties().containsKey("appserver.base")) {
+ return Paths.get(System.getProperty("appserver.base"));
+ } else {
+ return Paths.get("");
+ }
+ }
+
+
+ @Override
+ public Path getRepositoryBaseDir() {
+ return getDataDirectory().resolve("repositories");
+ }
+
+ @Override
+ public Path getRemoteRepositoryBaseDir() {
+ return getDataDirectory().resolve("remotes");
+ }
+
+ @Override
+ public Path getDataDirectory() {
+ if (configuration!=null && StringUtils.isNotEmpty(configuration.getArchivaRuntimeConfiguration().getDataDirectory())) {
+ return Paths.get(configuration.getArchivaRuntimeConfiguration().getDataDirectory());
+ } else {
+ return getAppServerBaseDir().resolve("data");
+ }
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java
new file mode 100644
index 000000000..9ab0585bf
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java
@@ -0,0 +1,329 @@
+package org.apache.archiva.proxy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.policies.CachedFailuresPolicy;
+import org.apache.archiva.policies.ChecksumPolicy;
+import org.apache.archiva.policies.ReleasesPolicy;
+import org.apache.archiva.policies.SnapshotsPolicy;
+import org.junit.Test;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.FileTime;
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * SnapshotTransferTest
+ *
+ *
+ */
+public class SnapshotTransferTest
+ extends AbstractProxyTestCase
+{
+ @Test
+ public void testSnapshotNonExistant()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/does-not-exist/1.0-SNAPSHOT/does-not-exist-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ Files.deleteIfExists(expectedFile);
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false);
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+ assertNotDownloaded( downloadedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testTimestampDrivenSnapshotNotPresentAlready()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ Files.deleteIfExists(expectedFile);
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false);
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxiedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testNewerTimestampDrivenSnapshotOnFirstRepo()
+ 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 );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertTrue( Files.exists(expectedFile) );
+ Files.setLastModifiedTime( expectedFile, FileTime.from( getPastDate().getTime(), TimeUnit.MILLISECONDS ));
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false);
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxiedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testOlderTimestampDrivenSnapshotOnFirstRepo()
+ 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 );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ Path remoteFile = Paths.get(REPOPATH_PROXIED1, path);
+
+ setManagedNewerThanRemote( expectedFile, remoteFile );
+
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false );
+
+ // Attempt to download.
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ // Should not have downloaded as managed is newer than remote.
+ assertNotDownloaded( downloadedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ /**
+ * TODO: Has problems with wagon implementation not preserving timestamp.
+ */
+ /*
+ public void testNewerTimestampDrivenSnapshotOnSecondRepoThanFirstNotPresentAlready()
+ 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 );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = createArtifactReference( "default", path );
+
+ Files.delete(expectedFile);
+ assertFalse( Files.exists(expectedFile) );
+
+ // Create customized proxy / target repository
+ File targetProxyDir = saveTargetedRepositoryConfig( ID_PROXIED1_TARGET, REPOPATH_PROXIED1,
+ REPOPATH_PROXIED1_TARGET, "default" );
+
+ new File( targetProxyDir, path ).setLastModified( getPastDate().getTime() );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1_TARGET, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+
+ File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ // Should have downloaded the content from proxy2, as proxy1 has an old (by file.lastModified check) version.
+ Path proxiedFile = Paths.get(REPOPATH_PROXIED2, path);
+ assertFileEquals( expectedFile, downloadedFile, proxiedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ public void testOlderTimestampDrivenSnapshotOnSecondRepoThanFirstNotPresentAlready()
+ 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 );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = createArtifactReference( "default", path );
+
+ Files.delete(expectedFile);
+ assertFalse( Files.exists(expectedFile) );
+
+ // Create customized proxy / target repository
+ File targetProxyDir = saveTargetedRepositoryConfig( ID_PROXIED2_TARGET, REPOPATH_PROXIED2,
+ REPOPATH_PROXIED2_TARGET, "default" );
+
+ new File( targetProxyDir, path ).setLastModified( getPastDate().getTime() );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2_TARGET, ChecksumPolicy.IGNORED, ReleasesPolicy.IGNORED,
+ SnapshotsPolicy.IGNORED, CachedFailuresPolicy.IGNORED );
+
+ File downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ File proxiedFile = new File( REPOPATH_PROXIED1_TARGET, path );
+ assertFileEquals( expectedFile, downloadedFile, proxiedFile );
+ assertNoTempFiles( expectedFile );
+ } */
+
+ @Test
+ public void testTimestampDrivenSnapshotNotExpired()
+ 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 );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertTrue( Files.exists(expectedFile) );
+
+ Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path);
+ Files.setLastModifiedTime( proxiedFile, FileTime.from( getFutureDate().getTime(), TimeUnit.MILLISECONDS ));
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false);
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ assertFileEquals( expectedFile, downloadedFile, proxiedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testTimestampDrivenSnapshotNotUpdated()
+ 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 );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ Path remoteFile = Paths.get(REPOPATH_PROXIED1, path);
+
+ setManagedNewerThanRemote( expectedFile, remoteFile, 12000000 );
+ long expectedTimestamp = Files.getLastModifiedTime( expectedFile ).toMillis();
+
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false);
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ assertNotDownloaded( downloadedFile );
+ assertNotModified( expectedFile, expectedTimestamp );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testTimestampDrivenSnapshotNotPresentAlreadyExpiredCacheFailure()
+ throws Exception
+ {
+ String path = "org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar";
+ setupTestableManagedRepository( path );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ Files.deleteIfExists(expectedFile);
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES , false);
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED2, ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS,
+ SnapshotsPolicy.ALWAYS, CachedFailuresPolicy.YES , false);
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxiedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testMetadataDrivenSnapshotNotPresentAlready()
+ 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 );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ Files.deleteIfExists(expectedFile);
+ assertFalse( Files.exists(expectedFile) );
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false);
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxiedFile );
+ assertNoTempFiles( expectedFile );
+ }
+
+ @Test
+ public void testGetMetadataDrivenSnapshotRemoteUpdate()
+ throws Exception
+ {
+ // 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 );
+
+ Path expectedFile = managedDefaultDir.resolve(path);
+ ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+
+ assertTrue( Files.exists(expectedFile) );
+
+ Files.setLastModifiedTime( expectedFile, FileTime.from( getPastDate().getTime(), TimeUnit.MILLISECONDS ));
+
+ // Configure Connector (usually done within archiva.xml configuration)
+ saveConnector( ID_DEFAULT_MANAGED, ID_PROXIED1, false);
+
+ Path downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository, artifact );
+
+ Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path);
+ assertFileEquals( expectedFile, downloadedFile, proxiedFile );
+ assertNoTempFiles( expectedFile );
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java
new file mode 100644
index 000000000..702fe99c7
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/WagonDelegate.java
@@ -0,0 +1,286 @@
+package org.apache.archiva.proxy;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.wagon.ConnectionException;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.apache.maven.wagon.TransferFailedException;
+import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.authentication.AuthenticationException;
+import org.apache.maven.wagon.authentication.AuthenticationInfo;
+import org.apache.maven.wagon.authorization.AuthorizationException;
+import org.apache.maven.wagon.events.SessionListener;
+import org.apache.maven.wagon.events.TransferListener;
+import org.apache.maven.wagon.proxy.ProxyInfo;
+import org.apache.maven.wagon.proxy.ProxyInfoProvider;
+import org.apache.maven.wagon.repository.Repository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+
+/**
+ * A dummy wagon implementation
+ */
+@Service ("wagon#test")
+public class WagonDelegate
+ implements Wagon
+{
+ private Logger log = LoggerFactory.getLogger( WagonDelegate.class );
+
+ private Wagon delegate;
+
+ private String contentToGet;
+
+ @Override
+ public void get( String resourceName, File destination )
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
+ {
+ log.debug( ".get({}, {})", resourceName, destination );
+ delegate.get( resourceName, destination );
+ create( destination.toPath() );
+ }
+
+ @Override
+ public boolean getIfNewer( String resourceName, File destination, long timestamp )
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
+ {
+ log.info( ".getIfNewer({}, {}, {})", resourceName, destination, timestamp );
+
+ boolean result = delegate.getIfNewer( resourceName, destination, timestamp );
+ createIfMissing( destination.toPath() );
+ return result;
+ }
+
+ @Override
+ public void put( File source, String destination )
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
+ {
+ delegate.put( source, destination );
+ }
+
+ @Override
+ public void putDirectory( File sourceDirectory, String destinationDirectory )
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
+ {
+ delegate.putDirectory( sourceDirectory, destinationDirectory );
+ }
+
+ @Override
+ public boolean resourceExists( String resourceName )
+ throws TransferFailedException, AuthorizationException
+ {
+ return delegate.resourceExists( resourceName );
+ }
+
+ @SuppressWarnings ("unchecked")
+ @Override
+ public List<String> getFileList( String destinationDirectory )
+ throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
+ {
+ return delegate.getFileList( destinationDirectory );
+ }
+
+ @Override
+ public boolean supportsDirectoryCopy()
+ {
+ return delegate.supportsDirectoryCopy();
+ }
+
+ @Override
+ public void setTimeout( int val )
+ {
+ // ignore
+ }
+
+ @Override
+ public int getTimeout()
+ {
+ return 0;
+ }
+
+ @Override
+ public void setReadTimeout( int timeoutValue )
+ {
+ // ignore
+ }
+
+ @Override
+ public int getReadTimeout()
+ {
+ return 0;
+ }
+
+ @Override
+ public Repository getRepository()
+ {
+ return delegate.getRepository();
+ }
+
+ @Override
+ public void connect( Repository source )
+ throws ConnectionException, AuthenticationException
+ {
+ delegate.connect( source );
+ }
+
+ @Override
+ public void connect( Repository source, ProxyInfo proxyInfo )
+ throws ConnectionException, AuthenticationException
+ {
+ delegate.connect( source, proxyInfo );
+ }
+
+ @Override
+ public void connect( Repository source, ProxyInfoProvider proxyInfoProvider )
+ throws ConnectionException, AuthenticationException
+ {
+ delegate.connect( source, proxyInfoProvider );
+ }
+
+ @Override
+ public void connect( Repository source, AuthenticationInfo authenticationInfo )
+ throws ConnectionException, AuthenticationException
+ {
+ delegate.connect( source, authenticationInfo );
+ }
+
+ @Override
+ public void connect( Repository source, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo )
+ throws ConnectionException, AuthenticationException
+ {
+ delegate.connect( source, authenticationInfo, proxyInfo );
+ }
+
+ @Override
+ public void connect( Repository source, AuthenticationInfo authenticationInfo, ProxyInfoProvider proxyInfoProvider )
+ throws ConnectionException, AuthenticationException
+ {
+ delegate.connect( source, authenticationInfo, proxyInfoProvider );
+ }
+
+ @SuppressWarnings ("deprecation")
+ @Override
+ public void openConnection()
+ throws ConnectionException, AuthenticationException
+ {
+ delegate.openConnection();
+ }
+
+ @Override
+ public void disconnect()
+ throws ConnectionException
+ {
+ delegate.disconnect();
+ }
+
+ @Override
+ public void addSessionListener( SessionListener listener )
+ {
+ delegate.addSessionListener( listener );
+ }
+
+ @Override
+ public void removeSessionListener( SessionListener listener )
+ {
+ delegate.removeSessionListener( listener );
+ }
+
+ @Override
+ public boolean hasSessionListener( SessionListener listener )
+ {
+ return delegate.hasSessionListener( listener );
+ }
+
+ @Override
+ public void addTransferListener( TransferListener listener )
+ {
+ delegate.addTransferListener( listener );
+ }
+
+ @Override
+ public void removeTransferListener( TransferListener listener )
+ {
+ delegate.removeTransferListener( listener );
+ }
+
+ @Override
+ public boolean hasTransferListener( TransferListener listener )
+ {
+ return delegate.hasTransferListener( listener );
+ }
+
+ @Override
+ public boolean isInteractive()
+ {
+ return delegate.isInteractive();
+ }
+
+ @Override
+ public void setInteractive( boolean interactive )
+ {
+ delegate.setInteractive( interactive );
+ }
+
+ public void setDelegate( Wagon delegate )
+ {
+ this.delegate = delegate;
+ }
+
+ void setContentToGet( String content )
+ {
+ contentToGet = content;
+ }
+
+ private void createIfMissing( Path destination )
+ {
+ // since the mock won't actually copy a file, create an empty one to simulate file existence
+ if ( !Files.exists(destination) )
+ {
+ create( destination );
+ }
+ }
+
+ private void create( Path destination )
+ {
+ try
+ {
+ Files.createDirectories(destination.getParent());
+ if ( contentToGet == null )
+ {
+ Files.createFile(destination);
+ }
+ else
+ {
+ org.apache.archiva.common.utils.FileUtils.writeStringToFile(destination, Charset.defaultCharset(), contentToGet);
+ }
+ }
+ catch ( IOException e )
+ {
+ throw new RuntimeException( e.getMessage(), e );
+ }
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java
new file mode 100644
index 000000000..f7289383c
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/common/WagonFactoryTest.java
@@ -0,0 +1,61 @@
+package org.apache.archiva.proxy.common;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+import org.apache.archiva.proxy.maven.WagonFactory;
+import org.apache.archiva.proxy.maven.WagonFactoryRequest;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
+import org.apache.maven.wagon.Wagon;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+
+import javax.inject.Inject;
+
+/**
+ * Test the WagonFactory works through Spring to be bound into the RepositoryProxyHandler implementation.
+ */
+@RunWith ( ArchivaSpringJUnit4ClassRunner.class )
+@ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml" } )
+public class WagonFactoryTest
+ extends TestCase
+{
+
+ @Inject
+ WagonFactory factory;
+
+ @Test
+ public void testLookupSuccessiveWagons()
+ throws Exception
+ {
+
+ Wagon first = factory.getWagon( new org.apache.archiva.proxy.maven.WagonFactoryRequest().protocol( "wagon#file" ) );
+
+ Wagon second = factory.getWagon( new org.apache.archiva.proxy.maven.WagonFactoryRequest().protocol( "wagon#file" ) );
+
+ // ensure we support only protocol name too
+ Wagon third = factory.getWagon( new WagonFactoryRequest().protocol( "file" ) );
+
+ assertNotSame( first, second );
+
+ assertNotSame( first, third );
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ArchivaIndexManagerMock.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ArchivaIndexManagerMock.java
new file mode 100644
index 000000000..65d8196b9
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ArchivaIndexManagerMock.java
@@ -0,0 +1,90 @@
+package org.apache.archiva.repository.mock;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.indexer.ArchivaIndexManager;
+import org.apache.archiva.indexer.ArchivaIndexingContext;
+import org.apache.archiva.indexer.IndexCreationFailedException;
+import org.apache.archiva.indexer.IndexUpdateFailedException;
+import org.apache.archiva.repository.Repository;
+import org.apache.archiva.repository.RepositoryType;
+import org.springframework.stereotype.Service;
+
+import java.net.URI;
+import java.util.Collection;
+
+/**
+ * @author Martin Stockhammer <martin_s@apache.org>
+ */
+@Service("archivaIndexManager#maven")
+public class ArchivaIndexManagerMock implements ArchivaIndexManager {
+
+
+
+ @Override
+ public void pack(ArchivaIndexingContext context) throws IndexUpdateFailedException {
+
+ }
+
+ @Override
+ public void scan(ArchivaIndexingContext context) throws IndexUpdateFailedException {
+
+ }
+
+ @Override
+ public void update(ArchivaIndexingContext context, boolean fullUpdate) throws IndexUpdateFailedException {
+
+ }
+
+ @Override
+ public void addArtifactsToIndex(ArchivaIndexingContext context, Collection<URI> artifactReference) throws IndexUpdateFailedException {
+
+ }
+
+ @Override
+ public void removeArtifactsFromIndex(ArchivaIndexingContext context, Collection<URI> artifactReference) throws IndexUpdateFailedException {
+
+ }
+
+ @Override
+ public boolean supportsRepository(RepositoryType type) {
+ return true;
+ }
+
+ @Override
+ public ArchivaIndexingContext createContext(Repository repository) throws IndexCreationFailedException {
+ return null;
+ }
+
+ @Override
+ public ArchivaIndexingContext reset(ArchivaIndexingContext context) throws IndexUpdateFailedException {
+ return null;
+ }
+
+ @Override
+ public ArchivaIndexingContext move(ArchivaIndexingContext context, Repository repo) throws IndexCreationFailedException {
+ return null;
+ }
+
+ @Override
+ public void updateLocalIndexPath(Repository repo) {
+
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java
new file mode 100644
index 000000000..e185c3e73
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java
@@ -0,0 +1,387 @@
+package org.apache.archiva.repository.mock;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.common.utils.VersionUtil;
+import org.apache.archiva.metadata.model.ArtifactMetadata;
+import org.apache.archiva.metadata.model.maven2.MavenArtifactFacet;
+import org.apache.archiva.model.ArchivaArtifact;
+import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.model.ProjectReference;
+import org.apache.archiva.model.VersionedReference;
+import org.apache.archiva.repository.*;
+import org.apache.archiva.repository.content.PathParser;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author Martin Stockhammer <martin_s@apache.org>
+ */
+@Service("managedRepositoryContent#mock")
+public class ManagedRepositoryContentMock implements ManagedRepositoryContent
+{
+ private static final String PATH_SEPARATOR = "/";
+ private static final String GROUP_SEPARATOR = ".";
+ public static final String MAVEN_METADATA = "maven-metadata.xml";
+
+
+ private ManagedRepository repository;
+
+ ManagedRepositoryContentMock(ManagedRepository repo) {
+ this.repository = repo;
+ }
+
+ @Override
+ public void deleteVersion( VersionedReference reference ) throws ContentNotFoundException
+ {
+
+ }
+
+ @Override
+ public void deleteArtifact( ArtifactReference artifactReference ) throws ContentNotFoundException
+ {
+
+ }
+
+ @Override
+ public void deleteGroupId( String groupId ) throws ContentNotFoundException
+ {
+
+ }
+
+ @Override
+ public void deleteProject( String namespace, String projectId ) throws RepositoryException
+ {
+
+ }
+
+ @Override
+ public String getId( )
+ {
+ return repository.getId();
+ }
+
+ @Override
+ public Set<ArtifactReference> getRelatedArtifacts( ArtifactReference reference ) throws ContentNotFoundException
+ {
+ return null;
+ }
+
+ @Override
+ public String getRepoRoot( )
+ {
+ return Paths.get("", "target", "test-repository", "managed").toString();
+ }
+
+ @Override
+ public ManagedRepository getRepository( )
+ {
+ return repository;
+ }
+
+ @Override
+ public Set<String> getVersions( ProjectReference reference ) throws ContentNotFoundException, LayoutException
+ {
+ return null;
+ }
+
+ @Override
+ public Set<String> getVersions( VersionedReference reference ) throws ContentNotFoundException
+ {
+ return null;
+ }
+
+ @Override
+ public boolean hasContent( ArtifactReference reference )
+ {
+ return false;
+ }
+
+ @Override
+ public boolean hasContent( ProjectReference reference )
+ {
+ return false;
+ }
+
+ @Override
+ public boolean hasContent( VersionedReference reference )
+ {
+ return false;
+ }
+
+ @Override
+ public void setRepository( ManagedRepository repo )
+ {
+ this.repository = repo;
+ }
+
+ private Map<ArtifactReference, String> refs = new HashMap<>();
+
+ @Override
+ public ArtifactReference toArtifactReference( String path ) throws LayoutException
+ {
+ if ( StringUtils.isBlank( path ) )
+ {
+ throw new LayoutException( "Unable to convert blank path." );
+ }
+
+ ArtifactMetadata metadata = getArtifactForPath("test-repository", path);
+
+ ArtifactReference artifact = new ArtifactReference();
+ artifact.setGroupId( metadata.getNamespace() );
+ artifact.setArtifactId( metadata.getProject() );
+ artifact.setVersion( metadata.getVersion() );
+ MavenArtifactFacet facet = (MavenArtifactFacet) metadata.getFacet( MavenArtifactFacet.FACET_ID );
+ if ( facet != null )
+ {
+ artifact.setClassifier( facet.getClassifier() );
+ artifact.setType( facet.getType() );
+ }
+ refs.put(artifact, path);
+ return artifact;
+ }
+
+ public ArtifactMetadata getArtifactForPath( String repoId, String relativePath )
+ {
+ String[] parts = relativePath.replace( '\\', '/' ).split( "/" );
+
+ int len = parts.length;
+ if ( len < 4 )
+ {
+ throw new IllegalArgumentException(
+ "Not a valid artifact path in a Maven 2 repository, not enough directories: " + relativePath );
+ }
+
+ String id = parts[--len];
+ String baseVersion = parts[--len];
+ String artifactId = parts[--len];
+ StringBuilder groupIdBuilder = new StringBuilder();
+ for ( int i = 0; i < len - 1; i++ )
+ {
+ groupIdBuilder.append( parts[i] );
+ groupIdBuilder.append( '.' );
+ }
+ groupIdBuilder.append( parts[len - 1] );
+
+ return getArtifactFromId( repoId, groupIdBuilder.toString(), artifactId, baseVersion, id );
+ }
+
+ private static final Pattern TIMESTAMP_PATTERN = Pattern.compile( "([0-9]{8}.[0-9]{6})-([0-9]+).*" );
+
+
+
+ public ArtifactMetadata getArtifactFromId( String repoId, String namespace, String projectId, String projectVersion,
+ String id )
+ {
+ if ( !id.startsWith( projectId + "-" ) )
+ {
+ throw new IllegalArgumentException( "Not a valid artifact path in a Maven 2 repository, filename '" + id
+ + "' doesn't start with artifact ID '" + projectId + "'" );
+ }
+
+ MavenArtifactFacet facet = new MavenArtifactFacet();
+
+ int index = projectId.length() + 1;
+ String version;
+ String idSubStrFromVersion = id.substring( index );
+ if ( idSubStrFromVersion.startsWith( projectVersion ) && !VersionUtil.isUniqueSnapshot( projectVersion ) )
+ {
+ // non-snapshot versions, or non-timestamped snapshot versions
+ version = projectVersion;
+ }
+ else if ( VersionUtil.isGenericSnapshot( projectVersion ) )
+ {
+ // timestamped snapshots
+ try
+ {
+ int mainVersionLength = projectVersion.length() - 8; // 8 is length of "SNAPSHOT"
+ if ( mainVersionLength == 0 )
+ {
+ throw new IllegalArgumentException(
+ "Timestamped snapshots must contain the main version, filename was '" + id + "'" );
+ }
+
+ Matcher m = TIMESTAMP_PATTERN.matcher( idSubStrFromVersion.substring( mainVersionLength ) );
+ m.matches();
+ String timestamp = m.group( 1 );
+ String buildNumber = m.group( 2 );
+ facet.setTimestamp( timestamp );
+ facet.setBuildNumber( Integer.parseInt( buildNumber ) );
+ version = idSubStrFromVersion.substring( 0, mainVersionLength ) + timestamp + "-" + buildNumber;
+ }
+ catch ( IllegalStateException e )
+ {
+ throw new IllegalArgumentException( "Not a valid artifact path in a Maven 2 repository, filename '" + id
+ + "' doesn't contain a timestamped version matching snapshot '"
+ + projectVersion + "'", e);
+ }
+ }
+ else
+ {
+ // invalid
+ throw new IllegalArgumentException(
+ "Not a valid artifact path in a Maven 2 repository, filename '" + id + "' doesn't contain version '"
+ + projectVersion + "'" );
+ }
+
+ String classifier;
+ String ext;
+ index += version.length();
+ if ( index == id.length() )
+ {
+ // no classifier or extension
+ classifier = null;
+ ext = null;
+ }
+ else
+ {
+ char c = id.charAt( index );
+ if ( c == '-' )
+ {
+ // classifier up until '.'
+ int extIndex = id.indexOf( '.', index );
+ if ( extIndex >= 0 )
+ {
+ classifier = id.substring( index + 1, extIndex );
+ ext = id.substring( extIndex + 1 );
+ }
+ else
+ {
+ classifier = id.substring( index + 1 );
+ ext = null;
+ }
+ }
+ else if ( c == '.' )
+ {
+ // rest is the extension
+ classifier = null;
+ ext = id.substring( index + 1 );
+ }
+ else
+ {
+ throw new IllegalArgumentException( "Not a valid artifact path in a Maven 2 repository, filename '" + id
+ + "' expected classifier or extension but got '"
+ + id.substring( index ) + "'" );
+ }
+ }
+
+ ArtifactMetadata metadata = new ArtifactMetadata();
+ metadata.setId( id );
+ metadata.setNamespace( namespace );
+ metadata.setProject( projectId );
+ metadata.setRepositoryId( repoId );
+ metadata.setProjectVersion( projectVersion );
+ metadata.setVersion( version );
+
+ facet.setClassifier( classifier );
+
+ // we use our own provider here instead of directly accessing Maven's artifact handlers as it has no way
+ // to select the correct order to apply multiple extensions mappings to a preferred type
+ // TODO: this won't allow the user to decide order to apply them if there are conflicts or desired changes -
+ // perhaps the plugins could register missing entries in configuration, then we just use configuration
+ // here?
+
+ String type = null;
+
+
+ // use extension as default
+ if ( type == null )
+ {
+ type = ext;
+ }
+
+ // TODO: should we allow this instead?
+ if ( type == null )
+ {
+ throw new IllegalArgumentException(
+ "Not a valid artifact path in a Maven 2 repository, filename '" + id + "' does not have a type" );
+ }
+
+ facet.setType( type );
+ metadata.addFacet( facet );
+
+ return metadata;
+ }
+
+
+ @Override
+ public Path toFile( ArtifactReference reference )
+ {
+ return Paths.get(getRepoRoot(), refs.get(reference));
+ }
+
+ @Override
+ public Path toFile( ArchivaArtifact reference )
+ {
+ return null;
+ }
+
+ private String formatAsDirectory( String directory )
+ {
+ return directory.replace( GROUP_SEPARATOR, PATH_SEPARATOR );
+ }
+
+ public String toMetadataPath( ProjectReference reference )
+ {
+ StringBuilder path = new StringBuilder();
+
+ path.append( formatAsDirectory( reference.getGroupId() ) ).append( PATH_SEPARATOR );
+ path.append( reference.getArtifactId() ).append( PATH_SEPARATOR );
+ path.append( MAVEN_METADATA );
+
+ return path.toString();
+ }
+
+ public String toMetadataPath( VersionedReference reference )
+ {
+ StringBuilder path = new StringBuilder();
+
+ path.append( formatAsDirectory( reference.getGroupId() ) ).append( PATH_SEPARATOR );
+ path.append( reference.getArtifactId() ).append( PATH_SEPARATOR );
+ if ( reference.getVersion() != null )
+ {
+ // add the version only if it is present
+ path.append( VersionUtil.getBaseVersion( reference.getVersion() ) ).append( PATH_SEPARATOR );
+ }
+ path.append( MAVEN_METADATA );
+
+ return path.toString();
+ }
+
+ @Override
+ public String toPath( ArtifactReference reference )
+ {
+ return null;
+ }
+
+ @Override
+ public String toPath( ArchivaArtifact reference )
+ {
+ return null;
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java
new file mode 100644
index 000000000..4ab4a5aae
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RemoteRepositoryContentMock.java
@@ -0,0 +1,92 @@
+package org.apache.archiva.repository.mock;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.common.utils.VersionUtil;
+import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.model.RepositoryURL;
+import org.apache.archiva.repository.LayoutException;
+import org.apache.archiva.repository.RemoteRepository;
+import org.apache.archiva.repository.RemoteRepositoryContent;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Martin Stockhammer <martin_s@apache.org>
+ */
+@Service("remoteRepositoryContent#mock")
+public class RemoteRepositoryContentMock implements RemoteRepositoryContent
+{
+ RemoteRepository repository;
+
+ RemoteRepositoryContentMock(RemoteRepository repo) {
+ this.repository = repo;
+ }
+
+ @Override
+ public String getId( )
+ {
+ return repository.getId();
+ }
+
+ @Override
+ public RemoteRepository getRepository( )
+ {
+ return repository;
+ }
+
+ @Override
+ public RepositoryURL getURL( )
+ {
+ return new RepositoryURL(repository.getLocation().toString());
+ }
+
+ @Override
+ public void setRepository( RemoteRepository repo )
+ {
+ this.repository = repo;
+ }
+
+ @Override
+ public ArtifactReference toArtifactReference( String path ) throws LayoutException
+ {
+ return null;
+ }
+
+ @Override
+ public String toPath( ArtifactReference reference )
+ {
+ String baseVersion;
+ if (VersionUtil.isSnapshot(reference.getVersion())) {
+ baseVersion=VersionUtil.getBaseVersion(reference.getVersion());
+ } else {
+ baseVersion=reference.getVersion();
+ }
+ return reference.getGroupId().replaceAll("\\.", "/")+"/"+reference.getArtifactId()+"/"+baseVersion+"/"
+ +reference.getArtifactId()+"-"+reference.getVersion()+(
+ StringUtils.isNotEmpty(reference.getClassifier()) ? "-"+reference.getClassifier() : "")+"."+reference.getType();
+ }
+
+ @Override
+ public RepositoryURL toURL( ArtifactReference reference )
+ {
+ return null;
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryContentProviderMock.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryContentProviderMock.java
new file mode 100644
index 000000000..2822ae976
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryContentProviderMock.java
@@ -0,0 +1,66 @@
+package org.apache.archiva.repository.mock;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.repository.*;
+import org.springframework.stereotype.Service;
+
+import java.util.HashSet;
+import java.util.Set;
+
+@Service("repositoryContentProvider#mock")
+public class RepositoryContentProviderMock implements RepositoryContentProvider {
+
+ private static final Set<RepositoryType> REPOSITORY_TYPES = new HashSet<>();
+ static {
+ REPOSITORY_TYPES.add(RepositoryType.MAVEN);
+ REPOSITORY_TYPES.add(RepositoryType.NPM);
+ }
+
+ @Override
+ public boolean supportsLayout(String layout) {
+ return true;
+ }
+
+ @Override
+ public Set<RepositoryType> getSupportedRepositoryTypes() {
+ return REPOSITORY_TYPES;
+ }
+
+ @Override
+ public boolean supports(RepositoryType type) {
+ return true;
+ }
+
+ @Override
+ public RemoteRepositoryContent createRemoteContent(RemoteRepository repository) throws RepositoryException {
+ return new RemoteRepositoryContentMock(repository);
+ }
+
+ @Override
+ public ManagedRepositoryContent createManagedContent(ManagedRepository repository) throws RepositoryException {
+ return new ManagedRepositoryContentMock(repository);
+ }
+
+ @Override
+ public <T extends RepositoryContent, V extends Repository> T createContent(Class<T> clazz, V repository) throws RepositoryException {
+ return null;
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java
new file mode 100644
index 000000000..691d7eefa
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/RepositoryProviderMock.java
@@ -0,0 +1,240 @@
+package org.apache.archiva.repository.mock;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
+import org.apache.archiva.repository.BasicManagedRepository;
+import org.apache.archiva.repository.BasicRemoteRepository;
+import org.apache.archiva.repository.EditableManagedRepository;
+import org.apache.archiva.repository.EditableRemoteRepository;
+import org.apache.archiva.repository.ManagedRepository;
+import org.apache.archiva.repository.PasswordCredentials;
+import org.apache.archiva.repository.ReleaseScheme;
+import org.apache.archiva.repository.RemoteRepository;
+import org.apache.archiva.repository.RepositoryCredentials;
+import org.apache.archiva.repository.RepositoryEvent;
+import org.apache.archiva.repository.RepositoryException;
+import org.apache.archiva.repository.RepositoryProvider;
+import org.apache.archiva.repository.RepositoryType;
+import org.apache.archiva.repository.features.ArtifactCleanupFeature;
+import org.apache.archiva.repository.features.IndexCreationFeature;
+import org.apache.archiva.repository.features.RemoteIndexFeature;
+import org.apache.archiva.repository.features.StagingRepositoryFeature;
+import org.springframework.stereotype.Service;
+
+import java.net.URI;
+import java.nio.file.Paths;
+import java.time.Duration;
+import java.time.Period;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Just a simple mock class for the repository provider
+ */
+@Service("mockRepositoryProvider")
+public class RepositoryProviderMock implements RepositoryProvider
+{
+
+ private static final Set<RepositoryType> TYPES = new HashSet<>( );
+
+ static
+ {
+ TYPES.add( RepositoryType.MAVEN );
+ TYPES.add( RepositoryType.NPM );
+ }
+
+ @Override
+ public Set<RepositoryType> provides( )
+ {
+ return TYPES;
+ }
+
+ @Override
+ public EditableManagedRepository createManagedInstance( String id, String name )
+ {
+ return new BasicManagedRepository( id, name , Paths.get("target/repositories"));
+ }
+
+ @Override
+ public EditableRemoteRepository createRemoteInstance( String id, String name )
+ {
+ return new BasicRemoteRepository( id, name, Paths.get("target/remotes") );
+ }
+
+ @Override
+ public ManagedRepository createManagedInstance( ManagedRepositoryConfiguration configuration ) throws RepositoryException
+ {
+ BasicManagedRepository managedRepository = new BasicManagedRepository( configuration.getId( ), configuration.getName( ) , Paths.get("target/repositories"));
+ updateManagedInstance( managedRepository, configuration );
+ return managedRepository;
+ }
+
+
+ @Override
+ public void updateManagedInstance( EditableManagedRepository managedRepository, ManagedRepositoryConfiguration configuration ) throws RepositoryException
+ {
+ try
+ {
+ managedRepository.setName( managedRepository.getPrimaryLocale(), configuration.getName( ) );
+ managedRepository.setLocation( new URI( configuration.getLocation( )==null ?"" : configuration.getLocation() ) );
+ managedRepository.setBaseUri( new URI( "" ) );
+ managedRepository.setBlocksRedeployment( configuration.isBlockRedeployments( ) );
+ managedRepository.setDescription( managedRepository.getPrimaryLocale(), configuration.getDescription( ) );
+ managedRepository.setLayout( configuration.getLayout( ) );
+ managedRepository.setScanned( configuration.isScanned( ) );
+ managedRepository.setSchedulingDefinition( configuration.getRefreshCronExpression( ) );
+ if (configuration.isReleases()) {
+ managedRepository.addActiveReleaseScheme( ReleaseScheme.RELEASE );
+ }
+ if (configuration.isSnapshots()) {
+ managedRepository.addActiveReleaseScheme( ReleaseScheme.SNAPSHOT );
+ }
+ ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ).get( );
+ acf.setRetentionPeriod( Period.ofDays( configuration.getRetentionPeriod( ) ) );
+ acf.setDeleteReleasedSnapshots( configuration.isDeleteReleasedSnapshots( ) );
+ acf.setRetentionCount( configuration.getRetentionCount( ) );
+ IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ).get( );
+ icf.setIndexPath( new URI( configuration.getIndexDir( ) ) );
+ icf.setSkipPackedIndexCreation( configuration.isSkipPackedIndexCreation( ) );
+ StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ).get( );
+ srf.setStageRepoNeeded( configuration.isStageRepoNeeded( ) );
+ }
+ catch ( Exception e )
+ {
+ throw new RepositoryException( "Error", e );
+ }
+
+ }
+
+
+ @Override
+ public ManagedRepository createStagingInstance( ManagedRepositoryConfiguration configuration ) throws RepositoryException
+ {
+ String id = configuration.getId( ) + StagingRepositoryFeature.STAGING_REPO_POSTFIX;
+ BasicManagedRepository managedRepository = new BasicManagedRepository( id, configuration.getName( ), Paths.get("target/repositories") );
+ updateManagedInstance( managedRepository, configuration );
+ return managedRepository;
+ }
+
+ @Override
+ public RemoteRepository createRemoteInstance( RemoteRepositoryConfiguration configuration ) throws RepositoryException
+ {
+ BasicRemoteRepository remoteRepository = new BasicRemoteRepository( configuration.getId( ), configuration.getName( ), Paths.get("target/remotes") );
+ updateRemoteInstance( remoteRepository, configuration );
+ return remoteRepository;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void updateRemoteInstance( EditableRemoteRepository remoteRepository, RemoteRepositoryConfiguration configuration ) throws RepositoryException
+ {
+ try
+ {
+ remoteRepository.setName( remoteRepository.getPrimaryLocale(), configuration.getName( ) );
+ remoteRepository.setBaseUri( new URI( "" ) );
+ remoteRepository.setDescription( remoteRepository.getPrimaryLocale(), configuration.getDescription( ) );
+ remoteRepository.setLayout( configuration.getLayout( ) );
+ remoteRepository.setSchedulingDefinition( configuration.getRefreshCronExpression( ) );
+ remoteRepository.setCheckPath( configuration.getCheckPath( ) );
+ remoteRepository.setExtraHeaders( configuration.getExtraHeaders( ) );
+ remoteRepository.setExtraParameters( configuration.getExtraParameters( ) );
+ remoteRepository.setTimeout( Duration.ofSeconds( configuration.getTimeout( ) ) );
+ char[] pwd = configuration.getPassword()==null ? "".toCharArray() : configuration.getPassword().toCharArray();
+ remoteRepository.setCredentials( new PasswordCredentials( configuration.getUsername( ), pwd ) );
+ remoteRepository.setLocation( new URI( configuration.getUrl( )==null ? "" : configuration.getUrl() ) );
+ RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( );
+ rif.setDownloadRemoteIndexOnStartup( configuration.isDownloadRemoteIndexOnStartup( ) );
+ rif.setDownloadRemoteIndex( configuration.isDownloadRemoteIndex( ) );
+ rif.setIndexUri( new URI( configuration.getIndexDir( ) ) );
+ rif.setDownloadTimeout( Duration.ofSeconds( configuration.getRemoteDownloadTimeout( ) ) );
+ rif.setProxyId( configuration.getRemoteDownloadNetworkProxyId( ) );
+ IndexCreationFeature icf = remoteRepository.getFeature(IndexCreationFeature.class).get();
+ icf.setIndexPath(new URI(".index" ));
+ }
+ catch ( Exception e )
+ {
+ throw new RepositoryException( "Error", e );
+ }
+
+ }
+
+ @Override
+ public ManagedRepositoryConfiguration getManagedConfiguration( ManagedRepository managedRepository ) throws RepositoryException
+ {
+ ManagedRepositoryConfiguration configuration = new ManagedRepositoryConfiguration( );
+ configuration.setId( managedRepository.getId( ) );
+ configuration.setName(managedRepository.getName());
+ configuration.setLocation( managedRepository.getLocation( ) == null ? "" : managedRepository.getLocation().toString( ) );
+ configuration.setBlockRedeployments( managedRepository.blocksRedeployments( ) );
+ configuration.setDescription( managedRepository.getDescription( ) );
+ configuration.setLayout( managedRepository.getLayout( ) );
+ configuration.setScanned( managedRepository.isScanned( ) );
+ configuration.setRefreshCronExpression( managedRepository.getSchedulingDefinition( ) );
+ configuration.setReleases( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE) );
+ configuration.setSnapshots( managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT) );
+ ArtifactCleanupFeature acf = managedRepository.getFeature( ArtifactCleanupFeature.class ).get( );
+ configuration.setRetentionPeriod( acf.getRetentionPeriod( ).getDays( ) );
+ configuration.setDeleteReleasedSnapshots( acf.isDeleteReleasedSnapshots( ) );
+ configuration.setRetentionCount( acf.getRetentionCount( ) );
+ IndexCreationFeature icf = managedRepository.getFeature( IndexCreationFeature.class ).get( );
+ configuration.setSkipPackedIndexCreation( icf.isSkipPackedIndexCreation( ) );
+ configuration.setIndexDir( icf.getIndexPath( ) == null ? "" : icf.getIndexPath().toString( ) );
+ StagingRepositoryFeature srf = managedRepository.getFeature( StagingRepositoryFeature.class ).get( );
+ configuration.setStageRepoNeeded( srf.isStageRepoNeeded( ) );
+ return configuration;
+ }
+
+
+ @Override
+ public RemoteRepositoryConfiguration getRemoteConfiguration( RemoteRepository remoteRepository ) throws RepositoryException
+ {
+ RemoteRepositoryConfiguration configuration = new RemoteRepositoryConfiguration( );
+ configuration.setId( remoteRepository.getId( ) );
+ configuration.setName( remoteRepository.getName( ) );
+ configuration.setDescription( remoteRepository.getDescription( ) );
+ configuration.setLayout( remoteRepository.getLayout( ) );
+ configuration.setRefreshCronExpression( remoteRepository.getSchedulingDefinition( ) );
+ configuration.setCheckPath( remoteRepository.getCheckPath( ) );
+ configuration.setExtraHeaders( remoteRepository.getExtraHeaders( ) );
+ configuration.setExtraParameters( remoteRepository.getExtraParameters( ) );
+ configuration.setTimeout( (int) remoteRepository.getTimeout( ).getSeconds( ) );
+ RepositoryCredentials creds = remoteRepository.getLoginCredentials( );
+ if (creds!=null)
+ {
+ PasswordCredentials pwdCreds = (PasswordCredentials) creds;
+ configuration.setUsername( pwdCreds.getUsername( ) );
+ configuration.setPassword( new String( pwdCreds.getPassword( ) ) );
+ }
+ configuration.setUrl( remoteRepository.getLocation( ) == null ? "" : remoteRepository.getLocation().toString( ) );
+ RemoteIndexFeature rif = remoteRepository.getFeature( RemoteIndexFeature.class ).get( );
+ configuration.setDownloadRemoteIndex( rif.isDownloadRemoteIndex( ) );
+ configuration.setDownloadRemoteIndexOnStartup( rif.isDownloadRemoteIndexOnStartup( ) );
+ configuration.setIndexDir( rif.getIndexUri( )==null ? "" : rif.getIndexUri().toString( ) );
+ configuration.setRemoteDownloadNetworkProxyId( rif.getProxyId( ) );
+ return configuration;
+ }
+
+ @Override
+ public <T> void raise(RepositoryEvent<T> event) {
+
+ }
+}
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/create-managed-to-proxy-map.sh b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/create-managed-to-proxy-map.sh
new file mode 100755
index 000000000..ffaaa584b
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed-to-proxy-map.txt b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed-to-proxy-map.txt
new file mode 100644
index 000000000..3b4967824
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar
new file mode 100644
index 000000000..62a1e1c71
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar
@@ -0,0 +1,3 @@
+get-bad-local-checksum-1.0.jar
+(managed)
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.md5 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.md5
new file mode 100644
index 000000000..5fd0ae2b7
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.md5
@@ -0,0 +1 @@
+invalid checksum file \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.sha1 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.sha1
new file mode 100644
index 000000000..5fd0ae2b7
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar.sha1
@@ -0,0 +1 @@
+invalid checksum file \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1
new file mode 100644
index 000000000..5558e53ee
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1
@@ -0,0 +1 @@
+066d76e459f7782c312c31e8a11b3c0f1e3e43a7 *get-checksum-from-managed-repo-1.0.jar
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.jar
new file mode 100644
index 000000000..a3b38382c
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.jar
@@ -0,0 +1,3 @@
+get-default-layout-present-1.0.jar
+(managed)
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.pom b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.pom
new file mode 100644
index 000000000..b2f94e307
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present-with-pom/1.0/get-default-layout-present-with-pom-1.0.pom
@@ -0,0 +1,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.
+ -->
+
+<project>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-default-layout-present-with-pom</artifactId>
+ <version>1.0</version>
+</project>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar
new file mode 100644
index 000000000..a3b38382c
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar
@@ -0,0 +1,3 @@
+get-default-layout-present-1.0.jar
+(managed)
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc
new file mode 100644
index 000000000..c3f4c234e
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc
@@ -0,0 +1,7 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.8 (Darwin)
+
+iEYEABECAAYFAkiAQxIACgkQTusOMqfRa9T2xACfcvI2fjAXoAHGwJm0zXPJ2rWW
+OPoAn23dSOEJhyNUY2hgUlH2wSQiADeP
+=ZOwh
+-----END PGP SIGNATURE-----
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md5 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md5
new file mode 100644
index 000000000..b597d8ce4
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.md5
@@ -0,0 +1 @@
+7dfb7ade9a8fa90bfbfac52d3090b8c2 *get-default-layout-present-1.0.jar
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/get-default-metadata-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/get-default-metadata-1.0.jar
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml
new file mode 100644
index 000000000..e008e501c
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-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>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom
new file mode 100644
index 000000000..f8c149eb6
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-doubly-relocated-artefact/1.0/get-doubly-relocated-artefact-1.0.pom
@@ -0,0 +1,32 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-doubly-relocated-artefact</artifactId>
+ <version>1.0</version>
+
+ <distributionManagement>
+ <relocation>
+ <artifactId>get-relocated-artefact</artifactId>
+ </relocation>
+ </distributionManagement>
+
+</project> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-merged-metadata/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-merged-metadata/maven-metadata.xml
new file mode 100644
index 000000000..00af1a181
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-merged-metadata/maven-metadata.xml
@@ -0,0 +1,33 @@
+<!--
+ ~ 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-merged-metadata</artifactId>
+ <versioning>
+ <versions>
+ <version>0.9</version>
+ <!-- unique -->
+ <version>1.0</version>
+ <!-- merged with proxied2 -->
+ <version>2.0</version>
+ <!-- merged with proxied1 -->
+ </versions>
+ </versioning>
+</metadata> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/get-not-on-remotes-1.0-beta-2.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/1.0-beta-2/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-not-on-remotes/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/get-on-local-on-remote-1.0.22.pom b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/1.0.8/get-on-local-on-remote-1.0.8.pom b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/get-on-multiple-repos-1.0.pom b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar
new file mode 100644
index 000000000..b71eb7b74
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar
@@ -0,0 +1,2 @@
+get-present-metadata-snapshot-1.0-20050831.101112-1.jar
+(managed) \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar
new file mode 100644
index 000000000..0c2d93e3c
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar
@@ -0,0 +1,2 @@
+get-present-timestamped-snapshot-1.0-SNAPSHOT.jar
+(managed) \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.0/get-project-metadata-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.0/get-project-metadata-1.0.jar
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.1/get-project-metadata-1.1.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/1.1/get-project-metadata-1.1.jar
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/2.0/get-project-metadata-2.0.pom b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/2.0/get-project-metadata-2.0.pom
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-project-metadata/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/get-release-metadata-2.2.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/get-release-metadata-2.2.jar
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-release-metadata/2.2/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact-with-pom/1.0/get-relocated-artefact-with-pom-1.0.pom b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact-with-pom/1.0/get-relocated-artefact-with-pom-1.0.pom
new file mode 100644
index 000000000..384f369f5
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact-with-pom/1.0/get-relocated-artefact-with-pom-1.0.pom
@@ -0,0 +1,32 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-relocated-artefact-with-pom</artifactId>
+ <version>1.0</version>
+
+ <distributionManagement>
+ <relocation>
+ <artifactId>get-default-layout-present-with-pom</artifactId>
+ </relocation>
+ </distributionManagement>
+
+</project> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom
new file mode 100644
index 000000000..ae50586ec
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-relocated-artefact/1.0/get-relocated-artefact-1.0.pom
@@ -0,0 +1,32 @@
+<!--
+ ~ 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.
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-relocated-artefact</artifactId>
+ <version>1.0</version>
+
+ <distributionManagement>
+ <relocation>
+ <artifactId>get-default-layout-present</artifactId>
+ </relocation>
+ </distributionManagement>
+
+</project> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-from-proxies/1.0/get-removed-from-proxies-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-from-proxies/1.0/get-removed-from-proxies-1.0.jar
new file mode 100644
index 000000000..54dc5ee86
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-from-proxies/1.0/get-removed-from-proxies-1.0.jar
@@ -0,0 +1,3 @@
+get-removed-from-proxies-1.0.jar
+(managed)
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-metadata/1.0/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-metadata/1.0/maven-metadata.xml
new file mode 100644
index 000000000..f2c41db2e
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-removed-metadata/1.0/maven-metadata.xml
@@ -0,0 +1,22 @@
+<!--
+ ~ 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>
+
+</metadata> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/get-snapshot-on-local-not-remote-2.0-alpha-2-20070821.123456-1.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/get-snapshot-on-local-not-remote-2.0-alpha-2-20070821.220304-2.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-on-local-not-remote/2.0-alpha-2-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.102030-1.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.185701-2.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.021008-3.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/.metadata-proxied1 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/.metadata-proxied1
new file mode 100644
index 000000000..2a83df1ce
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/.metadata-proxied1
@@ -0,0 +1,25 @@
+<!--
+ ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-updated-metadata</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0</version>
+ </versions>
+ </versioning>
+</metadata>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/.metadata-proxied1 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/.metadata-proxied1
new file mode 100644
index 000000000..cd7216a64
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/.metadata-proxied1
@@ -0,0 +1,27 @@
+<!--
+ ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<metadata>
+ <groupId>org.apache.maven.test</groupId>
+ <artifactId>get-updated-metadata</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20050831.1011112</timestamp>
+ <buildNumber>1</buildNumber>
+ </snapshot>
+ </versioning>
+</metadata> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 000000000..e9830b0fb
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ 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-updated-metadata</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20050831.1011112</timestamp>
+ <buildNumber>1</buildNumber>
+ </snapshot>
+ </versioning>
+</metadata> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-metadata/maven-metadata.xml
new file mode 100644
index 000000000..242873e10
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/get-updated-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-updated-metadata</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0</version>
+ </versions>
+ </versioning>
+</metadata> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/maven-metadata.xml
new file mode 100644
index 000000000..6053adcf4
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-not-on-remotes/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.groups.get-not-on-remotes</groupId>
+ <plugins>
+ <plugin>
+ <prefix>plugin5</prefix>
+ <artifactId>plugin5-maven-plugin</artifactId>
+ <name>The plugin5 Plugin</name>
+ </plugin>
+ </plugins>
+</metadata>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml
new file mode 100644
index 000000000..14196bdc1
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml
@@ -0,0 +1,34 @@
+<!--
+ ~ 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.groups.get-on-local-on-remote</groupId>
+ <plugins>
+ <plugin>
+ <prefix>plugin6</prefix>
+ <artifactId>plugin6-maven-plugin</artifactId>
+ <name>The plugin6 Plugin</name>
+ </plugin>
+ <plugin>
+ <prefix>plugin7</prefix>
+ <artifactId>plugin7-maven-plugin</artifactId>
+ <name>The plugin7 Plugin</name>
+ </plugin>
+ </plugins>
+</metadata>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml
new file mode 100644
index 000000000..a04428913
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/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.groups.get-on-multiple-repos</groupId>
+ <plugins>
+ <plugin>
+ <prefix>plugin1</prefix>
+ <artifactId>plugin1-maven-plugin</artifactId>
+ <name>The plugin1 Plugin</name>
+ </plugin>
+ </plugins>
+</metadata>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/maven-metadata.xml
new file mode 100644
index 000000000..e0829c112
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/managed/org/apache/maven/test/groups/get-project-metadata/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.groups.get-project-metadata</groupId>
+ <plugins>
+ <plugin>
+ <prefix>plugin1</prefix>
+ <artifactId>plugin1-maven-plugin</artifactId>
+ <name>The plugin1 Plugin</name>
+ </plugin>
+ </plugins>
+</metadata>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar
new file mode 100644
index 000000000..b5d8045c9
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-bad-local-checksum/1.0/get-bad-local-checksum-1.0.jar
@@ -0,0 +1,3 @@
+get-bad-local-checksum-1.0.jar
+(proxied 1)
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar
new file mode 100644
index 000000000..98fae8093
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar
@@ -0,0 +1,2 @@
+get-checksum-both-bad-1.0.jar
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.md5 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.md5
new file mode 100644
index 000000000..5fd0ae2b7
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.md5
@@ -0,0 +1 @@
+invalid checksum file \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.sha1 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.sha1
new file mode 100644
index 000000000..cf3e1ef62
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-bad/1.0/get-checksum-both-bad-1.0.jar.sha1
@@ -0,0 +1 @@
+invalid checksum file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar
new file mode 100644
index 000000000..7fa9ec4a0
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar
@@ -0,0 +1 @@
+get-checksum-both-right-1.0.jar
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.md5 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.md5
new file mode 100644
index 000000000..9b9e3374c
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.md5
@@ -0,0 +1 @@
+e58f30c6a150a2e843552438d18e15cb *get-checksum-both-right-1.0.jar \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.sha1 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.sha1
new file mode 100644
index 000000000..6661b7da5
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-both-right/1.0/get-checksum-both-right-1.0.jar.sha1
@@ -0,0 +1 @@
+066d76e459f7782c312c31e8a11b3c0f1e3e43a7 *get-checksum-both-right-1.0.jar
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1
new file mode 100644
index 000000000..c2fea5868
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-from-managed-repo/1.0/get-checksum-from-managed-repo-1.0.jar.sha1
@@ -0,0 +1,2 @@
+066d76e459f7782c312c31e8a11b3c0f1e3e43a7 *get-checksum-from-managed-repo-1.0.jar
+(proxied 1)
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar
new file mode 100644
index 000000000..68e3480fc
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar
@@ -0,0 +1,2 @@
+get-checksum-md5-bad-sha1-1.0.jar
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.md5 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.md5
new file mode 100644
index 000000000..d785caa7f
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.md5
@@ -0,0 +1 @@
+8a02aa67549d27b2a03cd4547439c6d3 *get-checksum-md5-bad-sha1-1.0.jar \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.sha1 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.sha1
new file mode 100644
index 000000000..cf3e1ef62
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-bad-sha1/1.0/get-checksum-md5-bad-sha1-1.0.jar.sha1
@@ -0,0 +1 @@
+invalid checksum file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar
new file mode 100644
index 000000000..915323d0e
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar
@@ -0,0 +1,2 @@
+get-checksum-md5-only-1.0.jar
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar.md5 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar.md5
new file mode 100644
index 000000000..0e8431f4b
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-md5-only/1.0/get-checksum-md5-only-1.0.jar.md5
@@ -0,0 +1 @@
+f3af5201bf8da801da37db8842846e1c *get-checksum-md5-only-1.0.jar
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar
new file mode 100644
index 000000000..f02c91843
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar
@@ -0,0 +1,2 @@
+get-checksum-sha1-bad-md5-1.0.jar
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.md5 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.md5
new file mode 100644
index 000000000..cf3e1ef62
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.md5
@@ -0,0 +1 @@
+invalid checksum file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.sha1 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.sha1
new file mode 100644
index 000000000..3e2d43198
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-bad-md5/1.0/get-checksum-sha1-bad-md5-1.0.jar.sha1
@@ -0,0 +1 @@
+3dd1a3a57b807d3ef3fbc6013d926c891cbb8670 *get-checksum-sha1-bad-md5-1.0.jar
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar
new file mode 100644
index 000000000..efd9ed015
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar
@@ -0,0 +1,2 @@
+get-checksum-sha1-only-1.0.jar
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar.sha1 b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar.sha1
new file mode 100644
index 000000000..e64dccfd8
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-checksum-sha1-only/1.0/get-checksum-sha1-only-1.0.jar.sha1
@@ -0,0 +1 @@
+748a3a013bf5eacf2bbb40a2ac7d37889b728837 *get-checksum-sha1-only-1.0.jar
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar
new file mode 100644
index 000000000..15fd36d5d
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar
@@ -0,0 +1,3 @@
+get-default-layout-present-1.0.jar
+(proxied 1)
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc
new file mode 100644
index 000000000..07bf0cfd6
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout-present/1.0/get-default-layout-present-1.0.jar.asc
@@ -0,0 +1 @@
+THIS IS THE WRONG CONTENT!
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar.asc b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar.asc
new file mode 100644
index 000000000..bf07c716d
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar.asc
@@ -0,0 +1,7 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.8 (Darwin)
+
+iEUEABECAAYFAkiAKPMACgkQTusOMqfRa9RpcQCfUsvdYGZ7P97TYXzQ0MclsV2r
+ASkAmJNCpmKjersaTXmsCupNGAJu38c=
+=/yRo
+-----END PGP SIGNATURE-----
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-layout/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-default-metadata/1.0/maven-metadata.xml
new file mode 100644
index 000000000..f53003c56
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/1.0.5/get-found-in-proxy-1.0.5-javadoc.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-found-in-proxy/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar
new file mode 100644
index 000000000..3cc35fa29
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar
@@ -0,0 +1,3 @@
+get-in-both-proxies-1.0.jar
+(proxied 1)
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-merged-metadata/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-merged-metadata/maven-metadata.xml
new file mode 100644
index 000000000..6f9ac0f52
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-merged-metadata/maven-metadata.xml
@@ -0,0 +1,33 @@
+<!--
+ ~ 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-merged-metadata</artifactId>
+ <versioning>
+ <versions>
+ <version>2.0</version>
+ <!-- merge with managed -->
+ <version>3.0</version>
+ <!-- merge with proxied2 -->
+ <version>5.0</version>
+ <!-- unique -->
+ </versions>
+ </versioning>
+</metadata> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/get-metadata-snapshot-1.0-20050831.101112-1.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/get-metadata-snapshot-1.0-20050831.101112-1.jar
new file mode 100644
index 000000000..139c17b97
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/get-metadata-snapshot-1.0-20050831.101112-1.jar
@@ -0,0 +1 @@
+get-metadata-snapshot-1.0-SNAPSHOT.jar \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/1.0.22/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-local-on-remote/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar
new file mode 100644
index 000000000..8bbffa00f
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/get-present-metadata-snapshot-1.0-20050831.101112-1.jar
@@ -0,0 +1,2 @@
+get-present-metadata-snapshot-1.0-20050831.101112-1.jar
+(proxied 1) \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-metadata-snapshot/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar
new file mode 100644
index 000000000..0bf178413
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-present-timestamped-snapshot/1.0-SNAPSHOT/get-present-timestamped-snapshot-1.0-SNAPSHOT.jar
@@ -0,0 +1,2 @@
+get-present-timestamped-snapshot-1.0-SNAPSHOT.jar
+(proxied 1) \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070819.040004-1.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070822.145534-9.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061222.034118-1.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061227.112101-2.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar
new file mode 100644
index 000000000..dfacfaa15
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar
@@ -0,0 +1,2 @@
+get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar
+(proxied 1) \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar
new file mode 100644
index 000000000..af86df92f
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-timestamped-snapshot/1.0-SNAPSHOT/get-timestamped-snapshot-1.0-SNAPSHOT.jar
@@ -0,0 +1 @@
+get-timestamped-snapshot-1.0-SNAPSHOT.jar \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml
new file mode 100644
index 000000000..5005e6c0e
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/1.0-SNAPSHOT/maven-metadata.xml
@@ -0,0 +1,30 @@
+<!--
+ ~ 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-updated-metadata</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20050831.111213</timestamp>
+ <buildNumber>2</buildNumber>
+ </snapshot>
+ </versioning>
+</metadata> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/maven-metadata.xml
new file mode 100644
index 000000000..085576ddb
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/get-updated-metadata/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-updated-metadata</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0</version>
+ <version>2.0</version>
+ </versions>
+ </versioning>
+</metadata> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml
new file mode 100644
index 000000000..9f6bf9239
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-default-layout/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.groups.get-default-layout</groupId>
+ <plugins>
+ <plugin>
+ <prefix>plugin1</prefix>
+ <artifactId>plugin1-maven-plugin</artifactId>
+ <name>The plugin1 Plugin</name>
+ </plugin>
+ </plugins>
+</metadata>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/maven-metadata.xml
new file mode 100644
index 000000000..90102867a
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-found-in-proxy/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.groups.get-found-in-proxy</groupId>
+ <plugins>
+ <plugin>
+ <prefix>plugin3</prefix>
+ <artifactId>plugin3-maven-plugin</artifactId>
+ <name>The plugin3 Plugin</name>
+ </plugin>
+ </plugins>
+</metadata>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml
new file mode 100644
index 000000000..23f12bbf1
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-local-on-remote/maven-metadata.xml
@@ -0,0 +1,34 @@
+<!--
+ ~ 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.groups.get-on-local-on-remote</groupId>
+ <plugins>
+ <plugin>
+ <prefix>plugin7</prefix>
+ <artifactId>plugin7-maven-plugin</artifactId>
+ <name>The plugin7 Plugin</name>
+ </plugin>
+ <plugin>
+ <prefix>plugin4</prefix>
+ <artifactId>plugin4-maven-plugin</artifactId>
+ <name>The plugin4 Plugin</name>
+ </plugin>
+ </plugins>
+</metadata>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml
new file mode 100644
index 000000000..3abe069e7
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied1/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml
@@ -0,0 +1,34 @@
+<!--
+ ~ 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.groups.get-on-multiple-repos</groupId>
+ <plugins>
+ <plugin>
+ <prefix>plugin1</prefix>
+ <artifactId>plugin1-maven-plugin</artifactId>
+ <name>The plugin1 Plugin</name>
+ </plugin>
+ <plugin>
+ <prefix>plugin4</prefix>
+ <artifactId>plugin4-maven-plugin</artifactId>
+ <name>The plugin4 Plugin</name>
+ </plugin>
+ </plugins>
+</metadata>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0.1/get-default-layout-1.0.1.pom b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/get-default-layout-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/1.0/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-default-layout/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar
new file mode 100644
index 000000000..e46d60ac3
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-both-proxies/1.0/get-in-both-proxies-1.0.jar
@@ -0,0 +1,3 @@
+get-in-both-proxies-1.0.jar
+(proxied 2)
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar
new file mode 100644
index 000000000..3460f656d
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-in-second-proxy/1.0/get-in-second-proxy-1.0.jar
@@ -0,0 +1,2 @@
+get-in-second-proxy-1.0.jar
+
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-merged-metadata/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-merged-metadata/maven-metadata.xml
new file mode 100644
index 000000000..a8d714f84
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-merged-metadata/maven-metadata.xml
@@ -0,0 +1,33 @@
+<!--
+ ~ 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-merged-metadata</artifactId>
+ <versioning>
+ <versions>
+ <version>1.0</version>
+ <!-- merged with managed -->
+ <version>3.0</version>
+ <!-- merged with proxied1 -->
+ <version>4.0</version>
+ <!-- unique -->
+ </versions>
+ </versioning>
+</metadata> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/1.0/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070821.102030-1.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.111741-5.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/get-snapshot-popular-2.0-20070823.212711-6.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-snapshot-popular/2.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20061222.034118-1.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-20070101.000103-2.jar b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar
new file mode 100644
index 000000000..915b2b22c
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar
@@ -0,0 +1,2 @@
+get-timestamped-snapshot-in-both-1.0-SNAPSHOT.jar
+(proxied 2) \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/get-timestamped-snapshot-in-both/1.0-SNAPSHOT/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-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-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/maven-metadata.xml
new file mode 100644
index 000000000..41109859e
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-default-layout/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.groups.get-default-layout</groupId>
+ <plugins>
+ <plugin>
+ <prefix>plugin2</prefix>
+ <artifactId>plugin2-maven-plugin</artifactId>
+ <name>The plugin2 Plugin</name>
+ </plugin>
+ </plugins>
+</metadata>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml
new file mode 100644
index 000000000..b7db006fe
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/repositories/proxied2/org/apache/maven/test/groups/get-on-multiple-repos/maven-metadata.xml
@@ -0,0 +1,34 @@
+<!--
+ ~ 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.groups.get-on-multiple-repos</groupId>
+ <plugins>
+ <plugin>
+ <prefix>plugin1</prefix>
+ <artifactId>plugin1-maven-plugin</artifactId>
+ <name>The plugin1 Plugin</name>
+ </plugin>
+ <plugin>
+ <prefix>plugin2</prefix>
+ <artifactId>plugin2-maven-plugin</artifactId>
+ <name>The plugin2 Plugin</name>
+ </plugin>
+ </plugins>
+</metadata>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/resources/META-INF/spring-context.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/resources/META-INF/spring-context.xml
new file mode 100644
index 000000000..f900a933b
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/resources/META-INF/spring-context.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
+ default-lazy-init="true">
+
+ <context:component-scan base-package="org.apache.archiva.proxy.maven"/>
+
+ <bean name="wagon#file" scope="prototype" class="org.apache.maven.wagon.providers.file.FileWagon"/>
+
+ <alias name="userConfiguration#redback" alias="userConfiguration#default"/>
+
+ <!-- ***
+ JPA settings
+ *** -->
+ <bean name="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+ <property name="jpaVendorAdapter" >
+ <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter" />
+ </property>
+ <property name="persistenceXmlLocation" value="classpath:META-INF/persistence-hsqldb.xml" />
+ <property name="jpaPropertyMap">
+ <map>
+ <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" />
+ <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" />
+ <entry key="openjpa.ConnectionUserName" value="sa" />
+ <entry key="openjpa.ConnectionPassword" value="" />
+ <entry key="openjpa.Log" value="${openjpa.Log:DefaultLevel=INFO,Runtime=ERROR,Tool=ERROR,SQL=ERROR,Schema=ERROR,MetaData=ERROR}" />
+ <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" />
+ <entry key="openjpa.jdbc.MappingDefaults"
+ value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/>
+ </map>
+ </property>
+
+ </bean>
+
+ <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" >
+ <property name="entityManagerFactory" ref="entityManagerFactory" />
+ </bean>
+
+ <tx:annotation-driven />
+ <!-- ***
+ End of JPA settings
+ *** -->
+
+</beans> \ No newline at end of file
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/resources/spring-context.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/resources/spring-context.xml
new file mode 100755
index 000000000..f10fb3e86
--- /dev/null
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/resources/spring-context.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
+ default-lazy-init="true">
+
+ <context:annotation-config/>
+ <context:component-scan base-package="org.apache.archiva.metadata.repository,org.apache.archiva.proxy,org.apache.archiva.repository.mock"/>
+ <alias name="mockRepositoryProvider" alias="mavenRepositoryProvider" />
+
+ <alias name="archivaConfiguration#mock" alias="archivaConfiguration#default"/>
+ <alias name="archivaConfiguration#mock" alias="archivaConfiguration"/>
+ <alias name="archivaTaskScheduler#repositoryMock" alias="archivaTaskScheduler#repository" />
+
+ <bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
+ <property name="properties">
+ <props>
+ <prop key="org.quartz.scheduler.instanceName">scheduler1</prop>
+ <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
+ <prop key="org.quartz.threadPool.threadCount">1</prop>
+ <prop key="org.quartz.threadPool.threadPriority">4</prop>
+ <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
+ </props>
+ </property>
+ </bean>
+
+ <bean name="repositoryContentFactory#mocked" class="org.apache.archiva.repository.RepositoryContentFactory">
+ <property name="archivaConfiguration" ref="archivaConfiguration#mock"/>
+ </bean>
+
+
+ <bean name="repositoryContentProvider#mocked" class="org.apache.archiva.repository.mock.RepositoryContentProviderMock" >
+
+ </bean>
+
+
+ <bean name="repositoryProxyConnectors#test" class="org.apache.archiva.proxy.maven.MavenRepositoryProxyHandler">
+ <property name="archivaConfiguration" ref="archivaConfiguration#mock"/>
+ <property name="repositoryFactory" ref="repositoryContentFactory#mocked"/>
+ <property name="metadataTools" ref="metadataTools#mocked"/>
+ </bean>
+
+ <bean name="metadataTools#default" class="org.apache.archiva.repository.metadata.MetadataTools">
+ <property name="configuration" ref="archivaConfiguration#mock"/>
+ </bean>
+
+ <bean name="metadataTools#mocked" class="org.apache.archiva.repository.metadata.MetadataTools">
+ <property name="configuration" ref="archivaConfiguration#mock"/>
+ </bean>
+
+
+ <bean name="cache#url-failures-cache" class="org.apache.archiva.redback.components.cache.ehcache.EhcacheCache" lazy-init="true"
+ destroy-method="dispose">
+ <property name="diskExpiryThreadIntervalSeconds" value="600"/>
+ <property name="diskPersistent" value="false"/>
+ <property name="diskStorePath" value="${appserver.base}/tmp/urlcache"/>
+ <property name="maxElementsInMemory" value="1000"/>
+ <property name="memoryEvictionPolicy" value="LRU"/>
+ <property name="name" value="url-failures-cache"/>
+ <property name="overflowToDisk" value="false"/>
+ <!-- 45 minutes = 2700 seconds -->
+ <property name="timeToIdleSeconds" value="2700"/>
+ <!-- 30 minutes = 1800 seconds -->
+ <property name="timeToLiveSeconds" value="1800"/>
+ </bean>
+
+ <bean name="wagon#test" class="org.apache.archiva.proxy.WagonDelegate" scope="singleton"/>
+ <bean name="wagon#file" scope="prototype" class="org.apache.maven.wagon.providers.file.FileWagon"/>
+
+ <alias name="userConfiguration#redback" alias="userConfiguration#default"/>
+
+ <!-- ***
+ JPA settings
+ *** -->
+ <bean name="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+ <property name="jpaVendorAdapter" >
+ <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter" />
+ </property>
+ <property name="persistenceXmlLocation" value="classpath:META-INF/persistence-hsqldb.xml" />
+ <property name="jpaPropertyMap">
+ <map>
+ <entry key="openjpa.ConnectionURL" value="jdbc:hsqldb:mem:redback_database" />
+ <entry key="openjpa.ConnectionDriverName" value="org.hsqldb.jdbcDriver" />
+ <entry key="openjpa.ConnectionUserName" value="sa" />
+ <entry key="openjpa.ConnectionPassword" value="" />
+ <entry key="openjpa.Log" value="${openjpa.Log:DefaultLevel=INFO,Runtime=ERROR,Tool=ERROR,SQL=ERROR,Schema=ERROR,MetaData=ERROR}" />
+ <entry key="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" />
+ <entry key="openjpa.jdbc.MappingDefaults"
+ value="ForeignKeyDeleteAction=restrict,JoinForeignKeyDeleteAction=restrict"/>
+ </map>
+ </property>
+
+ </bean>
+
+ <bean name="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" >
+ <property name="entityManagerFactory" ref="entityManagerFactory" />
+ </bean>
+
+ <tx:annotation-driven />
+ <!-- ***
+ End of JPA settings
+ *** -->
+
+</beans> \ No newline at end of file