From 5de7825b42441a17d3c7856032ef3d3d65827975 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Mon, 17 Oct 2016 22:11:57 +0200 Subject: [PATCH] Fixing wrong checksum files of proxy repositories Fixes https://issues.apache.org/jira/browse/MRM-1926 --- .../maven2/RepositoryModelResolver.java | 25 +++++++++++++++---- .../1.0/test-artifact-module-a-1.0.pom.md5 | 1 + .../1.0/test-artifact-module-a-1.0.pom.sha1 | 1 + .../1.0/test-artifact-module-b-1.0.pom.md5 | 1 + .../1.0/test-artifact-module-b-1.0.pom.sha1 | 1 + .../1/test-artifact-parent-1.pom.md5 | 1 + .../1/test-artifact-parent-1.pom.sha1 | 1 + .../1.0/test-artifact-root-1.0.pom.md5 | 1 + .../1.0/test-artifact-root-1.0.pom.sha1 | 1 + ...hot-artifact-module-a-1.1-SNAPSHOT.pom.md5 | 1 + ...ot-artifact-module-a-1.1-SNAPSHOT.pom.sha1 | 1 + ...rtifact-root-1.1-20100310.014828-2.pom.md5 | 1 + ...tifact-root-1.1-20100310.014828-2.pom.sha1 | 1 + 13 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.md5 create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.sha1 create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.md5 create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.sha1 create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.md5 create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.sha1 create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.md5 create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.sha1 create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.md5 create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.sha1 create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.md5 create mode 100644 archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.sha1 diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java index 0cb92646a..b84a859b9 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java @@ -413,15 +413,30 @@ public class RepositoryModelResolver return connected; } - private File transferChecksum( Wagon wagon, RemoteRepository remoteRepository, String remotePath, File resource, - File tmpDirectory, String ext ) + /** + * + * @param wagon The wagon instance that should be connected. + * @param remoteRepository The repository from where the checksum file should be retrieved + * @param remotePath The remote path of the artifact (without extension) + * @param resource The local artifact (without extension) + * @param workingDir The working directory where the downloaded file should be placed to + * @param ext The extension of th checksum file + * @return The file where the data has been downloaded to. + * @throws AuthorizationException + * @throws TransferFailedException + * @throws ResourceDoesNotExistException + */ + private File transferChecksum( final Wagon wagon, final RemoteRepository remoteRepository, + final String remotePath, final File resource, + final File workingDir, final String ext ) throws AuthorizationException, TransferFailedException, ResourceDoesNotExistException { - File destFile = new File( tmpDirectory, resource.getName() + ext ); + File destFile = new File( workingDir, resource.getName() + ext ); + String remoteChecksumPath = remotePath + ext; - log.info( "Retrieving {} from {}", remotePath, remoteRepository.getName() ); + log.info( "Retrieving {} from {}", remoteChecksumPath, remoteRepository.getName() ); - wagon.get( addParameters( remotePath, remoteRepository ), destFile ); + wagon.get( addParameters( remoteChecksumPath, remoteRepository ), destFile ); log.debug( "Downloaded successfully." ); diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.md5 new file mode 100644 index 000000000..40dc44a73 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.md5 @@ -0,0 +1 @@ +61a4d030260fc6bee0681cf99ba54674 test-artifact-module-a-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.sha1 new file mode 100644 index 000000000..59d811196 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-a/1.0/test-artifact-module-a-1.0.pom.sha1 @@ -0,0 +1 @@ +6f54bc4223bc39d7880420f66baa3a24d7f9c181 test-artifact-module-a-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.md5 new file mode 100644 index 000000000..c087db3b9 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.md5 @@ -0,0 +1 @@ +daa5fa59239b1a81d7c04aea1c235aad test-artifact-module-b-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.sha1 new file mode 100644 index 000000000..3315ef896 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-module-b/1.0/test-artifact-module-b-1.0.pom.sha1 @@ -0,0 +1 @@ +3d0a66ad4f202b823feb367c46c7574cbb0301c8 test-artifact-module-b-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.md5 new file mode 100644 index 000000000..98587da1d --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.md5 @@ -0,0 +1 @@ +92c60efe85e23fe5afd8a854cea87209 test-artifact-parent-1.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.sha1 new file mode 100644 index 000000000..a0bcb35bd --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-parent/1/test-artifact-parent-1.pom.sha1 @@ -0,0 +1 @@ +6eca3509acf66023c29e2bc17f73e79d1d1a341a test-artifact-parent-1.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.md5 new file mode 100644 index 000000000..8870d46d1 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.md5 @@ -0,0 +1 @@ +034449f8696981edce2485b841a02a47 test-artifact-root-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.sha1 new file mode 100644 index 000000000..eba419703 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-artifact-root/1.0/test-artifact-root-1.0.pom.sha1 @@ -0,0 +1 @@ +bef26aec1a0714cec7fa56cdbb7ebcdb452295eb test-artifact-root-1.0.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.md5 new file mode 100644 index 000000000..a36564b4f --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.md5 @@ -0,0 +1 @@ +3b689a3c3cacecdf4371c342606211f1 test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.sha1 new file mode 100644 index 000000000..e9d1ab6f9 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-module-a/1.1-SNAPSHOT/test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom.sha1 @@ -0,0 +1 @@ +b401e87baeeb0174efd85eaf327d9c98efe79cf1 test-snapshot-artifact-module-a-1.1-SNAPSHOT.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.md5 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.md5 new file mode 100644 index 000000000..278e71bca --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.md5 @@ -0,0 +1 @@ +0c304367d7a99291eb8292b1fe7114a2 test-snapshot-artifact-root-1.1-20100310.014828-2.pom diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.sha1 b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.sha1 new file mode 100644 index 000000000..3fe44e181 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/com/example/test/test-snapshot-artifact-root/1.1-SNAPSHOT/test-snapshot-artifact-root-1.1-20100310.014828-2.pom.sha1 @@ -0,0 +1 @@ +e5e6ca9ae3628ae474c155619467848dc900b8cf test-snapshot-artifact-root-1.1-20100310.014828-2.pom -- 2.39.5