Build against XMLUnit 2
This commit is contained in:
parent
573b350678
commit
552c6341de
@ -1,252 +0,0 @@
|
|||||||
From 4145b42a37b2b8ad87cfc464f62d7aace1b33ebf Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
|
||||||
Date: Sat, 13 Apr 2019 17:07:44 +0200
|
|
||||||
Subject: [PATCH 4/4] Revert "[MNG-6479] Upgrade XMLUnit to 2.2.1 (#183)"
|
|
||||||
|
|
||||||
This reverts commit 91fa89ea2876448bf73b47763d43307149601749.
|
|
||||||
---
|
|
||||||
maven-model-builder/pom.xml | 10 +--
|
|
||||||
.../DefaultInheritanceAssemblerTest.java | 66 +++++++++++--------
|
|
||||||
.../plugin-configuration-expected.xml | 2 +-
|
|
||||||
pom.xml | 13 ----
|
|
||||||
4 files changed, 43 insertions(+), 48 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/maven-model-builder/pom.xml b/maven-model-builder/pom.xml
|
|
||||||
index 9b4f87027..9404d2524 100644
|
|
||||||
--- a/maven-model-builder/pom.xml
|
|
||||||
+++ b/maven-model-builder/pom.xml
|
|
||||||
@@ -71,13 +71,9 @@ under the License.
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
- <groupId>org.xmlunit</groupId>
|
|
||||||
- <artifactId>xmlunit-core</artifactId>
|
|
||||||
- <scope>test</scope>
|
|
||||||
- </dependency>
|
|
||||||
- <dependency>
|
|
||||||
- <groupId>org.xmlunit</groupId>
|
|
||||||
- <artifactId>xmlunit-matchers</artifactId>
|
|
||||||
+ <groupId>xmlunit</groupId>
|
|
||||||
+ <artifactId>xmlunit</artifactId>
|
|
||||||
+ <version>1.6</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
|
|
||||||
index 07a121ae5..dce6c0123 100644
|
|
||||||
--- a/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
|
|
||||||
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
|
|
||||||
@@ -21,16 +21,21 @@
|
|
||||||
|
|
||||||
import org.apache.maven.model.Model;
|
|
||||||
import org.apache.maven.model.building.SimpleProblemCollector;
|
|
||||||
+import org.apache.maven.model.io.ModelParseException;
|
|
||||||
import org.apache.maven.model.io.ModelReader;
|
|
||||||
import org.apache.maven.model.io.ModelWriter;
|
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
|
||||||
+import org.custommonkey.xmlunit.XMLAssert;
|
|
||||||
+import org.custommonkey.xmlunit.XMLUnit;
|
|
||||||
|
|
||||||
-import org.xmlunit.matchers.CompareMatcher;
|
|
||||||
+import junit.framework.AssertionFailedError;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
+import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
-
|
|
||||||
-import static org.junit.Assert.assertThat;
|
|
||||||
+import java.io.InputStreamReader;
|
|
||||||
+import java.io.Reader;
|
|
||||||
+import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Hervé Boutemy
|
|
||||||
@@ -61,7 +66,7 @@ private File getPom( String name )
|
|
||||||
}
|
|
||||||
|
|
||||||
private Model getModel( String name )
|
|
||||||
- throws IOException
|
|
||||||
+ throws ModelParseException, IOException
|
|
||||||
{
|
|
||||||
return reader.read( getPom( name ), null );
|
|
||||||
}
|
|
||||||
@@ -75,7 +80,7 @@ public void testPluginConfiguration()
|
|
||||||
/**
|
|
||||||
* Check most classical urls inheritance: directory structure where parent POM in parent directory
|
|
||||||
* and child directory == artifactId
|
|
||||||
- * @throws IOException Model read problem
|
|
||||||
+ * @throws Exception
|
|
||||||
*/
|
|
||||||
public void testUrls()
|
|
||||||
throws Exception
|
|
||||||
@@ -85,10 +90,10 @@ public void testUrls()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flat directory structure: parent & child POMs in sibling directories, child directory == artifactId.
|
|
||||||
- * @throws IOException Model read problem
|
|
||||||
+ * @throws Exception
|
|
||||||
*/
|
|
||||||
public void testFlatUrls()
|
|
||||||
- throws IOException
|
|
||||||
+ throws Exception
|
|
||||||
{
|
|
||||||
testInheritance( "flat-urls" );
|
|
||||||
}
|
|
||||||
@@ -127,10 +132,10 @@ public void testNoAppendUrls3()
|
|
||||||
* Tricky case: flat directory structure, but child directory != artifactId.
|
|
||||||
* Model interpolation does not give same result when calculated from build or from repo...
|
|
||||||
* This is why MNG-5000 fix in code is marked as bad practice (uses file names)
|
|
||||||
- * @throws IOException Model read problem
|
|
||||||
+ * @throws Exception
|
|
||||||
*/
|
|
||||||
public void testFlatTrickyUrls()
|
|
||||||
- throws IOException
|
|
||||||
+ throws Exception
|
|
||||||
{
|
|
||||||
// parent references child with artifactId (which is not directory name)
|
|
||||||
// then relative path calculation will fail during build from disk but success when calculated from repo
|
|
||||||
@@ -140,49 +145,46 @@ public void testFlatTrickyUrls()
|
|
||||||
testInheritance( "tricky-flat-artifactId-urls", false );
|
|
||||||
//fail( "should have failed since module reference == artifactId != directory name" );
|
|
||||||
}
|
|
||||||
- catch ( AssertionError afe )
|
|
||||||
+ catch ( AssertionFailedError afe )
|
|
||||||
{
|
|
||||||
// expected failure: wrong relative path calculation
|
|
||||||
assertTrue( afe.getMessage(),
|
|
||||||
- afe.getMessage().contains(
|
|
||||||
- "Expected text value 'http://www.apache.org/path/to/parent/child-artifact-id/' but was " +
|
|
||||||
- "'http://www.apache.org/path/to/parent/../child-artifact-id/'" ) );
|
|
||||||
+ afe.getMessage().contains( "http://www.apache.org/path/to/parent/child-artifact-id/" ) );
|
|
||||||
}
|
|
||||||
// but ok from repo: local disk is ignored
|
|
||||||
testInheritance( "tricky-flat-artifactId-urls", true );
|
|
||||||
|
|
||||||
// parent references child with directory name (which is not artifact id)
|
|
||||||
- // then relative path calculation will success during build from disk but fail when calculated from repo
|
|
||||||
+ // then relative path calculation will success during build from disk but failwhen calculated from repo
|
|
||||||
testInheritance( "tricky-flat-directory-urls", false );
|
|
||||||
try
|
|
||||||
{
|
|
||||||
testInheritance( "tricky-flat-directory-urls", true );
|
|
||||||
fail( "should have failed since module reference == directory name != artifactId" );
|
|
||||||
}
|
|
||||||
- catch ( AssertionError afe )
|
|
||||||
+ catch ( AssertionFailedError afe )
|
|
||||||
{
|
|
||||||
// expected failure
|
|
||||||
- assertTrue( afe.getMessage(), afe.getMessage().contains(
|
|
||||||
- "Expected text value 'http://www.apache.org/path/to/parent/../child-artifact-id/' but was " +
|
|
||||||
- "'http://www.apache.org/path/to/parent/child-artifact-id/'" ) );
|
|
||||||
+ assertTrue( afe.getMessage(),
|
|
||||||
+ afe.getMessage().contains( "http://www.apache.org/path/to/parent/child-artifact-id/" ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testWithEmptyUrl()
|
|
||||||
- throws IOException
|
|
||||||
+ throws Exception
|
|
||||||
{
|
|
||||||
testInheritance( "empty-urls", false );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testInheritance( String baseName )
|
|
||||||
- throws IOException
|
|
||||||
+ throws Exception
|
|
||||||
{
|
|
||||||
testInheritance( baseName, false );
|
|
||||||
testInheritance( baseName, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testInheritance( String baseName, boolean fromRepo )
|
|
||||||
- throws IOException
|
|
||||||
+ throws Exception
|
|
||||||
{
|
|
||||||
Model parent = getModel( baseName + "-parent" );
|
|
||||||
|
|
||||||
@@ -207,12 +209,17 @@ public void testInheritance( String baseName, boolean fromRepo )
|
|
||||||
|
|
||||||
// check with getPom( baseName + "-expected" )
|
|
||||||
File expected = getPom( baseName + "-expected" );
|
|
||||||
-
|
|
||||||
- assertThat( actual, CompareMatcher.isIdenticalTo( expected ).ignoreComments().ignoreWhitespace() );
|
|
||||||
- }
|
|
||||||
+ try ( Reader control = new InputStreamReader( new FileInputStream( expected ), StandardCharsets.UTF_8 );
|
|
||||||
+ Reader test = new InputStreamReader( new FileInputStream( actual ), StandardCharsets.UTF_8 ) )
|
|
||||||
+ {
|
|
||||||
+ XMLUnit.setIgnoreComments( true );
|
|
||||||
+ XMLUnit.setIgnoreWhitespace( true );
|
|
||||||
+ XMLAssert.assertXMLEqual( control, test );
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
public void testModulePathNotArtifactId()
|
|
||||||
- throws IOException
|
|
||||||
+ throws Exception
|
|
||||||
{
|
|
||||||
Model parent = getModel( "module-path-not-artifactId-parent" );
|
|
||||||
|
|
||||||
@@ -228,7 +235,12 @@ public void testModulePathNotArtifactId()
|
|
||||||
|
|
||||||
// check with getPom( "module-path-not-artifactId-effective" )
|
|
||||||
File expected = getPom( "module-path-not-artifactId-expected" );
|
|
||||||
-
|
|
||||||
- assertThat( actual, CompareMatcher.isIdenticalTo(expected).ignoreComments().ignoreWhitespace() );
|
|
||||||
+ try ( Reader control = new InputStreamReader( new FileInputStream( expected ), StandardCharsets.UTF_8 );
|
|
||||||
+ Reader test = new InputStreamReader( new FileInputStream( actual ), StandardCharsets.UTF_8 ) )
|
|
||||||
+ {
|
|
||||||
+ XMLUnit.setIgnoreComments( true );
|
|
||||||
+ XMLUnit.setIgnoreWhitespace( true );
|
|
||||||
+ XMLAssert.assertXMLEqual( control, test );
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/maven-model-builder/src/test/resources/poms/inheritance/plugin-configuration-expected.xml b/maven-model-builder/src/test/resources/poms/inheritance/plugin-configuration-expected.xml
|
|
||||||
index 318ee4488..00a21f3dd 100644
|
|
||||||
--- a/maven-model-builder/src/test/resources/poms/inheritance/plugin-configuration-expected.xml
|
|
||||||
+++ b/maven-model-builder/src/test/resources/poms/inheritance/plugin-configuration-expected.xml
|
|
||||||
@@ -34,9 +34,9 @@ under the License.
|
|
||||||
<mailingLists>
|
|
||||||
<mailingList>
|
|
||||||
<name>parent</name>
|
|
||||||
+ <post>post@mailing.list.com</post>
|
|
||||||
<subscribe>subscribe@mailing.list.com</subscribe>
|
|
||||||
<unsubscribe>unsubscribe@mailing.list.com</unsubscribe>
|
|
||||||
- <post>post@mailing.list.com</post>
|
|
||||||
</mailingList>
|
|
||||||
</mailingLists>
|
|
||||||
|
|
||||||
diff --git a/pom.xml b/pom.xml
|
|
||||||
index 84fc037bc..2e7907137 100644
|
|
||||||
--- a/pom.xml
|
|
||||||
+++ b/pom.xml
|
|
||||||
@@ -66,7 +66,6 @@ under the License.
|
|
||||||
<jxpathVersion>1.3</jxpathVersion>
|
|
||||||
<resolverVersion>1.3.3</resolverVersion>
|
|
||||||
<slf4jVersion>1.7.25</slf4jVersion>
|
|
||||||
- <xmlunitVersion>2.2.1</xmlunitVersion>
|
|
||||||
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
|
|
||||||
<!-- Control the name of the distribution and information output by mvn -->
|
|
||||||
<distributionId>apache-maven</distributionId>
|
|
||||||
@@ -405,18 +404,6 @@ under the License.
|
|
||||||
<version>${mockitoVersion}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
- <dependency>
|
|
||||||
- <groupId>org.xmlunit</groupId>
|
|
||||||
- <artifactId>xmlunit-core</artifactId>
|
|
||||||
- <version>${xmlunitVersion}</version>
|
|
||||||
- <scope>test</scope>
|
|
||||||
- </dependency>
|
|
||||||
- <dependency>
|
|
||||||
- <groupId>org.xmlunit</groupId>
|
|
||||||
- <artifactId>xmlunit-matchers</artifactId>
|
|
||||||
- <version>${xmlunitVersion}</version>
|
|
||||||
- <scope>test</scope>
|
|
||||||
- </dependency>
|
|
||||||
</dependencies>
|
|
||||||
<!--bootstrap-start-comment-->
|
|
||||||
</dependencyManagement>
|
|
||||||
--
|
|
||||||
2.20.1
|
|
||||||
|
|
@ -23,8 +23,6 @@ Patch1: 0001-Adapt-mvn-script.patch
|
|||||||
Patch2: 0002-Invoke-logback-via-reflection.patch
|
Patch2: 0002-Invoke-logback-via-reflection.patch
|
||||||
# We don't have mockito 2 yet
|
# We don't have mockito 2 yet
|
||||||
Patch3: 0003-Revert-MNG-6335-Update-Mockito-to-2.12.0.patch
|
Patch3: 0003-Revert-MNG-6335-Update-Mockito-to-2.12.0.patch
|
||||||
# We don't have xmlunit 2 yet
|
|
||||||
Patch4: 0004-Revert-MNG-6479-Upgrade-XMLUnit-to-2.2.1-183.patch
|
|
||||||
|
|
||||||
BuildRequires: maven-local
|
BuildRequires: maven-local
|
||||||
BuildRequires: mvn(com.google.inject:guice::no_aop:)
|
BuildRequires: mvn(com.google.inject:guice::no_aop:)
|
||||||
@ -64,7 +62,7 @@ BuildRequires: mvn(org.slf4j:slf4j-api)
|
|||||||
BuildRequires: mvn(org.slf4j:slf4j-simple)
|
BuildRequires: mvn(org.slf4j:slf4j-simple)
|
||||||
BuildRequires: mvn(org.sonatype.plexus:plexus-cipher)
|
BuildRequires: mvn(org.sonatype.plexus:plexus-cipher)
|
||||||
BuildRequires: mvn(org.sonatype.plexus:plexus-sec-dispatcher)
|
BuildRequires: mvn(org.sonatype.plexus:plexus-sec-dispatcher)
|
||||||
BuildRequires: mvn(xmlunit:xmlunit) < 2
|
BuildRequires: mvn(xmlunit:xmlunit) >= 2
|
||||||
|
|
||||||
BuildRequires: slf4j-sources = %{bundled_slf4j_version}
|
BuildRequires: slf4j-sources = %{bundled_slf4j_version}
|
||||||
|
|
||||||
@ -157,7 +155,6 @@ Summary: API documentation for %{name}
|
|||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%patch4 -p1
|
|
||||||
|
|
||||||
# not really used during build, but a precaution
|
# not really used during build, but a precaution
|
||||||
find -name '*.jar' -not -path '*/test/*' -delete
|
find -name '*.jar' -not -path '*/test/*' -delete
|
||||||
|
Loading…
Reference in New Issue
Block a user