aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-maven
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-maven')
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/pom.xml5
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java15
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-repository/pom.xml10
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/metadata/MetadataToolsTest.java19
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java5
5 files changed, 42 insertions, 12 deletions
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/pom.xml b/archiva-modules/archiva-maven/archiva-maven-proxy/pom.xml
index 9c4599f2b..657cd0f47 100644
--- a/archiva-modules/archiva-maven/archiva-maven-proxy/pom.xml
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/pom.xml
@@ -79,6 +79,11 @@
<!-- Test scope -->
<dependency>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java
index 9a4934269..f12a966d0 100644
--- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/MetadataTransferTest.java
@@ -39,10 +39,13 @@ import org.apache.archiva.repository.storage.FilesystemStorage;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.wagon.TransferFailedException;
-import org.custommonkey.xmlunit.DetailedDiff;
-import org.custommonkey.xmlunit.Diff;
import org.easymock.EasyMock;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xmlunit.builder.DiffBuilder;
+import org.xmlunit.diff.Diff;
+import org.xmlunit.diff.Difference;
import javax.inject.Inject;
import javax.inject.Named;
@@ -1098,9 +1101,13 @@ public class MetadataTransferTest
ArchivaRepositoryMetadata metadata = MavenMetadataReader.read( actualFileAsset );
RepositoryMetadataWriter.write( metadata, actualContents );
- DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadataXml, actualContents.toString() ) );
- if ( !detailedDiff.similar() )
+ Diff detailedDiff = DiffBuilder.compare( expectedMetadataXml).withTest( actualContents.toString() ).checkForSimilar().build();
+ if ( detailedDiff.hasDifferences() )
{
+ for ( Difference diff : detailedDiff.getDifferences() )
+ {
+ System.out.println( diff );
+ }
assertEquals( expectedMetadataXml, actualContents );
}
diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/pom.xml b/archiva-modules/archiva-maven/archiva-maven-repository/pom.xml
index dac8aff5b..94d7e7f9a 100644
--- a/archiva-modules/archiva-maven/archiva-maven-repository/pom.xml
+++ b/archiva-modules/archiva-maven/archiva-maven-repository/pom.xml
@@ -152,6 +152,16 @@
<!-- Test scope -->
<dependency>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-assertj</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/metadata/MetadataToolsTest.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/metadata/MetadataToolsTest.java
index e39a3dc69..b9b09db20 100644
--- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/metadata/MetadataToolsTest.java
+++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/metadata/MetadataToolsTest.java
@@ -37,11 +37,12 @@ import org.apache.archiva.repository.metadata.base.MetadataTools;
import org.apache.archiva.repository.maven2.MavenManagedRepository;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
-import org.custommonkey.xmlunit.DetailedDiff;
-import org.custommonkey.xmlunit.Diff;
import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;
import org.xml.sax.SAXException;
+import org.xmlunit.builder.DiffBuilder;
+import org.xmlunit.diff.Diff;
+import org.xmlunit.diff.Difference;
import javax.inject.Inject;
import javax.inject.Named;
@@ -397,9 +398,12 @@ public class MetadataToolsTest
Path metadataFile = Paths.get( repository.getRepoRoot(), tools.toPath( reference ) );
String actualMetadata = org.apache.archiva.common.utils.FileUtils.readFileToString( metadataFile, Charset.defaultCharset() );
- DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadata, actualMetadata ) );
- if ( !detailedDiff.similar() )
+ Diff detailedDiff = DiffBuilder.compare( expectedMetadata ).withTest( actualMetadata ).checkForSimilar().build();
+ if ( detailedDiff.hasDifferences() )
{
+ for ( Difference diff : detailedDiff.getDifferences() ) {
+ System.out.println( diff );
+ }
// If it isn't similar, dump the difference.
assertEquals( expectedMetadata, actualMetadata );
}
@@ -412,9 +416,12 @@ public class MetadataToolsTest
Path metadataFile = Paths.get( repository.getRepoRoot(), tools.toPath( reference ) );
String actualMetadata = org.apache.archiva.common.utils.FileUtils.readFileToString( metadataFile, Charset.defaultCharset() );
- DetailedDiff detailedDiff = new DetailedDiff( new Diff( expectedMetadata, actualMetadata ) );
- if ( !detailedDiff.similar() )
+ Diff detailedDiff = DiffBuilder.compare( expectedMetadata ).withTest( actualMetadata ).checkForSimilar().build();
+ if ( detailedDiff.hasDifferences() )
{
+ for ( Difference diff : detailedDiff.getDifferences() ) {
+ System.out.println( diff );
+ }
// If it isn't similar, dump the difference.
assertEquals( expectedMetadata, actualMetadata );
}
diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java
index 304adf2ef..55936edd3 100644
--- a/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java
+++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/test/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriterTest.java
@@ -23,7 +23,6 @@ import junit.framework.TestCase;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.repository.metadata.base.RepositoryMetadataWriter;
import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
-import org.custommonkey.xmlunit.XMLAssert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -32,6 +31,8 @@ import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;
+import org.xmlunit.assertj.XmlAssert;
+
/**
* RepositoryMetadataWriterTest
*/
@@ -61,6 +62,6 @@ public class RepositoryMetadataWriterTest
StringWriter actual = new StringWriter();
RepositoryMetadataWriter.write( metadata, actual );
- XMLAssert.assertXMLEqual( "XML Contents", expectedContent, actual.toString() );
+ XmlAssert.assertThat( actual.toString() ).and( expectedContent ).areIdentical();
}
}