<scope>test</scope>
</dependency>
<dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
+ <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>
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.metadata.audit.RepositoryListener;
import org.apache.archiva.repository.metadata.base.MetadataTools;
-import org.custommonkey.xmlunit.XMLAssert;
import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;
+import org.xmlunit.assertj.XmlAssert;
import javax.inject.Inject;
import java.nio.charset.Charset;
String expectedVersions =
"<expected><versions><version>2.2</version>" + "<version>2.3</version></versions></expected>";
- XMLAssert.assertXpathEvaluatesTo( "2.3", "//metadata/versioning/release", metadataXml );
- XMLAssert.assertXpathEvaluatesTo( "2.3", "//metadata/versioning/latest", metadataXml );
- System.out.println(metadataXml);
- XMLAssert.assertXpathsEqual( "//expected/versions/version", expectedVersions,
- "//metadata/versioning/versions/version", metadataXml );
- XMLAssert.assertXpathEvaluatesTo( "20070315032817", "//metadata/versioning/lastUpdated", metadataXml );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/release" ).isEqualTo( "2.3" );
+ // XMLAssert.assertXpathEvaluatesTo( "2.3", "//metadata/versioning/release", metadataXml );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/latest" ).isEqualTo( "2.3" );
+ // XMLAssert.assertXpathEvaluatesTo( "2.3", "//metadata/versioning/latest", metadataXml );
+ XmlAssert.assertThat( metadataXml ).nodesByXPath( "//metadata/versioning/versions/version" ).hasSize( 2 );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/versions/version[1]" ).isEqualTo( "2.2" );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/versions/version[2]" ).isEqualTo( "2.3" );
+
+ // XMLAssert.assertXpathsEqual( "//expected/versions/version", expectedVersions,
+ // "//metadata/versioning/versions/version", metadataXml );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/lastUpdated" ).isEqualTo( "20070315032817" );
+ // XMLAssert.assertXpathEvaluatesTo( "20070315032817", "//metadata/versioning/lastUpdated", metadataXml );
}
@Test
String expectedVersions = "<expected><versions><version>2.0.3-SNAPSHOT</version>"
+ "<version>2.0.4-SNAPSHOT</version></versions></expected>";
- XMLAssert.assertXpathEvaluatesTo( "2.0.4-SNAPSHOT", "//metadata/versioning/latest", metadataXml );
- XMLAssert.assertXpathsEqual( "//expected/versions/version", expectedVersions,
- "//metadata/versioning/versions/version", metadataXml );
- XMLAssert.assertXpathEvaluatesTo( "20070427033345", "//metadata/versioning/lastUpdated", metadataXml );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/latest" ).isEqualTo( "2.0.4-SNAPSHOT" );
+ // XMLAssert.assertXpathEvaluatesTo( "2.0.4-SNAPSHOT", "//metadata/versioning/latest", metadataXml );
+ XmlAssert.assertThat( metadataXml ).nodesByXPath( "//metadata/versioning/versions/version" ).hasSize( 2 );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/versions/version[1]" ).isEqualTo( "2.0.3-SNAPSHOT" );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/versions/version[2]" ).isEqualTo( "2.0.4-SNAPSHOT" );
+ // XMLAssert.assertXpathsEqual( "//expected/versions/version", expectedVersions,
+ // "//metadata/versioning/versions/version", metadataXml );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/lastUpdated" ).isEqualTo( "20070427033345" );
+ // XMLAssert.assertXpathEvaluatesTo( "20070427033345", "//metadata/versioning/lastUpdated", metadataXml );
}
}
import org.apache.archiva.repository.base.ArchivaRepositoryRegistry;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.features.ArtifactCleanupFeature;
-import org.custommonkey.xmlunit.XMLAssert;
import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
+import org.xmlunit.assertj.XmlAssert;
import java.io.IOException;
import java.nio.charset.Charset;
String metadataXml = org.apache.archiva.common.utils.FileUtils.readFileToString( artifactMetadataFile, Charset.defaultCharset() );
- String expectedVersions = "<expected><versions><version>2.3-SNAPSHOT</version></versions></expected>";
-
- XMLAssert.assertXpathEvaluatesTo( "2.3-SNAPSHOT", "//metadata/versioning/latest", metadataXml );
- XMLAssert.assertXpathsEqual( "//expected/versions/version", expectedVersions,
- "//metadata/versioning/versions/version", metadataXml );
- XMLAssert.assertXpathEvaluatesTo( "20070315032817", "//metadata/versioning/lastUpdated", metadataXml );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/latest" ).isEqualTo( "2.3-SNAPSHOT" );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/versions/version" ).isEqualTo( "2.3-SNAPSHOT" );
+ XmlAssert.assertThat(metadataXml).valueByXPath("//metadata/versioning/lastUpdated").isEqualTo ( "20070315032817" );
removeRepoFromConfiguration( "retention-count", repoConfiguration );
}
String expectedVersions =
"<expected><versions><version>2.2</version>" + "<version>2.3</version></versions></expected>";
- XMLAssert.assertXpathEvaluatesTo( "2.3", "//metadata/versioning/latest", metadataXml );
- XMLAssert.assertXpathsEqual( "//expected/versions/version", expectedVersions,
- "//metadata/versioning/versions/version", metadataXml );
- XMLAssert.assertXpathEvaluatesTo( "20070315032817", "//metadata/versioning/lastUpdated", metadataXml );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/latest" ).isEqualTo( "2.3" );
+ // XMLAssert.assertXpathEvaluatesTo( "2.3", "//metadata/versioning/latest", metadataXml );
+ XmlAssert.assertThat( metadataXml ).nodesByXPath( "//metadata/versioning/versions/version" ).hasSize( 2 );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/versions/version[1]" ).isEqualTo( "2.2" );
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/versions/version[2]" ).isEqualTo( "2.3" );
+ // XMLAssert.assertXpathsEqual( "//expected/versions/version", expectedVersions,
+ // "//metadata/versioning/versions/version", metadataXml );
+
+ XmlAssert.assertThat( metadataXml ).valueByXPath( "//metadata/versioning/lastUpdated" ).isEqualTo( "20070315032817" );
+ //XMLAssert.assertXpathEvaluatesTo( "20070315032817", "//metadata/versioning/lastUpdated", metadataXml );
removeRepoFromConfiguration( "days-old", repoConfiguration );
}
<scope>test</scope>
</dependency>
<dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-core</artifactId>
<scope>test</scope>
</dependency>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-core</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
</dependency>
<!-- Test scope -->
+ <dependency>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-core</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
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;
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 );
}
<!-- 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>
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;
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 );
}
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 );
}
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;
import java.nio.file.Path;
import java.nio.file.Paths;
+import org.xmlunit.assertj.XmlAssert;
+
/**
* RepositoryMetadataWriterTest
*/
StringWriter actual = new StringWriter();
RepositoryMetadataWriter.write( metadata, actual );
- XMLAssert.assertXMLEqual( "XML Contents", expectedContent, actual.toString() );
+ XmlAssert.assertThat( actual.toString() ).and( expectedContent ).areIdentical();
}
}
<scope>test</scope>
</dependency>
<dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
import org.apache.archiva.common.utils.FileUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
-import org.custommonkey.xmlunit.DetailedDiff;
-import org.custommonkey.xmlunit.Diff;
import org.junit.Before;
+import org.xmlunit.builder.DiffBuilder;
+import org.xmlunit.diff.Diff;
+import org.xmlunit.diff.Difference;
import java.nio.file.Paths;
protected void assertExpectedMetadata( String expectedMetadata, String actualMetadata )
throws Exception
{
- 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 );
}
<commons-fileupload.version>1.4</commons-fileupload.version>
<commons-lang.version>3.9</commons-lang.version>
+ <xmlunit.version>2.6.3</xmlunit.version>
+
<maven3x.version>3.5.4</maven3x.version>
<maven.resolver.version>1.1.1</maven.resolver.version>
<maven.indexer.version>6.0.1-SNAPSHOT</maven.indexer.version>
<dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- <version>1.0</version>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-core</artifactId>
+ <version>${xmlunit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.xmlunit</groupId>
+ <artifactId>xmlunit-assertj</artifactId>
+ <version>${xmlunit.version}</version>
+ <scope>test</scope>
</dependency>
+
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>