You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2021/10/04 10:24:53 UTC

[maven-integration-testing] 01/01: Fix for MavenITmng6656BuildConsumer

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

cstamas pushed a commit to branch fix-MavenITmng6656BuildConsumer
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git

commit 587c7ad7d336dca178e03075a112a98a96aa1e40
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Mon Oct 4 12:23:58 2021 +0200

    Fix for MavenITmng6656BuildConsumer
    
    Instead to compare POMs as "string blobs" (so along with all line-ending),
    it should go for pure content instead, as it makes IT more
    resilient to environment related issues.
---
 .../maven/it/MavenITmng6656BuildConsumer.java      | 27 ++++++++++++++--------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6656BuildConsumer.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6656BuildConsumer.java
index 6086e5c..d2ed090 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6656BuildConsumer.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6656BuildConsumer.java
@@ -24,6 +24,8 @@ import org.apache.maven.shared.utils.io.FileUtils;
 
 import java.io.File;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * With the build-consumer the pom.xml will be adjusted during the process.
@@ -71,21 +73,26 @@ public class MavenITmng6656BuildConsumer
         verifier.setAutoclean( false );
         verifier.addCliOption( "-Dchangelist=MNG6656" );
 
-        verifier.executeGoals( Arrays.asList( "install" ) );
+        verifier.executeGoals( Collections.singletonList("install") );
         verifier.verifyErrorFreeLog();
 
-        String content;
-        content = FileUtils.fileRead( new File( testDir, "expected/parent.pom") );
-        verifier.assertArtifactContents( "org.sonatype.mavenbook.multi", "parent", "0.9-MNG6656-SNAPSHOT", "pom", content );
+        List<String> generated;
+        List<String> expected;
+        generated = FileUtils.loadFile( new File( testDir, "expected/parent.pom") );
+        expected = FileUtils.loadFile( new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "parent", "0.9-MNG6656-SNAPSHOT", "pom" ) ) );
+        assertEquals( expected, generated );
 
-        content = FileUtils.fileRead( new File( testDir, "expected/simple-parent.pom") );
-        verifier.assertArtifactContents( "org.sonatype.mavenbook.multi", "simple-parent", "0.9-MNG6656-SNAPSHOT", "pom", content );
+        generated = FileUtils.loadFile( new File( testDir, "expected/simple-parent.pom") );
+        expected = FileUtils.loadFile( new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "simple-parent", "0.9-MNG6656-SNAPSHOT", "pom" ) ) );
+        assertEquals( expected, generated );
 
-        content = FileUtils.fileRead( new File( testDir, "expected/simple-weather.pom") );
-        verifier.assertArtifactContents( "org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6656-SNAPSHOT", "pom", content );
+        generated = FileUtils.loadFile( new File( testDir, "expected/simple-weather.pom") );
+        expected = FileUtils.loadFile( new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "simple-weather", "0.9-MNG6656-SNAPSHOT", "pom" ) ) );
+        assertEquals( expected, generated );
 
-        content = FileUtils.fileRead( new File( testDir, "expected/simple-webapp.pom") );
-        verifier.assertArtifactContents( "org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6656-SNAPSHOT", "pom", content );
+        generated = FileUtils.loadFile( new File( testDir, "expected/simple-webapp.pom") );
+        expected = FileUtils.loadFile( new File( verifier.getArtifactPath( "org.sonatype.mavenbook.multi", "simple-webapp", "0.9-MNG6656-SNAPSHOT", "pom" ) ) );
+        assertEquals( expected, generated );
     }
 
 }