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 2022/07/21 20:43:03 UTC

[maven-integration-testing] 01/01: [MNG-7020] Remove Maven 2 WagonExcluder backward compat code

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

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

commit 2381f284e85254e9d4849ab3852a509d56ec1bc4
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Fri Nov 13 23:29:19 2020 +0100

    [MNG-7020] Remove Maven 2 WagonExcluder backward compat code
    
    * Disable unused tests
    * Update Maven 2 plugins to Maven 3 to avoid conflicts with old Maven
      and Wagon 1
    
    This closes #78
---
 core-it-suite/pom.xml                              |  2 +-
 .../it/MavenITmng3652UserAgentHeaderTest.java      | 63 ++++------------------
 ...528ExcludeWagonsFromMavenCoreArtifactsTest.java |  2 +-
 .../maven/it/MavenITmng5669ReadPomsOnce.java       | 12 ++---
 .../src/test/resources-filtered/bootstrap.txt      |  1 +
 .../src/test/resources/mng-3599-mk2/pom.xml        | 11 +++-
 core-it-suite/src/test/resources/mng-3599/pom.xml  |  2 +-
 .../test/resources/mng-3652/test-plugin/pom.xml    |  8 +--
 .../test/resources/mng-3652/test-project/pom.xml   |  2 +-
 .../test/resources/mng-5669-read-poms-once/pom.xml | 10 ++--
 .../mng-7470-resolver-transport/project/pom.xml    |  5 ++
 11 files changed, 45 insertions(+), 73 deletions(-)

diff --git a/core-it-suite/pom.xml b/core-it-suite/pom.xml
index cdb95f9c7..3e225ee7b 100644
--- a/core-it-suite/pom.xml
+++ b/core-it-suite/pom.xml
@@ -234,7 +234,7 @@ under the License.
         <dependency>
           <groupId>org.apache.maven.wagon</groupId>
           <artifactId>wagon-webdav-jackrabbit</artifactId>
-          <version>2.0</version>
+          <version>3.0.0</version>
           <scope>test</scope>
         </dependency>
         <dependency>
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3652UserAgentHeaderTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3652UserAgentHeaderTest.java
index d6cb804e2..3642c927e 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3652UserAgentHeaderTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3652UserAgentHeaderTest.java
@@ -48,7 +48,7 @@ public class MavenITmng3652UserAgentHeaderTest
 
     public MavenITmng3652UserAgentHeaderTest()
     {
-        super( "[2.1.0-M1,3.0-alpha-1),[3.0-beta-3,)" ); // 2.1.0-M1+
+        super( "[3.0-beta-3,)" );
     }
 
     @Override
@@ -139,21 +139,13 @@ public class MavenITmng3652UserAgentHeaderTest
         // NOTE: system property for maven.version may not exist if you use -Dtest
         // surefire parameter to run this single test. Therefore, the plugin writes
         // the maven version into the check file.
-        String mavenVersion = getMavenUAVersion( lines.get( 0 ) );
+        String mavenVersion = lines.get( 0 );
         String javaVersion = lines.get( 1 );
         String os = lines.get( 2 ) + " " + lines.get( 3 );
         String artifactVersion = lines.get( 4 );
 
-        if ( matchesVersionRange( "(,3.0-beta-3)" ) )
-        {
-            assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
-                + javaVersion + "; " + os + ")" + " maven-artifact/" + artifactVersion, userAgent );
-        }
-        else
-        {
-            assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
-                + javaVersion + "; " + os + ")", userAgent );
-        }
+        assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+            + javaVersion + "; " + os + ")", userAgent );
     }
 
     public void testmng3652_UnConfiguredDAV()
@@ -188,7 +180,7 @@ public class MavenITmng3652UserAgentHeaderTest
         // NOTE: system property for maven.version may not exist if you use -Dtest
         // surefire parameter to run this single test. Therefore, the plugin writes
         // the maven version into the check file.
-        String mavenVersion = getMavenUAVersion( lines.get( 0 ) );
+        String mavenVersion = lines.get( 0 );
         String javaVersion = lines.get( 1 );
         String os = lines.get( 2 ) + " " + lines.get( 3 );
         String artifactVersion = lines.get( 4 );
@@ -196,16 +188,8 @@ public class MavenITmng3652UserAgentHeaderTest
         String userAgent = this.userAgent;
         assertNotNull( userAgent );
 
-        if ( matchesVersionRange( "(,3.0-beta-3)" ) )
-        {
-            assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
-                + javaVersion + "; " + os + ")" + " maven-artifact/" + artifactVersion, userAgent );
-        }
-        else
-        {
-            assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
-                + javaVersion + "; " + os + ")", userAgent );
-        }
+        assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+            + javaVersion + "; " + os + ")", userAgent );
     }
 
     public void testmng3652_ConfigurationInSettingsWithoutUserAgent()
@@ -242,7 +226,7 @@ public class MavenITmng3652UserAgentHeaderTest
         // NOTE: system property for maven.version may not exist if you use -Dtest
         // surefire parameter to run this single test. Therefore, the plugin writes
         // the maven version into the check file.
-        String mavenVersion = getMavenUAVersion( lines.get( 0 ) );
+        String mavenVersion = lines.get( 0 );
         String javaVersion = lines.get( 1 );
         String os = lines.get( 2 ) + " " + lines.get( 3 );
         String artifactVersion = lines.get( 4 );
@@ -250,25 +234,13 @@ public class MavenITmng3652UserAgentHeaderTest
         String userAgent = this.userAgent;
         assertNotNull( userAgent );
 
-        if ( matchesVersionRange( "(,3.0-beta-3)" ) )
-        {
-            assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
-                + javaVersion + "; " + os + ")" + " maven-artifact/" + artifactVersion, userAgent );
-        }
-        else
-        {
-            assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
-                + javaVersion + "; " + os + ")", userAgent );
-        }
+        assertEquals( "Comparing User-Agent '" + userAgent + "'", "Apache-Maven/" + mavenVersion + " (Java "
+            + javaVersion + "; " + os + ")", userAgent );
     }
 
     public void testmng3652_UserAgentConfiguredInSettings()
         throws Exception
     {
-        // customizing version not supported in Maven 3
-        //requiresMavenVersion( "(,3.0-beta-3)" );
-        requiresMavenVersion("[2.1.0-M1,3.0-alpha-1),[3.0-beta-3,)");
-
         File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3652" );
         File pluginDir = new File( testDir, "test-plugin" );
         File projectDir = new File( testDir, "test-project" );
@@ -302,9 +274,6 @@ public class MavenITmng3652UserAgentHeaderTest
     public void testmng3652_AdditionalHttpHeaderConfiguredInSettings()
         throws Exception
     {
-        // customizing version not supported in Maven 3
-        requiresMavenVersion("[2.1.0-M1,3.0-alpha-1),[3.0-beta-3,)");
-
         File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3652" );
         File pluginDir = new File( testDir, "test-plugin" );
         File projectDir = new File( testDir, "test-project" );
@@ -335,16 +304,4 @@ public class MavenITmng3652UserAgentHeaderTest
         assertEquals( "My wonderful header", customHeader );
     }
 
-    private String getMavenUAVersion( String mavenVersion )
-    {
-        if ( matchesVersionRange( "(,3.0-beta-3)" ) )
-        {
-            return mavenVersion.substring( 0, 3 );
-        }
-        else
-        {
-            // Maven 3 returns the whole version
-            return mavenVersion;
-        }
-    }
 }
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest.java
index b8038ab27..94fc57544 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest.java
@@ -37,7 +37,7 @@ public class MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest
 
     public MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest()
     {
-        super( "[2.0.5,3.0-alpha-1),[3.0-alpha-7,)" );
+        super( "[2.0.5,3.0-alpha-1),[3.0-alpha-7,3.9.0)" );
     }
 
     /**
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java
index de432d599..cbcd46c03 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5669ReadPomsOnce.java
@@ -74,10 +74,10 @@ public class MavenITmng5669ReadPomsOnce
                 break;
             }
         }
-        assertEquals( logTxt.toString(), 168, logTxt.size() );
+        assertEquals( logTxt.toString(), 202, logTxt.size() );
 
         // analyze lines. It is a Hashmap, so we can't rely on the order
-        Set<String> uniqueBuildingSources = new HashSet<>( 168 );
+        Set<String> uniqueBuildingSources = new HashSet<>( 202 );
         final String buildSourceKey = "org.apache.maven.model.building.source=";
         final int keyLength = buildSourceKey.length();
         for ( String line : logTxt )
@@ -95,7 +95,7 @@ public class MavenITmng5669ReadPomsOnce
             }
             uniqueBuildingSources.add( line.substring( start + keyLength, end ) );
         }
-        assertEquals( uniqueBuildingSources.size(), 167 /* is 168 minus superpom */ );
+        assertEquals( uniqueBuildingSources.size(), 201 /* is 202 minus superpom */ );
     }
 
     public void testWithBuildConsumer()
@@ -128,11 +128,11 @@ public class MavenITmng5669ReadPomsOnce
                 break;
             }
         }
-        assertEquals( logTxt.toString(), 168 + 4 /* reactor poms are read twice: file + raw (=XMLFilters) */,
+        assertEquals( logTxt.toString(), 202 + 4 /* reactor poms are read twice: file + raw (=XMLFilters) */,
                       logTxt.size() );
 
         // analyze lines. It is a Hashmap, so we can't rely on the order
-        Set<String> uniqueBuildingSources = new HashSet<>( 168 );
+        Set<String> uniqueBuildingSources = new HashSet<>( 202 );
         final String buildSourceKey = "org.apache.maven.model.building.source=";
         final int keyLength = buildSourceKey.length();
         for ( String line : logTxt )
@@ -150,7 +150,7 @@ public class MavenITmng5669ReadPomsOnce
             }
             uniqueBuildingSources.add( line.substring( start + keyLength, end ) );
         }
-        assertEquals( uniqueBuildingSources.size(), 167 /* is 168 minus superpom */ );
+        assertEquals( uniqueBuildingSources.size(), 201 /* is 202 minus superpom */ );
     }
 
 }
diff --git a/core-it-suite/src/test/resources-filtered/bootstrap.txt b/core-it-suite/src/test/resources-filtered/bootstrap.txt
index 851152a86..adc695fe4 100644
--- a/core-it-suite/src/test/resources-filtered/bootstrap.txt
+++ b/core-it-suite/src/test/resources-filtered/bootstrap.txt
@@ -70,6 +70,7 @@ org.apache.maven.plugins:maven-compiler-plugin:${stubPluginVersion}
 org.apache.maven.plugins:maven-compiler-plugin:2.0.2
 org.apache.maven.plugins:maven-compiler-plugin:3.1
 org.apache.maven.plugins:maven-compiler-plugin:3.8.1
+org.apache.maven.plugins:maven-compiler-plugin:3.10.1
 org.apache.maven.plugins:maven-dependency-plugin:2.7
 org.apache.maven.plugins:maven-dependency-plugin:2.8
 org.apache.maven.plugins:maven-deploy-plugin:${stubPluginVersion}
diff --git a/core-it-suite/src/test/resources/mng-3599-mk2/pom.xml b/core-it-suite/src/test/resources/mng-3599-mk2/pom.xml
index 693733940..441702638 100644
--- a/core-it-suite/src/test/resources/mng-3599-mk2/pom.xml
+++ b/core-it-suite/src/test/resources/mng-3599-mk2/pom.xml
@@ -15,9 +15,18 @@
       <extension>
         <groupId>org.apache.maven.wagon</groupId>
         <artifactId>wagon-webdav-jackrabbit</artifactId>
-        <version>2.10</version>
+        <version>3.0.0</version>
       </extension>
     </extensions>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.10.1</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
   </build>
 </project>
 
diff --git a/core-it-suite/src/test/resources/mng-3599/pom.xml b/core-it-suite/src/test/resources/mng-3599/pom.xml
index 779cbc865..98f6103ef 100644
--- a/core-it-suite/src/test/resources/mng-3599/pom.xml
+++ b/core-it-suite/src/test/resources/mng-3599/pom.xml
@@ -15,7 +15,7 @@
       <extension>
         <groupId>org.apache.maven.wagon</groupId>
         <artifactId>wagon-webdav-jackrabbit</artifactId>
-        <version>2.0</version>
+        <version>3.0.0</version>
       </extension>
     </extensions>
   </build>
diff --git a/core-it-suite/src/test/resources/mng-3652/test-plugin/pom.xml b/core-it-suite/src/test/resources/mng-3652/test-plugin/pom.xml
index 3fa623c0c..3206281c7 100644
--- a/core-it-suite/src/test/resources/mng-3652/test-plugin/pom.xml
+++ b/core-it-suite/src/test/resources/mng-3652/test-plugin/pom.xml
@@ -10,13 +10,13 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact-manager</artifactId>
-      <version>2.0.9</version>
+      <artifactId>maven-compat</artifactId>
+      <version>3.0-beta-3</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-plugin-api</artifactId>
-      <version>2.0</version>
+      <version>3.0-beta-3</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>
@@ -27,7 +27,7 @@
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-core</artifactId>
-      <version>2.0.9</version>
+      <version>3.0-beta-3</version>
     </dependency>
   </dependencies>
 </project>
diff --git a/core-it-suite/src/test/resources/mng-3652/test-project/pom.xml b/core-it-suite/src/test/resources/mng-3652/test-project/pom.xml
index f07a5dd7f..6e5ded482 100644
--- a/core-it-suite/src/test/resources/mng-3652/test-project/pom.xml
+++ b/core-it-suite/src/test/resources/mng-3652/test-project/pom.xml
@@ -25,7 +25,7 @@
       <extension>
         <groupId>org.apache.maven.wagon</groupId>
         <artifactId>wagon-webdav-jackrabbit</artifactId>
-        <version>2.0</version>
+        <version>3.0.0</version>
       </extension>
     </extensions>
   </build>
diff --git a/core-it-suite/src/test/resources/mng-5669-read-poms-once/pom.xml b/core-it-suite/src/test/resources/mng-5669-read-poms-once/pom.xml
index 77013251a..8b41e0b6a 100644
--- a/core-it-suite/src/test/resources/mng-5669-read-poms-once/pom.xml
+++ b/core-it-suite/src/test/resources/mng-5669-read-poms-once/pom.xml
@@ -39,25 +39,25 @@ under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-resources-plugin</artifactId>
-          <version>2.6</version>
+          <version>3.2.0</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
-          <version>3.1</version>
+          <version>3.10.1</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.12.4</version>
+          <version>3.0.0-M5</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-jar-plugin</artifactId>
-          <version>2.4</version>
+          <version>3.2.0</version>
         </plugin>
       </plugins>
     </pluginManagement>
   </build>
 
-</project>
\ No newline at end of file
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7470-resolver-transport/project/pom.xml b/core-it-suite/src/test/resources/mng-7470-resolver-transport/project/pom.xml
index 9759c899b..c9dbca26b 100644
--- a/core-it-suite/src/test/resources/mng-7470-resolver-transport/project/pom.xml
+++ b/core-it-suite/src/test/resources/mng-7470-resolver-transport/project/pom.xml
@@ -34,6 +34,11 @@ under the License.
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.10.1</version>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.resolver</groupId>
         <artifactId>resolver-demo-maven-plugin</artifactId>