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/08 18:00:56 UTC
[maven-deploy-plugin] 01/01: WIP - Upgraded release test
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 acb06aa2a81c81880ff7fbd7c3d497a6d6ecf724
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Sun Jul 8 19:49:24 2018 +0200
WIP - Upgraded release test
---
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 | 3 +-
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 | 97 +++++++++++++++--------
6 files changed, 98 insertions(+), 41 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..ac362f8 100644
--- a/src/it/attach-jar-checksum-release/verify.groovy
+++ b/src/it/attach-jar-checksum-release/verify.groovy
@@ -44,7 +44,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..0a4a14f 100644
--- a/src/it/attach-jar-checksum-snapshot/verify.groovy
+++ b/src/it/attach-jar-checksum-snapshot/verify.groovy
@@ -17,50 +17,79 @@
* under the License.
*/
-import java.io.*;
-import java.util.*;
-
import org.apache.maven.plugins.deploy.Utils;
-def paths =
-[
- "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",
- "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.jar.md5",
- "org/apache/maven/its/deploy/ajc/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.jar.sha1",
- "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",
- "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 pathsInTargetDirectory = [
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom\\.md5",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom\\.sha1",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar\\.md5",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar\\.sha1",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar\\.md5",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-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.
+ "maven\\-metadata\\.xml",
+ "maven\\-metadata\\.xml\\.md5",
+ "maven\\-metadata\\.xml\\.sha1",
]
-def cksumToCheckPaths = [
- "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"
+def checkSumsToCheckPaths = [
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.pom",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\.jar",
+ "test\\-1\\.0\\-\\d{8}\\.\\d{6}\\-\\d{1}\\-sources\\.jar",
]
-def buildLog = new File ( basedir, "build.log")
+// All files 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 the target directory.
+def filesInDirectory = []
+repository.eachFile() { file ->
+ filesInDirectory << file.getName()
+}
+
+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 filesInDirectory and the number of files in pathsInTargetDirectory are not equal" );
+}
+// The following will check for the existence of all given
+// files based on the given regular expressions.
+// This is needed cause the time stamp in the file name
+// changes each time this test will be running.
+filesInDirectory.each { existingFile ->
+ def result = false
+ pathsInTargetDirectory.each { searchItem ->
+ def expected = existingFile ==~ searchItem
+ println "existingFile: ${existingFile} ${searchItem} expeced:${expected}"
+ if (expected) {
+ result = true
+ }
+ }
-def repository = new File (basedir, "target/repo" )
-paths.each { path ->
- //File file = new File( localRepositoryPath, path );
- File file = new File( repository, path );
- println "Checking for existence of ${file}"
- if ( !file.isFile() )
- {
- throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
+ if (!result) {
+ throw new FileNotFoundException ( "Missing: ${existingFile}" )
}
- if ( cksumToCheckPaths.contains( path ) )
- {
- println "Verifying ${file}"
- Utils.verifyChecksum( file );
+}
+
+// The following will check the existing checksums.
+filesInDirectory.each { existingFile ->
+ def result = false
+ checkSumsToCheckPaths.each { searchItem ->
+ //search for the file name pattern..
+ def expected = existingFile ==~ searchItem
+ if (expected) {
+ println "Verifying ${existingFile}"
+ Utils.verifyChecksum( new File(repository, existingFile) );
+ }
}
}
return true;
+