You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2021/03/14 12:21:53 UTC

[maven-integration-testing] 01/01: [MNG-6075] Increase the model validation level to the next minor level version

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MNG-6075
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git

commit e2e2789fcabbe054327f352f073eeb5974cfe6b3
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Sun Mar 14 00:06:09 2021 +0100

    [MNG-6075] Increase the model validation level to the next minor level version
    
    * Modify ITs to pass with Maven 4
    * Disable MavenITmng3719PomExecutionOrderingTest for Maven 4 because it
      deliberately relies on duplicate plugin declarations
---
 ...venITmng1021EqualAttachmentBuildNumberTest.java | 30 +++++++-------
 .../it/MavenITmng1701DuplicatePluginTest.java      | 27 +++++++++---
 .../it/MavenITmng3719PomExecutionOrderingTest.java |  2 +-
 .../it/MavenITmng4005UniqueDependencyKeyTest.java  | 27 +++++++++---
 .../src/test/resources/bootstrap/group-13/pom.xml  | 48 ++++++++++++++++++++++
 .../src/test/resources/bootstrap/group-8/pom.xml   |  5 ---
 core-it-suite/src/test/resources/bootstrap/pom.xml |  1 +
 core-it-suite/src/test/resources/mng-1021/pom.xml  |  2 +-
 .../src/test/resources/mng-3259/module1/pom.xml    |  2 +-
 .../src/test/resources/mng-3259/module2/pom.xml    |  2 +-
 .../src/test/resources/mng-3259/module3/pom.xml    |  2 +-
 .../src/test/resources/mng-3259/module4/pom.xml    |  2 +-
 .../src/test/resources/mng-3259/module5/pom.xml    |  2 +-
 .../src/test/resources/mng-3259/parent/pom.xml     |  2 +-
 core-it-suite/src/test/resources/mng-3259/pom.xml  |  2 +-
 15 files changed, 115 insertions(+), 41 deletions(-)

diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java
index 4228a8e..d6c985d 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1021EqualAttachmentBuildNumberTest.java
@@ -53,28 +53,28 @@ public class MavenITmng1021EqualAttachmentBuildNumberTest
         verifier.verifyErrorFreeLog();
         verifier.resetStreams();
 
-        verifier.assertArtifactPresent( "org.apache.maven.its.mng1021", "test", "SNAPSHOT", "pom" );
-        verifier.assertArtifactPresent( "org.apache.maven.its.mng1021", "test", "SNAPSHOT", "jar" );
+        verifier.assertArtifactPresent( "org.apache.maven.its.mng1021", "test", "1-SNAPSHOT", "pom" );
+        verifier.assertArtifactPresent( "org.apache.maven.its.mng1021", "test", "1-SNAPSHOT", "jar" );
 
         String dir = "repo/org/apache/maven/its/mng1021/test/";
-        String snapshot = getSnapshotVersion( new File( testDir, dir + "SNAPSHOT" ) );
+        String snapshot = getSnapshotVersion( new File( testDir, dir + "1-SNAPSHOT" ) );
         assertTrue( snapshot, snapshot.endsWith( "-1" ) );
 
         verifier.assertFilePresent( dir + "maven-metadata.xml" );
         verifier.assertFilePresent( dir + "maven-metadata.xml.md5" );
         verifier.assertFilePresent( dir + "maven-metadata.xml.sha1" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/maven-metadata.xml" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/maven-metadata.xml.md5" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/maven-metadata.xml.sha1" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".pom" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".pom.md5" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".pom.sha1" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".jar" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".jar.md5" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + ".jar.sha1" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + "-it.jar" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + "-it.jar.md5" );
-        verifier.assertFilePresent( dir + "SNAPSHOT/test-" + snapshot + "-it.jar.sha1" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/maven-metadata.xml" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/maven-metadata.xml.md5" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/maven-metadata.xml.sha1" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".pom" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".pom.md5" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".pom.sha1" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".jar" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".jar.md5" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + ".jar.sha1" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + "-it.jar" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + "-it.jar.md5" );
+        verifier.assertFilePresent( dir + "1-SNAPSHOT/test-" + snapshot + "-it.jar.sha1" );
     }
 
     private String getSnapshotVersion( File artifactDir )
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java
index 62eb5a0..f15308a 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng1701DuplicatePluginTest.java
@@ -48,22 +48,37 @@ public class MavenITmng1701DuplicatePluginTest
 
         Verifier verifier = newVerifier( testDir.getAbsolutePath() );
         verifier.setAutoclean( false );
-        verifier.executeGoal( "validate" );
-        verifier.verifyErrorFreeLog();
+        try {
+            verifier.executeGoal( "validate" );
+        }
+        catch ( VerificationException e )
+        {
+            // expected with Maven 4+
+        }
         verifier.resetStreams();
 
+        String logLevel;
+        if ( matchesVersionRange( "(,4.0.0-alpha-1)" ) )
+        {
+            logLevel = "WARNING";
+        }
+        else
+        {
+            logLevel = "ERROR";
+        }
+
         List<String> lines = verifier.loadLines( verifier.getLogFileName(), "UTF-8" );
-        boolean foundWarning = false;
+        boolean foundMessage = false;
         for ( String line : lines )
         {
-            if ( line.startsWith( "[WARNING]" )
+            if ( line.startsWith(  "[" + logLevel + "]" )
                 && line.indexOf( "duplicate declaration of plugin org.apache.maven.its.plugins:maven-it-plugin-expression" ) > 0 )
             {
-                foundWarning = true;
+                foundMessage = true;
             }
         }
 
-        assertTrue( "Duplicate plugin warning wasn't generated.", foundWarning );
+        assertTrue( "Duplicate plugin message wasn't generated.", foundMessage );
     }
 
 }
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java
index b2cd6a9..885c892 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3719PomExecutionOrderingTest.java
@@ -38,7 +38,7 @@ public class MavenITmng3719PomExecutionOrderingTest
 
     public MavenITmng3719PomExecutionOrderingTest()
     {
-        super( "[2.0.11,2.1.0-M1),[2.1.0-M2,)" );
+        super( "[2.0.11,2.1.0-M1),[2.1.0-M2,4.0.0-alpha-1)" );
     }
 
     /**
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java
index 75f8e9f..56d97c4 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4005UniqueDependencyKeyTest.java
@@ -83,21 +83,36 @@ public class MavenITmng4005UniqueDependencyKeyTest
         Verifier verifier = newVerifier( testDir.getAbsolutePath() );
         verifier.setAutoclean( false );
         verifier.deleteDirectory( "target" );
-        verifier.executeGoal( "validate" );
-        verifier.verifyErrorFreeLog();
+        try {
+            verifier.executeGoal( "validate" );
+        }
+        catch ( VerificationException e )
+        {
+            // expected with Maven 4+
+        }
         verifier.resetStreams();
 
+        String logLevel;
+        if ( matchesVersionRange( "(,4.0.0-alpha-1)" ) )
+        {
+            logLevel = "WARNING";
+        }
+        else
+        {
+            logLevel = "ERROR";
+        }
+
         List<String> lines = verifier.loadLines( verifier.getLogFileName(), "UTF-8" );
-        boolean foundWarning = false;
+        boolean foundMessage = false;
         for ( String line : lines )
         {
-            if ( line.startsWith( "[WARNING]" ) && line.indexOf( "must be unique: junit:junit:jar" ) > 0 )
+            if ( line.startsWith( "[" + logLevel + "]" ) && line.indexOf( "must be unique: junit:junit:jar" ) > 0 )
             {
-                foundWarning = true;
+                foundMessage = true;
             }
         }
 
-        assertTrue( "Duplicate dependency warning wasn't generated.", foundWarning );
+        assertTrue( "Duplicate dependency message wasn't generated.", foundMessage );
     }
 
 }
diff --git a/core-it-suite/src/test/resources/bootstrap/group-13/pom.xml b/core-it-suite/src/test/resources/bootstrap/group-13/pom.xml
new file mode 100644
index 0000000..6a45468
--- /dev/null
+++ b/core-it-suite/src/test/resources/bootstrap/group-13/pom.xml
@@ -0,0 +1,48 @@
+<?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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.its.bootstrap</groupId>
+    <artifactId>maven-it-boostrap</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <groupId>org.apache.maven.its.bootstrap</groupId>
+  <artifactId>group-13</artifactId>
+  <version>1.0</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: Boostrap :: Group-13</name>
+
+  <properties>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>2.0.5</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/core-it-suite/src/test/resources/bootstrap/group-8/pom.xml b/core-it-suite/src/test/resources/bootstrap/group-8/pom.xml
index bf8f15c..1da4e5f 100644
--- a/core-it-suite/src/test/resources/bootstrap/group-8/pom.xml
+++ b/core-it-suite/src/test/resources/bootstrap/group-8/pom.xml
@@ -85,11 +85,6 @@ under the License.
       <version>1.1</version>
     </dependency>
     <dependency>
-      <groupId>org.codehaus.plexus</groupId>
-      <artifactId>plexus-utils</artifactId>
-      <version>2.0.5</version>
-    </dependency>
-    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <version>1.6.1</version>
diff --git a/core-it-suite/src/test/resources/bootstrap/pom.xml b/core-it-suite/src/test/resources/bootstrap/pom.xml
index 7c331d2..fbae028 100644
--- a/core-it-suite/src/test/resources/bootstrap/pom.xml
+++ b/core-it-suite/src/test/resources/bootstrap/pom.xml
@@ -49,6 +49,7 @@ under the License.
     <module>group-10</module>
     <module>group-11</module>
     <module>group-12</module>
+    <module>group-13</module>
   </modules>
 
   <properties>
diff --git a/core-it-suite/src/test/resources/mng-1021/pom.xml b/core-it-suite/src/test/resources/mng-1021/pom.xml
index 1c30c47..347cf79 100644
--- a/core-it-suite/src/test/resources/mng-1021/pom.xml
+++ b/core-it-suite/src/test/resources/mng-1021/pom.xml
@@ -24,7 +24,7 @@ under the License.
 
   <groupId>org.apache.maven.its.mng1021</groupId>
   <artifactId>test</artifactId>
-  <version>SNAPSHOT</version>
+  <version>1-SNAPSHOT</version>
 
   <name>Maven Integration Test :: MNG-1021</name>
   <description>
diff --git a/core-it-suite/src/test/resources/mng-3259/module1/pom.xml b/core-it-suite/src/test/resources/mng-3259/module1/pom.xml
index 13de0d5..8b20132 100644
--- a/core-it-suite/src/test/resources/mng-3259/module1/pom.xml
+++ b/core-it-suite/src/test/resources/mng-3259/module1/pom.xml
@@ -7,7 +7,7 @@
 	<parent>
 	    <groupId>org.codehaus.jira.mng.XXX</groupId>
     	<artifactId>parent</artifactId>
-	    <version>SNAPSHOT</version>
+	    <version>1-SNAPSHOT</version>
 	</parent>	
 	
     <modelVersion>4.0.0</modelVersion>
diff --git a/core-it-suite/src/test/resources/mng-3259/module2/pom.xml b/core-it-suite/src/test/resources/mng-3259/module2/pom.xml
index 052dffd..72ce2bd 100644
--- a/core-it-suite/src/test/resources/mng-3259/module2/pom.xml
+++ b/core-it-suite/src/test/resources/mng-3259/module2/pom.xml
@@ -7,7 +7,7 @@
 	<parent>
 	    <groupId>org.codehaus.jira.mng.XXX</groupId>
     	<artifactId>parent</artifactId>
-	    <version>SNAPSHOT</version>
+	    <version>1-SNAPSHOT</version>
 	</parent>	
 	
     <modelVersion>4.0.0</modelVersion>
diff --git a/core-it-suite/src/test/resources/mng-3259/module3/pom.xml b/core-it-suite/src/test/resources/mng-3259/module3/pom.xml
index 7b6f74a..acfcb0b 100644
--- a/core-it-suite/src/test/resources/mng-3259/module3/pom.xml
+++ b/core-it-suite/src/test/resources/mng-3259/module3/pom.xml
@@ -7,7 +7,7 @@
 	<parent>
 	    <groupId>org.codehaus.jira.mng.XXX</groupId>
     	<artifactId>parent</artifactId>
-	    <version>SNAPSHOT</version>
+	    <version>1-SNAPSHOT</version>
 	</parent>	
 	
     <modelVersion>4.0.0</modelVersion>
diff --git a/core-it-suite/src/test/resources/mng-3259/module4/pom.xml b/core-it-suite/src/test/resources/mng-3259/module4/pom.xml
index 2a0cb1e..259f37c 100644
--- a/core-it-suite/src/test/resources/mng-3259/module4/pom.xml
+++ b/core-it-suite/src/test/resources/mng-3259/module4/pom.xml
@@ -7,7 +7,7 @@
 	<parent>
 	    <groupId>org.codehaus.jira.mng.XXX</groupId>
     	<artifactId>parent</artifactId>
-	    <version>SNAPSHOT</version>
+	    <version>1-SNAPSHOT</version>
 	</parent>	
 	
     <modelVersion>4.0.0</modelVersion>
diff --git a/core-it-suite/src/test/resources/mng-3259/module5/pom.xml b/core-it-suite/src/test/resources/mng-3259/module5/pom.xml
index c8546d5..f7020d2 100644
--- a/core-it-suite/src/test/resources/mng-3259/module5/pom.xml
+++ b/core-it-suite/src/test/resources/mng-3259/module5/pom.xml
@@ -7,7 +7,7 @@
 	<parent>
 	    <groupId>org.codehaus.jira.mng.XXX</groupId>
     	<artifactId>parent</artifactId>
-	    <version>SNAPSHOT</version>
+	    <version>1-SNAPSHOT</version>
 	</parent>	
 	
     <modelVersion>4.0.0</modelVersion>
diff --git a/core-it-suite/src/test/resources/mng-3259/parent/pom.xml b/core-it-suite/src/test/resources/mng-3259/parent/pom.xml
index 4005796..068f7f7 100644
--- a/core-it-suite/src/test/resources/mng-3259/parent/pom.xml
+++ b/core-it-suite/src/test/resources/mng-3259/parent/pom.xml
@@ -9,7 +9,7 @@
     <artifactId>parent</artifactId>
     <packaging>pom</packaging>
     <name>Parent POM for issue</name>
-    <version>SNAPSHOT</version>
+    <version>1-SNAPSHOT</version>
     <inceptionYear>2007</inceptionYear>
 
 	<build>
diff --git a/core-it-suite/src/test/resources/mng-3259/pom.xml b/core-it-suite/src/test/resources/mng-3259/pom.xml
index baa3070..bb17a50 100644
--- a/core-it-suite/src/test/resources/mng-3259/pom.xml
+++ b/core-it-suite/src/test/resources/mng-3259/pom.xml
@@ -9,7 +9,7 @@
     <artifactId>builder</artifactId>
     <packaging>pom</packaging>
     <name>Builder POM for issue XXX</name>
-    <version>SNAPSHOT</version>
+    <version>1-SNAPSHOT</version>
     <inceptionYear>2007</inceptionYear>
 
     <modules>