You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/08/07 19:48:14 UTC
[maven-deploy-plugin] 01/01: WIP - Upgraded release test WIP - Need
to reconsider check in SNAPSHOT test cause I can't predict the names
correct. Need to think about this (Will fail at the moment.).
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch MSHARED-695
in repository https://gitbox.apache.org/repos/asf/maven-deploy-plugin.git
commit 9b584f99baaeef3ecd17413fee9e2d0ec494a476
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Jul 8 19:49:24 2018 +0200
WIP - Upgraded release test
WIP - Need to reconsider check in SNAPSHOT test
cause I can't predict the names correct.
Need to think about this (Will fail at the moment.).
---
src/it/attach-jar-checksum-release/pom.xml | 16 ++++++++-
src/it/attach-jar-checksum-release/setup.bsh | 2 +-
src/it/attach-jar-checksum-release/verify.groovy | 6 +++-
src/it/attach-jar-checksum-snapshot/pom.xml | 19 ++++++++--
src/it/attach-jar-checksum-snapshot/setup.bsh | 2 +-
src/it/attach-jar-checksum-snapshot/verify.groovy | 43 +++++++++++++++++------
6 files changed, 70 insertions(+), 18 deletions(-)
diff --git a/src/it/attach-jar-checksum-release/pom.xml b/src/it/attach-jar-checksum-release/pom.xml
index d0e28b0..bda659d 100644
--- a/src/it/attach-jar-checksum-release/pom.xml
+++ b/src/it/attach-jar-checksum-release/pom.xml
@@ -39,7 +39,7 @@ under the License.
<distributionManagement>
<repository>
<id>it</id>
- <url>file:///${basedir}/target/repo</url>
+ <url>file:///${basedir}/target/remoterepo</url>
</repository>
</distributionManagement>
@@ -55,6 +55,20 @@ under the License.
<artifactId>maven-deploy-plugin</artifactId>
<version>@project.version@</version>
</plugin>
+ <!--
+ ! This is intentionally the old version which
+ ! will not create checksums by default.
+ ! We want to make sure that only maven-deploy-plugin
+ ! will generate the checksums.
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.5.2</version>
+ <configuration>
+ <createChecksum>false</createChecksum>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
diff --git a/src/it/attach-jar-checksum-release/setup.bsh b/src/it/attach-jar-checksum-release/setup.bsh
index 9c52da8..4d73971 100644
--- a/src/it/attach-jar-checksum-release/setup.bsh
+++ b/src/it/attach-jar-checksum-release/setup.bsh
@@ -22,7 +22,7 @@ import java.util.*;
import org.codehaus.plexus.util.*;
-File file = new File( localRepositoryPath, "org/apache/maven/its/install/ajc" );
+File file = new File( basedir, "org/apache/maven/its/deploy/ajc" );
System.out.println( "Deleting " + file );
FileUtils.deleteDirectory( file );
diff --git a/src/it/attach-jar-checksum-release/verify.groovy b/src/it/attach-jar-checksum-release/verify.groovy
index 9a7376b..6c5c8ed 100644
--- a/src/it/attach-jar-checksum-release/verify.groovy
+++ b/src/it/attach-jar-checksum-release/verify.groovy
@@ -33,6 +33,9 @@ def paths =
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar",
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar.md5",
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar.sha1",
+ "org/apache/maven/its/deploy/ajc/test/1.0/maven-metadata.xml",
+ "org/apache/maven/its/deploy/ajc/test/1.0/maven-metadata.xml.md5",
+ "org/apache/maven/its/deploy/ajc/test/1.0/maven-metadata.xml.sha1",
"org/apache/maven/its/deploy/ajc/test/maven-metadata.xml",
"org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.md5",
"org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.sha1",
@@ -44,7 +47,8 @@ def cksumToCheckPaths = [
"org/apache/maven/its/deploy/ajc/test/1.0/test-1.0-sources.jar"
]
-def repository = new File (basedir, "target/repo" )
+// Check if artifacts have been uploaded to remote with checksums
+def repository = new File (basedir, "target/remoterepo" )
paths.each { path ->
//File file = new File( localRepositoryPath, path );
File file = new File( repository, path );
diff --git a/src/it/attach-jar-checksum-snapshot/pom.xml b/src/it/attach-jar-checksum-snapshot/pom.xml
index c81cc24..89ddce7 100644
--- a/src/it/attach-jar-checksum-snapshot/pom.xml
+++ b/src/it/attach-jar-checksum-snapshot/pom.xml
@@ -29,8 +29,7 @@ under the License.
<packaging>jar</packaging>
<description>
- This test has been moved from maven-install-plugin to maven-deploy-plugin.
- Tests the installation of a simple snapshot JAR with an attached artifact and checksums
+ Tests the deployment of a simple SNAPSHOT JAR with an attached artifact and checksums
</description>
<properties>
@@ -39,7 +38,7 @@ under the License.
<distributionManagement>
<repository>
<id>it</id>
- <url>file:///${basedir}/target/repo</url>
+ <url>file:///${basedir}/target/remoterepo</url>
</repository>
</distributionManagement>
@@ -60,6 +59,20 @@ under the License.
<artifactId>maven-jar-plugin</artifactId>
<version>2.1</version>
</plugin>
+ <!--
+ ! This is intentionally the old version which
+ ! will not create checksums by default.
+ ! We want to make sure that only maven-deploy-plugin
+ ! will generate the checksums.
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.5.2</version>
+ <configuration>
+ <createChecksum>false</createChecksum>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
diff --git a/src/it/attach-jar-checksum-snapshot/setup.bsh b/src/it/attach-jar-checksum-snapshot/setup.bsh
index 9c52da8..7d54f90 100644
--- a/src/it/attach-jar-checksum-snapshot/setup.bsh
+++ b/src/it/attach-jar-checksum-snapshot/setup.bsh
@@ -22,7 +22,7 @@ import java.util.*;
import org.codehaus.plexus.util.*;
-File file = new File( localRepositoryPath, "org/apache/maven/its/install/ajc" );
+File file = new File( basedir, "target/remoterepo/org/apache/maven/its/deploy/ajc" );
System.out.println( "Deleting " + file );
FileUtils.deleteDirectory( file );
diff --git a/src/it/attach-jar-checksum-snapshot/verify.groovy b/src/it/attach-jar-checksum-snapshot/verify.groovy
index b533981..e2b663f 100644
--- a/src/it/attach-jar-checksum-snapshot/verify.groovy
+++ b/src/it/attach-jar-checksum-snapshot/verify.groovy
@@ -17,13 +17,9 @@
* under the License.
*/
-import java.io.*;
-import java.util.*;
-
import org.apache.maven.plugins.deploy.Utils;
-def paths =
-[
+def pathsInTargetDirectory = [
"org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom",
"org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom.md5",
"org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom.sha1",
@@ -33,12 +29,20 @@ def paths =
"org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-sources.jar",
"org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-sources.jar.md5",
"org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-sources.jar.sha1",
+ //The following files will be generated. But they can't be check for the checksums
+ //cause they contain timestamps which means they change everytime.
+ "org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/maven-metadata.xml",
+ "org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/maven-metadata.xml.md5",
+ "org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/maven-metadata.xml.sha1",
+]
+
+def pathsInTargetDirectoryWithOnlyMetadata = [
"org/apache/maven/its/deploy/ajc/test/maven-metadata.xml",
"org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.md5",
"org/apache/maven/its/deploy/ajc/test/maven-metadata.xml.sha1",
]
-def cksumToCheckPaths = [
+def checkSumsToCheckPaths = [
"org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom",
"org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.jar",
"org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT-sources.jar"
@@ -47,17 +51,34 @@ def cksumToCheckPaths = [
def buildLog = new File ( basedir, "build.log")
-def repository = new File (basedir, "target/repo" )
-paths.each { path ->
- //File file = new File( localRepositoryPath, path );
+// All file are being deployed to that location. See pom.xml
+def repository = new File (basedir, "target/remoterepo/org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT" )
+
+// Read all files from result target directory.
+def filesInDirectory = []
+repository.eachFile() { file ->
+ filesInDirectory << file.getName()
+}
+
+filesInDirectory.each { file -> println " -> ${file}" }
+
+println "Size: ${filesInDirectory.size()} / ${pathsInTargetDirectory.size()}"
+// First Step is to check the number of files found in directory against
+// the number of files we expect to find.
+if (filesInDirectory.size() != pathsInTargetDirectory.size()) {
+ throw new Exception( "The number of files in directory and the number of files in paths are not equal" );
+}
+
+
+pathsInTargetDirectory.each { path ->
File file = new File( repository, path );
println "Checking for existence of ${file}"
if ( !file.isFile() )
{
throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
}
- if ( cksumToCheckPaths.contains( path ) )
- {
+ if ( checkSumsToCheckPaths.contains( path ) )
+ {
println "Verifying ${file}"
Utils.verifyChecksum( file );
}