You can subscribe to this list here.
| 2007 |
Jan
|
Feb
(3) |
Mar
(18) |
Apr
(39) |
May
(15) |
Jun
(12) |
Jul
(3) |
Aug
(23) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(21) |
Feb
(23) |
Mar
(33) |
Apr
(8) |
May
(1) |
Jun
(22) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(6) |
Nov
|
Dec
(11) |
| 2009 |
Jan
(5) |
Feb
|
Mar
(2) |
Apr
(24) |
May
(36) |
Jun
(18) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(3) |
Nov
(1) |
Dec
|
| 2010 |
Jan
(5) |
Feb
(3) |
Mar
|
Apr
(15) |
May
(24) |
Jun
(11) |
Jul
(8) |
Aug
(34) |
Sep
(42) |
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
(13) |
Feb
(32) |
Mar
(35) |
Apr
(31) |
May
(33) |
Jun
(30) |
Jul
(32) |
Aug
(31) |
Sep
(30) |
Oct
(31) |
Nov
(32) |
Dec
(31) |
| 2012 |
Jan
(35) |
Feb
(31) |
Mar
(31) |
Apr
(30) |
May
(31) |
Jun
(34) |
Jul
(23) |
Aug
(30) |
Sep
(30) |
Oct
(29) |
Nov
(30) |
Dec
(32) |
| 2013 |
Jan
(25) |
Feb
(39) |
Mar
(1) |
Apr
(18) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(20) |
Sep
(41) |
Oct
(32) |
Nov
(9) |
Dec
(31) |
| 2014 |
Jan
(31) |
Feb
(30) |
Mar
(34) |
Apr
(60) |
May
(31) |
Jun
(28) |
Jul
(32) |
Aug
(28) |
Sep
(26) |
Oct
(32) |
Nov
(43) |
Dec
(115) |
| 2015 |
Jan
(106) |
Feb
(101) |
Mar
(51) |
Apr
(32) |
May
(63) |
Jun
(18) |
Jul
|
Aug
(18) |
Sep
|
Oct
(1) |
Nov
(84) |
Dec
(63) |
| 2016 |
Jan
(26) |
Feb
(17) |
Mar
(104) |
Apr
(30) |
May
(6) |
Jun
(30) |
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
(48) |
Dec
(22) |
| 2017 |
Jan
(15) |
Feb
(29) |
Mar
(43) |
Apr
(29) |
May
(25) |
Jun
(28) |
Jul
(62) |
Aug
(35) |
Sep
(35) |
Oct
(72) |
Nov
(10) |
Dec
(4) |
| 2018 |
Jan
(7) |
Feb
(4) |
Mar
|
Apr
(46) |
May
(20) |
Jun
(12) |
Jul
(9) |
Aug
(42) |
Sep
(4) |
Oct
(17) |
Nov
(32) |
Dec
(31) |
| 2019 |
Jan
(21) |
Feb
(14) |
Mar
|
Apr
(74) |
May
(25) |
Jun
(43) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
(10) |
| 2020 |
Jan
(1) |
Feb
|
Mar
(26) |
Apr
(8) |
May
(62) |
Jun
(4) |
Jul
(25) |
Aug
|
Sep
(21) |
Oct
(24) |
Nov
(26) |
Dec
(9) |
| 2021 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(11) |
Nov
(1) |
Dec
(12) |
| 2022 |
Jan
(47) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(14) |
| 2023 |
Jan
(3) |
Feb
|
Mar
(60) |
Apr
(9) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2024 |
Jan
(5) |
Feb
|
Mar
|
Apr
(10) |
May
(1) |
Jun
|
Jul
|
Aug
(17) |
Sep
(2) |
Oct
|
Nov
|
Dec
(1) |
| 2025 |
Jan
|
Feb
|
Mar
(88) |
Apr
(64) |
May
(47) |
Jun
(20) |
Jul
|
Aug
(14) |
Sep
(8) |
Oct
(13) |
Nov
|
Dec
|
| 2026 |
Jan
(24) |
Feb
|
Mar
|
Apr
|
May
(18) |
Jun
(8) |
Jul
(33) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <bo...@us...> - 2007-04-30 13:40:13
|
Revision: 202
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=202&view=rev
Author: bodewig
Date: 2007-04-30 06:40:12 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
keep backwards compatibility
Modified Paths:
--------------
trunk/xmlunit/src/csharp/XmlAssertion.cs
Modified: trunk/xmlunit/src/csharp/XmlAssertion.cs
===================================================================
--- trunk/xmlunit/src/csharp/XmlAssertion.cs 2007-04-23 16:13:15 UTC (rev 201)
+++ trunk/xmlunit/src/csharp/XmlAssertion.cs 2007-04-30 13:40:12 UTC (rev 202)
@@ -2,7 +2,7 @@
using NUnit.Framework;
using System.IO;
- public class XmlAssertion : Assert {
+ public class XmlAssertion : Assertion {
public static void AssertXmlEquals(TextReader controlTextReader, TextReader testTextReader) {
AssertXmlEquals(new XmlDiff(controlTextReader, testTextReader));
}
@@ -38,9 +38,9 @@
private static void AssertXmlEquals(XmlDiff xmlDiff, bool equalOrNot) {
DiffResult diffResult = xmlDiff.Compare();
if (equalOrNot) {
- IsTrue(diffResult.Equal, diffResult.StringValue);
+ NUnit.Framework.Assert.IsTrue(diffResult.Equal, diffResult.StringValue);
} else {
- IsFalse(diffResult.Equal, diffResult.StringValue);
+ NUnit.Framework.Assert.IsFalse(diffResult.Equal, diffResult.StringValue);
}
}
@@ -55,9 +55,9 @@
private static void AssertXmlIdentical(XmlDiff xmlDiff, bool identicalOrNot) {
DiffResult diffResult = xmlDiff.Compare();
if (identicalOrNot) {
- IsTrue(diffResult.Identical, xmlDiff.OptionalDescription);
+ NUnit.Framework.Assert.IsTrue(diffResult.Identical, xmlDiff.OptionalDescription);
} else {
- IsFalse(diffResult.Identical, xmlDiff.OptionalDescription);
+ NUnit.Framework.Assert.IsFalse(diffResult.Identical, xmlDiff.OptionalDescription);
}
}
@@ -83,7 +83,7 @@
}
public static void AssertXmlValid(Validator validator) {
- IsTrue(validator.IsValid, validator.ValidationMessage);
+ NUnit.Framework.Assert.IsTrue(validator.IsValid, validator.ValidationMessage);
}
public static void AssertXPathExists(string anXPathExpression, string inXml) {
@@ -96,7 +96,7 @@
public static void AssertXPathExists(string anXPathExpression, XmlInput inXml) {
XPath xpath = new XPath(anXPathExpression);
- AreEqual(true, xpath.XPathExists(inXml));
+ NUnit.Framework.Assert.AreEqual(true, xpath.XPathExists(inXml));
}
public static void AssertXPathEvaluatesTo(string anXPathExpression, string inXml,
@@ -112,7 +112,7 @@
public static void AssertXPathEvaluatesTo(string anXPathExpression, XmlInput inXml,
string expectedValue) {
XPath xpath = new XPath(anXPathExpression);
- AreEqual(expectedValue, xpath.EvaluateXPath(inXml));
+ NUnit.Framework.Assert.AreEqual(expectedValue, xpath.EvaluateXPath(inXml));
}
public static void AssertXslTransformResults(string xslTransform, string xmlToTransform, string expectedResult) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-23 16:13:16
|
Revision: 201
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=201&view=rev
Author: bodewig
Date: 2007-04-23 09:13:15 -0700 (Mon, 23 Apr 2007)
Log Message:
-----------
make test locale independent
Modified Paths:
--------------
trunk/xmlunit/tests/csharp/ValidatorTests.cs
Modified: trunk/xmlunit/tests/csharp/ValidatorTests.cs
===================================================================
--- trunk/xmlunit/tests/csharp/ValidatorTests.cs 2007-04-23 15:47:38 UTC (rev 200)
+++ trunk/xmlunit/tests/csharp/ValidatorTests.cs 2007-04-23 16:13:15 UTC (rev 201)
@@ -28,9 +28,12 @@
[Test] public void XsdInvalidFileIsNotValid() {
Validator validator = PerformAssertion(INVALID_FILE, false);
- string expected = "The element 'http://www.publishing.org:Book' has incomplete content";
- Assert.AreEqual(true,
- validator.ValidationMessage.StartsWith(expected));
+ Assert.IsFalse(validator.IsValid);
+ Assert.IsTrue(validator.ValidationMessage
+ .IndexOf("http://www.publishing.org") > -1,
+ validator.ValidationMessage);
+ Assert.IsTrue(validator.ValidationMessage.IndexOf("Book") > -1,
+ validator.ValidationMessage);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-23 16:09:50
|
Revision: 200
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=200&view=rev
Author: bodewig
Date: 2007-04-23 08:47:38 -0700 (Mon, 23 Apr 2007)
Log Message:
-----------
modernize NUnit usage: Assertion -> Assert
Modified Paths:
--------------
trunk/xmlunit/src/csharp/XmlAssertion.cs
trunk/xmlunit/tests/csharp/DiffConfigurationTests.cs
trunk/xmlunit/tests/csharp/DiffResultTests.cs
trunk/xmlunit/tests/csharp/DifferenceTests.cs
trunk/xmlunit/tests/csharp/ValidatorTests.cs
trunk/xmlunit/tests/csharp/XPathTests.cs
trunk/xmlunit/tests/csharp/XmlAssertionTests.cs
trunk/xmlunit/tests/csharp/XmlDiffTests.cs
trunk/xmlunit/tests/csharp/XmlInputTests.cs
trunk/xmlunit/tests/csharp/XsltTests.cs
Modified: trunk/xmlunit/src/csharp/XmlAssertion.cs
===================================================================
--- trunk/xmlunit/src/csharp/XmlAssertion.cs 2007-04-23 15:18:56 UTC (rev 199)
+++ trunk/xmlunit/src/csharp/XmlAssertion.cs 2007-04-23 15:47:38 UTC (rev 200)
@@ -2,7 +2,7 @@
using NUnit.Framework;
using System.IO;
- public class XmlAssertion : Assertion {
+ public class XmlAssertion : Assert {
public static void AssertXmlEquals(TextReader controlTextReader, TextReader testTextReader) {
AssertXmlEquals(new XmlDiff(controlTextReader, testTextReader));
}
@@ -37,7 +37,11 @@
private static void AssertXmlEquals(XmlDiff xmlDiff, bool equalOrNot) {
DiffResult diffResult = xmlDiff.Compare();
- Assertion.AssertEquals(diffResult.StringValue, equalOrNot, diffResult.Equal);
+ if (equalOrNot) {
+ IsTrue(diffResult.Equal, diffResult.StringValue);
+ } else {
+ IsFalse(diffResult.Equal, diffResult.StringValue);
+ }
}
public static void AssertXmlIdentical(XmlDiff xmlDiff) {
@@ -50,7 +54,11 @@
private static void AssertXmlIdentical(XmlDiff xmlDiff, bool identicalOrNot) {
DiffResult diffResult = xmlDiff.Compare();
- AssertEquals(xmlDiff.OptionalDescription, identicalOrNot, diffResult.Identical);
+ if (identicalOrNot) {
+ IsTrue(diffResult.Identical, xmlDiff.OptionalDescription);
+ } else {
+ IsFalse(diffResult.Identical, xmlDiff.OptionalDescription);
+ }
}
public static void AssertXmlValid(string someXml) {
@@ -75,7 +83,7 @@
}
public static void AssertXmlValid(Validator validator) {
- AssertEquals(validator.ValidationMessage, true, validator.IsValid);
+ IsTrue(validator.IsValid, validator.ValidationMessage);
}
public static void AssertXPathExists(string anXPathExpression, string inXml) {
@@ -88,7 +96,7 @@
public static void AssertXPathExists(string anXPathExpression, XmlInput inXml) {
XPath xpath = new XPath(anXPathExpression);
- AssertEquals(true, xpath.XPathExists(inXml));
+ AreEqual(true, xpath.XPathExists(inXml));
}
public static void AssertXPathEvaluatesTo(string anXPathExpression, string inXml,
@@ -104,7 +112,7 @@
public static void AssertXPathEvaluatesTo(string anXPathExpression, XmlInput inXml,
string expectedValue) {
XPath xpath = new XPath(anXPathExpression);
- AssertEquals(expectedValue, xpath.EvaluateXPath(inXml));
+ AreEqual(expectedValue, xpath.EvaluateXPath(inXml));
}
public static void AssertXslTransformResults(string xslTransform, string xmlToTransform, string expectedResult) {
Modified: trunk/xmlunit/tests/csharp/DiffConfigurationTests.cs
===================================================================
--- trunk/xmlunit/tests/csharp/DiffConfigurationTests.cs 2007-04-23 15:18:56 UTC (rev 199)
+++ trunk/xmlunit/tests/csharp/DiffConfigurationTests.cs 2007-04-23 15:47:38 UTC (rev 200)
@@ -14,16 +14,16 @@
[Test] public void DefaultConfiguredWithGenericDescription() {
DiffConfiguration diffConfiguration = new DiffConfiguration();
- Assertion.AssertEquals(DiffConfiguration.DEFAULT_DESCRIPTION,
+ Assert.AreEqual(DiffConfiguration.DEFAULT_DESCRIPTION,
diffConfiguration.Description);
- Assertion.AssertEquals(DiffConfiguration.DEFAULT_DESCRIPTION,
+ Assert.AreEqual(DiffConfiguration.DEFAULT_DESCRIPTION,
new XmlDiff("", "").OptionalDescription);
}
[Test] public void DefaultConfiguredToUseValidatingParser() {
DiffConfiguration diffConfiguration = new DiffConfiguration();
- Assertion.AssertEquals(DiffConfiguration.DEFAULT_USE_VALIDATING_PARSER,
+ Assert.AreEqual(DiffConfiguration.DEFAULT_USE_VALIDATING_PARSER,
diffConfiguration.UseValidatingParser);
FileStream controlFileStream = File.Open(ValidatorTests.VALID_FILE,
@@ -34,7 +34,7 @@
XmlDiff diff = new XmlDiff(new StreamReader(controlFileStream),
new StreamReader(testFileStream));
diff.Compare();
- Assertion.Fail("Expected validation failure");
+ Assert.Fail("Expected validation failure");
} catch (XmlSchemaException e) {
string message = e.Message; // to prevent 'unused variable' compiler warning
} finally {
@@ -45,7 +45,7 @@
[Test] public void CanConfigureNotToUseValidatingParser() {
DiffConfiguration diffConfiguration = new DiffConfiguration(false);
- Assertion.AssertEquals(false, diffConfiguration.UseValidatingParser);
+ Assert.AreEqual(false, diffConfiguration.UseValidatingParser);
FileStream controlFileStream = File.Open(ValidatorTests.VALID_FILE,
FileMode.Open, FileAccess.Read);
@@ -57,7 +57,7 @@
diffConfiguration);
diff.Compare();
} catch (XmlSchemaException e) {
- Assertion.Fail("Unexpected validation failure: " + e.Message);
+ Assert.Fail("Unexpected validation failure: " + e.Message);
} finally {
controlFileStream.Close();
testFileStream.Close();
@@ -66,7 +66,7 @@
[Test] public void DefaultConfiguredWithWhitespaceHandlingAll() {
DiffConfiguration diffConfiguration = new DiffConfiguration();
- Assertion.AssertEquals(WhitespaceHandling.All, diffConfiguration.WhitespaceHandling);
+ Assert.AreEqual(WhitespaceHandling.All, diffConfiguration.WhitespaceHandling);
PerformAssertion(xmlWithoutWhitespace, xmlWithWhitespaceElement, false);
PerformAssertion(xmlWithoutWhitespace, xmlWithoutWhitespaceElement, false);
@@ -85,8 +85,8 @@
PerformAssertion(diff, assertion);
}
private void PerformAssertion(XmlDiff diff, bool assertion) {
- Assertion.AssertEquals(assertion, diff.Compare().Equal);
- Assertion.AssertEquals(assertion, diff.Compare().Identical);
+ Assert.AreEqual(assertion, diff.Compare().Equal);
+ Assert.AreEqual(assertion, diff.Compare().Identical);
}
[Test] public void CanConfigureWhitespaceHandlingSignificant() {
Modified: trunk/xmlunit/tests/csharp/DiffResultTests.cs
===================================================================
--- trunk/xmlunit/tests/csharp/DiffResultTests.cs 2007-04-23 15:18:56 UTC (rev 199)
+++ trunk/xmlunit/tests/csharp/DiffResultTests.cs 2007-04-23 15:47:38 UTC (rev 200)
@@ -18,25 +18,25 @@
}
[Test] public void NewDiffResultIsEqualAndIdentical() {
- Assertion.AssertEquals(true, _result.Identical);
- Assertion.AssertEquals(true, _result.Equal);
- Assertion.AssertEquals("Identical", _result.StringValue);
+ Assert.AreEqual(true, _result.Identical);
+ Assert.AreEqual(true, _result.Equal);
+ Assert.AreEqual("Identical", _result.StringValue);
}
[Test] public void NotEqualOrIdenticalAfterMajorDifferenceFound() {
_result.DifferenceFound(_diff, _majorDifference);
- Assertion.AssertEquals(false, _result.Identical);
- Assertion.AssertEquals(false, _result.Equal);
- Assertion.AssertEquals(_diff.OptionalDescription
+ Assert.AreEqual(false, _result.Identical);
+ Assert.AreEqual(false, _result.Equal);
+ Assert.AreEqual(_diff.OptionalDescription
+ Environment.NewLine
+ _majorDifference.ToString(), _result.StringValue);
}
[Test] public void NotIdenticalButEqualAfterMinorDifferenceFound() {
_result.DifferenceFound(_diff, _minorDifference);
- Assertion.AssertEquals(false, _result.Identical);
- Assertion.AssertEquals(true, _result.Equal);
- Assertion.AssertEquals(_diff.OptionalDescription
+ Assert.AreEqual(false, _result.Identical);
+ Assert.AreEqual(true, _result.Equal);
+ Assert.AreEqual(_diff.OptionalDescription
+ Environment.NewLine
+ _minorDifference.ToString(), _result.StringValue);
}
Modified: trunk/xmlunit/tests/csharp/DifferenceTests.cs
===================================================================
--- trunk/xmlunit/tests/csharp/DifferenceTests.cs 2007-04-23 15:18:56 UTC (rev 199)
+++ trunk/xmlunit/tests/csharp/DifferenceTests.cs 2007-04-23 15:47:38 UTC (rev 200)
@@ -9,16 +9,15 @@
[SetUp] public void CreateMinorDifference() {
DifferenceType id = DifferenceType.ATTR_SEQUENCE_ID;
- Assertion.AssertEquals(false, Differences.isMajorDifference(id));
+ Assert.IsFalse(Differences.isMajorDifference(id));
minorDifference = new Difference(id);
}
[Test] public void ToStringContainsId() {
string commentDifference = minorDifference.ToString();
string idValue = "type: " + (int)DifferenceType.ATTR_SEQUENCE_ID;
- Assertion.AssertEquals("contains " + idValue,
- true,
- commentDifference.IndexOfAny(idValue.ToCharArray()) > 0);
+ Assert.IsTrue(commentDifference.IndexOfAny(idValue.ToCharArray()) > 0,
+ "contains " + idValue);
}
}
}
Modified: trunk/xmlunit/tests/csharp/ValidatorTests.cs
===================================================================
--- trunk/xmlunit/tests/csharp/ValidatorTests.cs 2007-04-23 15:18:56 UTC (rev 199)
+++ trunk/xmlunit/tests/csharp/ValidatorTests.cs 2007-04-23 15:47:38 UTC (rev 200)
@@ -19,7 +19,7 @@
FileStream input = File.Open(file, FileMode.Open, FileAccess.Read);
try {
Validator validator = new Validator(new XmlInput(new StreamReader(input)));
- Assertion.AssertEquals(expected, validator.IsValid);
+ Assert.AreEqual(expected, validator.IsValid);
return validator;
} finally {
input.Close();
@@ -29,7 +29,7 @@
[Test] public void XsdInvalidFileIsNotValid() {
Validator validator = PerformAssertion(INVALID_FILE, false);
string expected = "The element 'http://www.publishing.org:Book' has incomplete content";
- Assertion.AssertEquals(true,
+ Assert.AreEqual(true,
validator.ValidationMessage.StartsWith(expected));
}
}
Modified: trunk/xmlunit/tests/csharp/XPathTests.cs
===================================================================
--- trunk/xmlunit/tests/csharp/XPathTests.cs 2007-04-23 15:18:56 UTC (rev 199)
+++ trunk/xmlunit/tests/csharp/XPathTests.cs 2007-04-23 15:47:38 UTC (rev 200)
@@ -13,39 +13,39 @@
private static readonly string COUNT_XPATH = "count(//b)";
[Test] public void XpathExistsTrueForXpathThatExists() {
XPath xpath = new XPath(EXISTENT_XPATH);
- Assertion.AssertEquals(true,
+ Assert.AreEqual(true,
xpath.XPathExists(SIMPLE_XML));
}
[Test] public void XpathExistsFalseForUnmatchedExpression() {
XPath xpath = new XPath(NONEXISTENT_XPATH);
- Assertion.AssertEquals(false,
+ Assert.AreEqual(false,
xpath.XPathExists(SIMPLE_XML));
}
[Test] public void XpathEvaluatesToTextValueForSimpleString() {
string expectedValue = "one two";
XPath xpath = new XPath(EXISTENT_XPATH);
- Assertion.AssertEquals(expectedValue,
+ Assert.AreEqual(expectedValue,
xpath.EvaluateXPath(SIMPLE_XML));
}
[Test] public void XpathEvaluatesToEmptyStringForUnmatchedExpression() {
string expectedValue = "";
XPath xpath = new XPath(NONEXISTENT_XPATH);
- Assertion.AssertEquals(expectedValue,
+ Assert.AreEqual(expectedValue,
xpath.EvaluateXPath(SIMPLE_XML));
}
[Test] public void XpathEvaluatesCountExpression() {
string expectedValue = "2";
XPath xpath = new XPath(COUNT_XPATH);
- Assertion.AssertEquals(expectedValue,
+ Assert.AreEqual(expectedValue,
xpath.EvaluateXPath(MORE_COMPLEX_XML));
}
[Test] public void XpathEvaluatesMultiNodeExpression() {
string expectedValue = "onetwo";
XPath xpath = new XPath(MULTI_NODE_XPATH);
- Assertion.AssertEquals(expectedValue,
+ Assert.AreEqual(expectedValue,
xpath.EvaluateXPath(MORE_COMPLEX_XML));
}
}
Modified: trunk/xmlunit/tests/csharp/XmlAssertionTests.cs
===================================================================
--- trunk/xmlunit/tests/csharp/XmlAssertionTests.cs 2007-04-23 15:18:56 UTC (rev 199)
+++ trunk/xmlunit/tests/csharp/XmlAssertionTests.cs 2007-04-23 15:47:38 UTC (rev 200)
@@ -27,7 +27,7 @@
new DiffConfiguration(description));
XmlAssertion.AssertXmlIdentical(diff);
} catch (NUnit.Framework.AssertionException e) {
- Assertion.AssertEquals(true, e.Message.StartsWith(description));
+ Assert.IsTrue(e.Message.StartsWith(description));
}
}
@@ -38,7 +38,7 @@
new DiffConfiguration(description));
XmlAssertion.AssertXmlEquals(diff);
} catch (NUnit.Framework.AssertionException e) {
- Assertion.AssertEquals(true, e.Message.StartsWith(description));
+ Assert.AreEqual(true, e.Message.StartsWith(description));
}
}
@@ -55,7 +55,7 @@
StreamReader reader = GetStreamReader(ValidatorTests.INVALID_FILE);
try {
XmlAssertion.AssertXmlValid(reader);
- Assertion.Fail("Expected assertion failure");
+ Assert.Fail("Expected assertion failure");
} catch(AssertionException e) {
AvoidUnusedVariableCompilerWarning(e);
} finally {
@@ -79,7 +79,7 @@
try {
XmlAssertion.AssertXPathExists("//star[@name='alpha centauri']",
MY_SOLAR_SYSTEM);
- Assertion.Fail("Expected assertion failure");
+ Assert.Fail("Expected assertion failure");
} catch (AssertionException e) {
AvoidUnusedVariableCompilerWarning(e);
}
@@ -131,7 +131,7 @@
try {
XmlAssertion.AssertXslTransformResults(xslt, xmlToTransform, expectedXml);
exceptionExpected = false;
- Assertion.Fail("Expected dog not cat!");
+ Assert.Fail("Expected dog not cat!");
} catch (AssertionException e) {
AvoidUnusedVariableCompilerWarning(e);
if (!exceptionExpected) {
Modified: trunk/xmlunit/tests/csharp/XmlDiffTests.cs
===================================================================
--- trunk/xmlunit/tests/csharp/XmlDiffTests.cs 2007-04-23 15:18:56 UTC (rev 199)
+++ trunk/xmlunit/tests/csharp/XmlDiffTests.cs 2007-04-23 15:47:38 UTC (rev 200)
@@ -10,14 +10,14 @@
[Test] public void EqualResultForSameReader() {
TextReader reader = new StringReader("<empty/>");
DiffResult result = PerformDiff(reader, reader);
- Assertion.AssertEquals(true, result.Equal);
+ Assert.AreEqual(true, result.Equal);
}
[Test] public void SameResultForTwoInvocations() {
TextReader reader = new StringReader("<empty/>");
DiffResult result1 = PerformDiff(reader, reader);
DiffResult result2 = _xmlDiff.Compare();
- Assertion.AssertSame(result1, result2);
+ Assert.AreSame(result1, result2);
}
@@ -26,7 +26,7 @@
TextReader reader2 = new StringReader(input2);
DiffResult result = PerformDiff(reader1, reader2);
string msg = "comparing " + input1 + " to " + input2 + ": " + result.Difference;
- Assertion.AssertEquals(msg, expected, result.Equal);
+ Assert.AreEqual(expected, result.Equal);
}
private void AssertExpectedResult(string[] inputs1, string[] inputs2, bool expected) {
Modified: trunk/xmlunit/tests/csharp/XmlInputTests.cs
===================================================================
--- trunk/xmlunit/tests/csharp/XmlInputTests.cs 2007-04-23 15:18:56 UTC (rev 199)
+++ trunk/xmlunit/tests/csharp/XmlInputTests.cs 2007-04-23 15:47:38 UTC (rev 200)
@@ -18,13 +18,13 @@
[Test] public void StringInputTranslatesToXmlReader() {
XmlInput input = new XmlInput(INPUT);
string actual = ReadOuterXml(input.CreateXmlReader());
- Assertion.AssertEquals(_expected, actual);
+ Assert.AreEqual(_expected, actual);
}
[Test] public void TextReaderInputTranslatesToXmlReader() {
XmlInput input = new XmlInput(new StringReader(INPUT));
string actual = ReadOuterXml(input.CreateXmlReader());
- Assertion.AssertEquals(_expected, actual);
+ Assert.AreEqual(_expected, actual);
}
[Test] public void StreamInputTranslatesToXmlReader() {
@@ -36,7 +36,7 @@
XmlInput input = new XmlInput(stream);
string actual = ReadOuterXml(input.CreateXmlReader());
try {
- Assertion.AssertEquals(_expected, actual);
+ Assert.AreEqual(_expected, actual);
} finally {
writer.Close();
}
@@ -53,32 +53,32 @@
[Test] public void NotEqualsNull() {
XmlInput input = new XmlInput(INPUT);
- Assertion.AssertEquals(false, input.Equals(null));
+ Assert.AreEqual(false, input.Equals(null));
}
[Test] public void NotEqualsADifferentClass() {
XmlInput input = new XmlInput(INPUT);
- Assertion.AssertEquals(false, input.Equals(INPUT));
+ Assert.AreEqual(false, input.Equals(INPUT));
}
[Test] public void EqualsSelf() {
XmlInput input = new XmlInput(INPUT);
- Assertion.AssertEquals(input, input);
+ Assert.AreEqual(input, input);
}
[Test] public void EqualsCopyOfSelf() {
XmlInput input = new XmlInput(INPUT);
- Assertion.AssertEquals(new XmlInput(INPUT), input);
+ Assert.AreEqual(new XmlInput(INPUT), input);
}
[Test] public void HashCodeEqualsHashCodeOfInput() {
XmlInput input = new XmlInput(INPUT);
- Assertion.AssertEquals(INPUT.GetHashCode(), input.GetHashCode());
+ Assert.AreEqual(INPUT.GetHashCode(), input.GetHashCode());
}
[Test] public void HashCodeEqualsHashCodeOfCopy() {
XmlInput input = new XmlInput(INPUT);
- Assertion.AssertEquals(new XmlInput(INPUT).GetHashCode(), input.GetHashCode());
+ Assert.AreEqual(new XmlInput(INPUT).GetHashCode(), input.GetHashCode());
}
}
Modified: trunk/xmlunit/tests/csharp/XsltTests.cs
===================================================================
--- trunk/xmlunit/tests/csharp/XsltTests.cs 2007-04-23 15:18:56 UTC (rev 199)
+++ trunk/xmlunit/tests/csharp/XsltTests.cs 2007-04-23 15:47:38 UTC (rev 200)
@@ -27,8 +27,8 @@
Xslt xslt = new Xslt(IDENTITY_TRANSFORM);
string input = "<qwerty>uiop</qwerty>";
string output = new string(input.ToCharArray());
- Assertion.AssertEquals(output, xslt.Transform(input).AsString());
- Assertion.AssertEquals(output, xslt.Transform(input).AsString());
+ Assert.AreEqual(output, xslt.Transform(input).AsString());
+ Assert.AreEqual(output, xslt.Transform(input).AsString());
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-23 15:18:54
|
Revision: 199
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=199&view=rev
Author: bodewig
Date: 2007-04-23 08:18:56 -0700 (Mon, 23 Apr 2007)
Log Message:
-----------
Modernize NAnt build
Modified Paths:
--------------
trunk/xmlunit/xmlunit.nant.build
Modified: trunk/xmlunit/xmlunit.nant.build
===================================================================
--- trunk/xmlunit/xmlunit.nant.build 2007-04-23 14:59:01 UTC (rev 198)
+++ trunk/xmlunit/xmlunit.nant.build 2007-04-23 15:18:56 UTC (rev 199)
@@ -1,70 +1,84 @@
<project name="xmlunit" description="XmlUnit for .Net" default="compile">
- <property name="project.version" value="0.3"/>
- <property name="base.dir" value="${nant.project.basedir}"/>
- <property name="src.dir" value="${base.dir}/src/csharp"/>
- <property name="tests.src.dir" value="${base.dir}/tests/csharp"/>
- <property name="bin.dir" value="${base.dir}/bin"/>
- <property name="csc.verbose" value="false"/>
- <property name="deploy.file" value="${nant.project.name}${project.version}.zip"/>
+ <property name="project.version" value="0.3" overwrite="false"/>
+ <property name="base.dir" value="${project::get-base-directory()}"
+ overwrite="false"/>
+ <property name="src.dir" value="${base.dir}/src/csharp" overwrite="false"/>
+ <property name="tests.src.dir" value="${base.dir}/tests/csharp"
+ overwrite="false"/>
+ <property name="bin.dir" value="${base.dir}/bin" overwrite="false"/>
+ <property name="csc.verbose" value="false" overwrite="false"/>
+ <property name="deploy.file" overwrite="false"
+ value="${project::get-name()}-${project.version}.zip"/>
<!-- *** You may need to edit these properties for your filesystem *** -->
- <property name="nunit.v2.assembly" value="nunit.framework.dll"/>
- <property name="nunit.v2.bin.dir" value="c:/apps/SharpDevelop/bin/nunit"/>
+ <property name="nunit.v2.assembly" value="nunit.framework.dll"
+ overwrite="false"/>
+ <property name="nunit.v2.bin.dir" overwrite="false"
+ value="c:/apps/SharpDevelop/bin/nunit" />
<target name="init" description="prepare for other targets">
<mkdir dir="${bin.dir}"/>
- <copy file="${nunit.v2.bin.dir}/${nunit.v2.assembly}" tofile="${bin.dir}/${nunit.v2.assembly}"/>
+ <copy file="${nunit.v2.bin.dir}/${nunit.v2.assembly}"
+ tofile="${bin.dir}/${nunit.v2.assembly}"/>
</target>
<target name="clean" description="clean out compiled files">
<delete failonerror="false">
<fileset basedir="${bin.dir}">
- <includes name="${nant.project.name}.*"/>
+ <include name="${project::get-name()}.*"/>
</fileset>
</delete>
</target>
<target name="compile" description="compile all source files" depends="init">
- <csc target="library" output="${bin.dir}/${nant.project.name}.dll" debug="true" verbose="${csc.verbose}">
+ <csc target="library" output="${bin.dir}/${project::get-name()}.dll"
+ debug="true" verbose="${csc.verbose}">
<references basedir="${bin.dir}">
- <includes name="${nunit.v2.assembly}"/>
+ <include name="${nunit.v2.assembly}"/>
</references>
<sources basedir="${src.dir}">
- <includes name="*.cs"/>
+ <include name="*.cs"/>
</sources>
</csc>
- <csc target="library" output="${bin.dir}/${nant.project.name}.tests.dll" debug="true" verbose="${csc.verbose}">
- <references basedir="${bin.dir}">
- <includes name="${nant.project.name}.dll"/>
- <includes name="${nunit.v2.assembly}"/>
- </references>
- <sources basedir="${tests.src.dir}">
- <includes name="*.cs"/>
- <excludes name="AllTests.cs"/>
- </sources>
+ <csc target="library"
+ output="${bin.dir}/${project::get-name()}.tests.dll"
+ debug="true" verbose="${csc.verbose}">
+ <references basedir="${bin.dir}">
+ <include name="${project::get-name()}.dll"/>
+ <include name="${nunit.v2.assembly}"/>
+ </references>
+ <sources basedir="${tests.src.dir}">
+ <include name="*.cs"/>
+ <exclude name="AllTests.cs"/>
+ </sources>
</csc>
</target>
<target name="test" description="run all tests" depends="compile">
- <exec basedir="${bin.dir}" workingdir="${bin.dir}" program="${nunit.v2.bin.dir}/nunit-console.exe" commandline="${nant.project.name}.tests.dll"/>
+ <nunit2>
+ <formatter type="Plain"/>
+ <test assemblyname="${bin.dir}/${project::get-name()}.tests.dll"/>
+ </nunit2>
</target>
- <target name="deploy" description="zip all code for deployment" depends="test">
+ <target name="deploy" description="zip all code for deployment"
+ depends="test">
<delete file="${deploy.file}" failonerror="false"/>
<zip zipfile="${deploy.file}">
<fileset basedir="${base.dir}">
- <includes name="LICENSE.txt"/>
- <includes name="NUnit.ReadMe"/>
- <includes name="*.build"/>
- <includes name="**/*.cs"/>
- <includes name="./tests/etc/**/*.*"/>
- <includes name="**/${nant.project.name}*.dll"/>
- <excludes name="**/AllTests.cs"/>
+ <include name="LICENSE.txt"/>
+ <include name="NUnit.ReadMe"/>
+ <include name="*.build"/>
+ <include name="**/*.cs"/>
+ <include name="./tests/etc/**/*.*"/>
+ <include name="**/${project::get-name()}*.dll"/>
+ <exclude name="**/AllTests.cs"/>
</fileset>
</zip>
</target>
- <target name="all" description="execute all tasks in the project" depends="clean,compile,test,deploy"/>
+ <target name="all" description="execute all tasks in the project"
+ depends="clean,compile,test,deploy"/>
</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-23 14:59:02
|
Revision: 198
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=198&view=rev
Author: bodewig
Date: 2007-04-23 07:59:01 -0700 (Mon, 23 Apr 2007)
Log Message:
-----------
Remove old documentation which has been absorbed by the User's Guide
Removed Paths:
-------------
trunk/xmlunit/src/site/XMLUnit.pdf
trunk/xmlunit/src/site/XMLUnit.rtf
Deleted: trunk/xmlunit/src/site/XMLUnit.pdf
===================================================================
(Binary files differ)
Deleted: trunk/xmlunit/src/site/XMLUnit.rtf
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-23 14:58:09
|
Revision: 197
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=197&view=rev
Author: bodewig
Date: 2007-04-23 07:58:02 -0700 (Mon, 23 Apr 2007)
Log Message:
-----------
Add POM and ivy.xml to bin-dist, remove C# from Java source-dist
Modified Paths:
--------------
trunk/xmlunit/build.xml
Modified: trunk/xmlunit/build.xml
===================================================================
--- trunk/xmlunit/build.xml 2007-04-19 04:00:56 UTC (rev 196)
+++ trunk/xmlunit/build.xml 2007-04-23 14:58:02 UTC (rev 197)
@@ -171,6 +171,10 @@
basedir="${out.dir}"
/>
+ <tstamp>
+ <format property="ivy.publication.datetime" pattern="yyyyMMddHHmmss"/>
+ </tstamp>
+
<copy todir="${lib.dir}">
<fileset dir="${src.dir}/etc">
<include name="xmlunit.pom"/>
@@ -195,7 +199,7 @@
<target name="bindist" depends="jar,test,docs">
<zip zipfile="${dist.dir}/xmlunit-${xmlunit.version}-bin.zip">
<zipfileset prefix="xmlunit-${xmlunit.version}/lib"
- dir="${lib.dir}" includes="*.jar"/>
+ dir="${lib.dir}"/>
<zipfileset prefix="xmlunit-${xmlunit.version}/docs"
dir="${docs.dir}"/>
<zipfileset prefix="xmlunit-${xmlunit.version}" dir=".">
@@ -215,6 +219,7 @@
<include name="KEYS"/>
<include name="LICENSE.txt"/>
<include name="README.txt"/>
+ <exclude name="**/csharp/**"/>
</zipfileset>
<zipfileset dir="${userguide.docs.dir}"
prefix="xmlunit-${xmlunit.version}/userguide"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-19 04:00:54
|
Revision: 196
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=196&view=rev
Author: bodewig
Date: 2007-04-18 21:00:56 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
bump version
Modified Paths:
--------------
trunk/xmlunit/build.xml
trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java
Modified: trunk/xmlunit/build.xml
===================================================================
--- trunk/xmlunit/build.xml 2007-04-19 03:59:31 UTC (rev 195)
+++ trunk/xmlunit/build.xml 2007-04-19 04:00:56 UTC (rev 196)
@@ -4,7 +4,7 @@
<property file="build.properties"/>
<!-- Version -->
- <property name="xmlunit.version" value="1.1alpha"/>
+ <property name="xmlunit.version" value="1.1beta2"/>
<!-- some locations -->
<property name="src.dir" value="src"/>
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java 2007-04-19 03:59:31 UTC (rev 195)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java 2007-04-19 04:00:56 UTC (rev 196)
@@ -469,7 +469,7 @@
* @return current version
*/
public static String getVersion() {
- return "1.1alpha";
+ return "1.1beta2";
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-19 03:59:30
|
Revision: 195
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=195&view=rev
Author: bodewig
Date: 2007-04-18 20:59:31 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Tag XMLUnit for Java 1.1 beta 1
Modified Paths:
--------------
tags/XMLUnit-Java-1.1-beta1/build.xml
tags/XMLUnit-Java-1.1-beta1/src/java/org/custommonkey/xmlunit/XMLUnit.java
Added Paths:
-----------
tags/XMLUnit-Java-1.1-beta1/
Copied: tags/XMLUnit-Java-1.1-beta1 (from rev 194, trunk/xmlunit)
Modified: tags/XMLUnit-Java-1.1-beta1/build.xml
===================================================================
--- trunk/xmlunit/build.xml 2007-04-18 15:29:47 UTC (rev 194)
+++ tags/XMLUnit-Java-1.1-beta1/build.xml 2007-04-19 03:59:31 UTC (rev 195)
@@ -4,7 +4,7 @@
<property file="build.properties"/>
<!-- Version -->
- <property name="xmlunit.version" value="1.1alpha"/>
+ <property name="xmlunit.version" value="1.1beta1"/>
<!-- some locations -->
<property name="src.dir" value="src"/>
Modified: tags/XMLUnit-Java-1.1-beta1/src/java/org/custommonkey/xmlunit/XMLUnit.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java 2007-04-18 15:29:47 UTC (rev 194)
+++ tags/XMLUnit-Java-1.1-beta1/src/java/org/custommonkey/xmlunit/XMLUnit.java 2007-04-19 03:59:31 UTC (rev 195)
@@ -469,7 +469,7 @@
* @return current version
*/
public static String getVersion() {
- return "1.1alpha";
+ return "1.1beta1";
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-18 15:29:46
|
Revision: 194
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=194&view=rev
Author: bodewig
Date: 2007-04-18 08:29:47 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Add a target for Apache Gump
Modified Paths:
--------------
trunk/xmlunit/build.xml
Modified: trunk/xmlunit/build.xml
===================================================================
--- trunk/xmlunit/build.xml 2007-04-18 15:27:50 UTC (rev 193)
+++ trunk/xmlunit/build.xml 2007-04-18 15:29:47 UTC (rev 194)
@@ -165,7 +165,7 @@
</copy>
</target>
- <target name="jar" depends="clean,compile"
+ <target name="jar" depends="compile"
description="creates jar, Maven2 POM and Ivy file">
<jar jarfile="${lib.dir}/xmlunit-${xmlunit.version}.jar"
basedir="${out.dir}"
@@ -190,6 +190,8 @@
</copy>
</target>
+ <target name="Gump" depends="test,jar"/>
+
<target name="bindist" depends="jar,test,docs">
<zip zipfile="${dist.dir}/xmlunit-${xmlunit.version}-bin.zip">
<zipfileset prefix="xmlunit-${xmlunit.version}/lib"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-18 15:27:49
|
Revision: 193
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=193&view=rev
Author: bodewig
Date: 2007-04-18 08:27:50 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Preparing build system and site for release
Modified Paths:
--------------
trunk/xmlunit/build.xml
trunk/xmlunit/src/site/index.html
Added Paths:
-----------
trunk/xmlunit/docbook.xml
Modified: trunk/xmlunit/build.xml
===================================================================
--- trunk/xmlunit/build.xml 2007-04-18 15:27:27 UTC (rev 192)
+++ trunk/xmlunit/build.xml 2007-04-18 15:27:50 UTC (rev 193)
@@ -1,16 +1,37 @@
-<project name="xmlunit" default="compile" basedir=".">
- <!-- The properties junit.lib, xmlxsl.lib, and test.report.dir should be defined in your build.properties file -->
- <target name="props">
- <property name="xmlunit.version" value="1.1alpha"/>
- <property name="src.dir" value="src"/>
- <property name="test.dir" value="tests"/>
- <property name="lib.dir" value="lib"/>
- <property name="out.dir" value="classes"/>
- <property name="dist.dir" value="dist"/>
- <property name="docs.dir" value="doc"/>
- <property name="build.user.guide" value="userguide"/>
- <property file="build.properties"/>
+<project name="xmlunit" default="test" basedir=".">
+ <!-- allow properties to be overridden in a properties file -->
+ <property file="build.properties"/>
+
+ <!-- Version -->
+ <property name="xmlunit.version" value="1.1alpha"/>
+
+ <!-- some locations -->
+ <property name="src.dir" value="src"/>
+ <property name="test.dir" value="tests"/>
+ <property name="build.dir" location="build"/>
+ <property name="lib.dir" value="${build.dir}/lib"/>
+ <property name="out.dir" value="${build.dir}/classes"/>
+ <property name="test.out.dir" value="${build.dir}/test-classes"/>
+ <property name="userguide.out.dir" value="${build.dir}/ug-classes"/>
+ <property name="test.report.dir" value="${build.dir}/test-report"/>
+ <property name="dist.dir" value="${build.dir}/dist"/>
+ <property name="docs.dir" value="${build.dir}/doc"/>
+ <property name="userguide.docs.dir" value="${docs.dir}/userguide"/>
+
+ <!-- javac properties -->
+ <property name="javac.source" value="1.3"/>
+ <property name="javac.target" value="1.3"/>
+ <property name="javac.debug" value="true"/>
+
+ <!-- some library paths -->
+ <!-- where is JAXP? property name="${xmlxsl.lib}" location="."/ -->
+ <!-- where is JUnit? property name="${junit.lib}" location="."/ -->
+
+ <!-- Docbook related properties, macros and targets -->
+ <import file="docbook.xml"/>
+
+ <target name="-props">
<available property="jaxp13+" classname="javax.xml.xpath.XPath"/>
<condition property="jaxp13+.impl">
<and>
@@ -21,31 +42,34 @@
<available property="regexp.present" classname="java.util.regex.Matcher"/>
</target>
- <target name="check-props" unless="test.report.dir">
- <fail>Please provide the
-values for junit.lib, xmlxsl.lib, and test.report.dir
-in build.properties</fail>
- </target>
-
- <target name="init" depends="props,check-props">
+ <target name="-init" depends="-props">
<mkdir dir="${lib.dir}"/>
<mkdir dir="${out.dir}"/>
+ <mkdir dir="${test.out.dir}"/>
<mkdir dir="${test.report.dir}"/>
<mkdir dir="${dist.dir}"/>
+ <mkdir dir="${docs.dir}"/>
+ <mkdir dir="${userguide.docs.dir}"/>
</target>
- <target name="clean" depends="init">
+ <target name="clean"
+ description="removes created directories">
<delete includeEmptyDirs="true" quiet="true">
- <fileset dir="${out.dir}" includes="**/*.class"/>
- <fileset dir="${test.report.dir}" includes="**/TEST*.*"/>
+ <fileset dir="${lib.dir}"/>
+ <fileset dir="${out.dir}"/>
+ <fileset dir="${test.out.dir}"/>
+ <fileset dir="${test.report.dir}"/>
<fileset dir="${dist.dir}"/>
- <fileset dir="${build.user.guide}"/>
+ <fileset dir="${docs.dir}"/>
+ <fileset dir="${userguide.docs.dir}"/>
+ <fileset dir="${build.dir}"/>
</delete>
</target>
- <target name="compile" depends="init">
- <mkdir dir="${out.dir}"/>
- <javac srcdir="${src.dir}/java:${test.dir}/java" destdir="${out.dir}" debug="on" target="1.2" source="1.3">
+ <target name="compile" depends="-init"
+ description="compiles sources and tests">
+ <javac srcdir="${src.dir}/java" destdir="${out.dir}"
+ debug="${javac.debug}" target="${javac.target}" source="${javac.source}">
<classpath>
<pathelement location="${xmlxsl.lib}"/>
<pathelement location="${junit.lib}"/>
@@ -54,11 +78,23 @@
<exclude name="**/jaxp13/**" unless="jaxp13+"/>
<exclude name="**/*XPathRegexAssert.java" unless="regexp.present"/>
</javac>
+ <javac srcdir="${test.dir}/java" destdir="${test.out.dir}"
+ debug="${javac.debug}" target="${javac.target}" source="${javac.source}">
+ <classpath>
+ <pathelement location="${out.dir}"/>
+ <pathelement location="${xmlxsl.lib}"/>
+ <pathelement location="${junit.lib}"/>
+ <pathelement path="${java.class.path}"/>
+ </classpath>
+ <exclude name="**/jaxp13/**" unless="jaxp13+"/>
+ <exclude name="**/*XPathRegexAssert.java" unless="regexp.present"/>
+ </javac>
</target>
- <target name="test" depends="compile">
- <mkdir dir="${test.report.dir}"/>
- <junit printsummary="yes" haltonfailure="no" fork="yes" forkMode="perBatch">
+ <target name="test" depends="compile"
+ description="runs the tests">
+ <junit printsummary="yes" haltonfailure="no" fork="yes"
+ forkMode="perBatch" failureproperty="tests.failed">
<sysproperty key="basedir" value="${basedir}"/>
<sysproperty key="user.dir" value="${basedir}"/>
<!--
@@ -71,6 +107,7 @@
-->
<classpath>
<pathelement location="${out.dir}"/>
+ <pathelement location="${test.out.dir}"/>
<pathelement location="${xmlxsl.lib}"/>
<pathelement location="${junit.lib}"/>
<pathelement path="${java.class.path}"/>
@@ -90,25 +127,23 @@
</fileset>
<report format="frames" todir="${test.report.dir}/html"/>
</junitreport>
- </target>
- <target name="setDistVersion" depends="init">
- <replace dir="${src.dir}" token="@@version@@" value="${xmlunit.version}"
- includes="**/*.java"/>
- <tstamp>
- <format property="ivy.publication.datetime" pattern="yyyyMMddHHmmss"/>
- </tstamp>
+ <fail if="tests.failed">Some tests failed</fail>
</target>
- <target name="docs" depends="init">
- <mkdir dir="${docs.dir}"/>
- <delete includeEmptyDirs="true" dir="${docs.dir}/org"/>
- <javadoc destdir="${docs.dir}"
+ <target name="docs"
+ depends="create-users-guide,javadocs,-site"
+ description="creates the documentation bundle"/>
+
+ <target name="javadocs" depends="-init"
+ description="creates the API documentation">
+ <delete includeEmptyDirs="true" dir="${docs.dir}/api"/>
+ <javadoc destdir="${docs.dir}/api"
overview="${src.dir}/java/overview.html"
windowtitle="XMLUnit Documentation"
footer="<p><a href="http://xmlunit.sourceforge.net/">XMLUnit</a> is hosted by sourceforge.net</p>">
<group title="XMLUnit v${xmlunit.version}"
- packages="org.custommonkey.xmlunit.*"/>
+ packages="org.custommonkey.xmlunit*"/>
<fileset dir="${src.dir}/java">
<include name="org/custommonkey/**/*.java"/>
</fileset>
@@ -121,14 +156,23 @@
</javadoc>
</target>
- <target name="jar" depends="clean,setDistVersion,compile">
+ <target name="-site" depends="-init">
+ <copy todir="${docs.dir}">
+ <fileset dir="${src.dir}/site">
+ <include name="*.html"/>
+ <include name="*.png"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="jar" depends="clean,compile"
+ description="creates jar, Maven2 POM and Ivy file">
<jar jarfile="${lib.dir}/xmlunit-${xmlunit.version}.jar"
basedir="${out.dir}"
- excludes="**/test_*.class"
/>
<copy todir="${lib.dir}">
- <fileset dir="src/etc">
+ <fileset dir="${src.dir}/etc">
<include name="xmlunit.pom"/>
<include name="xmlunit-ivy.xml"/>
</fileset>
@@ -146,50 +190,59 @@
</copy>
</target>
- <target name="dist" depends="jar,test,docs">
- <mkdir dir="${dist.dir}"/>
- <zip zipfile="${dist.dir}/xmlunit${xmlunit.version}.zip">
- <zipfileset prefix="xmlunit" dir="${basedir}"
- includes="**/xmlunit${xmlunit.version}.jar"/>
- <zipfileset prefix="xmlunit" dir="${basedir}"
- includes="**/*.java,**/*.txt,**/*.xml,**/*.xsl,**/*.dtd,**/*.xsd"
- excludes="${out.dir}/*,**/TEST*.xml,bugs/*"/>
- <zipfileset prefix="xmlunit" dir="${basedir}"
- includes="${docs.dir}/**/*.css,${docs.dir}/**/*.html,${test.dir}/etc/*.html"/>
- <zipfileset prefix="xmlunit" dir="${src.dir}/site"
- includes="*.pdf,example.html"/>
+ <target name="bindist" depends="jar,test,docs">
+ <zip zipfile="${dist.dir}/xmlunit-${xmlunit.version}-bin.zip">
+ <zipfileset prefix="xmlunit-${xmlunit.version}/lib"
+ dir="${lib.dir}" includes="*.jar"/>
+ <zipfileset prefix="xmlunit-${xmlunit.version}/docs"
+ dir="${docs.dir}"/>
+ <zipfileset prefix="xmlunit-${xmlunit.version}" dir=".">
+ <include name="KEYS"/>
+ <include name="LICENSE.txt"/>
+ <include name="README.txt"/>
+ </zipfileset>
</zip>
</target>
- <target name="src" depends="clean">
- <property name="dist.name"
- value="${ant.project.name}-${xmlunit.version}"/>
- <copy todir="${dist.dir}/${dist.name}">
- <fileset dir="${basedir}">
- <include name="${src.dir}/**"/>
- <include name="${test.dir}/**"/>
- <include name="ISSUES"/>
+ <target name="srcdist" depends="-init,create-users-guide">
+ <zip zipfile="${dist.dir}/xmlunit-${xmlunit.version}-src.zip">
+ <zipfileset prefix="xmlunit-${xmlunit.version}" dir=".">
+ <include name="*.xml"/>
+ <include name="${src.dir}/"/>
+ <include name="${test.dir}/"/>
+ <include name="KEYS"/>
<include name="LICENSE.txt"/>
<include name="README.txt"/>
- <include name="build.xml"/>
- <include name="build.properties"/>
+ </zipfileset>
+ <zipfileset dir="${userguide.docs.dir}"
+ prefix="xmlunit-${xmlunit.version}/userguide"/>
+ </zip>
+ </target>
+
+ <target name="dist"
+ depends="clean,bindist,srcdist,compile-userguide-examples"
+ description="creates the distribution files">
+ <checksum algorithm="md5">
+ <fileset dir="${dist.dir}">
+ <include name="*.zip"/>
</fileset>
- </copy>
- <tar tarfile="${dist.name}-src.tar" basedir="${dist.dir}">
- </tar>
- <gzip zipfile="${dist.name}-src.tgz"
- src="${dist.name}-src.tar" />
- <delete file="${dist.name}-src.tar" />
+ </checksum>
+ <checksum algorithm="sha1">
+ <fileset dir="${dist.dir}">
+ <include name="*.zip"/>
+ </fileset>
+ </checksum>
</target>
<target name="compile-userguide-examples" depends="compile">
- <mkdir dir="${build.user.guide}"/>
+ <mkdir dir="${userguide.out.dir}"/>
<javac srcdir="src/user-guide" includes="org/"
- destdir="${build.user.guide}" source="1.3" target="1.2">
+ destdir="${userguide.out.dir}" source="1.3" target="1.2">
<classpath>
<pathelement location="${junit.lib}"/>
<pathelement location="${out.dir}"/>
</classpath>
</javac>
+ <delete dir="${userguide.out.dir}"/>
</target>
</project>
Added: trunk/xmlunit/docbook.xml
===================================================================
--- trunk/xmlunit/docbook.xml (rev 0)
+++ trunk/xmlunit/docbook.xml 2007-04-18 15:27:50 UTC (rev 193)
@@ -0,0 +1,84 @@
+<project>
+ <!-- allow overrides -->
+ <property file="docbook.properties"/>
+
+ <!-- location of Docbook Stylesheets and dblatex -->
+ <property name="db5.xsl" location="../../docbook/docbook5-xsl-1.72.0"/>
+ <property name="dblatex" value="/usr/bin/dblatex"/>
+
+ <property name="html.dir" location="${userguide.docs.dir}/html"/>
+ <property name="user.guide" value="XMLUnit-Java"/>
+ <property name="src.userguide.dir" value="${src.dir}/user-guide"/>
+
+ <target name="create-users-guide"
+ depends="users-guide-html,users-guide-pdf"
+ description="creates PDF and HTML version of User's Guide"/>
+
+ <target name="-html-needs-refresh?">
+ <uptodate property="HTML is up-to-date"
+ srcfile="${src.userguide.dir}/${user.guide}.xml"
+ targetfile="${html.dir}/index.html"/>
+ </target>
+
+ <target name="users-guide-html" depends="-html-needs-refresh?"
+ unless="HTML is up-to-date"
+ description="Creates HTML version of the User's Guide">
+ <delete dir="${html.dir}" quiet="true"/>
+ <mkdir dir="${html.dir}"/>
+ <xslt
+ basedir="${src.userguide.dir}"
+ destdir="${html.dir}"
+ style="${db5.xsl}/html/chunk.xsl">
+ <include name="${user.guide}.xml"/>
+
+ <param name="section.autolabel" expression="1"/>
+ <param name="section.label.includes.component.label" expression="1"/>
+ </xslt>
+ <copy file="${src.dir}/site/xmlunit.png" toDir="${html.dir}"/>
+ <delete file="${html.dir}/${user.guide}.html" quiet="true"/>
+ </target>
+
+ <target name="-check-os">
+ <condition property="isWindows">
+ <os family="windows"/>
+ </condition>
+ </target>
+
+ <target name="-define-dblatex-unix" unless="isWindows"
+ depends="-check-os">
+ <macrodef name="dblatex">
+ <attribute name="sourcefile"/>
+ <sequential>
+ <apply executable="${dblatex}">
+ <fileset file="@{sourcefile}"/>
+ <globmapper from="*.xml" to="*.pdf"/>
+ </apply>
+ </sequential>
+ </macrodef>
+ </target>
+
+ <target name="-define-dblatex-cygwin" if="isWindows"
+ depends="-check-os">
+ <macrodef name="dblatex">
+ <attribute name="sourcefile"/>
+ <sequential>
+ <apply executable="bash.exe" addsourcefile="false">
+ <fileset file="@{sourcefile}"/>
+ <globmapper from="*.xml" to="*.pdf"/>
+ <arg value="-c"/>
+ <arg value="${dblatex} @{sourcefile}"/>
+ </apply>
+ </sequential>
+ </macrodef>
+ </target>
+
+ <target name="-define-dblatex"
+ depends="-define-dblatex-unix,-define-dblatex-cygwin"/>
+
+ <target name="users-guide-pdf" depends="-define-dblatex"
+ description="Creates the PDF version of the User's Guide">
+ <dblatex sourcefile="${src.userguide.dir}/${user.guide}.xml"/>
+ <move file="${src.userguide.dir}/${user.guide}.pdf"
+ todir="${userguide.docs.dir}"/>
+ </target>
+</project>
\ No newline at end of file
Property changes on: trunk/xmlunit/docbook.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ native
Modified: trunk/xmlunit/src/site/index.html
===================================================================
--- trunk/xmlunit/src/site/index.html 2007-04-18 15:27:27 UTC (rev 192)
+++ trunk/xmlunit/src/site/index.html 2007-04-18 15:27:50 UTC (rev 193)
@@ -62,10 +62,10 @@
</tr>
<tr>
<td colspan="2">
- <p>The current release is <a
+ <p>The current stable release is <a
href="http://sourceforge.net/project/showfiles.php?group_id=23187&release_id=155097">XMLUnit
1.0</a>, April 2003 (release notes are <a
- href="http://xmlunit.svn.sourceforge.net/viewvc/*checkout*/xmlunit/tags/v1_0/xmlunit/README.txt">here</a>)</p>
+ href="http://xmlunit.svn.sourceforge.net/viewvc/*checkout*/xmlunit/tags/v1_0/xmlunit/README.txt">here</a>), the latest release is XMLUnit 1.1 beta 1 released in April 2007. It can be downloaded from <a href="http://sourceforge.net/project/showfiles.php?group_id=23187">here</a>.</p>
<p>XMLUnit for Java provides two JUnit extension classes, <code>XMLAssert</code>
and <code>XMLTestCase</code>,
and a set of supporting classes (e.g. <code>Diff</code>, <code>DetailedDiff</code>,<code>Transform</code>,<code>SimpleXpathEngine</code>,<code>Validator</code>,<code>NodeTest</code>)
@@ -84,9 +84,11 @@
<table border="0" cellspacing="5" cellpadding="5">
<tbody>
<tr>
- <td><a href="XMLUnit.pdf">Read the overview document (PDF)</a></td>
+ <td>Read the User's Guide (<a
+ href="userguide/XMLUnit-Java.pdf">PDF</a> or <a
+ href="userguide/html/index.html">HTML</a>)</td>
<td><a href="example.html">See some example code</a></td>
- <td><a href="doc">Browse the Javadocs</a></td>
+ <td><a href="api/index.html">Browse the Javadocs</a></td>
<td><a
href="http://xmlunit.svn.sourceforge.net/viewvc/xmlunit/trunk/xmlunit/">Visit
the Subversion repository</a> </td>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-18 15:27:29
|
Revision: 192
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=192&view=rev
Author: bodewig
Date: 2007-04-18 08:27:27 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Don't use deprecated method
Modified Paths:
--------------
trunk/xmlunit/src/user-guide/XMLUnit-Java.xml
trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ATourOfXMLUnit.java
Modified: trunk/xmlunit/src/user-guide/XMLUnit-Java.xml
===================================================================
--- trunk/xmlunit/src/user-guide/XMLUnit-Java.xml 2007-04-18 01:36:07 UTC (rev 191)
+++ trunk/xmlunit/src/user-guide/XMLUnit-Java.xml 2007-04-18 15:27:27 UTC (rev 192)
@@ -33,7 +33,7 @@
</revision>
<revision>
<revnumber>1.1</revnumber>
- <date>... 2007</date>
+ <date>April 2007</date>
<revremark>Documentation for XMLUnit Java 1.1</revremark>
</revision>
</revhistory>
@@ -470,7 +470,7 @@
+ "<planet name='Earth' position='3' supportsLife='yes'/>"
+ "<planet name='Venus' position='4'/></solar-system>";
assertXpathExists("//planet[@name='Earth']", mySolarSystemXML);
- assertNotXpathExists("//star[@name='alpha centauri']",
+ assertXpathNotExists("//star[@name='alpha centauri']",
mySolarSystemXML);
assertXpathsEqual("//planet[@name='Earth']",
"//planet[@position='3']", mySolarSystemXML);
@@ -1192,6 +1192,13 @@
same child nodes but in a different order.</entry>
</row>
<row>
+ <entry><literal>CHILD_NODE_NOT_FOUND_ID</literal></entry>
+ <entry><literal>CHILD_NODE_NOT_FOUND</literal></entry>
+ <entry><literal>false</literal></entry>
+ <entry>A child node in one piece of XML couldn't be
+ matched against any other node of the other piece.</entry>
+ </row>
+ <row>
<entry><literal>ATTR_SEQUENCE_ID</literal></entry>
<entry><literal>ATTR_SEQUENCE</literal></entry>
<entry><literal>true</literal></entry>
@@ -1416,6 +1423,11 @@
<literal>String</literal>.</entry>
</row>
<row>
+ <entry><literal>CHILD_NODE_NOT_FOUND_ID</literal></entry>
+ <entry>The name of the unmatched node or
+ <literal>null</literal>.</entry>
+ </row>
+ <row>
<entry><literal>ATTR_SEQUENCE_ID</literal></entry>
<entry>The attribute's name.</entry>
</row>
@@ -2995,6 +3007,22 @@
but if you tried to catch these exceptions they will now
bypass your catch blocks.</para>
</listitem>
+
+ <listitem>
+ <para>A new type of <literal>Difference</literal>
+ (<literal>CHILD_NODE_NOT_FOUND_ID</literal>) has been
+ added. It will be raised for the excess children if the
+ control element has more child nodes than the test element
+ - or vice versa.</para>
+
+ <para>Prior to XMLUnit 1.1 a <literal>Difference</literal>
+ of either <literal>ELEMENT_TAG_NAME_ID</literal> or
+ <literal>NODE_TYPE_ID</literal> would have been raised if
+ the control element had more children. The excess
+ children were compared to the very first child node of the
+ test element. Excess children of the test element were
+ not reported at all.</para>
+ </listitem>
</itemizedlist>
</section>
Modified: trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ATourOfXMLUnit.java
===================================================================
--- trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ATourOfXMLUnit.java 2007-04-18 01:36:07 UTC (rev 191)
+++ trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ATourOfXMLUnit.java 2007-04-18 15:27:27 UTC (rev 192)
@@ -173,7 +173,7 @@
+ "<planet name='Earth' position='3' supportsLife='yes'/>"
+ "<planet name='Venus' position='4'/></solar-system>";
assertXpathExists("//planet[@name='Earth']", mySolarSystemXML);
- assertNotXpathExists("//star[@name='alpha centauri']",
+ assertXpathNotExists("//star[@name='alpha centauri']",
mySolarSystemXML);
assertXpathsEqual("//planet[@name='Earth']",
"//planet[@position='3']", mySolarSystemXML);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-18 01:36:08
|
Revision: 191
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=191&view=rev
Author: bodewig
Date: 2007-04-17 18:36:07 -0700 (Tue, 17 Apr 2007)
Log Message:
-----------
Implement new difference type for unmatched nodes
Modified Paths:
--------------
trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceConstants.java
trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java
trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java
trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceConstants.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceConstants.java 2007-04-17 04:04:57 UTC (rev 190)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceConstants.java 2007-04-18 01:36:07 UTC (rev 191)
@@ -1,6 +1,6 @@
/*
******************************************************************
-Copyright (c) 2001, Jeff Martin, Tim Bacon
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -84,6 +84,9 @@
int CHILD_NODELIST_SEQUENCE_ID = 20;
/** Comparing 2 Documents only one of which has a doctype */
int HAS_DOCTYPE_DECLARATION_ID = 21;
+ /** Comparing 2 nodes and one holds more childnodes than can be
+ * matched against child nodes of the other. */
+ int CHILD_NODE_NOT_FOUND_ID = 22;
/** Comparing an implied attribute value against an explicit value */
public static final Difference ATTR_VALUE_EXPLICITLY_SPECIFIED =
@@ -173,4 +176,9 @@
public static final Difference HAS_DOCTYPE_DECLARATION =
new Difference(HAS_DOCTYPE_DECLARATION_ID,
"presence of doctype declaration", true);
+
+ /** Comparing 2 nodes and one holds more childnodes than can be
+ * matched against child nodes of the other. */
+ public static final Difference CHILD_NODE_NOT_FOUND =
+ new Difference(CHILD_NODE_NOT_FOUND_ID, "presence of child node");
}
\ No newline at end of file
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java 2007-04-17 04:04:57 UTC (rev 190)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java 2007-04-18 01:36:07 UTC (rev 191)
@@ -39,6 +39,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import org.w3c.dom.Attr;
@@ -360,6 +361,8 @@
HashMap/*<Node, Node>*/ matchingNodes = new HashMap();
HashMap/*<Node, Integer>*/ matchingNodeIndexes = new HashMap();
+ List/*<Node>*/ unmatchedTestNodes = new ArrayList(testChildren);
+
// first pass to find the matching nodes in control and test docs
for (int i=0; i < numNodes; ++i) {
Node nextControl = (Node) controlChildren.get(i);
@@ -371,12 +374,14 @@
boolean matchFound = false;
while (!matchFound) {
- if (findNodeType == ((Node)testChildren.get(j)).getNodeType()) {
+ Node t = (Node) testChildren.get(j);
+ if (findNodeType == t.getNodeType()
+ || comparingTextAndCDATA(findNodeType, t.getNodeType())) {
matchFound = !matchOnElement
|| elementQualifier == null
|| elementQualifier
.qualifyForComparison((Element) nextControl,
- (Element) testChildren.get(j));
+ (Element) t);
}
if (!matchFound) {
++j;
@@ -392,47 +397,38 @@
if (matchFound) {
matchingNodes.put(nextControl, testChildren.get(j));
matchingNodeIndexes.put(nextControl, new Integer(j));
+ unmatchedTestNodes.remove(testChildren.get(j));
}
}
// next, do the actual comparision on those that matched - or
// match them against the first test nodes that didn't match
// any other control nodes
- Collection matchingTestNodes = matchingNodes.values();
for (int i=0; i < numNodes; ++i) {
Node nextControl = (Node) controlChildren.get(i);
Node nextTest = (Node) matchingNodes.get(nextControl);
Integer testIndex = (Integer) matchingNodeIndexes.get(nextControl);
- if (nextTest == null) {
- short findNodeType = nextControl.getNodeType();
- int startAt = ( i > lastTestNode ? lastTestNode : i);
- j = startAt;
-
- boolean matchFound = false;
-
- while (!matchFound) {
- if (((Node) testChildren.get(j))
- .getNodeType() == findNodeType
- && !matchingTestNodes.contains(testChildren.get(j))) {
- matchFound = true;
- } else {
- ++j;
- if (j > lastTestNode) {
- j = 0;
- }
- if (j == startAt) {
- // been through all children
- break;
- }
- }
- }
- nextTest = (Node) testChildren.get(j);
- testIndex = new Integer(j);
+ if (nextTest == null && !unmatchedTestNodes.isEmpty()) {
+ nextTest = (Node) unmatchedTestNodes.get(0);
+ testIndex = new Integer(testChildren.indexOf(nextTest));
+ unmatchedTestNodes.remove(0);
}
+ if (nextTest != null) {
compareNode(nextControl, nextTest, listener, elementQualifier);
compare(new Integer(i), testIndex,
nextControl, nextTest, listener, CHILD_NODELIST_SEQUENCE);
+ } else {
+ compare(nextControl.getNodeName(), null, nextControl, null,
+ listener, CHILD_NODE_NOT_FOUND);
+ }
}
+
+ // now handle remaining unmatched test nodes
+ for (Iterator iter = unmatchedTestNodes.iterator(); iter.hasNext();) {
+ Node n = (Node) iter.next();
+ compare(null, n.getNodeName(), null, n, listener,
+ CHILD_NODE_NOT_FOUND);
+ }
}
/**
Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java
===================================================================
--- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java 2007-04-17 04:04:57 UTC (rev 190)
+++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DetailedDiff.java 2007-04-18 01:36:07 UTC (rev 191)
@@ -1,6 +1,6 @@
/*
******************************************************************
-Copyright (c) 200, Jeff Martin, Tim Bacon
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -110,15 +110,33 @@
DetailedDiff differencesWithWhitespace = new DetailedDiff(
new Diff(new InputSource(new FileReader(control)),
new InputSource(new FileReader(test))) );
- assertEquals(1402, differencesWithWhitespace.getAllDifferences().size());
+ List l = differencesWithWhitespace.getAllDifferences();
+ int unmatchedNodes = 0;
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ Difference d = (Difference) iter.next();
+ if (d.getId() == DifferenceConstants.CHILD_NODE_NOT_FOUND_ID) {
+ unmatchedNodes++;
+ }
+ }
+
+ assertEquals(1402 + unmatchedNodes,
+ differencesWithWhitespace.getAllDifferences().size());
+
try {
XMLUnit.setIgnoreWhitespace(true);
Diff prototype =
new Diff(new FileReader(control), new FileReader(test));
DetailedDiff detailedDiff = new DetailedDiff(prototype);
List differences = detailedDiff.getAllDifferences();
- assertEquals(40, differences.size());
+ unmatchedNodes = 0;
+ for (Iterator iter = differences.iterator(); iter.hasNext();) {
+ Difference d = (Difference) iter.next();
+ if (d.getId() == DifferenceConstants.CHILD_NODE_NOT_FOUND_ID) {
+ unmatchedNodes++;
+ }
+ }
+ assertEquals(40 + unmatchedNodes, differences.size());
SimpleXpathEngine xpathEngine = new SimpleXpathEngine();
Document controlDoc =
@@ -217,8 +235,9 @@
DetailedDiff diff = new DetailedDiff(new Diff(control, test));
List changes = diff.getAllDifferences();
- // number of children, text of first child
- assertEquals(2, changes.size());
+ // number of children, text of first child, unexpected second
+ // test child
+ assertEquals(3, changes.size());
}
protected Diff buildDiff(Document control, Document test) {
Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java
===================================================================
--- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java 2007-04-17 04:04:57 UTC (rev 190)
+++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java 2007-04-18 01:36:07 UTC (rev 191)
@@ -620,7 +620,7 @@
String control = "<stuff><item id=\"1\"/><item id=\"2\"/></stuff>";
String test = "<stuff><?item data?></stuff>";
listenToDifferences(control, test);
- assertEquals("13th control xpath", "/stuff[1]/item[2]",
+ assertEquals("13th control xpath", "/stuff[1]/item[1]",
listener.controlXpath);
assertEquals("13th test xpath", "/stuff[1]/processing-instruction()[1]",
listener.testXpath);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-17 04:04:57
|
Revision: 190
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=190&view=rev
Author: bodewig
Date: 2007-04-16 21:04:57 -0700 (Mon, 16 Apr 2007)
Log Message:
-----------
adapt to changes
Modified Paths:
--------------
trunk/xmlunit/src/user-guide/XMLUnit-Java.xml
Modified: trunk/xmlunit/src/user-guide/XMLUnit-Java.xml
===================================================================
--- trunk/xmlunit/src/user-guide/XMLUnit-Java.xml 2007-04-17 04:02:14 UTC (rev 189)
+++ trunk/xmlunit/src/user-guide/XMLUnit-Java.xml 2007-04-17 04:04:57 UTC (rev 190)
@@ -931,6 +931,26 @@
linkend="Whitespace Handling"/> for more details.</para>
</section>
+
+ <section id="XSLT Stylesheet Version">
+ <title>XSLT Stylesheet Version</title>
+
+ <para>Some features of XMLUnit use XSLT stylesheets under the
+ covers, in particular XSLT will be used to strip element
+ content whitespace or comments as well as by
+ <literal>SimpleXpathEngine</literal>. These stylesheets only
+ require a XSLT transformer that supports XSLT 1.0 and will say
+ so in the <literal>stylesheet</literal> element.</para>
+
+ <para>If your XSLT transformer supports XSLT 2.0 or newer it
+ may<footnote><para>The W3C recommendation says it
+ SHOULD.</para></footnote> issue a warning for these stylesheets
+ which can be annoying. You can use
+ <literal>XMLUnit.setXSLTVersion</literal> to make XMLUnit
+ change the version attribute to a different value. Note that
+ XMLUnit hasn't been tested with a value other than
+ <literal>"1.0"</literal>.</para>
+ </section>
</section>
<section id="Providing Input to XMLUnit">
@@ -2958,6 +2978,11 @@
</listitem>
<listitem>
+ <para>All methods that have been deprecated in XMLUnit 1.0
+ have been removed.</para>
+ </listitem>
+
+ <listitem>
<para>All methods that had been declared to throw
<literal>TransformerConfigurationException</literal> or
<literal>ParserConfigurationException</literal> now no
@@ -3012,6 +3037,10 @@
</listitem>
<listitem>It is now possible to provide a custom
+ <literal>org.xml.sax.EntityResolver</literal> for control
+ and test parsers.</listitem>
+
+ <listitem>It is now possible to provide a custom
<literal>javax.xml.transform.URIResolver</literal> for
transformations.</listitem>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-17 04:02:13
|
Revision: 189
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=189&view=rev
Author: bodewig
Date: 2007-04-16 21:02:14 -0700 (Mon, 16 Apr 2007)
Log Message:
-----------
Make XSLT version used for internal stylesheets configurable
Modified Paths:
--------------
trunk/xmlunit/src/java/org/custommonkey/xmlunit/SimpleXpathEngine.java
trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java
trunk/xmlunit/src/java/org/custommonkey/xmlunit/XSLTConstants.java
trunk/xmlunit/src/java/org/custommonkey/xmlunit/exceptions/ConfigurationException.java
trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Constants.java
trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Transform.java
trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_XMLUnit.java
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/SimpleXpathEngine.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/SimpleXpathEngine.java 2007-04-17 03:59:29 UTC (rev 188)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/SimpleXpathEngine.java 2007-04-17 04:02:14 UTC (rev 189)
@@ -73,7 +73,7 @@
*/
private StringBuffer getXSLTBase() {
StringBuffer result = new StringBuffer(XML_DECLARATION)
- .append(XSLT_START);
+ .append(XMLUnit.getXSLTStart());
String tmp = result.toString();
int close = tmp.lastIndexOf('>');
if (close == -1) {
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java 2007-04-17 03:59:29 UTC (rev 188)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java 2007-04-17 04:02:14 UTC (rev 189)
@@ -1,6 +1,6 @@
/*
*****************************************************************
-Copyright (c) 2001, Jeff Martin, Tim Bacon
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -48,6 +48,9 @@
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
+import java.text.NumberFormat;
+import java.text.ParseException;
+import java.util.Locale;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -72,19 +75,33 @@
private static boolean normalize = false;
private static boolean normalizeWhitespace = false;
private static boolean ignoreAttributeOrder = false;
+ private static String xsltVersion = "1.0";
- private static final String STRIP_WHITESPACE_STYLESHEET
+ private static final String XSLT_VERSION_START = " version=\"";
+ private static final String XSLT_VERSION_END = "\">";
+
+ private static final String STRIP_WHITESPACE_STYLESHEET_START
= new StringBuffer(XMLConstants.XML_DECLARATION)
- .append(XSLTConstants.XSLT_START)
+ .append(XSLTConstants.XSLT_START_NO_VERSION)
+ .append(XSLT_VERSION_START)
+ .toString();
+
+ private static final String STRIP_WHITESPACE_STYLESHEET_END
+ = new StringBuffer(XSLT_VERSION_END)
.append(XSLTConstants.XSLT_XML_OUTPUT_NOINDENT)
.append(XSLTConstants.XSLT_STRIP_WHITESPACE)
.append(XSLTConstants.XSLT_IDENTITY_TEMPLATE)
.append(XSLTConstants.XSLT_END)
.toString();
- private static final String STRIP_COMMENTS_STYLESHEET
+ private static final String STRIP_COMMENTS_STYLESHEET_START
= new StringBuffer(XMLConstants.XML_DECLARATION)
- .append(XSLTConstants.XSLT_START)
+ .append(XSLTConstants.XSLT_START_NO_VERSION)
+ .append(XSLT_VERSION_START)
+ .toString();
+
+ private static final String STRIP_COMMENTS_STYLESHEET_END
+ = new StringBuffer(XSLT_VERSION_END)
.append(XSLTConstants.XSLT_XML_OUTPUT_NOINDENT)
.append(XSLTConstants.XSLT_STRIP_COMMENTS_TEMPLATE)
.append(XSLTConstants.XSLT_END)
@@ -418,23 +435,33 @@
return newFactory;
}
+ private static String getStripWhitespaceStylesheet() {
+ return STRIP_WHITESPACE_STYLESHEET_START + getXSLTVersion()
+ + STRIP_WHITESPACE_STYLESHEET_END;
+ }
+
/**
- * Obtain the transformation that will strip whitespace from a DOM containing
- * empty Text nodes
+ * Obtain the transformation that will strip whitespace from a DOM
+ * containing empty Text nodes
* @param forDocument
* @return a <code>Transform</code> to do the whitespace stripping
*/
public static Transform getStripWhitespaceTransform(Document forDocument) {
- return new Transform(forDocument, STRIP_WHITESPACE_STYLESHEET);
+ return new Transform(forDocument, getStripWhitespaceStylesheet());
}
+ private static String getStripCommentsStylesheet() {
+ return STRIP_COMMENTS_STYLESHEET_START + getXSLTVersion()
+ + STRIP_COMMENTS_STYLESHEET_END;
+ }
+
/**
* Obtain the transformation that will strip comments from a DOM.
* @param forDocument
* @return a <code>Transform</code> to do the whitespace stripping
*/
public static Transform getStripCommentsTransform(Document forDocument) {
- return new Transform(forDocument, STRIP_COMMENTS_STYLESHEET);
+ return new Transform(forDocument, getStripCommentsStylesheet());
}
/**
@@ -685,5 +712,43 @@
public static boolean getIgnoreAttributeOrder() {
return ignoreAttributeOrder;
}
+
+ /**
+ * Sets the XSLT version to set on stylesheets used internally.
+ *
+ * <p>Defaults to "1.0".</p>
+ *
+ * @throws ConfigurationException if the argument cannot be parsed
+ * as a positive number.
+ */
+ public static void setXSLTVersion(String s) {
+ try {
+ Number n = NumberFormat.getInstance(Locale.US).parse(s);
+ if (n.doubleValue() < 0) {
+ throw new ConfigurationException(s + " doesn't reperesent a"
+ + " positive number.");
+ }
+ } catch (ParseException e) {
+ throw new ConfigurationException(e);
+ }
+ xsltVersion = s;
+ }
+
+ /**
+ * The XSLT version set on stylesheets used internally.
+ *
+ * <p>Defaults to "1.0".</p>
+ */
+ public static String getXSLTVersion() {
+ return xsltVersion;
+ }
+
+ /**
+ * XSLT stylesheet element using the configured XSLT version.
+ */
+ static String getXSLTStart() {
+ return XSLTConstants.XSLT_START_NO_VERSION
+ + XSLT_VERSION_START + getXSLTVersion() + XSLT_VERSION_END;
+ }
}
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/XSLTConstants.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/XSLTConstants.java 2007-04-17 03:59:29 UTC (rev 188)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/XSLTConstants.java 2007-04-17 04:02:14 UTC (rev 189)
@@ -1,6 +1,6 @@
/*
******************************************************************
-Copyright (c) 2001, Jeff Martin, Tim Bacon
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -41,34 +41,40 @@
*/
public interface XSLTConstants extends XMLConstants {
/**
- * <xsl:stylesheet>
+ * <xsl:stylesheet
*/
- public static final String XSLT_START =
- "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">";
+ String XSLT_START_NO_VERSION =
+ "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"";
/**
+ * <xsl:stylesheet ... version="1.0">
+ */
+ String XSLT_START =
+ XSLT_START_NO_VERSION + " version=\"1.0\">";
+
+ /**
* <xsl:output> for XML with no indentation
*/
- public static final String XSLT_XML_OUTPUT_NOINDENT =
+ String XSLT_XML_OUTPUT_NOINDENT =
"<xsl:output method=\"xml\" version=\"1.0\" indent=\"no\"/>";
/**
* <xsl:strip-space> for all elements
*/
- public static final String XSLT_STRIP_WHITESPACE =
+ String XSLT_STRIP_WHITESPACE =
"<xsl:strip-space elements=\"*\"/>";
/**
* <xsl:template> to copy the current nodeset into the output tree
*/
- public static final String XSLT_IDENTITY_TEMPLATE =
+ String XSLT_IDENTITY_TEMPLATE =
"<xsl:template match=\"/\"><xsl:copy-of select=\".\"/></xsl:template>";
/**
* <xsl:template> to copy the current nodeset into the
* output tree while stripping comments.
*/
- public static final String XSLT_STRIP_COMMENTS_TEMPLATE =
+ String XSLT_STRIP_COMMENTS_TEMPLATE =
"<xsl:template match=\"node()[not(self::comment())]|@*\">"
+ "<xsl:copy><xsl:apply-templates select=\"node()[not(self::comment())]|@*\"/></xsl:copy>"
+ "</xsl:template>";
@@ -76,5 +82,5 @@
/**
* </xsl:stylesheet>
*/
- public static final String XSLT_END = "</xsl:stylesheet>";
+ String XSLT_END = "</xsl:stylesheet>";
}
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/exceptions/ConfigurationException.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/exceptions/ConfigurationException.java 2007-04-17 03:59:29 UTC (rev 188)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/exceptions/ConfigurationException.java 2007-04-17 04:02:14 UTC (rev 189)
@@ -1,6 +1,6 @@
/*
******************************************************************
-Copyright (c) 2001, Jeff Martin, Tim Bacon
+Copyright (c) 2006-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -44,4 +44,7 @@
public ConfigurationException(Throwable t) {
super(t != null ? t.getMessage() : null, t);
}
+ public ConfigurationException(String s) {
+ super(s, null);
+ }
}
\ No newline at end of file
Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Constants.java
===================================================================
--- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Constants.java 2007-04-17 03:59:29 UTC (rev 188)
+++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Constants.java 2007-04-17 04:02:14 UTC (rev 189)
@@ -1,6 +1,6 @@
/*
******************************************************************
-Copyright (c) 200, Jeff Martin, Tim Bacon
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Transform.java
===================================================================
--- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Transform.java 2007-04-17 03:59:29 UTC (rev 188)
+++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_Transform.java 2007-04-17 04:02:14 UTC (rev 189)
@@ -1,6 +1,6 @@
/*
******************************************************************
-Copyright (c) 200, Jeff Martin, Tim Bacon
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_XMLUnit.java
===================================================================
--- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_XMLUnit.java 2007-04-17 03:59:29 UTC (rev 188)
+++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_XMLUnit.java 2007-04-17 04:02:14 UTC (rev 189)
@@ -1,6 +1,6 @@
/*
******************************************************************
-Copyright (c) 200, Jeff Martin, Tim Bacon
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -40,6 +40,7 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.custommonkey.xmlunit.exceptions.ConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.EntityResolver;
import org.xml.sax.helpers.DefaultHandler;
@@ -112,10 +113,26 @@
assertTrue(diff.similar());
}
- /**
- * Returns a TestSuite containing this test case.
- */
- public static TestSuite suite(){
- return new TestSuite(test_XMLUnit.class);
+ public void testXSLTVersion() {
+ try {
+ assertEquals("1.0", XMLUnit.getXSLTVersion());
+ assertEquals(XSLTConstants.XSLT_START, XMLUnit.getXSLTStart());
+ XMLUnit.setXSLTVersion("2.0");
+ assertTrue(XMLUnit.getXSLTStart()
+ .startsWith(XSLTConstants.XSLT_START_NO_VERSION));
+ assertTrue(XMLUnit.getXSLTStart().endsWith("\"2.0\">"));
+ try {
+ XMLUnit.setXSLTVersion("foo");
+ fail("foo is not a number");
+ } catch (ConfigurationException expected) {
+ }
+ try {
+ XMLUnit.setXSLTVersion("-1.0");
+ fail("-1.0 is negative");
+ } catch (ConfigurationException expected) {
+ }
+ } finally {
+ XMLUnit.setXSLTVersion("1.0");
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-17 03:59:28
|
Revision: 188
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=188&view=rev
Author: bodewig
Date: 2007-04-16 20:59:29 -0700 (Mon, 16 Apr 2007)
Log Message:
-----------
remove deprecated methods
Modified Paths:
--------------
trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLAssert.java
trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLTestCase.java
trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLAssert.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLAssert.java 2007-04-16 13:06:55 UTC (rev 187)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLAssert.java 2007-04-17 03:59:29 UTC (rev 188)
@@ -145,17 +145,6 @@
/**
* Assert that the result of an XML comparison is or is not identical
- * @param diff the result of an XML comparison
- * @param assertion true if asserting that result is identical
- * @param msg additional message to display if assertion fails
- * @deprecated Use XMLTestCase#assertXMLIdentical(String, Diff, boolean) instead
- */
- public static void assertXMLIdentical(Diff diff, boolean assertion, String msg) {
- assertXMLIdentical(msg, diff, assertion);
- }
-
- /**
- * Assert that the result of an XML comparison is or is not identical
* @param msg Message to display if assertion fails
* @param diff the result of an XML comparison
* @param assertion true if asserting that result is identical
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLTestCase.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLTestCase.java 2007-04-16 13:06:55 UTC (rev 187)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLTestCase.java 2007-04-17 03:59:29 UTC (rev 188)
@@ -78,34 +78,6 @@
}
/**
- * Whether to ignore whitespace in attributes and elements
- * @param ignore
- * @deprecated this is a global setting and should be invoked on
- * {@link XMLUnit#setIgnoreWhitespace XMLUnit} instead
- */
- public void setIgnoreWhitespace(boolean ignore){
- XMLUnit.setIgnoreWhitespace(ignore);
- }
-
- /**
- * Overide default sax parser used to parser documents
- * @deprecated this is a global setting and should be invoked on
- * {@link XMLUnit#setControlParser XMLUnit} instead
- */
- public void setControlParser(String parser){
- XMLUnit.setControlParser(parser);
- }
-
- /**
- * Overide default sax parser used to parse documents
- * @deprecated this is a global setting and should be invoked on
- * {@link XMLUnit#setTestParser XMLUnit} instead
- */
- public void setTestParser(String parser){
- XMLUnit.setTestParser(parser);
- }
-
- /**
* Compare XML documents provided by two InputSource classes
* @param control Control document
* @param test Document to test
@@ -191,18 +163,7 @@
/**
* Assert that the result of an XML comparison is or is not similar.
- * @param diff the result of an XML comparison
- * @param assertion true if asserting that result is similar
* @param msg additional message to display if assertion fails
- * @deprecated Use XMLTestCase#assertXMLEqual(String, Diff, boolean) instead
- */
- public void assertXMLEqual(Diff diff, boolean assertion, String msg) {
- XMLAssert.assertXMLEqual(msg, diff, assertion);
- }
-
- /**
- * Assert that the result of an XML comparison is or is not similar.
- * @param msg additional message to display if assertion fails
* @param diff the result of an XML comparison
* @param assertion true if asserting that result is similar
*/
@@ -221,17 +182,6 @@
/**
* Assert that the result of an XML comparison is or is not identical
- * @param diff the result of an XML comparison
- * @param assertion true if asserting that result is identical
- * @param msg additional message to display if assertion fails
- * @deprecated Use XMLTestCase#assertXMLIdentical(String, Diff, boolean) instead
- */
- public void assertXMLIdentical(Diff diff, boolean assertion, String msg) {
- XMLAssert.assertXMLIdentical(msg, diff, assertion);
- }
-
- /**
- * Assert that the result of an XML comparison is or is not identical
* @param msg Message to display if assertion fails
* @param diff the result of an XML comparison
* @param assertion true if asserting that result is identical
@@ -925,18 +875,6 @@
/**
* Assert that a specific XPath does NOT exist in some given XML
* @param inXpathExpression
- * @param inXMLString
- * @deprecated Use assertXpathNotExists instead
- */
- public void assertNotXpathExists(String xPathExpression,
- String inXMLString)
- throws IOException, SAXException , XpathException {
- XMLAssert.assertXpathNotExists(xPathExpression, inXMLString);
- }
-
- /**
- * Assert that a specific XPath does NOT exist in some given XML
- * @param inXpathExpression
* @param inDocument
* @see XpathEngine which provides the underlying evaluation mechanism
*/
@@ -947,18 +885,6 @@
}
/**
- * Assert that a specific XPath does NOT exist in some given XML
- * @param inXpathExpression
- * @param inDocument
- * @deprecated Use assertXpathNotExists instead
- */
- public void assertNotXpathExists(String xPathExpression,
- Document inDocument)
- throws XpathException {
- XMLAssert.assertXpathNotExists(xPathExpression, inDocument);
- }
-
- /**
* Assert that a piece of XML contains valid XML: the input must
* contain a DOCTYPE declaration to be validated
* @param xml
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java 2007-04-16 13:06:55 UTC (rev 187)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLUnit.java 2007-04-17 03:59:29 UTC (rev 188)
@@ -280,76 +280,6 @@
}
/**
- * Compare XML documents provided by two Reader classes.
- * @param control Control document
- * @param test Document to test
- * @return Diff object describing differences in documents
- * @throws SAXException
- * @throws IOException
- * @deprecated use Diff constructor directly
- */
- public static Diff compare(Reader control, Reader test)
- throws SAXException, IOException {
- return new Diff(control, test);
- }
-
- /**
- * Compare two XML documents provided by SAX <code>InputSources</code>
- * @param control Control document
- * @param test Document to test
- * @return Diff object describing differences in documents
- * @throws SAXException
- * @throws IOException
- * @deprecated use Diff constructor directly
- */
- public static Diff compare(InputSource control, InputSource test)
- throws SAXException, IOException {
- return new Diff(control, test);
- }
-
- /**
- * Compare two XML documents provided by a string and a Reader.
- * @param control Control document
- * @param test Document to test
- * @return Diff object describing differences in documents
- * @throws SAXException
- * @throws IOException
- * @deprecated use Diff constructor directly
- */
- public static Diff compare(String control, Reader test) throws SAXException,
- IOException {
- return new Diff(new StringReader(control), test);
- }
-
- /**
- * Compare two XML documents provided by a Reader and a string.
- * @param control Control document
- * @param test Document to test
- * @return Diff object describing differences in documents
- * @throws SAXException
- * @throws IOException
- * @deprecated use Diff constructor directly
- */
- public static Diff compare(Reader control, String test) throws SAXException,
- IOException {
- return new Diff(control, new StringReader(test));
- }
-
- /**
- * Compare two XML documents provided as strings.
- * @param control Control document
- * @param test Document to test
- * @return Diff object describing differences in documents
- * @throws SAXException
- * @throws IOException
- * @deprecated use Diff constructor directly
- */
- public static Diff compare(String control, String test) throws SAXException,
- IOException {
- return new Diff(control, test);
- }
-
- /**
* Utility method to build a Document using the control DocumentBuilder
* to parse the specified String.
* @param fromXML
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-16 13:06:57
|
Revision: 187
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=187&view=rev
Author: bodewig
Date: 2007-04-16 06:06:55 -0700 (Mon, 16 Apr 2007)
Log Message:
-----------
Add my GPG key
Added Paths:
-----------
trunk/xmlunit/KEYS
Added: trunk/xmlunit/KEYS
===================================================================
--- trunk/xmlunit/KEYS (rev 0)
+++ trunk/xmlunit/KEYS 2007-04-16 13:06:55 UTC (rev 187)
@@ -0,0 +1,388 @@
+This file contains the PGP keys of various developers.
+
+Users: pgp < KEYS
+ gpg --import KEYS
+Developers:
+ pgp -kxa <your name> and append it to this file.
+ (pgpk -ll <your name> && pgpk -xa <your name>) >> this file.
+ (gpg --list-sigs <your name>
+ && gpg --armor --export <your name>) >> this file.
+
+pub 1024D/5F6B8B72 2001-05-28
+uid Stefan Bodewig <bo...@ap...>
+sig 3 5F6B8B72 2001-05-28 Stefan Bodewig <bo...@ap...>
+sig 51898504 2002-01-11 Conor MacNeill <co...@co...>
+sig 3 F88341D9 2003-03-17 Lars Eilebrecht <la...@ei...>
+sig 3 2261D073 2003-03-17 Astrid Kessler (Kess) <ke...@ke...>
+sig 21D0A71B 2003-03-17 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) <di...@an...>
+sig 75A67692 2003-03-18 Erik Abele <er...@co...>
+sig B3B2A12C 2003-05-20 ct magazine CERTIFICATE <pg...@ct...>
+sig 3 8103A37E 2003-04-04 Andre Malo <nd...@ap...>
+sig 3 5F6B8B72 2001-05-28 Stefan Bodewig <bo...@ap...>
+sig D6298F01 2003-04-27 Paulo Henrique Gaspar Jorge <pj...@as...>
+sig 0CAA68B4 2004-11-11 Patrick Rentsch <pat...@su...>
+sig 2FE28BCF 2005-07-01 Harald Wilhelm (HAWI) <Har...@ha...>
+sig 5793498F 2005-07-21 Tim Ellison <ti...@el...>
+sig E4136392 2005-07-21 [User ID not found]
+sig 8408F755 2005-07-21 Christian Geisert <ch...@ap...>
+sig 2 FC243F3C 2005-07-20 Henk P. Penning <pe...@cs...>
+sig 3 EC140B81 2005-07-20 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) <di...@an...>
+sig 3 EE65E321 2005-07-20 Martin Kraemer <ma...@ap...>
+sig 3 A99F75DD 2005-07-21 Rodent of Unusual Size <co...@ph...>
+sig 3 3642CB4B 2005-07-20 Martin Kraemer <ma...@ap...>
+sig 3 302DA568 2005-07-21 Rodent of Unusual Size (DSA) <co...@Ap...>
+sig 3 2C312D2F 2005-07-21 Rodent of Unusual Size <co...@ph...>
+sig 3 CC78C893 2005-07-22 Rich Bowen <rb...@rc...>
+sig 3 E2D774DF 2005-07-22 Sylvain Wallez <sy...@ap...>
+sig 3 E04F9A89 2005-07-22 Roy T. Fielding <fie...@gb...>
+sig 3 015AFC8A 2005-07-22 Bertrand Delacretaz <bde...@ap...>
+sig 3 87315C31 2005-07-23 Rapha\xEBl Luta <rap...@ap...>
+sig 3 E41EDC7E 2005-07-24 Carsten Ziegeler <czi...@ap...>
+sig 3 F39B3750 2005-07-24 Colm MacCarthaigh <co...@st...>
+sig 1CD4861F 2005-07-25 Eran Chinthaka <chi...@ap...>
+sig EA1BA38D 2005-07-25 Ajith Harshana Ranabahu (Made at Apachecon 2005) <aj...@ap...>
+sig 333E4E84 2005-07-26 Chathura Kamalanath Herath (Apachecon Europe 2005) <cha...@ap...>
+sig 152924AF 2005-07-29 Sander Temme <sa...@te...>
+sig 3 9C85222B 2005-07-24 Henning Schmiedehausen <hp...@in...>
+sig 3 9978AF86 2005-07-25 [User ID not found]
+sig 3 2A623F72 2005-07-25 [User ID not found]
+sig 3 F8EA2967 2005-07-26 [User ID not found]
+sig 3 C152431A 2005-07-27 Steve Loughran <st...@ap...>
+sig DE885DD3 2005-11-25 Sander Striker <st...@ap...>
+uid Stefan Bodewig <ste...@fr...>
+sig 3 5F6B8B72 2003-03-07 Stefan Bodewig <bo...@ap...>
+sig 3 F88341D9 2003-03-17 Lars Eilebrecht <la...@ei...>
+sig 3 2261D073 2003-03-17 Astrid Kessler (Kess) <ke...@ke...>
+sig 21D0A71B 2003-03-17 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) <di...@an...>
+sig 75A67692 2003-03-18 Erik Abele <er...@co...>
+sig B3B2A12C 2003-05-20 ct magazine CERTIFICATE <pg...@ct...>
+sig 3 8103A37E 2003-04-04 Andre Malo <nd...@ap...>
+sig 51898504 2005-06-21 Conor MacNeill <co...@co...>
+sig 0CAA68B4 2004-11-11 Patrick Rentsch <pat...@su...>
+sig 2FE28BCF 2005-07-01 Harald Wilhelm (HAWI) <Har...@ha...>
+sig 5793498F 2005-07-21 Tim Ellison <ti...@el...>
+sig 8408F755 2005-07-21 Christian Geisert <ch...@ap...>
+sig 3 EC140B81 2005-07-20 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) <di...@an...>
+sig 3 EE65E321 2005-07-20 Martin Kraemer <ma...@ap...>
+sig 3 A99F75DD 2005-07-21 Rodent of Unusual Size <co...@ph...>
+sig 3 3642CB4B 2005-07-20 Martin Kraemer <ma...@ap...>
+sig 3 302DA568 2005-07-21 Rodent of Unusual Size (DSA) <co...@Ap...>
+sig 3 2C312D2F 2005-07-21 Rodent of Unusual Size <co...@ph...>
+sig 3 CC78C893 2005-07-22 Rich Bowen <rb...@rc...>
+sig 3 E2D774DF 2005-07-22 Sylvain Wallez <sy...@ap...>
+sig 3 E04F9A89 2005-07-22 Roy T. Fielding <fie...@gb...>
+sig 3 87315C31 2005-07-23 Rapha\xEBl Luta <rap...@ap...>
+sig 3 E41EDC7E 2005-07-24 Carsten Ziegeler <czi...@ap...>
+sig 3 F39B3750 2005-07-24 Colm MacCarthaigh <co...@st...>
+sig 1CD4861F 2005-07-25 Eran Chinthaka <chi...@ap...>
+sig EA1BA38D 2005-07-25 Ajith Harshana Ranabahu (Made at Apachecon 2005) <aj...@ap...>
+sig 333E4E84 2005-07-26 Chathura Kamalanath Herath (Apachecon Europe 2005) <cha...@ap...>
+sig 152924AF 2005-07-29 Sander Temme <sa...@te...>
+sig 3 9C85222B 2005-07-24 Henning Schmiedehausen <hp...@in...>
+sig 3 9978AF86 2005-07-25 [User ID not found]
+sig 3 2A623F72 2005-07-25 [User ID not found]
+sig 3 F8EA2967 2005-07-26 [User ID not found]
+sig 3 C152431A 2005-07-27 Steve Loughran <st...@ap...>
+sig DE885DD3 2005-11-25 Sander Striker <st...@ap...>
+uid Stefan Bodewig <st...@sa...>
+sig 3 5F6B8B72 2005-05-31 Stefan Bodewig <bo...@ap...>
+sig 51898504 2005-06-21 Conor MacNeill <co...@co...>
+sig 2FE28BCF 2005-07-01 Harald Wilhelm (HAWI) <Har...@ha...>
+sig 5793498F 2005-07-21 Tim Ellison <ti...@el...>
+sig 3 EC140B81 2005-07-20 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) <di...@an...>
+sig 3 EE65E321 2005-07-20 Martin Kraemer <ma...@ap...>
+sig 3 A99F75DD 2005-07-21 Rodent of Unusual Size <co...@ph...>
+sig 3 21D0A71B 2005-07-20 Dirk-Willem van Gulik (http://www.anywi.com/ - Senior partner) <di...@an...>
+sig 3 3642CB4B 2005-07-20 Martin Kraemer <ma...@ap...>
+sig 3 302DA568 2005-07-21 Rodent of Unusual Size (DSA) <co...@Ap...>
+sig 3 2C312D2F 2005-07-21 Rodent of Unusual Size <co...@ph...>
+sig 3 CC78C893 2005-07-22 Rich Bowen <rb...@rc...>
+sig 3 E2D774DF 2005-07-22 Sylvain Wallez <sy...@ap...>
+sig 3 E04F9A89 2005-07-22 Roy T. Fielding <fie...@gb...>
+sig 3 87315C31 2005-07-23 Rapha\xEBl Luta <rap...@ap...>
+sig 3 E41EDC7E 2005-07-24 Carsten Ziegeler <czi...@ap...>
+sig 3 F39B3750 2005-07-24 Colm MacCarthaigh <co...@st...>
+sig 1CD4861F 2005-07-25 Eran Chinthaka <chi...@ap...>
+sig EA1BA38D 2005-07-25 Ajith Harshana Ranabahu (Made at Apachecon 2005) <aj...@ap...>
+sig 333E4E84 2005-07-26 Chathura Kamalanath Herath (Apachecon Europe 2005) <cha...@ap...>
+sig 152924AF 2005-07-29 Sander Temme <sa...@te...>
+sig 3 9C85222B 2005-07-24 Henning Schmiedehausen <hp...@in...>
+sig 3 9978AF86 2005-07-25 [User ID not found]
+sig 3 2A623F72 2005-07-25 [User ID not found]
+sig 3 F8EA2967 2005-07-26 [User ID not found]
+sig 3 C152431A 2005-07-27 Steve Loughran <st...@ap...>
+sig DE885DD3 2005-11-25 Sander Striker <st...@ap...>
+sub 1024g/24774157 2001-05-28
+sig 5F6B8B72 2001-05-28 Stefan Bodewig <bo...@ap...>
+
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.2 (GNU/Linux)
+
+mQGiBDsSIk4RBADSCj6rUjV64tYCGT1DYKYR7GthyWpNdGHSYLbETBcDatAe1dzQ
+5NsCgfrlybfyeY+y1lxr3T9bqf6zJWDw/718wff96qmmv1qzexSYtmIrj+h53V82
+EXwWOFuYMJisuxdT940iQzosm3GOv4MJdEg3oI2SgfEyRQQ6vO4Ob5rHDwCg5taZ
+nrHOrXx2dIGHxpxRZ0SUl30D/jmtttFjYOQ3LBMriikz5mh2sK3ZnoSRF4o5O0zW
+Ve6e2SFXOEjVjImKsH6KCbdQNelrAdgiyOoXClyQKsQ27pncbdWo6bO0E3POJZVm
+XaeW7iudHVr63rU5PViXObIQrdQl0D59j5brKj4vdlTyUw8kaHPvbKPDEOwvZq4Y
+LJQ5BACA1YilTeXRJqwFsNlpcxCHwlULD4QUVP496prQWf1B7Z6g0KvLGrQsO0Vn
+Jcn+fEqukysTJixSXCPebosltd4RalJIupVYkp4w6MJ7biaDAlLuNhDcI/AiXTmV
+dXUedVXIaM8I3Ne23gucwbAyc0Hvb+3cSAKRhl/azFQhuHBvlrQjU3RlZmFuIEJv
+ZGV3aWcgPGJvZGV3aWdAYXBhY2hlLm9yZz6IYgQTEQIAGgULBwoDBAMVAwIDFgI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dpe6k9aYkLqAJoC/ud2
+8X0M478KlmacVVjb+PqzBIg/AwUQPnWqLv1viMYh0KcbEQJ6DwCff918LRigFUyE
+vYj04C12so87JNUAn0RNFw+P1/SR9Mr/JQmOzJVhlwdriEYEEBECAAYFAkLFMoYA
+CgkQm/IjRS/ii8+wZwCfRvfW6NyBoAp7oS9ILRHNYh2GbhsAnRYGs1hSaGK4rGxm
+/fmqxj+DvqI2uQENBDsSIlQQBADNUpZLxCuTKzJ1tMm7b/XjAhvPYKiL3doAZ6XA
+LBdLF/nQmlh1jcuRy93QWpPxtwSfPjcwJLHy+Uq5tC1SnH1YwYhviLG1KEsniUBr
+oUmV2HJyHP92fFI3LPk3xbqxvLh1NXFpzSuWjGMA66sZqeEbtMy2B8OLRwQShdHI
+BWgrIwADBQP+PWkmbg2mraaUmgTswre8CGArBgcV+WYm6yaq9IC1G4V1PXmlswms
+DlsAr6UDdJU46GFZMIi2WmFJHarEkIBwFN44ypSLmiEVwKRJE2/CYO0f7zQHcF6G
+USwQo2TxneahrZyHs7GdvpcRcfm0YnlC/H1CJ3pl8FpfHttzzIrIJviITgQYEQIA
+BgUCOxIiVAASCRCiEVrhX2uLcgdlR1BHAAEBDTIAoJ3NtpI/E345LVOruElFKrnd
+uWWXAJ9Adm9Mz4yoxrosHSkp5BWzXBUt4A==
+=95C5
+-----END PGP PUBLIC KEY BLOCK-----
Property changes on: trunk/xmlunit/KEYS
___________________________________________________________________
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-14 16:31:22
|
Revision: 186
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=186&view=rev
Author: bodewig
Date: 2007-04-14 09:31:23 -0700 (Sat, 14 Apr 2007)
Log Message:
-----------
copy DifferenceListener Delegate in Prototype constructor
Modified Paths:
--------------
trunk/xmlunit/build.xml
trunk/xmlunit/src/java/org/custommonkey/xmlunit/Diff.java
Modified: trunk/xmlunit/build.xml
===================================================================
--- trunk/xmlunit/build.xml 2007-04-14 16:18:35 UTC (rev 185)
+++ trunk/xmlunit/build.xml 2007-04-14 16:31:23 UTC (rev 186)
@@ -35,7 +35,7 @@
</target>
<target name="clean" depends="init">
- <delete includeEmptyDirs="true" >
+ <delete includeEmptyDirs="true" quiet="true">
<fileset dir="${out.dir}" includes="**/*.class"/>
<fileset dir="${test.report.dir}" includes="**/TEST*.*"/>
<fileset dir="${dist.dir}"/>
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/Diff.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/Diff.java 2007-04-14 16:18:35 UTC (rev 185)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/Diff.java 2007-04-14 16:31:23 UTC (rev 186)
@@ -81,7 +81,7 @@
private boolean haltComparison = false;
private StringBuffer messages;
private DifferenceEngine differenceEngine;
- private DifferenceListener differenceListenerDelegate;
+ private DifferenceListener differenceListenerDelegate;
private ElementQualifier elementQualifierDelegate;
/**
@@ -166,6 +166,7 @@
protected Diff(Diff prototype) {
this(prototype.controlDoc, prototype.testDoc, prototype.differenceEngine,
prototype.elementQualifierDelegate);
+ this.differenceListenerDelegate = prototype.differenceListenerDelegate;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-14 16:18:34
|
Revision: 185
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=185&view=rev
Author: bodewig
Date: 2007-04-14 09:18:35 -0700 (Sat, 14 Apr 2007)
Log Message:
-----------
complete user's guide
Modified Paths:
--------------
trunk/xmlunit/src/user-guide/XMLUnit-Java.xml
Modified: trunk/xmlunit/src/user-guide/XMLUnit-Java.xml
===================================================================
--- trunk/xmlunit/src/user-guide/XMLUnit-Java.xml 2007-04-14 16:16:11 UTC (rev 184)
+++ trunk/xmlunit/src/user-guide/XMLUnit-Java.xml 2007-04-14 16:18:35 UTC (rev 185)
@@ -39,7 +39,7 @@
</revhistory>
</articleinfo>
- <section><title>A Tour of XMLUnit</title>
+ <section id="A Tour of XMLUnit"><title>A Tour of XMLUnit</title>
<para>This first section contains a tour through XMLUnit's
features, the next sections will cover them in more detail.</para>
@@ -49,7 +49,7 @@
XMLUnit, but not the only one. XMLUnit's features can be fully
used without any dependency on JUnit at all.</para>
- <section><title>What is XMLUnit?</title>
+ <section id="What is XMLUnit?"><title>What is XMLUnit?</title>
<para>XMLUnit enables JUnit-style assertions to be made about
the content and structure of XML<footnote id="more on
@@ -71,7 +71,7 @@
generate and the message that the system actually generated. And
that was the beginning of XMLUnit.</para>
</section>
- <section><title>Quick tour</title>
+ <section id="Quick Tour"><title>Quick tour</title>
<para>XMLUnit provides a single JUnit extension class,
<literal>XMLTestCase</literal>, and a set of supporting classes
@@ -103,7 +103,7 @@
class).</para>
</section>
- <section><title>Glossary</title>
+ <section id="Glossary"><title>Glossary</title>
<para>As with many projects some words in XMLUnit have
particular meanings so here is a quick overview. A
@@ -126,7 +126,7 @@
unrecoverable differences</emphasis> between them.</para>
</section>
- <section id="configuring-intro"><title>Configuring XMLUnit</title>
+ <section id="Configuring XMLUnit"><title>Configuring XMLUnit</title>
<para>There are many Java XML parsers available, and XMLUnit
should work with any JAXP compliant parser library, such as
@@ -174,7 +174,8 @@
</section>
- <section><title>Writing XML comparison tests</title>
+ <section id="Writing XML comparison tests">
+ <title>Writing XML comparison tests</title>
<para>Let's say we have two pieces of XML that we wish to
compare and assert that they are equal. We could write a simple
@@ -191,7 +192,7 @@
String myControlXML = "<msg><uuid>0x00435A8C</uuid></msg>";
String myTestXML = "<msg><localId>2376</localId></msg>";
assertXMLEqual("Comparing test xml to control xml",
- myControlXML, myTestXML);
+ myControlXML, myTestXML);
}
}]]></programlisting></example>
@@ -232,9 +233,9 @@
"<struct><boolean>false</boolean><int>3</int></struct>";
Diff myDiff = new Diff(myControlXML, myTestXML);
assertTrue("XML similar " + myDiff.toString(),
- myDiff.similar());
+ myDiff.similar());
assertTrue("XML identical " + myDiff.toString(),
- myDiff.identical());
+ myDiff.identical());
}]]></programlisting></example>
<para>This test fails as two pieces of XML are similar but not
@@ -318,7 +319,7 @@
Diff myDiff = new Diff(myControlXML, myTestXML);
myDiff.overrideDifferenceListener(myDifferenceListener);
assertTrue("test XML matches control skeleton XML",
- myDiff.similar());
+ myDiff.similar());
}]]></programlisting></example>
<para>The <literal>DifferenceEngine</literal> class generates
@@ -376,7 +377,7 @@
</section>
- <section id="transform-intro">
+ <section id="Comparing XML Transformations">
<title>Comparing XML Transformations</title>
<para>XMLUnit can test XSL transformations at a high level using
@@ -422,7 +423,7 @@
</section>
- <section><title>Validation Tests</title>
+ <section id="Validation Tests"><title>Validation Tests</title>
<para>XML parsers that validate a piece of XML against a DTD are
common, however they rely on a DTD reference being present in
@@ -450,11 +451,11 @@
<para>Starting with XMLUnit 1.1, the
<literal>Validator</literal> class can also validate against one
or more XML Schema definitions. See <xref
- linkend="validating-schema"/> for details.</para>
+ linkend="XML Schema Validation"/> for details.</para>
</section>
- <section><title>Xpath Tests</title>
+ <section id="Xpath Tests"><title>Xpath Tests</title>
<para>One of the strengths of XML is the ability to
programmatically extract specific parts of a document using
@@ -557,7 +558,7 @@
</section>
- <section id="intro-nodetest">
+ <section id="Testing by Tree Walking">
<title>Testing by Tree Walking</title>
<para>The DOM specification allows a <literal>Document</literal>
@@ -657,9 +658,10 @@
</section>
</section>
- <section id="Using"><title>Using XMLUnit</title>
+ <section id="Using XMLUnit">
+ <title>Using XMLUnit</title>
- <section id="requirements">
+ <section id="Requirements">
<title>Requirements</title>
<para>XMLUnit requires a JAXP compliant XML parser virtually
@@ -691,7 +693,7 @@
<literal>XMLAssert</literal> classes.</para>
</section>
- <section id="using-plain">
+ <section id="Basic Usage">
<title>Basic Usage</title>
<para>XMLUnit consists of a few classes all living in the
@@ -705,7 +707,8 @@
found in the more specific sections later in this
document.</para>
- <section><title>Comparing Pieces of XML</title>
+ <section id="Basic: Comparing Pieces of XML">
+ <title>Comparing Pieces of XML</title>
<para>Heart and soul of XMLUnit's comparison engine is
<literal>DifferenceEngine</literal> but most of the time you
@@ -717,11 +720,11 @@
of options on the <literal>XMLUnit</literal> class.</para>
<para>More information is available in <xref
- linkend="Comparing"/>.</para>
+ linkend="Comparing Pieces of XML"/>.</para>
</section>
- <section><title>Validating</title>
+ <section id="Basic: Validating"><title>Validating</title>
<para>All validation happens in the
<literal>Validator</literal> class. The default is to
@@ -733,11 +736,11 @@
affect validation.</para>
<para>More information is available in <xref
- linkend="Validating"/>.</para>
+ linkend="Validating XML Documents"/>.</para>
</section>
- <section><title>XSLT Transformations</title>
+ <section id="XSLT Transformations"><title>XSLT Transformations</title>
<para>The <literal>Transform</literal> class provides an easy
to use layer on top of JAXP's transformations. An instance of
@@ -751,7 +754,7 @@
There is no detailed sections on transformations since they
are really only a different way to create input for the rest
of XMLUnit's machinery. Examples can be found in <xref
- linkend="transform-intro"/>.</para>
+ linkend="Comparing XML Transformations"/>.</para>
<para>It is possible to provide a custom
<literal>javax.xml.transform.URIResolver</literal> via the
@@ -761,7 +764,7 @@
<literal>XMLUnit.getTransformerFactory</literal>.</para>
</section>
- <section>
+ <section id="XPath Engine">
<title>XPath Engine</title>
<para>The central piece of XMLUnit's XPath support is the
@@ -794,10 +797,10 @@
<literal>String</literal>s.</para>
<para>More information is available in <xref
- linkend="XPath"/>.</para>
+ linkend="XPath Tests"/>.</para>
</section>
- <section>
+ <section id="Basic: DOM Tree Walking">
<title>DOM Tree Walking</title>
<para>To test pieces of XML by traversing the DOM tree you use
@@ -809,11 +812,11 @@
own.</para>
<para>More information is available in <xref
- linkend="NodeTest"/>.</para>
+ linkend="DOM Tree Walking"/>.</para>
</section>
</section>
- <section id="junit3">
+ <section id="Using XMLUnit With JUnit 3.x">
<title>Using XMLUnit With JUnit 3.x</title>
<para>Initially XMLUnit was tightly coupled to JUnit and the
@@ -839,7 +842,7 @@
</section>
- <section id="common-config">
+ <section id="Common Configuration Options">
<title>Common Configuration Options</title>
<section id="JAXP">
@@ -852,7 +855,7 @@
since the versions shipping with some JDKs are known to
contain serious bugs.</para>
- <para>As described in <xref linkend="configuring-intro"/>
+ <para>As described in <xref linkend="Configuring XMLUnit"/>
there are two main approaches to choose the XML parser of XSLT
transformer: System properties and setters in the
<literal>XMLUnit</literal> class.</para>
@@ -888,7 +891,7 @@
</section>
- <section id="entityresolver">
+ <section id="EntityResolver">
<title><literal>EntityResolver</literal></title>
<para>You can provide a custom
@@ -900,7 +903,7 @@
<literal>setControlEntityResolver</literal> as well.</para>
</section>
- <section id="element-content-whitespace">
+ <section id="Basic: Element Content Whitespace">
<title>Element Content Whitespace</title>
<para>Element content whitespace - also known as ignorable
@@ -925,12 +928,12 @@
validation by default. It does have an effect when comparing
pieces of XML, though, since the same flag is used for a
different purpose as well in that case. See <xref
- linkend="comparing-config"/> for more details.</para>
+ linkend="Whitespace Handling"/> for more details.</para>
</section>
</section>
- <section id="input-choices">
+ <section id="Providing Input to XMLUnit">
<title>Providing Input to XMLUnit</title>
<para>Most methods in XMLUnit that expect a piece of XML as
@@ -990,9 +993,10 @@
</section>
- <section id="Comparing"><title>Comparing Pieces of XML</title>
+ <section id="Comparing Pieces of XML">
+ <title>Comparing Pieces of XML</title>
- <section id="comparing-basics">
+ <section id="The Difference Engine">
<title>The Difference Engine</title>
<para>At the center of XMLUnit's support for comparisons is the
@@ -1002,7 +1006,7 @@
classes (see <xref linkend="Diff"/>).</para>
<para>The <literal>DifferenceEngine</literal> walks two trees of
- DOM <literal>Node</literal>s, the control and the test tree and
+ DOM <literal>Node</literal>s, the control and the test tree, and
compares the nodes. Whenever it detects a difference, it sends
a message to a configured <literal>DifferenceListener</literal>
(see <xref linkend="DifferenceListener"/>) and asks a
@@ -1025,15 +1029,16 @@
<para>A <literal>Difference</literal> can be recoverable;
recoverable <literal>Difference</literal>s make the
- <literal>Diff</literal> class consider the two pieces of XML
- similar while non-recoverable <literal>Difference</literal>s
- render the two pieces different.</para>
+ <literal>Diff</literal> class consider two pieces of XML similar
+ while non-recoverable <literal>Difference</literal>s render the
+ two pieces different.</para>
- <para>The following types of <literal>Difference</literal>s are
- currently detected (the first two columns refer to the
- <literal>DifferenceConstants</literal> class):</para>
+ <para>The types of <literal>Difference</literal>s that are
+ currently detected are listed in <xref linkend="docleveldiff"/>
+ to <xref linkend="otherdiff"/> (the first two columns refer to
+ the <literal>DifferenceConstants</literal> class).</para>
- <table frame="all" rules="all" pgwide="1">
+ <table frame="all" rules="all" pgwide="1" id="docleveldiff">
<title>Document level <literal>Difference</literal>s detected by
<literal>DifferenceEngine</literal></title>
<tgroup cols="4">
@@ -1046,7 +1051,7 @@
<row>
<entry><literal>ID</literal></entry>
<entry><literal>Constant</literal></entry>
- <entry><literal>revoverable</literal></entry>
+ <entry><literal>recoverable</literal></entry>
<entry align="center">Description</entry>
</row>
</thead>
@@ -1068,16 +1073,16 @@
root element.</entry>
</row>
<row>
+ <entry><literal>DOCTYPE_PUBLIC_ID_ID</literal></entry>
<entry><literal>DOCTYPE_PUBLIC_ID</literal></entry>
- <entry><literal>DOCTYPE_PUBLIC_ID</literal></entry>
<entry><literal>false</literal></entry>
<entry>Both pieces of XML contain a DOCTYPE declaration
but the declarations specify different PUBLIC
identifiers.</entry>
</row>
<row>
+ <entry><literal>DOCTYPE_SYSTEM_ID_ID</literal></entry>
<entry><literal>DOCTYPE_SYSTEM_ID</literal></entry>
- <entry><literal>DOCTYPE_SYSTEM_ID</literal></entry>
<entry><literal>true</literal></entry>
<entry>Both pieces of XML contain a DOCTYPE declaration
but the declarations specify different SYSTEM
@@ -1088,7 +1093,10 @@
<entry><literal>NODE_TYPE</literal></entry>
<entry><literal>false</literal></entry>
<entry>The test piece of XML contains a different type
- of node than was expected.</entry>
+ of node than was expected. This type of difference will
+ also occur if either the root control or test
+ <literal>Node</literal> is <literal>null</literal> while
+ the other is not.</entry>
</row>
<row>
<entry><literal>NAMESPACE_PREFIX_ID</literal></entry>
@@ -1108,7 +1116,7 @@
</tgroup>
</table>
- <table frame="all" rules="all" pgwide="1">
+ <table frame="all" rules="all" pgwide="1" id="elementleveldiff">
<title>Element level <literal>Difference</literal>s detected by
<literal>DifferenceEngine</literal></title>
<tgroup cols="4">
@@ -1121,7 +1129,7 @@
<row>
<entry><literal>ID</literal></entry>
<entry><literal>Constant</literal></entry>
- <entry><literal>revoverable</literal></entry>
+ <entry><literal>recoverable</literal></entry>
<entry align="center">Description</entry>
</row>
</thead>
@@ -1168,13 +1176,20 @@
<entry><literal>ATTR_SEQUENCE</literal></entry>
<entry><literal>true</literal></entry>
<entry>The attributes on an element appear in different
- order in the two pieces of XML.</entry>
+ order<footnote><para>Note that the order of attributes
+ is not significant in XML, different parsers may return
+ attributes in a different order even if parsing the same
+ XML document. There is an option to turn this check off
+ - see <xref linkend="Comparing: Configuration"/> - but it is on
+ by default for backwards compatibility
+ reasons</para></footnote> in the two pieces of
+ XML.</entry>
</row>
</tbody>
</tgroup>
</table>
- <table frame="all" rules="all" pgwide="1">
+ <table frame="all" rules="all" pgwide="1" id="attributeleveldiff">
<title>Attribute level <literal>Difference</literal>s detected by
<literal>DifferenceEngine</literal></title>
@@ -1188,7 +1203,7 @@
<row>
<entry><literal>ID</literal></entry>
<entry><literal>Constant</literal></entry>
- <entry><literal>revoverable</literal></entry>
+ <entry><literal>recoverable</literal></entry>
<entry align="center">Description</entry>
</row>
</thead>
@@ -1198,10 +1213,14 @@
<entry><literal>ATTR_VALUE_EXPLICITLY_SPECIFIED_ID</literal></entry>
<entry><literal>ATTR_VALUE_EXPLICITLY_SPECIFIED</literal></entry>
<entry><literal>true</literal></entry>
- <entry>An attribute that is not required and has a
- default value according to the content model of the
- element in question has been specified explicitly in one
- piece of XML but not in the other.</entry>
+ <entry>An attribute that has a default value according
+ to the content model of the element in question has been
+ specified explicitly in one piece of XML but not in the
+ other.<footnote><para>In order for this difference to be
+ detected the parser must have been in validating mode
+ when the piece of XML was parsed and the DTD or XML
+ Schema must have been available.</para></footnote></entry>
+
</row>
<row>
<entry><literal>ATTR_NAME_NOT_FOUND_ID</literal></entry>
@@ -1221,7 +1240,7 @@
</tgroup>
</table>
- <table frame="all" rules="all" pgwide="1">
+ <table frame="all" rules="all" pgwide="1" id="otherdiff">
<title>Other <literal>Difference</literal>s detected by
<literal>DifferenceEngine</literal></title>
@@ -1235,7 +1254,7 @@
<row>
<entry><literal>ID</literal></entry>
<entry><literal>Constant</literal></entry>
- <entry><literal>revoverable</literal></entry>
+ <entry><literal>recoverable</literal></entry>
<entry align="center">Description</entry>
</row>
</thead>
@@ -1281,12 +1300,556 @@
</tgroup>
</table>
- <para>Note that some of the listed differences may be ignored by
+ <para>Note that some of the differences listed may be ignored by
the <literal>DifferenceEngine</literal> if certain configuration
options have been specified. See <xref
- linkend="comparing-config"/> for details.</para>
+ linkend="Comparing: Configuration"/> for details.</para>
+
+ <para><literal>DifferenceEngine</literal> passes differences
+ found around as instances of the <literal>Difference</literal>
+ class. In addition to the type of of difference this class also
+ holds information on the nodes that have been found to be
+ different. The nodes are described by
+ <literal>NodeDetail</literal> instances that encapsulate the DOM
+ <literal>Node</literal> instance as well as the XPath expression
+ that locates the <literal>Node</literal> inside the given piece
+ of XML. <literal>NodeDetail</literal> also contains a "value"
+ that provides more information on the actual values that have
+ been found to be different, the concrete interpretation depends
+ on the type of difference as can be seen in <xref
+ linkend="diffvalue"/>.</para>
+
+ <table frame="all" rules="all" pgwide="0" id="diffvalue">
+ <title>Contents of <literal>NodeDetail.getValue()</literal>
+ for <literal>Difference</literal>s</title>
+
+ <tgroup cols="2">
+ <colspec colname="id" align="center"/>
+ <colspec colname="value" align="left"/>
+
+ <thead>
+ <row>
+ <entry><literal>Difference.getId()</literal></entry>
+ <entry align="center"><literal>NodeDetail.getValue()</literal></entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry><literal>HAS_DOCTYPE_DECLARATION_ID</literal></entry>
+ <entry><literal>"not null"</literal> if the document has
+ a DOCTYPE declaration, <literal>"null"</literal>
+ otherwise.</entry>
+ </row>
+ <row>
+ <entry><literal>DOCTYPE_NAME_ID</literal></entry>
+ <entry>The name of the root element.</entry>
+ </row>
+ <row>
+ <entry><literal>DOCTYPE_PUBLIC_ID</literal></entry>
+ <entry>The PUBLIC identifier.</entry>
+ </row>
+ <row>
+ <entry><literal>DOCTYPE_SYSTEM_ID</literal></entry>
+ <entry>The SYSTEM identifier.</entry>
+ </row>
+ <row>
+ <entry><literal>NODE_TYPE_ID</literal></entry>
+ <entry>If one node was absent: <literal>"not
+ null"</literal> if the node exists,
+ <literal>"null"</literal> otherwise. If the node types
+ differ the value will be a string-ified version of
+ <literal>org.w3c.dom.Node.getNodeType()</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>NAMESPACE_PREFIX_ID</literal></entry>
+ <entry>The Namespace prefix.</entry>
+ </row>
+ <row>
+ <entry><literal>NAMESPACE_URI_ID</literal></entry>
+ <entry>The Namespace URI.</entry>
+ </row>
+ <row>
+ <entry><literal>ELEMENT_TAG_NAME_ID</literal></entry>
+ <entry>The tag name with any Namespace information
+ stripped.</entry>
+ </row>
+ <row>
+ <entry><literal>ELEMENT_NUM_ATTRIBUTES_ID</literal></entry>
+ <entry>The number of attributes present turned into a
+ <literal>String</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>HAS_CHILD_NODES_ID</literal></entry>
+ <entry><literal>"true"</literal> if the element has
+ child nodes, <literal>"false"</literal>
+ otherwise.</entry>
+ </row>
+ <row>
+ <entry><literal>CHILD_NODELIST_LENGTH_ID</literal></entry>
+ <entry>The number of child nodes present turned into a
+ <literal>String</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>CHILD_NODELIST_SEQUENCE_ID</literal></entry>
+ <entry>The sequence number of this child node turned into a
+ <literal>String</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>ATTR_SEQUENCE_ID</literal></entry>
+ <entry>The attribute's name.</entry>
+ </row>
+ <row>
+ <entry><literal>ATTR_VALUE_EXPLICITLY_SPECIFIED_ID</literal></entry>
+ <entry><literal>"true"</literal> if the attribute has
+ been specified, <literal>"false"</literal>
+ otherwise.</entry>
+ </row>
+ <row>
+ <entry><literal>ATTR_NAME_NOT_FOUND_ID</literal></entry>
+ <entry>The attribute's name or <literal>null</literal>.</entry>
+ </row>
+ <row>
+ <entry><literal>ATTR_VALUE_ID</literal></entry>
+ <entry>The attribute's value.</entry>
+ </row>
+ <row>
+ <entry><literal>COMMENT_VALUE_ID</literal></entry>
+ <entry>The actual comment.</entry>
+ </row>
+ <row>
+ <entry><literal>PROCESSING_INSTRUCTION_TARGET_ID</literal></entry>
+ <entry>The processing instruction's target.</entry>
+ </row>
+ <row>
+ <entry><literal>PROCESSING_INSTRUCTION_DATA_ID</literal></entry>
+ <entry>The processing instruction's data.</entry>
+ </row>
+
+ <row>
+ <entry><literal>CDATA_VALUE_ID</literal></entry>
+ <entry>The content of the CDATA section.</entry>
+ </row>
+ <row>
+ <entry><literal>TEXT_VALUE_ID</literal></entry>
+ <entry>The actual text.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>As said in the first paragraph you won't deal with
+ <literal>DifferenceEngine</literal> directly in most cases. In
+ cases where <literal>Diff</literal> or
+ <literal>DetailedDiff</literal> don't provide what you need
+ you'd create an instance of <literal>DifferenceEngine</literal>
+ passing a <literal>ComparisonController</literal> in the
+ constructor and invoke <literal>compare</literal> with your DOM
+ trees to compare as well as a
+ <literal>DifferenceListener</literal> and
+ <literal>ElementQualifier</literal>. The listener will be
+ called on any differences while the <literal>control</literal>
+ method is executing.</para>
+
+ <example>
+ <title>Using <literal>DifferenceEngine</literal>
+ Directly</title>
+ <programlisting language="Java"><![CDATA[
+class MyDifferenceListener implements DifferenceListener {
+ private boolean calledFlag = false;
+ public boolean called() { return calledFlag; }
+
+ public int differenceFound(Difference difference) {
+ calledFlag = true;
+ return RETURN_ACCEPT_DIFFERENCE;
+ }
+
+ public void skippedComparison(Node control, Node test) {
+ }
+}
+
+DifferenceEngine engine = new DifferenceEngine(myComparisonController);
+MyDifferenceListener listener = new MyDifferenceListener();
+engine.compare(controlNode, testNode, listener,
+ myElementQualifier);
+System.err.println("There have been "
+ + (listener.called() ? "" : "no ")
+ + "differences.");
+]]></programlisting></example>
</section>
+ <section id="ComparisonController">
+ <title><literal>ComparisonController</literal></title>
+
+ <para>The <literal>ComparisonController</literal>'s job is to
+ decide whether a comparison should be halted after a difference
+ has been found. Its interface is:</para>
+
+ <programlisting language="Java"><![CDATA[
+ /**
+ * Determine whether a Difference that the listener has been notified of
+ * should halt further XML comparison. Default behaviour for a Diff
+ * instance is to halt if the Difference is not recoverable.
+ * @see Difference#isRecoverable
+ * @param afterDifference the last Difference passed to <code>differenceFound</code>
+ * @return true to halt further comparison, false otherwise
+ */
+ boolean haltComparison(Difference afterDifference);
+]]></programlisting>
+
+ <para>Whenever a difference has been detected by the
+ <literal>DifferenceEngine</literal> the
+ <literal>haltComparison</literal> method will be called
+ immediately after the <literal>DifferenceListener</literal> has
+ been informed of the difference. This is true no matter what
+ type of <literal>Difference</literal> has been found or which
+ value the <literal>DifferenceListener</literal> has
+ returned.</para>
+
+ <para>The only implementations of
+ <literal>ComparisonController</literal> that ship with XMLUnit
+ are <literal>Diff</literal> and <literal>DetailedDiff</literal>,
+ see <xref linkend="Diff"/> for details about them.</para>
+
+ <para>A <literal>ComparisonController</literal> that halted the
+ comparison on any non-recoverable difference could be
+ implemented as:</para>
+
+ <example>
+ <title>A Simple
+ <literal>ComparisonController</literal></title>
+ <programlisting language="Java"><![CDATA[
+public class HaltOnNonRecoverable implements ComparisonController {
+ public boolean haltComparison(Difference afterDifference) {
+ return !afterDifference.isRecoverable();
+ }
+}
+]]></programlisting></example>
+ </section>
+
+ <section id="DifferenceListener">
+ <title><literal>DifferenceListener</literal></title>
+
+ <para><literal>DifferenceListener</literal> contains two
+ callback methods that are invoked by the
+ <literal>DifferenceEngine</literal> when differences are
+ detected:</para>
+
+ <programlisting language="Java"><![CDATA[
+ /**
+ * Receive notification that 2 nodes are different.
+ * @param difference a Difference instance as defined in {@link
+ * DifferenceConstants DifferenceConstants} describing the cause
+ * of the difference and containing the detail of the nodes that
+ * differ
+ * @return int one of the RETURN_... constants describing how this
+ * difference was interpreted
+ */
+ int differenceFound(Difference difference);
+
+ /**
+ * Receive notification that a comparison between 2 nodes has been skipped
+ * because the node types are not comparable by the DifferenceEngine
+ * @param control the control node being compared
+ * @param test the test node being compared
+ * @see DifferenceEngine
+ */
+ void skippedComparison(Node control, Node test);
+]]></programlisting>
+
+ <para><literal>differenceFound</literal> is invoked by
+ <literal>DifferenceEngine</literal> as soon as a difference has
+ been detected. The return value of that method is completely
+ ignored by <literal>DifferenceEngine</literal>, it becomes
+ important when used together with <literal>Diff</literal>,
+ though (see <xref linkend="Diff"/>). The return value should be
+ one of the three constants defined in the the
+ <literal>DifferenceListener</literal> interface:</para>
+
+ <programlisting language="Java"><![CDATA[
+ /**
+ * Standard return value for the <code>differenceFound</code> method.
+ * Indicates that the <code>Difference</code> is interpreted as defined
+ * in {@link DifferenceConstants DifferenceConstants}.
+ */
+ int RETURN_ACCEPT_DIFFERENCE;
+ /**
+ * Override return value for the <code>differenceFound</code> method.
+ * Indicates that the nodes identified as being different should be
+ * interpreted as being identical.
+ */
+ int RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
+ /**
+ * Override return value for the <code>differenceFound</code> method.
+ * Indicates that the nodes identified as being different should be
+ * interpreted as being similar.
+ */
+ int RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR;
+]]></programlisting>
+
+ <para>The <literal>skippedComparison</literal> method is
+ invoked if the <literal>DifferenceEngine</literal> encounters
+ two <literal>Node</literal>s it cannot compare. Before invoking
+ <literal>skippedComparison</literal>
+ <literal>DifferenceEngine</literal> will have invoked
+ <literal>differenceFound</literal> with a
+ <literal>Difference</literal> of type
+ <literal>NODE_TYPE</literal>.</para>
+
+ <para>A custom <literal>DifferenceListener</literal> that
+ ignored any DOCTYPE related differences could be written
+ as:</para>
+
+ <example>
+ <title>A <literal>DifferenceListener</literal> that Ignores
+ DOCTYPE Differences</title>
+ <programlisting language="Java"><![CDATA[
+public class IgnoreDoctype implements DifferenceListener {
+ private static final int[] IGNORE = new int[] {
+ DifferenceConstants.HAS_DOCTYPE_DECLARATION_ID,
+ DifferenceConstants.DOCTYPE_NAME_ID,
+ DifferenceConstants.DOCTYPE_PUBLIC_ID_ID,
+ DifferenceConstants.DOCTYPE_SYSTEM_ID_ID
+ };
+
+ static {
+ Arrays.sort(IGNORE);
+ }
+
+ public int differenceFound(Difference difference) {
+ return Arrays.binarySearch(IGNORE, difference.getId()) >= 0
+ ? RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL
+ : RETURN_ACCEPT_DIFFERENCE;
+ }
+
+ public void skippedComparison(Node control, Node test) {
+ }
+}
+]]></programlisting></example>
+
+ <para>Apart from <literal>Diff</literal> and
+ <literal>DetailedDiff</literal> XMLUnit ships with an additional
+ implementation of <literal>DifferenceListener</literal>.</para>
+
+ <section id="IgnoreTextAndAttributeValuesDifferenceListener">
+ <title><literal>IgnoreTextAndAttributeValuesDifferenceListener</literal></title>
+
+ <para><literal>IgnoreTextAndAttributeValuesDifferenceListener</literal>
+ doesn't do anything in <literal>skippedComparison</literal>.
+ It "downgrades" <literal>Difference</literal>s of type
+ <literal>ATTR_VALUE</literal>,
+ <literal>ATTR_VALUE_EXPLICITLY_SPECIFIED</literal> and
+ <literal>TEXT_VALUE</literal> to recoverable
+ differences.</para>
+
+ <para>This means if instances of
+ <literal>IgnoreTextAndAttributeValuesDifferenceListener</literal>
+ are used together with <literal>Diff</literal> then two pieces
+ of XML will be considered similar if they have the same basic
+ structure. They are not considered identical, though.</para>
+
+ <para>Note that the list of ignored differences doesn't cover
+ all textual differences. You should configure XMLUnit to
+ ignore comments and whitespace and to consider CDATA sections
+ and text nodes to be the same (see <xref
+ linkend="Comparing: Configuration"/>) in order to cover
+ <literal>COMMENT_VALUE</literal> and
+ <literal>CDATA_VALUE</literal> as well.</para>
+
+ </section>
+ </section>
+
+ <section id="ElementQualifier">
+ <title><literal>ElementQualifier</literal></title>
+
+ <para>When <literal>DifferenceEngine</literal> encounters a list
+ of DOM <literal>Element</literal>s as children of another
+ <literal>Element</literal> it will ask the configured
+ <literal>ElementQualifier</literal> which
+ <literal>Element</literal> of the control piece of XML should be
+ compared to which of the test piece. Its contract is:</para>
+
+ <programlisting language="Java"><![CDATA[
+ /**
+ * Determine whether two elements are comparable
+ * @param control an Element from the control XML NodeList
+ * @param test an Element from the test XML NodeList
+ * @return true if the elements are comparable, false otherwise
+ */
+ boolean qualifyForComparison(Element control, Element test);
+]]></programlisting>
+
+ <para>For any given <literal>Element</literal> in the control
+ piece of XML <literal>DifferenceEngine</literal> will cycle
+ through the corresponding list of <literal>Element</literal>s in
+ the test piece of XML until
+ <literal>qualifyForComparison</literal> has returned
+ <literal>true</literal> or the test document is
+ exhausted.</para>
+
+ <para>When using <literal>DifferenceEngine</literal> or
+ <literal>Diff</literal> it is completely legal to set the
+ <literal>ElementQualifier</literal> to <literal>null</literal>.
+ In this case any kind of <literal>Node</literal> is compared to
+ the test <literal>Node</literal> that appears at the same
+ position in the sequence.</para>
+
+ <example id="eq-nodelist-example">
+ <title>Example Nodes for <literal>ElementQualifier</literal>
+ (the comments are not part of the example)</title>
+ <programlisting language="XML"><![CDATA[
+<!-- control piece of XML -->
+<parent>
+ <child1/> <!-- control node 1 -->
+ <child2/> <!-- control node 2 -->
+ <child2 foo="bar">xyzzy</child2> <!-- control node 3 -->
+ <child2 foo="baz"/> <!-- control node 4 -->
+</parent>
+
+<!-- test piece of XML -->
+<parent>
+ <child2 foo="baz"/> <!-- test node 1 -->
+ <child1/> <!-- test node 2 -->
+ <child2>xyzzy</child2> <!-- test node 3 -->
+ <child2 foo="bar"/> <!-- test node 4 -->
+</parent>
+]]></programlisting></example>
+
+ <para>Taking <xref linkend="eq-nodelist-example"/> without any
+ <literal>ElementQualifier</literal>
+ <literal>DifferenceEngine</literal> will compare control node
+ <literal>n</literal> to test node <literal>n</literal> for
+ <literal>n</literal> between 1 and 4. In many cases this is
+ exactly what is desired, but sometimes
+ <literal><![CDATA[<a><b/><c/></a>]]></literal> should be similar
+ to <literal><![CDATA[<a><c/><b/></a>]]></literal> because the
+ order of elements doesn't matter - this is when you'd use a
+ different <literal>ElementQualifier</literal>. XMLUnit ships
+ with several implementations.</para>
+
+ <section id="ElementNameQualifier">
+ <title><literal>ElementNameQualifier</literal></title>
+
+ <para>Only <literal>Element</literal>s with the same name -
+ and Namespace URI if present - qualify.</para>
+
+ <para>In <xref linkend="eq-nodelist-example"/> this means
+ control node 1 will be compared to test node 2. Then control
+ node 2 will be compared to test node 3 because
+ <literal>DifferenceEngine</literal> will start to search for
+ the matching test <literal>Element</literal> at the second
+ test node, the same sequence number the control node is at.
+ Control node 3 is compared to test node 3 as well and control
+ node 4 to test node 4.</para>
+ </section>
+
+ <section id="ElementNameAndAttributeQualifier">
+ <title><literal>ElementNameAndAttributeQualifier</literal></title>
+
+ <para>Only <literal>Element</literal>s with the same name -
+ and Namespace URI if present - as well as the same values for
+ all attributes given in
+ <literal>ElementNameAndAttributeQualifier</literal>'s
+ constructor qualify.</para>
+
+ <para>Let's say <literal>"foo"</literal> has been passed to
+ <literal>ElementNameAndAttributeQualifier</literal>'s
+ constructor when looking at <xref
+ linkend="eq-nodelist-example"/>. This again means control
+ node 1 will be compared to test node 2 since they do have the
+ same name and no value at all for attribute
+ <literal>"foo"</literal>. Then control node 2 will be
+ compared to test node 3 - again, no value for
+ <literal>"foo"</literal>. Control node 3 is compared to test
+ node 4 as they have the same value <literal>"bar"</literal>.
+ Finally control node 4 is compared to test node 1; here
+ <literal>DifferenceEngine</literal> searches from the
+ beginning of the test node list after test node 4 didn't
+ match.</para>
+
+ <para>There are three constructors in
+ <literal>ElementNameAndAttributeQualifier</literal>. The
+ no-arg constructor creates an instance that compares all
+ attributes while the others will compare a single attribute or
+ a given subset of all attributes.</para>
+ </section>
+
+ <section id="ElementNameAndTextQualifier">
+ <title><literal>ElementNameAndTextQualifier</literal></title>
+
+ <para>Only <literal>Element</literal>s with the same name -
+ and Namespace URI if present - as well as the same text
+ content nested into them qualify.</para>
+
+ <para>In <xref linkend="eq-nodelist-example"/> this means
+ control node 1 will be compared to test node 2 since they both
+ don't have any nested text at all. Then control node 2 will
+ be compared to test node 4. Control node 3 is compared to
+ test node 3 since they have the same nested text and control
+ node 4 to test node 4.</para>
+ </section>
+
+ <section id="MultiLevelElementNameAndTextQualifier">
+ <title><literal>org.custommonkey.xmlunit.examples.MultiLevelElementNameAndTextQualifier</literal></title>
+
+ <para>All <literal>ElementQualifier</literal>s seen so far
+ only looked at the <literal>Element</literal>s themselves and
+ not at the structure nested into them at a deeper level. A
+ frequent user question has been which
+ <literal>ElementQualifier</literal> should be used if the
+ pieces of XML in <xref linkend="htmltable"/> should be
+ considered similar.</para>
+
+ <example id="htmltable">
+ <title>Example for
+ <literal>MultiLevelElementNameAndTextQualifier</literal>
+ (the comments are not part of the example)</title>
+ <programlisting language="HTML"><![CDATA[
+<!-- control -->
+<table>
+ <tr> <!-- control row 1 -->
+ <td>foo</td>
+ </tr>
+ <tr> <!-- control row 2 -->
+ <td>bar</td>
+ </tr>
+</table>
+
+<!-- test -->
+<table>
+ <tr> <!-- test row 1 -->
+ <td>bar</td>
+ </tr>
+ <tr> <!-- test row 2 -->
+ <td>foo</td>
+ </tr>
+</table>
+]]></programlisting></example>
+
+ <para>At first glance
+ <literal>ElementNameAndTextQualifier</literal> should work but
+ it doesn't. When <literal>DifferenceEngine</literal>
+ processed the children of <literal>table</literal> it would
+ compare control row 1 to test row 1 since both
+ <literal>tr</literal> elements have the same name and both
+ have no textual content at all.</para>
+
+ <para>What is needed in this case is an
+ <literal>ElementQualifier</literal> that looks at the element's
+ name, as well as the name of the first child element and the
+ text nested into that first child element. This is what
+ <literal>MultiLevelElementNameAndTextQualifier</literal> does.
+ <literal>MultiLevelElementNameAndTextQualifier</literal>'s
+ constructor expects a single argument which is the nesting
+ level of the expected text. If you use an argument of 1,
+ <literal>MultiLevelElementNameAndTextQualifier</literal> is
+ identical to <literal>ElementNameAndTextQualifier</literal>.
+ In <xref linkend="htmltable"/> a value of 2 would be
+ needed.</para>
+ </section>
+
+ </section>
+
<section id="Diff">
<title><literal>Diff</literal> and
<literal>DetailedDiff</literal></title>
@@ -1301,34 +1864,319 @@
is what <literal>Diff</literal> does) and finding all
differences between them (this is what
<literal>DetailedDiff</literal> does).</para>
- </section>
- <section id="ElementQualifier">
- <title><literal>ElementQualifier</literal></title>
- </section>
+ <para><literal>DetailedDiff</literal> is a subclass of
+ <literal>Diff</literal> and can only be constructed by creating
+ a <literal>Diff</literal> instance first.</para>
- <section id="DifferenceListener">
- <title><literal>DifferenceListener</literal></title>
- </section>
+ <para>The major difference between them is their implementation
+ of the <literal>ComparisonController</literal> interface:
+ <literal>DetailedDiff</literal> will never stop the comparison
+ since it wants to collect all differences.
+ <literal>Diff</literal> in turn will halt the comparison as soon
+ as the first <literal>Difference</literal> is found that is not
+ recoverable. In addition <literal>DetailedDiff</literal>
+ collects all <literal>Difference</literal>s in a list and
+ provides access to it.</para>
- <section id="ComparisonController">
- <title><literal>ComparisonController</literal></title>
+ <para>By default <literal>Diff</literal> will consider two
+ pieces of XML as identical if no differences have been found at
+ all, similar if all differences that have been found have been
+ recoverable (see <xref linkend="docleveldiff"/> to <xref
+ linkend="otherdiff"/>) and different as soon as any
+ non-recoverable difference has been found.</para>
+
+ <para>It is possible to specify a
+ <literal>DifferenceListener</literal> to <literal>Diff</literal>
+ using the <literal>overrideDifferenceListener</literal> method.
+ In this case each <literal>Difference</literal> will be
+ evaluated by the passed in
+ <literal>DifferenceListener</literal>. By returning
+ <literal>RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL</literal> the
+ custom listener can make <literal>Diff</literal> ignore the
+ difference completely. Likewise any
+ <literal>Difference</literal> for which the custom listener
+ returns
+ <literal>RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR</literal> will
+ be treated as if the <literal>Difference</literal> was
+ recoverable.</para>
+
+ <para>There are several overloads of the <literal>Diff</literal>
+ constructor that allow you to specify your piece of XML in many
+ ways. There are overloads that accept additional
+ <literal>DifferenceEngine</literal> and
+ <literal>ElementQualifier</literal> arguments. Passing in a
+ <literal>DifferenceEngine</literal> of your own is the only way
+ to use a <literal>ComparisonController</literal> other than
+ <literal>Diff</literal>.</para>
+
+ <para>Note that <literal>Diff</literal> and
+ <literal>DetailedDiff</literal> use
+ <literal>ElementNameQualifier</literal> as their default
+ <literal>ElementQualifier</literal>. This is different from
+ <literal>DifferenceEngine</literal> which defaults to no
+ <literal>ElementQualifier</literal> at all.</para>
+
+ <para>To use a custom <literal>ElementQualifier</literal> you
+ can also use the <literal>overrideElementQualifier</literal>
+ method. Use this with an argument of <literal>null</literal> to
+ unset the default <literal>ElementQualifier</literal> as
+ well.</para>
+
+ <para>To compare two pieces of XML you'd create a
+ <literal>Diff</literal> instance from those two pieces and
+ invoke <literal>identical</literal> to check that there have
+ been no differences at all and <literal>similar</literal> to
+ check that any difference, if any, has been recoverable. If the
+ pieces are identical they are also similar. Likewise if they
+ are not similar they can't be identical either.</para>
+
+ <example>
+ <title>Comparing Two Pieces of XML Using
+ <literal>Diff</literal></title>
+ <programlisting language="Java"><![CDATA[
+Diff d = new Diff("<a><b/><c/></a>", "<a><c/><b/></a>");
+assertFalse(d.identical()); // CHILD_NODELIST_SEQUENCE Difference
+assertTrue(d.similar());
+]]></programlisting></example>
+
+ <para>The result of the comparison is cached in
+ <literal>Diff</literal>, repeated invocations of
+ <literal>identical</literal> or <literal>similar</literal> will
+ not reevaluate the pieces of XML.</para>
+
+ <para><literal>DetailedDiff</literal> provides only a single
+ constructor that expects a <literal>Diff</literal> as argument.
+ Don't use <literal>DetailedDiff</literal> if all you need to
+ know is whether two pieces of XML are identical/similar - use
+ <literal>Diff</literal> directly since its short-cut
+ <literal>ComparisonController</literal> implementation will save
+ time in this case.</para>
+
+ <example>
+ <title>Finding All Differences Using
+ <literal>DetailedDiff</literal></title>
+ <programlisting language="Java"><![CDATA[
+Diff d = new Diff("<a><b/><c/></a>", "<a><c/><b/></a>");
+DetailedDiff dd = new DetailedDiff(d);
+dd.overrideElementQualifier(null);
+assertFalse(dd.similar());
+List l = dd.getAllDifferences();
+assertEquals(2, l.size()); // expected <b/> but was <c/> and vice versa
+]]></programlisting></example>
+
</section>
- <section id="comparing-junit3">
+ <section id="Comparing: JUnit 3">
<title>JUnit 3.x Convenience Methods</title>
+
+ <para><literal>XMLAssert</literal> and
+ <literal>XMLTestCase</literal> contain quite a few overloads of
+ methods for comparing two pieces of XML.</para>
+
+ <para>The method's names use the word <literal>Equal</literal>
+ to mean the same as <literal>similar</literal> in the
+ <literal>Diff</literal> class (or throughout this guide). So
+ <literal>assertXMLEqual</literal> will assert that only
+ recoverable differences have been encountered where
+ <literal>assertXMLNotEqual</literal> asserts that some
+ differences have been non-recoverable.
+ <literal>assertXMLIdentical</literal> asserts that there haven't
+ been any differences at all while
+ <literal>assertXMLNotIdentical</literal> asserts that there have
+ been differences (recoverable or not).</para>
+
+ <para>Most of the overloads of <literal>assertXMLEqual</literal>
+ just provide different means to specify the pieces of XML as
+ <literal>String</literal>s, <literal>InputSource</literal>s,
+ <literal>Reader</literal>s<footnote><para>See <xref
+ linkend="Providing Input to XMLUnit"/> for some advice on choosing your input
+ format.</para></footnote> or <literal>Document</literal>s. For each
+ method there is a version that takes an additional
+ <literal>err</literal> argument which is used to create the
+ message if the assertion fails.</para>
+
+ <para>If you don't need any control over the
+ <literal>ElementQualifier</literal> or
+ <literal>DifferenceListener</literal> used by
+ <literal>Diff</literal> these methods will save some boilerplate
+ code. If <literal>CONTROL</literal> and <literal>TEST</literal>
+ are pieces of XML represented as one of the supported inputs
+ then</para>
+
+ <programlisting language="Java"><![CDATA[
+Diff d = new Diff(CONTROL, TEST);
+assertTrue("expected pieces to be similar, " + d.toString(),
+ d.similar());
+]]></programlisting>
+
+ <para>and</para>
+
+ <programlisting language="Java"><![CDATA[
+assertXMLEqual("expected pieces to be similar", CONTROL, TEST);
+]]></programlisting>
+
+ <para>are equivalent.</para>
+
+ <para>If you need more control over the <literal>Diff</literal>
+ instance there is a version of <literal>assertXMLEqual</literal>
+ (and <literal>assertXMLIdentical</literal>) that accepts a
+ <literal>Diff</literal> instance as its argument as well as a
+ <literal>boolean</literal> indicating whether you expect the
+ <literal>Diff</literal> to be <literal>similar</literal>
+ (<literal>identical</literal>) or not.</para>
+
+ <para><literal>XMLTestCase</literal> contains a couple of
+ <literal>compareXML</literal> methods that really are only
+ shortcuts to <literal>Diff</literal>'s constructors.</para>
+
+ <para>There is no way to use <literal>DifferenceEngine</literal>
+ or <literal>DetailedDiff</literal> directly via the convenience
+ methods.</para>
+
</section>
- <section id="comparing-config">
+ <section id="Comparing: Configuration">
<title>Configuration Options</title>
+
+ <para>Unless you are using <literal>Document</literal> or
+ <literal>DOMSource</literal> overrides when specifying your
+ pieces of XML, XMLUnit will use the configured XML parsers (see
+ <xref linkend="JAXP"/>) and <literal>EntityResolver</literal>s
+ (see <xref linkend="EntityResolver"/>). There configuration
+ options to use different settings for the control and test
+ pieces of XML.</para>
+
+ <para>In addition some of the other configuration settings may
+ lead to XMLUnit using the configured XSLT transformer (see <xref
+ linkend="JAXP"/>) under the covers.</para>
+
+ <section id="Whitespace Handling">
+ <title>Whitespace Handling</title>
+
+ <para>Two different configuration options affect how XMLUnit
+ treats whitespace in comparisons:</para>
+
+ <itemizedlist>
+
+ <listitem>Element Content Whitespace (see <xref
+ linkend="Basic: Element Content Whitespace"/>)
+
+ <para>If XMLUnit has been configured to ignore element
+ content whitespace it will trim any text nodes found by
+ the parser. This means that there won't appear to be any
+ textual content in element <literal><foo></literal>
+ for the following example. If you don't set
+ <literal>XMLUnit.setIgnoreWhitespace</literal> there would
+ be textual content consisting of a new line
+ character.</para>
+
+ <programlisting language="XML"><![CDATA[
+<foo>
+</foo>
+]]></programlisting>
+
+ <para>At the same time the following two
+ <literal><foo></literal> elements will be considered
+ identical if the option has been enabled, though.</para>
+
+ <programlisting language="XML"><![CDATA[
+<foo>bar</foo>
+<foo> bar </foo>
+]]></programlisting>
+
+ <para>When this option is set to <literal>true</literal>,
+ <literal>Diff</literal> will use the XSLT transformer
+ under the covers.</para>
+ </listitem>
+
+ <listitem>"Normalizing" Whitespace
+
+ <para>If you set
+ <literal>XMLUnit.setNormalizeWhitespace</literal> to true
+ then XMLUnit will replace any kind of whitespace found in
+ character content with a SPACE character and collapse
+ consecutive whitespace characters to a single SPACE. It
+ will also trim the resulting character content on both
+ ends.</para>
+
+ <para>The following two <literal><foo></literal>
+ elements will be considered identical if the option has
+ been set:</para>
+
+ <programlisting language="XML"><![CDATA[
+<foo>bar baz</foo>
+<foo> bar
+ baz</foo>
+]]></programlisting>
+
+ <para>Note that this is not related to "normalizing" the
+ document as a whole (see <xref
+ linkend="Normalizing Documents"/>).</para>
+
+ </listitem>
+
+ </itemizedlist>
+ </section>
+
+ <section id="Normalizing Documents">
+ <title>"Normalizing" <literal>Document</literal>s</title>
+
+ <para>"Normalize" in this context corresponds to the
+ <literal>normalize</literal> method in DOM's
+ <literal>Document</literal> class. It is the process of
+ merging adjacent <literal>Text</literal> nodes and is not
+ related to "normalizing whitespace" as described in the
+ previous section.</para>
+
+ <para>Usually you don't need to care about this option since
+ the XML parser is required to normalize the
+ <literal>Document</literal> when creating it. The only reason
+ you may want to change the option via
+ <literal>XMLUnit.setNormalize</literal> is that your
+ <literal>Document</literal> instances have not been created by
+ an XML parser but rather been put together in memory using the
+ DOM API directly.</para>
+ </section>
+
+ <section id="Ignoring Comments">
+ <title>Ignoring Comments</title>
+
+ <para>Using <literal>XMLUnit.setIgnoreComments</literal> you
+ can make XMLUnit's difference engine ignore comments
+ completely.</para>
+
+ <para>When this option is set to <literal>true</literal>,
+ <literal>Diff</literal> will use the XSLT transformer under
+ the covers.</para>
+ </section>
+
+ <section id="Treating CDATA Sections and Text Nodes Alike">
+ <title>Treating CDATA Sections and Text Nodes Alike</title>
+
+ <para>It is not always necessary to know whether a text has
+ been put into a CDATA section or not. Using
+ <literal>XMLUnit.setIgnoreDiffBetweenTextAndCDATA</literal>
+ you can make XMLUnit consider the following two pieces of XML
+ identical:</para>
+
+ <programlisting language="XML"><![CDATA[
+<foo><bar></foo>
+]]></programlisting>
+ <programlisting language="XML">
+<foo><![CDATA[<bar>]]></foo>
+</programlisting>
+ </section>
+
</section>
</section>
- <section id="Validating"><title>Validating XML documents</title>
+ <section id="Validating XML Documents">
+ <title>Validating XML Documents</title>
- <section id="validating-basics">
- <title>The <literal>Validator</literal> class</title>
+ <section id="The Validator Class">
+ <title>The <literal>Validator</literal> Class</title>
<para>The <literal>Validator</literal> class encapsulates
XMLUnit's validation support. It will use the
@@ -1346,7 +2194,7 @@
multiple) Schema(s) as well. Schema validation requires an XML
parser that supports it, of course.</para>
- <section id="validating-dtd">
+ <section id="DTD Validation">
<title>DTD Validation</title>
</section>
@@ -1357,12 +2205,12 @@
object using one of the single argument constructors.</para>
<example>
- <title>Validating against the DTD defined in
+ <title>Validating Against the DTD Defined in
<literal>DOCTYPE</literal></title>
<programlisting language="Java"><![CDATA[
InputSource is = new InputSource(new FileInputStream(myXmlDocument));
Validator v = new Validator(is);
-bool isValid = v.isValid();
+boolean isValid = v.isValid();
]]></programlisting></example>
<para>If the piece of XML doesn't contain any
@@ -1379,14 +2227,14 @@
can be resolved by your parser.</para>
<example>
- <title>Validating a piece of XML that doesn't contain a
+ <title>Validating a Piece of XML that doesn't Contain a
<literal>DOCTYPE</literal></title>
<programlisting language="Java"><![CDATA[
InputSource is = new InputSource(new FileInputStream(myXmlDocument));
Validator v = new Validator(is,
- (new File(myDTD)).toURI().toURL(),
+ (new File(myDTD)).toURI().toURL().toString(),
myPublicId);
-bool isValid = v.isValid();
+boolean isValid = v.isValid();
]]></programlisting></example>
<para>If the piece of XML already has the correct
@@ -1401,12 +2249,12 @@
<literal>systemId</literal>.
<example>
- <title>Validating against a local DTD</title>
+ <title>Validating Against a Local DTD</title>
<programlisting language="Java"><![CDATA[
InputSource is = new InputSource(new FileInputStream(myXmlDocument));
Validator v = new Validator(is,
- (new File(myDTD)).toURI().toURL());
-bool isValid = v.isValid();
+ (new File(myDTD)).toURI().toURL().toString());
+boolean isValid = v.isValid();
]]></programlisting></example>
</listitem>
@@ -1416,22 +2264,22 @@
Validator.
<para>This approach would allow you to use an OASIS
- catalog<footnote><ulink
- url="http://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html">http://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html</ulink></footnote>
+ catalog<footnote><para><ulink
+ url="http://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html">http://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html</ulink></para></footnote>
in conjunction with the Apache XML Resolver
- library<footnote><ulink
- url="http://xml.apache.org/commons/components/resolver/index.html">http://xml.apache.org/commons/components/resolver/index.html</ulink></footnote>
+ library<footnote><para><ulink
+ url="http://xml.apache.org/commons/components/resolver/index.html">http://xml.apache.org/commons/components/resolver/index.html</ulink></para></footnote>
to resolve the DTD location as well as the location of any
...
[truncated message content] |
|
From: <bo...@us...> - 2007-04-14 16:16:12
|
Revision: 184
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=184&view=rev
Author: bodewig
Date: 2007-04-14 09:16:11 -0700 (Sat, 14 Apr 2007)
Log Message:
-----------
sources of user guide
Modified Paths:
--------------
trunk/xmlunit/build.xml
Added Paths:
-----------
trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ATourOfXMLUnit.java
trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ComparingPiecesOfXML.java
trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/DOMTreeWalking.java
trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ValidatingXMLDocuments.java
trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/XPathTests.java
Modified: trunk/xmlunit/build.xml
===================================================================
--- trunk/xmlunit/build.xml 2007-04-13 14:43:42 UTC (rev 183)
+++ trunk/xmlunit/build.xml 2007-04-14 16:16:11 UTC (rev 184)
@@ -8,6 +8,7 @@
<property name="out.dir" value="classes"/>
<property name="dist.dir" value="dist"/>
<property name="docs.dir" value="doc"/>
+ <property name="build.user.guide" value="userguide"/>
<property file="build.properties"/>
<available property="jaxp13+" classname="javax.xml.xpath.XPath"/>
@@ -38,6 +39,7 @@
<fileset dir="${out.dir}" includes="**/*.class"/>
<fileset dir="${test.report.dir}" includes="**/TEST*.*"/>
<fileset dir="${dist.dir}"/>
+ <fileset dir="${build.user.guide}"/>
</delete>
</target>
@@ -180,4 +182,14 @@
<delete file="${dist.name}-src.tar" />
</target>
+ <target name="compile-userguide-examples" depends="compile">
+ <mkdir dir="${build.user.guide}"/>
+ <javac srcdir="src/user-guide" includes="org/"
+ destdir="${build.user.guide}" source="1.3" target="1.2">
+ <classpath>
+ <pathelement location="${junit.lib}"/>
+ <pathelement location="${out.dir}"/>
+ </classpath>
+ </javac>
+ </target>
</project>
Added: trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ATourOfXMLUnit.java
===================================================================
--- trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ATourOfXMLUnit.java (rev 0)
+++ trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ATourOfXMLUnit.java 2007-04-14 16:16:11 UTC (rev 184)
@@ -0,0 +1,255 @@
+/*
+******************************************************************
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of the xmlunit.sourceforge.net nor the names
+ of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+******************************************************************
+*/
+
+package org.custommonkey.xmlunit.examples;
+
+import java.io.File;
+import java.io.FileReader;
+import java.util.List;
+
+import javax.xml.transform.stream.StreamSource;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+import org.custommonkey.xmlunit.*;
+
+/**
+ * All code snippets from the "A Tour of XMLUnit" section of the the
+ * User Guide.
+ */
+public class ATourOfXMLUnit extends XMLTestCase {
+ public ATourOfXMLUnit(String name) {
+ super(name);
+ }
+
+ // never invoked
+ private void configure() {
+ System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
+ "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
+ System.setProperty("javax.xml.parsers.SAXParserFactory",
+ "org.apache.xerces.jaxp.SAXParserFactoryImpl");
+ System.setProperty("javax.xml.transform.TransformerFactory",
+ "org.apache.xalan.processor.TransformerFactoryImpl");
+ XMLUnit
+ .setControlParser("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
+ XMLUnit
+ .setTestParser("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
+ XMLUnit
+ .setSAXParserFactory("org.apache.xerces.jaxp.SAXParserFactoryImpl");
+ XMLUnit
+ .setTransformerFactory("org.apache.xalan.processor.TransformerFactoryImpl");
+ }
+
+ public void testForEquality() throws Exception {
+ String myControlXML = "<msg><uuid>0x00435A8C</uuid></msg>";
+ String myTestXML = "<msg><localId>2376</localId></msg>";
+ assertXMLEqual("Comparing test xml to control xml",
+ myControlXML, myTestXML);
+ }
+
+ public void testXMLIdentical()throws Exception {
+ String myControlXML =
+ "<struct><int>3</int><boolean>false</boolean></struct>";
+ String myTestXML =
+ "<struct><boolean>false</boolean><int>3</int></struct>";
+ Diff myDiff = new Diff(myControlXML, myTestXML);
+ assertTrue("XML similar " + myDiff.toString(),
+ myDiff.similar());
+ assertTrue("XML identical " + myDiff.toString(),
+ myDiff.identical());
+ }
+
+ public void testAllDifferences() throws Exception {
+ String myControlXML = "<news><item id=\"1\">War</item>"
+ + "<item id=\"2\">Plague</item>"
+ + "<item id=\"3\">Famine</item></news>";
+ String myTestXML = "<news><item id=\"1\">Peace</item>"
+ + "<item id=\"2\">Health</item>"
+ + "<item id=\"3\">Plenty</item></news>";
+ DetailedDiff myDiff = new DetailedDiff(new Diff(myControlXML,
+ myTestXML));
+ List allDifferences = myDiff.getAllDifferences();
+ assertEquals(myDiff.toString(), 2, allDifferences.size());
+ }
+
+ public void testCompareToSkeletonXML() throws Exception {
+ String myControlXML = "<location><street-address>22 any street</street-address><postcode>XY00 99Z</postcode></location>";
+ String myTestXML = "<location><street-address>20 east cheap</street-address><postcode>EC3M 1EB</postcode></location>";
+ DifferenceListener myDifferenceListener = new IgnoreTextAndAttributeValuesDifferenceListener();
+ Diff myDiff = new Diff(myControlXML, myTestXML);
+ myDiff.overrideDifferenceListener(myDifferenceListener);
+ assertTrue("test XML matches control skeleton XML",
+ myDiff.similar());
+ }
+
+ public void testRepeatedChildElements() throws Exception {
+ String myControlXML = "<suite>"
+ + "<test status=\"pass\">FirstTestCase</test>"
+ + "<test status=\"pass\">SecondTestCase</test></suite>";
+ String myTestXML = "<suite>"
+ + "<test status=\"pass\">SecondTestCase</test>"
+ + "<test status=\"pass\">FirstTestCase</test></suite>";
+ assertXMLNotEqual("Repeated child elements in different sequence order are not equal by default",
+ myControlXML, myTestXML);
+ Diff myDiff = new Diff(myControlXML, myTestXML);
+ myDiff.overrideElementQualifier(new ElementNameAndTextQualifier());
+ assertXMLEqual("But they are equal when an ElementQualifier controls which test element is compared with each control element",
+ myDiff, true);
+ }
+
+ public void testXSLTransformation() throws Exception {
+ String myInputXML = "...";
+ File myStylesheetFile = new File("...");
+ Transform myTransform = new Transform(myInputXML, myStylesheetFile);
+ String myExpectedOutputXML = "...";
+ Diff myDiff = new Diff(myExpectedOutputXML, myTransform);
+ assertTrue("XSL transformation worked as expected", myDiff.similar());
+ }
+
+ public void testAnotherXSLTransformation() throws Exception {
+ File myInputXMLFile = new File("...");
+ File myStylesheetFile = new File("...");
+ Transform myTransform = new Transform(
+ new StreamSource(myInputXMLFile),
+ new StreamSource(myStylesheetFile));
+ Document myExpectedOutputXML =
+ XMLUnit.buildDocument(XMLUnit.getControlParser(),
+ new FileReader("..."));
+ Diff myDiff = new Diff(myExpectedOutputXML,
+ myTransform.getResultDocument());
+ assertTrue("XSL transformation worked as expected", myDiff.similar());
+ }
+
+ public void testValidation() throws Exception {
+ XMLUnit.getTestDocumentBuilderFactory().setValidating(true);
+ // As the document is parsed it is validated against its referenced DTD
+ Document myTestDocument = XMLUnit.buildTestDocument("...");
+ String mySystemId = "...";
+ String myDTDUrl = new File("...").toURL().toExternalForm();
+ Validator myValidator = new Validator(myTestDocument, mySystemId,
+ myDTDUrl);
+ assertTrue("test document validates against unreferenced DTD",
+ myValidator.isValid());
+ }
+
+ public void testXPaths() throws Exception {
+ String mySolarSystemXML = "<solar-system>"
+ + "<planet name='Earth' position='3' supportsLife='yes'/>"
+ + "<planet name='Venus' position='4'/></solar-system>";
+ assertXpathExists("//planet[@name='Earth']", mySolarSystemXML);
+ assertNotXpathExists("//star[@name='alpha centauri']",
+ mySolarSystemXML);
+ assertXpathsEqual("//planet[@name='Earth']",
+ "//planet[@position='3']", mySolarSystemXML);
+ assertXpathsNotEqual("//planet[@name='Venus']",
+ "//planet[@supportsLife='yes']",
+ mySolarSystemXML);
+ }
+
+ public void testXPathValues() throws Exception {
+ String myJavaFlavours = "<java-flavours>"
+ + "<jvm current='some platforms'>1.1.x</jvm>"
+ + "<jvm current='no'>1.2.x</jvm>"
+ + "<jvm current='yes'>1.3.x</jvm>"
+ + "<jvm current='yes' latest='yes'>1.4.x</jvm></javaflavours>";
+ assertXpathEvaluatesTo("2", "count(//jvm[@current='yes'])",
+ myJavaFlavours);
+ assertXpathValuesEqual("//jvm[4]/@latest", "//jvm[4]/@current",
+ myJavaFlavours);
+ assertXpathValuesNotEqual("//jvm[2]/@current",
+ "//jvm[3]/@current", myJavaFlavours);
+ }
+
+ public void testXpathsInHTML() throws Exception {
+ String someBadlyFormedHTML = "<html><title>Ugh</title>"
+ + "<body><h1>Heading<ul>"
+ + "<li id='1'>Item One<li id='2'>Item Two";
+ TolerantSaxDocumentBuilder tolerantSaxDocumentBuilder =
+ new TolerantSaxDocumentBuilder(XMLUnit.getTestParser());
+ HTMLDocumentBuilder htmlDocumentBuilder =
+ new HTMLDocumentBuilder(tolerantSaxDocumentBuilder);
+ Document wellFormedDocument =
+ htmlDocumentBuilder.parse(someBadlyFormedHTML);
+ assertXpathEvaluatesTo("Item One", "/html/body//li[@id='1']",
+ wellFormedDocument);
+ }
+
+ public void testCountingNodeTester() throws Exception {
+ String testXML = "<fibonacci><val>1</val><val>2</val><val>3</val>"
+ + "<val>5</val><val>9</val></fibonacci>";
+ CountingNodeTester countingNodeTester = new CountingNodeTester(4);
+ assertNodeTestPasses(testXML, countingNodeTester, Node.TEXT_NODE);
+ }
+
+ public void testCustomNodeTester() throws Exception {
+ String testXML = "<fibonacci><val>1</val><val>2</val><val>3</val>"
+ + "<val>5</val><val>9</val></fibonacci>";
+ NodeTest nodeTest = new NodeTest(testXML);
+ assertNodeTestPasses(nodeTest, new FibonacciNodeTester(),
+ new short[] {Node.TEXT_NODE,
+ Node.ELEMENT_NODE},
+ true);
+ }
+
+ private class FibonacciNodeTester extends AbstractNodeTester {
+ private int nextVal = 1, lastVal = 1, priorVal = 0;
+
+ public void testText(Text text) throws NodeTestException {
+ int val = Integer.parseInt(text.getData());
+ if (nextVal != val) {
+ throw new NodeTestException("Incorrect value", text);
+ }
+ nextVal = val + lastVal;
+ priorVal = lastVal;
+ lastVal = val;
+ }
+
+ public void testElement(Element element) throws NodeTestException {
+ String name = element.getLocalName();
+ if ("fibonacci".equals(name) || "val".equals(name)) {
+ return;
+ }
+ throw new NodeTestException("Unexpected element", element);
+ }
+
+ public void noMoreNodes(NodeTest nodeTest) throws NodeTestException {
+ }
+ }
+}
+
Property changes on: trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ATourOfXMLUnit.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ native
Added: trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ComparingPiecesOfXML.java
===================================================================
--- trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ComparingPiecesOfXML.java (rev 0)
+++ trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ComparingPiecesOfXML.java 2007-04-14 16:16:11 UTC (rev 184)
@@ -0,0 +1,129 @@
+/*
+******************************************************************
+Copyright (c) 2007, Jeff Martin, Tim Bacon
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of the xmlunit.sourceforge.net nor the names
+ of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+******************************************************************
+*/
+
+package org.custommonkey.xmlunit.examples;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.custommonkey.xmlunit.*;
+import org.w3c.dom.*;
+
+/**
+ * Code from "Comparing Pieces of XML" section of User's Guide
+ */
+public class ComparingPiecesOfXML extends XMLTestCase {
+
+ class MyDifferenceListener implements DifferenceListener {
+ private boolean calledFlag = false;
+ public boolean called() { return calledFlag; }
+
+ public int differenceFound(Difference difference) {
+ calledFlag = true;
+ return RETURN_ACCEPT_DIFFERENCE;
+ }
+
+ public void skippedComparison(Node control, Node test) {
+ }
+ }
+
+ private void usingDifferenceEngineDirectly() {
+ ComparisonController myComparisonController = null;
+ Node controlNode = null;
+ Node testNode = null;
+ ElementQualifier myElementQualifier = null;
+
+ DifferenceEngine engine = new DifferenceEngine(myComparisonController);
+ MyDifferenceListener listener = new MyDifferenceListener();
+ engine.compare(controlNode, testNode, listener,
+ myElementQualifier);
+ System.err.println("There have been "
+ + (listener.called() ? "" : "no ")
+ + "differences.");
+ }
+
+ public class HaltOnNonRecoverable implements ComparisonController {
+ public boolean haltComparison(Difference afterDifference) {
+ return !afterDifference.isRecoverable();
+ }
+ }
+
+ public static class IgnoreDoctype implements DifferenceListener {
+ private static final int[] IGNORE = new int[] {
+ DifferenceConstants.HAS_DOCTYPE_DECLARATION_ID,
+ DifferenceConstants.DOCTYPE_NAME_ID,
+ DifferenceConstants.DOCTYPE_PUBLIC_ID_ID,
+ DifferenceConstants.DOCTYPE_SYSTEM_ID_ID
+ };
+
+ static {
+ Arrays.sort(IGNORE);
+ }
+
+ public int differenceFound(Difference difference) {
+ return Arrays.binarySearch(IGNORE, difference.getId()) >= 0
+ ? RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL
+ : RETURN_ACCEPT_DIFFERENCE;
+ }
+
+ public void skippedComparison(Node control, Node test) {
+ }
+ }
+
+ private void comparingTwoPiecesOfXMLUsingDiff() throws Exception {
+ Diff d = new Diff("<a><b/><c/></a>", "<a><c/><b/></a>");
+ assertFalse(d.identical()); // CHILD_NODELIST_SEQUENCE Difference
+ assertTrue(d.similar());
+ }
+
+ private void FindingAllDifferencesUsingDetailedDiff() throws Exception {
+ Diff d = new Diff("<a><b/><c/></a>", "<a><c/><b/></a>");
+ DetailedDiff dd = new DetailedDiff(d);
+ dd.overrideElementQualifier(null);
+ assertFalse(dd.similar());
+ List l = dd.getAllDifferences();
+ assertEquals(2, l.size()); // expexted <b/> but was <c/> and vice versa
+ }
+
+ private void junit3() throws Exception {
+ String CONTROL = null;
+ String TEST = null;
+ Diff d = new Diff(CONTROL, TEST);
+ assertTrue("expected pieces to be similar, " + d.toString(),
+ d.similar());
+ assertXMLEqual("expected pieces to be similar", CONTROL, TEST);
+ }
+}
\ No newline at end of file
Property changes on: trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ComparingPiecesOfXML.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ native
Added: trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/DOMTreeWalking.java
===================================================================
--- trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/DOMTreeWalking.java (rev 0)
+++ trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/DOMTreeWalking.java 2007-04-14 16:16:11 UTC (rev 184)
@@ -0,0 +1,76 @@
+/*
+******************************************************************
+Copyright (c) 2007, Jeff Martin, Tim Bacon
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of the xmlunit.sourceforge.net nor the names
+ of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+******************************************************************
+*/
+
+package org.custommonkey.xmlunit.examples;
+
+import junit.framework.TestCase;
+
+import org.custommonkey.xmlunit.*;
+import org.w3c.dom.*;
+
+/**
+ * Code from "DOM Tree Walking" section of User's Guide
+ */
+public class DOMTreeWalking extends TestCase {
+
+ private String myXML = null;
+ static final String ATTRIBUTE_NAME = null;
+
+ private void AccessingAttributesInANodeTest() throws Exception {
+ NodeTest nt = new NodeTest(myXML);
+ NodeTester tester = new MyNodeTester();
+ nt.performTest(tester, Node.ELEMENT_NODE);
+ }
+
+ private void AccessingAttributesInANodeTestAbstractNodeTesterVersion() throws Exception {
+ NodeTest nt = new NodeTest(myXML);
+ NodeTester tester = new AbstractNodeTester() {
+ public void testElement(Element element) throws NodeTestException {
+ Attr attributeToTest = element.getAttributeNode(ATTRIBUTE_NAME);
+ }
+ };
+ nt.performTest(tester, Node.ELEMENT_NODE);
+ }
+
+ static class MyNodeTester implements NodeTester {
+ public void testNode(Node aNode, NodeTest test) {
+ Element anElement = (Element) aNode;
+ Attr attributeToTest = anElement.getAttributeNode(ATTRIBUTE_NAME);
+ }
+
+ public void noMoreNodes(NodeTest test) {}
+ }
+}
\ No newline at end of file
Property changes on: trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/DOMTreeWalking.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ native
Added: trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ValidatingXMLDocuments.java
===================================================================
--- trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ValidatingXMLDocuments.java (rev 0)
+++ trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ValidatingXMLDocuments.java 2007-04-14 16:16:11 UTC (rev 184)
@@ -0,0 +1,96 @@
+/*
+******************************************************************
+Copyright (c) 2007, Jeff Martin, Tim Bacon
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of the xmlunit.sourceforge.net nor the names
+ of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+******************************************************************
+*/
+
+package org.custommonkey.xmlunit.examples;
+
+import java.io.*;
+import org.custommonkey.xmlunit.*;
+import org.xml.sax.*;
+
+/**
+ * Code from "Validating XML Documents" section of User's Guide
+ */
+public class ValidatingXMLDocuments {
+
+ private String myXmlDocument = null;
+ private String myDTD = null;
+
+ private void ValidatingAgainstTheDTDDefinedInDOCTYPE() throws Exception {
+ InputSource is = new InputSource(new FileInputStream(myXmlDocument));
+ Validator v = new Validator(is);
+ boolean isValid = v.isValid();
+ }
+
+ private void ValidatingAPieceOfXMLThatDoesntContainADOCTYPE() throws Exception {
+ String myPublicId = null;
+
+ InputSource is = new InputSource(new FileInputStream(myXmlDocument));
+ Validator v = new Validator(is,
+ (new File(myDTD)).toURI().toURL().toString(),
+ myPublicId);
+ boolean isValid = v.isValid();
+ }
+
+ private void ValidatingAgainstALocalDTD() throws Exception {
+ InputSource is = new InputSource(new FileInputStream(myXmlDocument));
+ Validator v = new Validator(is,
+ (new File(myDTD)).toURI().toURL().toString());
+ boolean isValid = v.isValid();
+ }
+
+ private void ValidatingAgainstDTDUsingApachesXMLResolverAndAXMLCatalog() throws Exception {
+ InputSource is = new InputSource(new FileInputStream(myXmlDocument));
+ XMLUnit.setControlEntityResolver(new CatalogResolver());
+ Validator v = new Validator(is);
+ boolean isValid = v.isValid();
+ }
+
+ private void ValidatingAgainstALocalXMLSchema() throws Exception {
+ String myXmlSchemaFile = null;
+
+ InputSource is = new InputSource(new FileInputStream(myXmlDocument));
+ Validator v = new Validator(is);
+ v.useXMLSchema(true);
+ v.setJAXP12SchemaSource(new File(myXmlSchemaFile));
+ boolean isValid = v.isValid();
+ }
+
+ private static class CatalogResolver implements EntityResolver {
+ public InputSource resolveEntity(String p, String s) {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/ValidatingXMLDocuments.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ native
Added: trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/XPathTests.java
===================================================================
--- trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/XPathTests.java (rev 0)
+++ trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/XPathTests.java 2007-04-14 16:16:11 UTC (rev 184)
@@ -0,0 +1,79 @@
+/*
+******************************************************************
+Copyright (c) 2007, Jeff Martin, Tim Bacon
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of the xmlunit.sourceforge.net nor the names
+ of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+******************************************************************
+*/
+
+package org.custommonkey.xmlunit.examples;
+
+import java.util.HashMap;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.custommonkey.xmlunit.*;
+
+/**
+ * Code from "XPath Tests" section of User's Guide
+ */
+public class XPathTests extends TestCase {
+
+ private void MatchingAnXPathSelectionAgainstARegularExpression() throws Exception {
+ Document doc = null;
+ String regex = null;
+ String xpath = null;
+ String message = null;
+
+ XpathEngine engine = XMLUnit.newXpathEngine();
+ String value = engine.evaluate(xpath, doc);
+ Assert.assertTrue(message, value.matches(regex));
+ }
+
+ private void UsingNamespacesInXPathTests() throws Exception {
+ String testDoc = "<t:test xmlns:t=\"urn:foo\"><t:bar/></t:test>";
+ Document d = XMLUnit.buildControlDocument(testDoc);
+ HashMap m = new HashMap();
+ m.put("foo", "urn:foo");
+
+ NamespaceContext ctx = new SimpleNamespaceContext(m);
+ XpathEngine engine = XMLUnit.newXpathEngine();
+ engine.setNamespaceContext(ctx);
+
+ NodeList l = engine.getMatchingNodes("//foo:bar", d);
+ assertEquals(1, l.getLength());
+ assertEquals(Node.ELEMENT_NODE, l.item(0).getNodeType());
+ }
+
+}
Property changes on: trunk/xmlunit/src/user-guide/org/custommonkey/xmlunit/examples/XPathTests.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-13 14:43:40
|
Revision: 183
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=183&view=rev
Author: bodewig
Date: 2007-04-13 07:43:42 -0700 (Fri, 13 Apr 2007)
Log Message:
-----------
yet another bad delegation
Modified Paths:
--------------
trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLTestCase.java
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLTestCase.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLTestCase.java 2007-04-13 13:11:28 UTC (rev 182)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/XMLTestCase.java 2007-04-13 14:43:42 UTC (rev 183)
@@ -216,7 +216,7 @@
* @param assertion true if asserting that result is identical
*/
public void assertXMLIdentical(Diff diff, boolean assertion) {
- XMLAssert.assertXMLEqual(diff.toString(), diff, assertion);
+ XMLAssert.assertXMLIdentical(diff.toString(), diff, assertion);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-13 13:11:27
|
Revision: 182
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=182&view=rev
Author: bodewig
Date: 2007-04-13 06:11:28 -0700 (Fri, 13 Apr 2007)
Log Message:
-----------
Move userguide
Added Paths:
-----------
trunk/xmlunit/src/user-guide/
trunk/xmlunit/src/user-guide/XMLUnit-Java.xml
trunk/xmlunit/src/user-guide/org/
Removed Paths:
-------------
trunk/xmlunit/src/site/XMLUnit-Java.xml
trunk/xmlunit/src/site/org/
Deleted: trunk/xmlunit/src/site/XMLUnit-Java.xml
===================================================================
--- trunk/xmlunit/src/site/XMLUnit-Java.xml 2007-04-13 13:07:54 UTC (rev 181)
+++ trunk/xmlunit/src/site/XMLUnit-Java.xml 2007-04-13 13:11:28 UTC (rev 182)
@@ -1,2227 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE article PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.1b1//EN" "http://docbook.org/xml/simple/1.1b1/sdocbook.dtd">
-
-<article>
- <title>XMLUnit Java User's Guide
- <inlinemediaobject><imageobject>
- <imagedata fileref="xmlunit.png" width="331" depth="100"
- valign="middle" format="PNG"/>
- </imageobject></inlinemediaobject>
- </title>
- <articleinfo>
- <authorgroup>
- <author>
- <firstname>Tim</firstname>
- <surname>Bacon</surname>
- </author>
- </authorgroup>
- <authorgroup>
- <author>
- <firstname>Stefan</firstname>
- <surname>Bodewig</surname>
- </author>
- </authorgroup>
- <revhistory>
- <revision>
- <revnumber>1.0</revnumber>
- <date>January 2003</date>
- <author>
- <firstname>Tim</firstname>
- <surname>Bacon</surname>
- </author>
- <revremark>Documentation for XMLUnit Java 1.0</revremark>
- </revision>
- <revision>
- <revnumber>1.1</revnumber>
- <date>... 2007</date>
- <revremark>Documentation for XMLUnit Java 1.1</revremark>
- </revision>
- </revhistory>
- </articleinfo>
-
- <section><title>A Tour of XMLUnit</title>
-
- <para>This first section contains a tour through XMLUnit's
- features, the next sections will cover them in more detail.</para>
-
- <para>Note that it has a strong focus on using the
- <literal>XMLTestCase</literal> class which is one option to use
- XMLUnit, but not the only one. XMLUnit's features can be fully
- used without any dependency on JUnit at all.</para>
-
- <section><title>What is XMLUnit?</title>
-
- <para>XMLUnit enables JUnit-style assertions to be made about
- the content and structure of XML<footnote id="more on
- JUnit"><para>For more information on JUnit see <ulink
- url="http://www.junit.org">http://www.junit.org</ulink></para></footnote>. It
- is an open source project hosted at <ulink
- url="http://xmlunit.sourceforge.net/">http://xmlunit.sourceforge.net/</ulink>
- that grew out of a need to test a system that generated and
- received custom XML messages. The problem that we faced was how
- to verify that the system generated the correct message from a
- known set of inputs. Obviously we could use a DTD or a schema to
- validate the message output, but this approach wouldn't allow us
- to distinguish between valid XML with correct content (e.g.
- element <literal><![CDATA[<foo>bar</foo>]]></literal>) and valid
- XML with incorrect content (e.g. element
- <literal><![CDATA[<foo>baz</foo>]]></literal>). What we really
- wanted was an <literal>assertXMLEquals()</literal> method, so we
- could compare the message that we expected the system to
- generate and the message that the system actually generated. And
- that was the beginning of XMLUnit.</para>
- </section>
- <section><title>Quick tour</title>
-
- <para>XMLUnit provides a single JUnit extension class,
- <literal>XMLTestCase</literal>, and a set of supporting classes
- that allow assertions to be made about:</para>
-
- <itemizedlist>
- <listitem>The differences between two pieces of XML (via
- <literal>Diff</literal> and <literal>DetailedDiff</literal>
- classes)</listitem>
-
- <listitem>The validity of a piece of XML (via
- <literal>Validator</literal> class)</listitem>
-
- <listitem> The outcome of transforming a piece of XML using
- XSLT (via <literal>Transform</literal> class)</listitem>
-
- <listitem>The evaluation of an XPath expression on a piece of
- XML (via classes implementing the
- <literal>XpathEngine</literal> interface)</listitem>
-
- <listitem>Individual nodes in a piece of XML that are exposed
- by DOM Traversal (via <literal>NodeTest</literal>
- class)</listitem>
- </itemizedlist>
-
- <para>XMLUnit can also treat HTML content, even badly-formed
- HTML, as valid XML to allow these assertions to be made about
- web pages (via the <literal>HTMLDocumentBuilder</literal>
- class).</para>
- </section>
-
- <section><title>Glossary</title>
-
- <para>As with many projects some words in XMLUnit have
- particular meanings so here is a quick overview. A
- <emphasis>piece</emphasis> of XML is a DOM Document, a String
- containing marked-up content, or a Source or Reader that allows
- access to marked-up content within some resource. XMLUnit
- compares the expected <emphasis>control</emphasis> XML to some
- actual <emphasis>test</emphasis> XML. The comparison can reveal
- that two pieces of XML are <emphasis>identical</emphasis>,
- <emphasis>similar</emphasis> or
- <emphasis>different</emphasis>. The unit of measurement used by
- the comparison is a <emphasis>difference</emphasis>, and
- differences can be either <emphasis>recoverable</emphasis> or
- <emphasis>unrecoverable</emphasis>. Two pieces of XML are
- <emphasis>identical</emphasis> if there are <emphasis>no
- differences</emphasis> between them,
- <emphasis>similar</emphasis> if there are <emphasis>only
- recoverable differences</emphasis> between them, and
- <emphasis>different</emphasis> if there are <emphasis>any
- unrecoverable differences</emphasis> between them.</para>
- </section>
-
- <section id="configuring-intro"><title>Configuring XMLUnit</title>
-
- <para>There are many Java XML parsers available, and XMLUnit
- should work with any JAXP compliant parser library, such as
- Xerces-J <footnote id="xerces-link"><para><ulink
- url="http://xerces.apache.org/">http://xerces.apache.org/</ulink></para></footnote>
- from the Apache Software Foundation. To use the XSL and XPath
- features of XMLUnit a Trax (the XSLT portion of JAXP) compliant
- transformation engine is required, such as Xalan-J<footnote
- id="xalan-link"><para><ulink
- url="http://xalan.apache.org/">http://xalan.apache.org/</ulink></para></footnote>,
- from the Apache Software Foundation. To configure XMLUnit to
- use a specific parser and transformation engine set three System
- properties before any tests are run, e.g.</para>
-
- <example><title>Configuring JAXP via System Properties</title>
- <programlisting language="Java"><![CDATA[
-System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
- "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
-System.setProperty("javax.xml.parsers.SAXParserFactory",
- "org.apache.xerces.jaxp.SAXParserFactoryImpl");
-System.setProperty("javax.xml.transform.TransformerFactory",
- "org.apache.xalan.processor.TransformerFactoryImpl");
-]]></programlisting>
- </example>
-
- <para>You may want to read <xref linkend="JAXP"/> for more
- details - in particular if you are using Java 1.4 or
- later.</para>
-
- <para>Alternatively there are static methods on the XMLUnit
- class that can be called directly. The advantage of this
- approach is that you can specify a different parser class for
- control and test XML and change the current parser class at any
- time in your tests, should you need to make assertions about the
- compatibility of different parsers.</para>
-
- <example><title>Configuring JAXP via XMLUnit class</title>
- <programlisting language="Java"><![CDATA[
-XMLUnit.setControlParser("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
-XMLUnit.setTestParser("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
-XMLUnit.setSAXParserFactory("org.apache.xerces.jaxp.SAXParserFactoryImpl");
-XMLUnit.setTransformerFactory("org.apache.xalan.processor.TransformerFactoryImpl");
-]]></programlisting>
- </example>
-
- </section>
-
- <section><title>Writing XML comparison tests</title>
-
- <para>Let's say we have two pieces of XML that we wish to
- compare and assert that they are equal. We could write a simple
- test class like this:</para>
-
- <example><title>A simple comparison test</title>
- <programlisting language="Java"><![CDATA[
-public class MyXMLTestCase extends XMLTestCase {
- public MyXMLTestCase(String name) {
- super(name);
- }
-
- public void testForEquality() throws Exception {
- String myControlXML = "<msg><uuid>0x00435A8C</uuid></msg>";
- String myTestXML = "<msg><localId>2376</localId></msg>";
- assertXMLEqual("Comparing test xml to control xml",
- myControlXML, myTestXML);
- }
-}]]></programlisting></example>
-
- <para>The <literal>assertXMLEqual</literal> test will pass if
- the control and test XML are either similar or
- identical. Obviously in this case the pieces of XML are
- different and the test will fail. The failure message indicates
- both what the difference is and the Xpath locations of the nodes
- that were being compared:</para>
-
- <programlisting><![CDATA[
-Comparing test xml to control xml
-[different] Expected element tag name 'uuid' but was 'localId' - comparing <uuid...> at /msg[1]/uuid[1] to <localId...> at /msg[1]/localId[1]
-]]></programlisting>
-
- <para>When comparing pieces of XML, the
- <literal>XMLTestCase</literal> actually creates an instance of
- the <literal>Diff</literal> class. The <literal>Diff</literal>
- class stores the result of an XML comparison and makes it
- available through the methods <literal>similar()</literal> and
- <literal>identical()</literal>. The
- <literal>assertXMLEquals()</literal> method tests the value of
- <literal>Diff.similar()</literal> and the
- <literal>assertXMLIdentical()</literal> method tests the value
- of <literal>Diff.identical()</literal>.</para>
-
- <para>It is easy to create a <literal>Diff</literal> instance
- directly without using the <literal>XMLTestCase</literal> class
- as below:</para>
-
- <example><title>Creating a <literal>Diff</literal>
- instance</title>
- <programlisting language="Java"><![CDATA[
-public void testXMLIdentical()throws Exception {
- String myControlXML =
- "<struct><int>3</int><boolean>false</boolean></struct>";
- String myTestXML =
- "<struct><boolean>false</boolean><int>3</int></struct>";
- Diff myDiff = new Diff(myControlXML, myTestXML);
- assertTrue("XML similar " + myDiff.toString(),
- myDiff.similar());
- assertTrue("XML identical " + myDiff.toString(),
- myDiff.identical());
-}]]></programlisting></example>
-
- <para>This test fails as two pieces of XML are similar but not
- identical if their nodes occur in a different sequence. The
- failure message reported by JUnit from the call to
- <literal>myDiff.toString()</literal> looks like this:</para>
-
- <programlisting><![CDATA[
-[not identical] Expected sequence of child nodes '0' but was '1' - comparing <int...> at /struct[1]/int[1] to <int...> at /struct[1]/int[1]
-]]></programlisting>
-
- <para>For efficiency reasons a <literal>Diff</literal> stops the
- comparison process as soon as the first difference is found. To
- get all the differences between two pieces of XML an instance of
- the <literal>DetailedDiff</literal> class, a subclass of
- <literal>Diff</literal>, is required. Note that a
- <literal>DetailedDiff</literal> is constructed using an existing
- <literal>Diff</literal> instance.</para>
-
- <para>Consider this test that uses a DetailedDiff:</para>
-
- <example><title>Using <literal>DetailedDiff</literal></title>
- <programlisting language="Java"><![CDATA[
-public void testAllDifferences() throws Exception {
- String myControlXML = "<news><item id=\"1\">War</item>"
- + "<item id=\"2\">Plague</item>"
- + "<item id=\"3\">Famine</item></news>";
- String myTestXML = "<news><item id=\"1\">Peace</item>"
- + "<item id=\"2\">Health</item>"
- + "<item id=\"3\">Plenty</item></news>";
- DetailedDiff myDiff = new DetailedDiff(new Diff(myControlXML, myTestXML));
- List allDifferences = myDiff.getAllDifferences();
- assertEquals(myDiff.toString(), 2, allDifferences.size());
-}]]></programlisting></example>
-
- <para>This test fails with the message below as each of the 3
- news items differs between the control and test XML:</para>
-
- <programlisting><![CDATA[
-[different] Expected text value 'War' but was 'Peace' - comparing <item...>War</item> at /news[1]/item[1]/text()[1] to <item...>Peace</item> at /news[1]/item[1]/text()[1]
-[different] Expected text value 'Plague' but was 'Health' - comparing <item...>Plague</item> at /news[1]/item[2]/text()[1] to <item...>Health</item> at /news[1]/item[2]/text()[1]
-[different] Expected text value 'Famine' but was 'Plenty' - comparing <item...>Famine</item> at /news[1]/item[3]/text()[1] to <item...>Plenty</item> at /news[1]/item[3]/text()[1]
-expected <2> but was <3>
-]]></programlisting>
-
- <para>The List returned from the
- <literal>getAllDifferences()</literal> method contains
- <literal>Difference</literal> instances. These instances
- describe both the type<footnote id="DifferenceConstants"><para>A
- full set of prototype <literal>Difference</literal> instances -
- one for each type of difference - is defined using final static
- fields in the <literal>DifferenceConstants</literal>
- class.</para></footnote> of difference found between a control
- node and test node and the <literal>NodeDetail</literal> of
- those nodes (including the XPath location of each
- node). <literal>Difference</literal> instances are passed at
- runtime in notification events to a registered
- <literal>DifferenceListener</literal>, an interface whose
- default implementation is provided by the
- <literal>Diff</literal> class.</para>
-
- <para>However it is possible to override this default behaviour
- by implementing the interface in your own class. The
- <literal>IgnoreTextAndAttributeValuesDifferenceListener</literal>
- class is an example of how to implement a custom
- <literal>DifferenceListener</literal>. It allows an XML
- comparison to be made that ignores differences in the values of
- text and attribute nodes, for example when comparing a skeleton
- or outline piece of XML to some generated XML.</para>
-
- <para>The following test illustrates the use of a custom
- <literal>DifferenceListener</literal>:</para>
-
- <example><title>Using a custom
- <literal>DifferenceListener</literal></title>
- <programlisting language="Java"><![CDATA[
-public void testCompareToSkeletonXML() throws Exception {
- String myControlXML = "<location><street-address>22 any street</street-address><postcode>XY00 99Z</postcode></location>";
- String myTestXML = "<location><street-address>20 east cheap</street-address><postcode>EC3M 1EB</postcode></location>";
- DifferenceListener myDifferenceListener = new IgnoreTextAndAttributeValuesDifferenceListener();
- Diff myDiff = new Diff(myControlXML, myTestXML);
- myDiff.overrideDifferenceListener(myDifferenceListener);
- assertTrue("test XML matches control skeleton XML",
- myDiff.similar());
-}]]></programlisting></example>
-
- <para>The <literal>DifferenceEngine</literal> class generates
- the events that are passed to a
- <literal>DifferenceListener</literal> implementation as two
- pieces of XML are compared. Using recursion it navigates through
- the nodes in the control XML DOM, and determines which node in
- the test XML DOM qualifies for comparison to the current control
- node. The qualifying test node will match the control node's
- node type, as well as the node name and namespace (if defined
- for the control node).</para>
-
- <para>However when the control node is an
- <literal>Element</literal>, it is less straightforward to
- determine which test <literal>Element</literal> qualifies for
- comparison as the parent node may contain repeated child
- <literal>Element</literal>s with the same name and namespace. So
- for <literal>Element</literal> nodes, an instance of the
- <literal>ElementQualifier</literal> interface is used determine
- whether a given test <literal>Element</literal> node qualifies
- for comparison with a control <literal>Element</literal>
- node. This separates the decision about whether two
- <literal>Elements</literal> should be compared from the decision
- about whether those two <literal>Elements</literal> are
- considered similar. By default an
- <literal>ElementNameQualifier</literal> class is used that
- compares the nth child <literal><![CDATA[<abc>]]></literal> test
- element to the nth child <literal><![CDATA[<abc>]]></literal>
- control element, i.e. the sequence of the child elements in the
- test XML is important. However this default behaviour can be
- overridden using an
- <literal>ElementNameAndTextQualifier</literal> or
- <literal>ElementNameAndAttributesQualifier</literal>.</para>
-
- <para>The test below demonstrates the use of a custom
- <literal>ElementQualifier</literal>:</para>
-
- <example><title>Using a custom
- <literal>ElementQualifier</literal></title>
- <programlisting language="Java"><![CDATA[
-public void testRepeatedChildElements() throws Exception {
- String myControlXML = "<suite>"
- + "<test status=\"pass\">FirstTestCase</test>"
- + "<test status=\"pass\">SecondTestCase</test></suite>";
- String myTestXML = "<suite>"
- + "<test status=\"pass\">SecondTestCase</test>"
- + "<test status=\"pass\">FirstTestCase</test></suite>";
- assertXMLNotEqual("Repeated child elements in different sequence order are not equal by default",
- myControlXML, myTestXML);
- Diff myDiff = new Diff(myControlXML, myTestXML);
- myDiff.overrideElementQualifier(new ElementNameAndTextQualifier());
- assertXMLEqual("But they are equal when an ElementQualifier controls which test element is compared with each control element",
- myDiff, true);
-}]]></programlisting></example>
-
- </section>
-
- <section id="transform-intro">
- <title>Comparing XML Transformations</title>
-
- <para>XMLUnit can test XSL transformations at a high level using
- the <literal>Transform</literal> class that wraps an
- <literal>javax.xml.transform.Transformer</literal>
- instance. Knowing the input XML, input stylesheet and expected
- output XML we can assert that the output of the transformation
- matches the expected output as follows:</para>
-
- <example><title>Testing the Result of a Transformation</title>
- <programlisting language="Java"><![CDATA[
-public void testXSLTransformation() throws Exception {
- String myInputXML = "...";
- File myStylesheetFile = new File("...");
- Transform myTransform = new Transform(myInputXML, myStylesheetFile);
- String myExpectedOutputXML = "...";
- Diff myDiff = new Diff(myExpectedOutputXML, myTransform);
- assertTrue("XSL transformation worked as expected", myDiff.similar());
-}]]></programlisting></example>
-
- <para>The <literal>getResultString()</literal> and
- <literal>getResultDocument()</literal> methods of the
- <literal>Transform</literal> class can be used to access the
- result of the XSL transformation programmatically if required,
- for example as below:</para>
-
- <example><title>Using <literal>Transform</literal>
- programmatically</title>
- <programlisting language="Java"><![CDATA[
-public void testAnotherXSLTransformation() throws Exception {
- File myInputXMLFile = new File("...");
- File myStylesheetFile = new File("...");
- Transform myTransform = new Transform(
- new StreamSource(myInputXMLFile),
- new StreamSource(myStylesheetFile));
- Document myExpectedOutputXML =
- XMLUnit.buildDocument(XMLUnit.getControlParser(),
- new FileReader("..."));
- Diff myDiff = new Diff(myExpectedOutputXML,
- myTransform.getResultDocument());
- assertTrue("XSL transformation worked as expected", myDiff.similar());
-}]]></programlisting></example>
-
- </section>
-
- <section><title>Validation Tests</title>
-
- <para>XML parsers that validate a piece of XML against a DTD are
- common, however they rely on a DTD reference being present in
- the XML, and they can only validate against a single DTD. When
- writing a system that exchanges XML messages with third parties
- there are times when you would like to validate the XML against
- a DTD that is not available to the recipient of the message and
- so cannot be referenced in the message itself. XMLUnit provides
- a <literal>Validator</literal> class for this purpose.</para>
-
- <example><title>Validating Against a DTD</title>
- <programlisting language="Java"><![CDATA[
-public void testValidation() throws Exception {
- XMLUnit.getTestDocumentBuilderFactory().setValidating(true);
- // As the document is parsed it is validated against its referenced DTD
- Document myTestDocument = XMLUnit.buildTestDocument("...");
- String mySystemId = "...";
- String myDTDUrl = new File("...").toURL().toExternalForm();
- Validator myValidator = new Validator(myTestDocument, mySystemId,
- myDTDUrl);
- assertTrue("test document validates against unreferenced DTD",
- myValidator.isValid());
-}]]></programlisting></example>
-
- <para>Starting with XMLUnit 1.1, the
- <literal>Validator</literal> class can also validate against one
- or more XML Schema definitions. See <xref
- linkend="validating-schema"/> for details.</para>
-
- </section>
-
- <section><title>Xpath Tests</title>
-
- <para>One of the strengths of XML is the ability to
- programmatically extract specific parts of a document using
- XPath expressions. The <literal>XMLTestCase</literal> class
- offers a number of XPath related assertion methods, as
- demonstrated in this test:</para>
-
- <example><title>Using Xpath Tests</title>
- <programlisting language="Java"><![CDATA[
-public void testXPaths() throws Exception {
- String mySolarSystemXML = "<solar-system>"
- + "<planet name='Earth' position='3' supportsLife='yes'/>"
- + "<planet name='Venus' position='4'/></solar-system>";
- assertXpathExists("//planet[@name='Earth']", mySolarSystemXML);
- assertNotXpathExists("//star[@name='alpha centauri']",
- mySolarSystemXML);
- assertXpathsEqual("//planet[@name='Earth']",
- "//planet[@position='3']", mySolarSystemXML);
- assertXpathsNotEqual("//planet[@name='Venus']",
- "//planet[@supportsLife='yes']",
- mySolarSystemXML);
-}]]></programlisting></example>
-
- <para>When an XPath expression is evaluated against a piece of
- XML a <literal>NodeList</literal> is created that contains the
- matching <literal>Node</literal>s. The methods in the previous
- test <literal>assertXPathExists</literal>,
- <literal>assertNotXPathExists</literal>,
- <literal>assertXPathsEqual</literal>, and
- <literal>assertXPathsNotEqual</literal> use these
- <literal>NodeList</literal>s. However, the contents of a
- <literal>NodeList</literal> can be flattened (or
- <literal>String</literal>-ified) to a single value, and XMLUnit
- also allows assertions to be made about this single value, as in
- this test<footnote id="XpathEngine note"><para>Each of the
- <literal>assertXpath...()</literal> methods uses an
- implementation of the <literal>XpathEngine</literal> interface
- to evaluate an Xpath expression.</para></footnote>:</para>
-
- <example><title>Testing Xpath Values</title>
- <programlisting language="Java"><![CDATA[
-public void testXPathValues() throws Exception {
- String myJavaFlavours = "<java-flavours>"
- + "<jvm current='some platforms'>1.1.x</jvm>"
- + "<jvm current='no'>1.2.x</jvm>"
- + "<jvm current='yes'>1.3.x</jvm>"
- + "<jvm current='yes' latest='yes'>1.4.x</jvm></javaflavours>";
- assertXpathEvaluatesTo("2", "count(//jvm[@current='yes'])",
- myJavaFlavours);
- assertXpathValuesEqual("//jvm[4]/@latest", "//jvm[4]/@current",
- myJavaFlavours);
- assertXpathValuesNotEqual("//jvm[2]/@current",
- "//jvm[3]/@current", myJavaFlavours);
-}]]></programlisting></example>
-
- <para>Xpaths are especially useful where a document is made up
- largely of known, unchanging content with only a small amount of
- changing content created by the system. One of the main areas
- where constant "boilerplate" markup is combined with system
- generated markup is of course in web applications. The power of
- XPath expressions can make testing web page output quite
- trivial, and XMLUnit supplies a means of converting even very
- badly formed HTML into XML to aid this approach to
- testing.</para>
-
- <para>The <literal>HTMLDocumentBuilder</literal> class uses the
- Swing HTML parser to convert marked-up content to Sax
- events. The <literal>TolerantSaxDocumentBuilder</literal> class
- handles the Sax events to build up a DOM document in a tolerant
- fashion i.e. without mandating that opened elements are
- closed. (In a purely XML world this class would have no purpose
- as there are plenty of Sax event handlers that can build DOM
- documents from well formed content). The test below illustrates
- how the use of these classes:</para>
-
- <example><title>Working with non well-formed HTML</title>
- <programlisting language="Java"><![CDATA[
-public void testXpathsInHTML() throws Exception {
- String someBadlyFormedHTML = "<html><title>Ugh</title>"
- + "<body><h1>Heading<ul>"
- + "<li id='1'>Item One<li id='2'>Item Two";
- TolerantSaxDocumentBuilder tolerantSaxDocumentBuilder =
- new TolerantSaxDocumentBuilder(XMLUnit.getTestParser());
- HTMLDocumentBuilder htmlDocumentBuilder =
- new HTMLDocumentBuilder(tolerantSaxDocumentBuilder);
- Document wellFormedDocument =
- htmlDocumentBuilder.parse(someBadlyFormedHTML);
- assertXpathEvaluatesTo("Item One", "/html/body//li[@id='1']",
- wellFormedDocument);
-}]]></programlisting></example>
-
- <para>One of the key points about using Xpaths with HTML content
- is that extracting values in tests requires the values to be
- identifiable. (This is just another way of saying that testing
- HTML is easier when it is written to be testable.) In the
- previous example id attributes were used to identify the list
- item values that needed to be testable, however class attributes
- or span and div tags can also be used to identify specific
- content for testing.</para>
-
- </section>
-
- <section id="intro-nodetest">
- <title>Testing by Tree Walking</title>
-
- <para>The DOM specification allows a <literal>Document</literal>
- to optionally implement the <literal>DocumentTraversal</literal>
- interface. This interface allows an application to iterate over
- the <literal>Node</literal>s contained in a
- <literal>Document</literal>, or to "walk the DOM tree". The
- XMLUnit <literal>NodeTest</literal> class and
- <literal>NodeTester</literal> interface make use of
- <literal>DocumentTraversal</literal> to expose individual
- <literal>Node</literal>s in tests: the former handles the
- mechanics of iteration, and the latter allows custom test
- strategies to be implemented. A sample test strategy is supplied
- by the <literal>CountingNodeTester</literal> class that counts
- the nodes presented to it and compares the actual count to an
- expected count. The test below illustrates its use:</para>
-
- <example><title>Using <literal>CountingNodeTester</literal></title>
- <programlisting language="Java"><![CDATA[
-public void testCountingNodeTester() throws Exception {
- String testXML = "<fibonacci><val>1</val><val>2</val><val>3</val>"
- + "<val>5</val><val>9</val></fibonacci>";
- CountingNodeTester countingNodeTester = new CountingNodeTester(4);
- assertNodeTestPasses(testXML, countingNodeTester, Node.TEXT_NODE);
-}]]></programlisting></example>
-
- <para>This test fails as there are 5 text nodes, and JUnit
- supplies the following message:</para>
-
- <programlisting>
-Expected node test to pass, but it failed! Counted 5 node(s) but
-expected 4
- </programlisting>
-
- <para>Note that if your DOM implementation does not support the
- <literal>DocumentTraversal</literal> interface then XMLUnit will
- throw an <literal>IllegalArgumentException</literal> informing
- you that you cannot use the <literal>NodeTest</literal> or
- <literal>NodeTester</literal> classes. Unfortunately even if
- your DOM implementation does support
- <literal>DocumentTraversal</literal>, attributes are not exposed
- by iteration: however they can be examined from the
- <literal>Element</literal> node that contains them.</para>
-
- <para>While the previous test could have been easily performed
- using XPath, there are times when <literal>Node</literal>
- iteration is more powerful. In general, this is true when there
- are programmatic relationships between nodes that can be more
- easily tested iteratively. The following test uses a custom
- <literal>NodeTester</literal> class to illustrate the
- potential:</para>
-
- <example><title>Using a Custom <literal>NodeTester</literal></title>
- <programlisting language="Java"><![CDATA[
-public void testCustomNodeTester() throws Exception {
- String testXML = "<fibonacci><val>1</val><val>2</val><val>3</val>"
- + "<val>5</val><val>9</val></fibonacci>";
- NodeTest nodeTest = new NodeTest(testXML);
- assertNodeTestPasses(nodeTest, new FibonacciNodeTester(),
- new short[] {Node.TEXT_NODE,
- Node.ELEMENT_NODE},
- true);
-}
-
-private class FibonacciNodeTester extends AbstractNodeTester {
- private int nextVal = 1, lastVal = 1, priorVal = 0;
-
- public void testText(Text text) throws NodeTestException {
- int val = Integer.parseInt(text.getData());
- if (nextVal != val) {
- throw new NodeTestException("Incorrect value", text);
- }
- nextVal = val + lastVal;
- priorVal = lastVal;
- lastVal = val;
- }
-
- public void testElement(Element element) throws NodeTestException {
- String name = element.getLocalName();
- if ("fibonacci".equals(name) || "val".equals(name)) {
- return;
- }
- throw new NodeTestException("Unexpected element", element);
- }
-
- public void noMoreNodes(NodeTest nodeTest) throws NodeTestException {
- }
-}]]></programlisting></example>
-
- <para>The test fails because the XML contains the wrong value
- for the last number in the sequence:</para>
-
- <programlisting>
-Expected node test to pass, but it failed! Incorrect value [#text: 9]
- </programlisting>
-
- </section>
- </section>
-
- <section id="Using"><title>Using XMLUnit</title>
-
- <section id="requirements">
- <title>Requirements</title>
-
- <para>XMLUnit requires a JAXP compliant XML parser virtually
- everywhere. Several features of XMLUnit also require a JAXP
- compliant XSLT transformer. If it is available, a JAXP
- compliant XPath engine will be used for XPath tests.</para>
-
- <para>To build XMLUnit at least JAXP 1.2 is required, this is
- the version provided by the Java class library in JDK 1.4. The
- JAXP 1.3 (i.e. Java5 and above) XPath engine can only be built
- when JAXP 1.3 is available.</para>
-
- <para>As long as you don't require support for XML Namespaces or
- XML Schema, any JAXP 1.1 compliant implementations should work
- at runtime. For namespace and schema support you will need a
- parser that complies to JAXP 1.2 and supports the required
- feature. The XML parser shipping with JDK 1.4 (a version of
- Apache Crimson) for example is compliant to JAXP 1.2 but doesn't
- support Schema validation.</para>
-
- <para>XMLUnit is supposed to build and run on any Java version
- after 1.3 (at least no new hard JDK 1.4 dependencies have been
- added in XMLUnit 1.1), but it has only been tested on JDK 1.4.2
- and above.</para>
-
- <para>To build XMLUnit JUnit 3.x (only tested with JUnit 3.8.x)
- is required. It is not required at runtime unless you intend to
- use the <literal>XMLTestCase</literal> or
- <literal>XMLAssert</literal> classes.</para>
- </section>
-
- <section id="using-plain">
- <title>Basic Usage</title>
-
- <para>XMLUnit consists of a few classes all living in the
- <literal>org.custommonkey.xmlunit</literal> package. You can
- use these classes directly from your code, no matter whether you
- are writing a unit test or want to use XMLUnit's features for
- any other purpose.</para>
-
- <para>This section provides a few hints of where to start if you
- want to use a certain feature of XMLUnit, more details can be
- found in the more specific sections later in this
- document.</para>
-
- <section><title>Comparing Pieces of XML</title>
-
- <para>Heart and soul of XMLUnit's comparison engine is
- <literal>DifferenceEngine</literal> but most of the time you
- will use it indirectly via the <literal>Diff</literal>
- class.</para>
-
- <para>You can influence the engine by providing (custom)
- implementations for various interfaces and by setting a couple
- of options on the <literal>XMLUnit</literal> class.</para>
-
- <para>More information is available in <xref
- linkend="Comparing"/>.</para>
-
- </section>
-
- <section><title>Validating</title>
-
- <para>All validation happens in the
- <literal>Validator</literal> class. The default is to
- validate against a DTD, but XML Schema validation can be
- enabled by an option (see
- <literal>Validator.useXMLSchema</literal>).</para>
-
- <para>Several options of the <literal>XMLUnit</literal> class
- affect validation.</para>
-
- <para>More information is available in <xref
- linkend="Validating"/>.</para>
-
- </section>
-
- <section><title>XSLT Transformations</title>
-
- <para>The <literal>Transform</literal> class provides an easy
- to use layer on top of JAXP's transformations. An instance of
- this class is initialized with the source document and a
- stylesheet and the result of the transformation can be
- retrieved as a <literal>String</literal> or DOM
- <literal>Document</literal>.</para>
-
- <para>The output of <literal>Transform</literal> can be used
- as input to comparisons, validations, XPath tests and so on.
- There is no detailed sections on transformations since they
- are really only a different way to create input for the rest
- of XMLUnit's machinery. Examples can be found in <xref
- linkend="transform-intro"/>.</para>
-
- <para>It is possible to provide a custom
- <literal>javax.xml.transform.URIResolver</literal> via the
- <literal>XMLUnit.setURIResolver</literal> method.</para>
-
- <para>You can access the underlying XSLT transformer via
- <literal>XMLUnit.getTransformerFactory</literal>.</para>
- </section>
-
- <section>
- <title>XPath Engine</title>
-
- <para>The central piece of XMLUnit's XPath support is the
- <literal>XpathEngine</literal> interface. Currently two
- implementations of the interface exist,
- <literal>SimpleXpathEngine</literal> and
- <literal>org.custommonkey.xmlunit.jaxp13.Jaxp13XpathEngine</literal>.</para>
-
- <para><literal>SimpleXpathEngine</literal> is a very basic
- implementation that uses your XSLT transformer under the
- covers. This also means it will expose you to the bugs found
- in your transformer like the transformer claiming a stylesheet
- couldn't be compiled for very basic XPath expressions. This
- has been reported to be the case for JDK 1.5.</para>
-
- <para><literal>org.custommonkey.xmlunit.jaxp13.Jaxp13XpathEngine</literal>
- uses JAXP 1.3's <literal>javax.xml.xpath</literal> package and
- seems to work more reliable, stable and performant than
- <literal>SimpleXpathEngine</literal>.</para>
-
- <para>You use the <literal>XMLUnit.newXpathEngine</literal>
- method to obtain an instance of the
- <literal>XpathEngine</literal>. As of XMLUnit 1.1 this will
- try to use JAXP 1.3 if it is available and fall back to
- <literal>SimpleXpathEngine</literal>.</para>
-
- <para>Instances of <literal>XpathEngine</literal> can return
- the results of XPath queries either as DOM
- <literal>NodeList</literal> or plain
- <literal>String</literal>s.</para>
-
- <para>More information is available in <xref
- linkend="XPath"/>.</para>
- </section>
-
- <section>
- <title>DOM Tree Walking</title>
-
- <para>To test pieces of XML by traversing the DOM tree you use
- the <literal>NodeTester</literal> class. Each DOM
- <literal>Node</literal> will be passed to a
- <literal>NodeTester</literal> implementation you provide. The
- <literal>AbstractNodeTester</literal> class is provided as a
- NullObject Pattern base class for implementations of your
- own.</para>
-
- <para>More information is available in <xref
- linkend="NodeTest"/>.</para>
- </section>
- </section>
-
- <section id="junit3">
- <title>Using XMLUnit With JUnit 3.x</title>
-
- <para>Initially XMLUnit was tightly coupled to JUnit and the
- recommended approach was to write unit tests by inheriting from
- the <literal>XMLTestCase</literal> class.
- <literal>XMLTestCase</literal> provides a pretty long list of
- <literal>assert...</literal> methods that may simplify your
- interaction with XMLUnit's internals in many common
- cases.</para>
-
- <para>The <literal>XMLAssert</literal> class provides the same
- set of <literal>assert...</literal>s as static methods. Use
- <literal>XMLAssert</literal> instead of
- <literal>XMLTestCase</literal> for your unit tests if you can't
- or don't want to inherit from
- <literal>XMLTestCase</literal>.</para>
-
- <para>All power of XMLUnit is available whether you use
- <literal>XMLTestCase</literal> and/or
- <literal>XMLAssert</literal> or the underlying API directly. If
- you are using JUnit 3.x then using the specific classes may prove
- to be more convenient.</para>
-
- </section>
-
- <section id="common-config">
- <title>Common Configuration Options</title>
-
- <section id="JAXP">
- <title>JAXP</title>
-
- <para>If you are using a JDK 1.4 or later, your Java class
- library already contains the required XML parsers and XSLT
- transformers. Still you may want to use a different
- parser/transformer than the one of your JDK - in particular
- since the versions shipping with some JDKs are known to
- contain serious bugs.</para>
-
- <para>As described in <xref linkend="configuring-intro"/>
- there are two main approaches to choose the XML parser of XSLT
- transformer: System properties and setters in the
- <literal>XMLUnit</literal> class.</para>
-
- <para>If you use system properties you have the advantage that
- your choice affects the whole JAXP system, whether it is used
- inside of XMLUnit or not. If you are using JDK 1.4 or later
- you may also want to review the <ulink
- url="http://java.sun.com/j2se/1.4.2/docs/guide/standards/">Endorsed
- Standards Override Mechanism</ulink> to use a different
- parser/transformer than the one shipping with your JDK.</para>
-
- <para>The second option - using the <literal>XMLUnit</literal>
- class - allows you to use different parsers for control and
- test documents, it even allows you to use different parsers
- for different test cases, if you really want to stretch it
- that far. It may also work for JDK 1.4 and above, even if you
- don't override the endorsed standards libraries.</para>
-
- <para>You can access the underlying JAXP parser by
- <literal>XMLUnit.newControlParser</literal>,
- <literal>XMLUnit.newTestParser</literal>,
- <literal>XMLUnit.getControlDocumentBuilderFactory</literal>,
- <literal>XMLUnit.getTestDocumentBuilderFactory</literal> and
- <literal>XMLUnit.getSAXParserFactory</literal> (used by
- <literal>Validator</literal>). Note that all these methods
- return factories or parsers that are namespace aware.</para>
-
- <para>The various <literal>build...</literal> methods in
- <literal>XMLUnit</literal> provide convenience layers for
- building DOM <literal>Document</literal>s using the configured
- parsers.</para>
-
- </section>
-
- <section id="entityresolver">
- <title><literal>EntityResolver</literal></title>
-
- <para>You can provide a custom
- <literal>org.xml.sax.EntityResolver</literal> for the control
- and test parsers via
- <literal>XMLUnit.setControlEntityResolver</literal> and
- <literal>XMLUnit.setTestEntityResolver</literal>.
- <literal>Validator</literal> uses the resolver set via
- <literal>setControlEntityResolver</literal> as well.</para>
- </section>
-
- <section id="element-content-whitespace">
- <title>Element Content Whitespace</title>
-
- <para>Element content whitespace - also known as ignorable
- whitespace - is whitespace contained in elements whose content
- model doesn't allow text content. I.e. the newline and space
- characters between <literal><![CDATA[<foo>]]></literal> and
- <literal><![CDATA[<bar>]]></literal> in the following example
- could belong into this category.</para>
-
- <programlisting language="XML"><![CDATA[
-<foo>
- <bar/></foo>
-]]></programlisting>
-
- <para>Using <literal>XMLUnit.setIgnoreWhitespace</literal> it
- is possible to make the test and control parser ignore this
- kind of whitespace.</para>
-
- <para>Note that setting this property to
- <literal>true</literal> usually doesn't have any effect since
- it only works on validating parsers and XMLUnit doesn't enable
- validation by default. It does have an effect when comparing
- pieces of XML, though, since the same flag is used for a
- different purpose as well in that case. See <xref
- linkend="comparing-config"/> for more details.</para>
-
- </section>
- </section>
-
- <section id="input-choices">
- <title>Providing Input to XMLUnit</title>
-
- <para>Most methods in XMLUnit that expect a piece of XML as
- input provide several overloads that obtain their input from
- different sources. The most common options are:</para>
-
- <itemizedlist>
-
- <listitem>A DOM <literal>Document</literal>.
-
- <para>Here you have all control over the document's
- creation. Such a <literal>Document</literal> could as well
- be the result of an XSLT transformation via the
- <literal>Transform</literal> class.</para>
- </listitem>
-
- <listitem>A SAX <literal>InputSource</literal>.
-
- <para>This is the most generic way since
- <literal>InputSource</literal> allows you to read from
- arbitrary <literal>InputStream</literal>s or
- <literal>Reader</literal>s. Use an
- <literal>InputStream</literal> wrapped by an
- <literal>InputSource</literal> if you want the XML parser to
- pick up the proper encoding from the XML declaration.</para>
- </listitem>
-
- <listitem>A <literal>String</literal>.
-
- <para>Here a DOM <literal>Document</literal> is built from
- the input <literal>String</literal> using the JAXP parser
- specified for control or test documents - depending on
- whether the input is a control or test piece of XML.</para>
-
- <para>Note that using a <literal>String</literal> assumes
- that your XML has already been converted from its XML
- encoding to a Java <literal>String</literal> upfront.</para>
- </listitem>
-
- <listitem>A <literal>Reader</literal>.
-
- <para>Here a DOM <literal>Document</literal> is built from
- the input <literal>Reader</literal> using the JAXP parser
- specified for control or test documents - depending on
- whether the input is a control or test piece of XML.</para>
-
- <para>Note that using a <literal>Reader</literal> is a
- bad choice if your XML encoding is different from your
- platform's default encoding since Java's IO system won't
- read your XML declaration. It is a good practice to use one
- of the other overloads rather than the
- <literal>Reader</literal> version to ensure encoding has
- been dealt with properly.</para>
- </listitem>
- </itemizedlist>
- </section>
-
- </section>
-
- <section id="Comparing"><title>Comparing Pieces of XML</title>
-
- <section id="comparing-basics">
- <title>The Difference Engine</title>
-
- <para>At the center of XMLUnit's support for comparisons is the
- <literal>DifferenceEngine</literal> class. In practice you
- rarely deal with it directly but rather use it via instances of
- <literal>Diff</literal> or <literal>DetailedDiff</literal>
- classes (see <xref linkend="Diff"/>).</para>
-
- <para>The <literal>DifferenceEngine</literal> walks two trees of
- DOM <literal>Node</literal>s, the control and the test tree and
- compares the nodes. Whenever it detects a difference, it sends
- a message to a configured <literal>DifferenceListener</literal>
- (see <xref linkend="DifferenceListener"/>) and asks a
- <literal>ComparisonController</literal> (see <xref
- linkend="ComparisonController"/>) whether the current comparison
- should be halted.</para>
-
- <para>In some cases the order of elements in two pieces of XML
- may not be significant. If this is true, the
- <literal>DifferenceEngine</literal> needs help to determine
- which <literal>Element</literal>s to compare. This is the job
- of an <literal>ElementQualifier</literal> (see <xref
- linkend="ElementQualifier"/>).</para>
-
- <para>The types of differences
- <literal>DifferenceEngine</literal> can detect are enumerated in
- the <literal>DifferenceConstants</literal> interface and
- represented by instances of the <literal>Difference</literal>
- class.</para>
-
- <para>A <literal>Difference</literal> can be recoverable;
- recoverable <literal>Difference</literal>s make the
- <literal>Diff</literal> class consider the two pieces of XML
- similar while non-recoverable <literal>Difference</literal>s
- render the two pieces different.</para>
-
- <para>The following types of <literal>Difference</literal>s are
- currently detected (the first two columns refer to the
- <literal>DifferenceConstants</literal> class):</para>
-
- <table frame="all" rules="all" pgwide="1">
- <title>Document level <literal>Difference</literal>s detected by
- <literal>DifferenceEngine</literal></title>
- <tgroup cols="4">
- <colspec colname="id" align="center"/>
- <colspec colname="constant" align="center"/>
- <colspec colname="recoverable" align="center"/>
- <colspec colname="description" align="left"/>
-
- <thead>
- <row>
- <entry><literal>ID</literal></entry>
- <entry><literal>Constant</literal></entry>
- <entry><literal>revoverable</literal></entry>
- <entry align="center">Description</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry><literal>HAS_DOCTYPE_DECLARATION_ID</literal></entry>
- <entry><literal>HAS_DOCTYPE_DECLARATION</literal></entry>
- <entry><literal>true</literal></entry>
- <entry>One piece of XML has a DOCTYPE declaration while
- the other one has not.</entry>
- </row>
- <row>
- <entry><literal>DOCTYPE_NAME_ID</literal></entry>
- <entry><literal>DOCTYPE_NAME</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>Both pieces of XML contain a DOCTYPE declaration
- but the declarations specify different names for the
- root element.</entry>
- </row>
- <row>
- <entry><literal>DOCTYPE_PUBLIC_ID</literal></entry>
- <entry><literal>DOCTYPE_PUBLIC_ID</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>Both pieces of XML contain a DOCTYPE declaration
- but the declarations specify different PUBLIC
- identifiers.</entry>
- </row>
- <row>
- <entry><literal>DOCTYPE_SYSTEM_ID</literal></entry>
- <entry><literal>DOCTYPE_SYSTEM_ID</literal></entry>
- <entry><literal>true</literal></entry>
- <entry>Both pieces of XML contain a DOCTYPE declaration
- but the declarations specify different SYSTEM
- identifiers.</entry>
- </row>
- <row>
- <entry><literal>NODE_TYPE_ID</literal></entry>
- <entry><literal>NODE_TYPE</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>The test piece of XML contains a different type
- of node than was expected.</entry>
- </row>
- <row>
- <entry><literal>NAMESPACE_PREFIX_ID</literal></entry>
- <entry><literal>NAMESPACE_PREFIX</literal></entry>
- <entry><literal>true</literal></entry>
- <entry>Two nodes use different prefixes for the same
- XML Namespace URI in the two pieces of XML.</entry>
- </row>
- <row>
- <entry><literal>NAMESPACE_URI_ID</literal></entry>
- <entry><literal>NAMESPACE_URI</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>Two nodes in the two pieces of XML share the same
- local name but use different XML Namespace URIs.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <table frame="all" rules="all" pgwide="1">
- <title>Element level <literal>Difference</literal>s detected by
- <literal>DifferenceEngine</literal></title>
- <tgroup cols="4">
- <colspec colname="id" align="center"/>
- <colspec colname="constant" align="center"/>
- <colspec colname="recoverable" align="center"/>
- <colspec colname="description" align="left"/>
-
- <thead>
- <row>
- <entry><literal>ID</literal></entry>
- <entry><literal>Constant</literal></entry>
- <entry><literal>revoverable</literal></entry>
- <entry align="center">Description</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry><literal>ELEMENT_TAG_NAME_ID</literal></entry>
- <entry><literal>ELEMENT_TAG_NAME</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>The two pieces of XML contain elements with
- different tag names.</entry>
- </row>
- <row>
- <entry><literal>ELEMENT_NUM_ATTRIBUTES_ID</literal></entry>
- <entry><literal>ELEMENT_NUM_ATTRIBUTES</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>The two pieces of XML contain a common element,
- but the number of attributes on the element is
- different.</entry>
- </row>
- <row>
- <entry><literal>HAS_CHILD_NODES_ID</literal></entry>
- <entry><literal>HAS_CHILD_NODES</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>An element in one piece of XML has child nodes
- while the corresponding one in the other has not.</entry>
- </row>
- <row>
- <entry><literal>CHILD_NODELIST_LENGTH_ID</literal></entry>
- <entry><literal>CHILD_NODELIST_LENGTH</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>Two elements in the two pieces of XML differ by
- their number of child nodes.</entry>
- </row>
- <row>
- <entry><literal>CHILD_NODELIST_SEQUENCE_ID</literal></entry>
- <entry><literal>CHILD_NODELIST_SEQUENCE</literal></entry>
- <entry><literal>true</literal></entry>
- <entry>Two elements in the two pieces of XML contain the
- same child nodes but in a different order.</entry>
- </row>
- <row>
- <entry><literal>ATTR_SEQUENCE_ID</literal></entry>
- <entry><literal>ATTR_SEQUENCE</literal></entry>
- <entry><literal>true</literal></entry>
- <entry>The attributes on an element appear in different
- order in the two pieces of XML.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <table frame="all" rules="all" pgwide="1">
- <title>Attribute level <literal>Difference</literal>s detected by
- <literal>DifferenceEngine</literal></title>
-
- <tgroup cols="4">
- <colspec colname="id" align="center"/>
- <colspec colname="constant" align="center"/>
- <colspec colname="recoverable" align="center"/>
- <colspec colname="description" align="left"/>
-
- <thead>
- <row>
- <entry><literal>ID</literal></entry>
- <entry><literal>Constant</literal></entry>
- <entry><literal>revoverable</literal></entry>
- <entry align="center">Description</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry><literal>ATTR_VALUE_EXPLICITLY_SPECIFIED_ID</literal></entry>
- <entry><literal>ATTR_VALUE_EXPLICITLY_SPECIFIED</literal></entry>
- <entry><literal>true</literal></entry>
- <entry>An attribute that is not required and has a
- default value according to the content model of the
- element in question has been specified explicitly in one
- piece of XML but not in the other.</entry>
- </row>
- <row>
- <entry><literal>ATTR_NAME_NOT_FOUND_ID</literal></entry>
- <entry><literal>ATTR_NAME_NOT_FOUND</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>One piece of XML contains an attribute on an
- element that is missing in the other.</entry>
- </row>
- <row>
- <entry><literal>ATTR_VALUE_ID</literal></entry>
- <entry><literal>ATTR_VALUE</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>The value of an element's attribute is different
- in the two pieces of XML.</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <table frame="all" rules="all" pgwide="1">
- <title>Other <literal>Difference</literal>s detected by
- <literal>DifferenceEngine</literal></title>
-
- <tgroup cols="4">
- <colspec colname="id" align="center"/>
- <colspec colname="constant" align="center"/>
- <colspec colname="recoverable" align="center"/>
- <colspec colname="description" align="left"/>
-
- <thead>
- <row>
- <entry><literal>ID</literal></entry>
- <entry><literal>Constant</literal></entry>
- <entry><literal>revoverable</literal></entry>
- <entry align="center">Description</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry><literal>COMMENT_VALUE_ID</literal></entry>
- <entry><literal>COMMENT_VALUE</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>The content of two comments is different in the
- two pieces of XML.</entry>
- </row>
- <row>
- <entry><literal>PROCESSING_INSTRUCTION_TARGET_ID</literal></entry>
- <entry><literal>PROCESSING_INSTRUCTION_TARGET</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>The target of two processing instructions is
- different in the two pieces of XML.</entry>
- </row>
- <row>
- <entry><literal>PROCESSING_INSTRUCTION_DATA_ID</literal></entry>
- <entry><literal>PROCESSING_INSTRUCTION_DATA</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>The data of two processing instructions is
- different in the two pieces of XML.</entry>
- </row>
-
- <row>
- <entry><literal>CDATA_VALUE_ID</literal></entry>
- <entry><literal>CDATA_VALUE</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>The content of two CDATA sections is different in
- the two pieces of XML.</entry>
- </row>
- <row>
- <entry><literal>TEXT_VALUE_ID</literal></entry>
- <entry><literal>TEXT_VALUE</literal></entry>
- <entry><literal>false</literal></entry>
- <entry>The value of two texts is different in the two
- pieces of XML.</entry>
- </...
[truncated message content] |
|
From: <bo...@us...> - 2007-04-13 13:07:56
|
Revision: 181
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=181&view=rev
Author: bodewig
Date: 2007-04-13 06:07:54 -0700 (Fri, 13 Apr 2007)
Log Message:
-----------
directory for example code from user-guide
Added Paths:
-----------
trunk/xmlunit/src/site/org/
trunk/xmlunit/src/site/org/custommonkey/
trunk/xmlunit/src/site/org/custommonkey/xmlunit/
trunk/xmlunit/src/site/org/custommonkey/xmlunit/examples/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-13 11:31:16
|
Revision: 180
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=180&view=rev
Author: bodewig
Date: 2007-04-13 04:31:15 -0700 (Fri, 13 Apr 2007)
Log Message:
-----------
Make ignoreComments work at the DifferenceEngine level
Modified Paths:
--------------
trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java
trunk/xmlunit/src/java/org/custommonkey/xmlunit/XpathNodeTracker.java
trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java 2007-04-13 08:11:02 UTC (rev 179)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java 2007-04-13 11:31:15 UTC (rev 180)
@@ -1,6 +1,6 @@
/*
******************************************************************
-Copyright (c) 2001, Jeff Martin, Tim Bacon
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,8 +36,10 @@
package org.custommonkey.xmlunit;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import org.w3c.dom.Attr;
import org.w3c.dom.CharacterData;
@@ -246,15 +248,42 @@
*/
protected void compareHasChildNodes(Node control, Node test,
DifferenceListener listener) throws DifferenceFoundException {
- Boolean controlHasChildren = control.hasChildNodes()
- ? Boolean.TRUE : Boolean.FALSE;
- Boolean testHasChildren = test.hasChildNodes()
- ? Boolean.TRUE : Boolean.FALSE;
+ Boolean controlHasChildren = hasChildNodes(control);
+ Boolean testHasChildren = hasChildNodes(test);
compare(controlHasChildren, testHasChildren, control, test,
listener, HAS_CHILD_NODES);
}
/**
+ * Tests whether a Node has children, taking ignoreComments
+ * setting into account.
+ */
+ private Boolean hasChildNodes(Node n) {
+ boolean flag = n.hasChildNodes();
+ if (flag && XMLUnit.getIgnoreComments()) {
+ List nl = nodeList2List(n.getChildNodes());
+ flag = nl.size() > 0;
+ }
+ return flag ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+ /**
+ * Returns the NodeList's Nodes as List, taking ignoreComments
+ * into account.
+ */
+ static List nodeList2List(NodeList nl) {
+ int len = nl.getLength();
+ ArrayList l = new ArrayList(len);
+ for (int i = 0; i < len; i++) {
+ Node n = nl.item(i);
+ if (!XMLUnit.getIgnoreComments() || !(n instanceof Comment)) {
+ l.add(n);
+ }
+ }
+ return l;
+ }
+
+ /**
* Compare the number of children, and if the same, compare the actual
* children via their NodeLists.
* @param control
@@ -267,11 +296,11 @@
DifferenceListener listener, ElementQualifier elementQualifier)
throws DifferenceFoundException {
if (control.hasChildNodes() && test.hasChildNodes()) {
- NodeList controlChildren = control.getChildNodes();
- NodeList testChildren = test.getChildNodes();
+ List controlChildren = nodeList2List(control.getChildNodes());
+ List testChildren = nodeList2List(test.getChildNodes());
- Integer controlLength = new Integer(controlChildren.getLength());
- Integer testLength = new Integer(testChildren.getLength());
+ Integer controlLength = new Integer(controlChildren.size());
+ Integer testLength = new Integer(testChildren.size());
compare(controlLength, testLength, control, test, listener,
CHILD_NODELIST_LENGTH);
compareNodeList(controlChildren, testChildren,
@@ -292,23 +321,48 @@
* the test NodeList should be compared to the current child element in the
* control NodeList.
* @throws DifferenceFoundException
+ * @deprecated Use the version with List arguments instead
*/
protected void compareNodeList(final NodeList control, final NodeList test,
final int numNodes,
final DifferenceListener listener,
final ElementQualifier elementQualifier)
throws DifferenceFoundException {
+ compareNodeList(nodeList2List(control), nodeList2List(test),
+ numNodes, listener, elementQualifier);
+ }
+ /**
+ * Compare the contents of two node list one by one, assuming that order
+ * of children is NOT important: matching begins at same position in test
+ * list as control list.
+ * @param control
+ * @param test
+ * @param numNodes convenience parameter because the calling method should
+ * know the value already
+ * @param listener
+ * @param elementQualifier used to determine which of the child elements in
+ * the test NodeList should be compared to the current child element in the
+ * control NodeList.
+ * @throws DifferenceFoundException
+ */
+ protected void compareNodeList(final List controlChildren,
+ final List testChildren,
+ final int numNodes,
+ final DifferenceListener listener,
+ final ElementQualifier elementQualifier)
+ throws DifferenceFoundException {
+
int j = 0;
- final int lastTestNode = test.getLength() - 1;
- testTracker.preloadNodeList(test);
+ final int lastTestNode = testChildren.size() - 1;
+ testTracker.preloadChildList(testChildren);
HashMap/*<Node, Node>*/ matchingNodes = new HashMap();
HashMap/*<Node, Integer>*/ matchingNodeIndexes = new HashMap();
// first pass to find the matching nodes in control and test docs
for (int i=0; i < numNodes; ++i) {
- Node nextControl = control.item(i);
+ Node nextControl = (Node) controlChildren.get(i);
boolean matchOnElement = nextControl instanceof Element;
short findNodeType = nextControl.getNodeType();
int startAt = ( i > lastTestNode ? lastTestNode : i);
@@ -317,12 +371,12 @@
boolean matchFound = false;
while (!matchFound) {
- if (findNodeType == test.item(j).getNodeType()) {
+ if (findNodeType == ((Node)testChildren.get(j)).getNodeType()) {
matchFound = !matchOnElement
|| elementQualifier == null
|| elementQualifier
- .qualifyForComparison((Element)nextControl,
- (Element)test.item(j));
+ .qualifyForComparison((Element) nextControl,
+ (Element) testChildren.get(j));
}
if (!matchFound) {
++j;
@@ -336,7 +390,7 @@
}
}
if (matchFound) {
- matchingNodes.put(nextControl, test.item(j));
+ matchingNodes.put(nextControl, testChildren.get(j));
matchingNodeIndexes.put(nextControl, new Integer(j));
}
}
@@ -346,7 +400,7 @@
// any other control nodes
Collection matchingTestNodes = matchingNodes.values();
for (int i=0; i < numNodes; ++i) {
- Node nextControl = control.item(i);
+ Node nextControl = (Node) controlChildren.get(i);
Node nextTest = (Node) matchingNodes.get(nextControl);
Integer testIndex = (Integer) matchingNodeIndexes.get(nextControl);
if (nextTest == null) {
@@ -357,8 +411,9 @@
boolean matchFound = false;
while (!matchFound) {
- if (test.item(j).getNodeType() == findNodeType
- && !matchingTestNodes.contains(test.item(j))) {
+ if (((Node) testChildren.get(j))
+ .getNodeType() == findNodeType
+ && !matchingTestNodes.contains(testChildren.get(j))) {
matchFound = true;
} else {
++j;
@@ -371,7 +426,7 @@
}
}
}
- nextTest = test.item(j);
+ nextTest = (Node) testChildren.get(j);
testIndex = new Integer(j);
}
compareNode(nextControl, nextTest, listener, elementQualifier);
@@ -531,7 +586,9 @@
*/
protected void compareComment(Comment control, Comment test,
DifferenceListener listener) throws DifferenceFoundException {
- compareCharacterData(control, test, listener, COMMENT_VALUE);
+ if (!XMLUnit.getIgnoreComments()) {
+ compareCharacterData(control, test, listener, COMMENT_VALUE);
+ }
}
/**
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/XpathNodeTracker.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/XpathNodeTracker.java 2007-04-13 08:11:02 UTC (rev 179)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/XpathNodeTracker.java 2007-04-13 11:31:15 UTC (rev 180)
@@ -1,6 +1,6 @@
/*
******************************************************************
-Copyright (c) 2001, Jeff Martin, Tim Bacon
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -35,10 +35,10 @@
*/
package org.custommonkey.xmlunit;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Map;
import org.w3c.dom.Attr;
@@ -167,6 +167,21 @@
}
/**
+ * Preload the items in a List by visiting each in turn
+ * Required for pieces of test XML whose node children can be visited
+ * out of sequence by a DifferenceEngine comparison
+ * @param nodeList the items to preload
+ */
+ public void preloadChildList(List nodeList) {
+ currentEntry.trackNodesAsWellAsValues(true);
+ int length = nodeList.size();
+ for (int i=0; i < length; ++i) {
+ visited((Node) nodeList.get(i));
+ }
+ currentEntry.trackNodesAsWellAsValues(false);
+ }
+
+ /**
* @return the last visited node as an xpath-location String
*/
public String toXpathString() {
Modified: trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java
===================================================================
--- trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java 2007-04-13 08:11:02 UTC (rev 179)
+++ trunk/xmlunit/tests/java/org/custommonkey/xmlunit/test_DifferenceEngine.java 2007-04-13 11:31:15 UTC (rev 180)
@@ -1,6 +1,6 @@
/*
******************************************************************
-Copyright (c) 200, Jeff Martin, Tim Bacon
+Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -731,6 +731,55 @@
assertEquals(expected, listener.comparingWhat);
}
+ public void testExtraComment() {
+ testExtraComment(true);
+ resetListener();
+ XMLUnit.setIgnoreComments(true);
+ try {
+ testExtraComment(false);
+ } finally {
+ XMLUnit.setIgnoreComments(false);
+ }
+ }
+
+ private void testExtraComment(boolean expectDifference) {
+ Element control = document.createElement("foo");
+ Element test = document.createElement("foo");
+ Comment c = document.createComment("bar");
+ control.appendChild(c);
+ Element cChild = document.createElement("baz");
+ control.appendChild(cChild);
+ Element tChild = document.createElement("baz");
+ test.appendChild(tChild);
+ engine.compare(control, test, listener, null);
+ assertEquals(expectDifference, listener.different);
+ resetListener();
+ engine.compare(test, control, listener, null);
+ assertEquals(expectDifference, listener.different);
+ }
+
+ public void testCommentContent() {
+ testCommentContent(true);
+ resetListener();
+ XMLUnit.setIgnoreComments(true);
+ try {
+ testCommentContent(false);
+ } finally {
+ XMLUnit.setIgnoreComments(false);
+ }
+ }
+
+ private void testCommentContent(boolean expectDifference) {
+ Element control = document.createElement("foo");
+ Element test = document.createElement("foo");
+ Comment c = document.createComment("bar");
+ control.appendChild(c);
+ Comment c2 = document.createComment("baz");
+ test.appendChild(c2);
+ engine.compare(control, test, listener, null);
+ assertEquals(expectDifference, listener.different);
+ }
+
private void listenToDifferences(String control, String test)
throws SAXException, IOException {
Document controlDoc = XMLUnit.buildControlDocument(control);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-13 08:11:04
|
Revision: 179
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=179&view=rev
Author: bodewig
Date: 2007-04-13 01:11:02 -0700 (Fri, 13 Apr 2007)
Log Message:
-----------
fix a few javadocs, remove redundant public identifiers from interfaces
Modified Paths:
--------------
trunk/xmlunit/src/java/org/custommonkey/xmlunit/ComparisonController.java
trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceListener.java
trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTester.java
trunk/xmlunit/src/java/org/custommonkey/xmlunit/examples/MultiLevelElementNameAndTextQualifier.java
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/ComparisonController.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/ComparisonController.java 2007-04-12 09:07:12 UTC (rev 178)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/ComparisonController.java 2007-04-13 08:11:02 UTC (rev 179)
@@ -41,13 +41,13 @@
*/
public interface ComparisonController {
/**
- * Determine whether a Difference that this listener has been notified of
+ * Determine whether a Difference that the listener has been notified of
* should halt further XML comparison. Default behaviour for a Diff
* instance is to halt if the Difference is not recoverable.
* @see Difference#isRecoverable
* @param afterDifference the last Difference passed to <code>differenceFound</code>
* @return true to halt further comparison, false otherwise
*/
- public boolean haltComparison(Difference afterDifference);
+ boolean haltComparison(Difference afterDifference);
}
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceListener.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceListener.java 2007-04-12 09:07:12 UTC (rev 178)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceListener.java 2007-04-13 08:11:02 UTC (rev 179)
@@ -49,28 +49,29 @@
* Indicates that the <code>Difference</code> is interpreted as defined
* in {@link DifferenceConstants DifferenceConstants}.
*/
- public final int RETURN_ACCEPT_DIFFERENCE = 0;
+ int RETURN_ACCEPT_DIFFERENCE = 0;
/**
* Override return value for the <code>differenceFound</code> method.
* Indicates that the nodes identified as being different should be
* interpreted as being identical.
*/
- public final int RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL = 1;
+ int RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL = 1;
/**
* Override return value for the <code>differenceFound</code> method.
* Indicates that the nodes identified as being different should be
* interpreted as being similar.
*/
- public final int RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR = 2;
+ int RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR = 2;
/**
* Receive notification that 2 nodes are different.
- * @param difference a Difference instance as defined in
- * {@link DifferenceConstants DifferenceConstants} describing the
- * cause of the difference and containing the detail of the nodes that differ
- * @return int one of the RETURN_... constants describing how this difference
- * was interpreted
+ * @param difference a Difference instance as defined in {@link
+ * DifferenceConstants DifferenceConstants} describing the cause
+ * of the difference and containing the detail of the nodes that
+ * differ
+ * @return int one of the RETURN_... constants describing how this
+ * difference was interpreted
*/
- public int differenceFound(Difference difference);
+ int differenceFound(Difference difference);
/**
* Receive notification that a comparison between 2 nodes has been skipped
@@ -79,6 +80,6 @@
* @param test the test node being compared
* @see DifferenceEngine
*/
- public void skippedComparison(Node control, Node test);
+ void skippedComparison(Node control, Node test);
}
\ No newline at end of file
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTester.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTester.java 2007-04-12 09:07:12 UTC (rev 178)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/NodeTester.java 2007-04-13 08:11:02 UTC (rev 179)
@@ -53,7 +53,7 @@
* @param forTest
* @exception NodeTestException if the node fails the test
*/
- public void testNode(Node aNode, NodeTest forTest) throws NodeTestException ;
+ void testNode(Node aNode, NodeTest forTest) throws NodeTestException ;
/**
* Validate that the Nodes passed one-by-one to the <code>testNode</code>
@@ -61,5 +61,5 @@
* @param forTest
* @exception NodeTestException if this instance was expecting more nodes
*/
- public void noMoreNodes(NodeTest forTest) throws NodeTestException ;
+ void noMoreNodes(NodeTest forTest) throws NodeTestException ;
}
\ No newline at end of file
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/examples/MultiLevelElementNameAndTextQualifier.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/examples/MultiLevelElementNameAndTextQualifier.java 2007-04-12 09:07:12 UTC (rev 178)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/examples/MultiLevelElementNameAndTextQualifier.java 2007-04-13 08:11:02 UTC (rev 179)
@@ -1,6 +1,6 @@
/*
******************************************************************
-Copyright (c) 2001, Jeff Martin, Tim Bacon
+Copyright (c) 2006-2007, Jeff Martin, Tim Bacon
All rights reserved.
Redistribution and use in source and binary forms, with or without
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2007-04-12 09:07:11
|
Revision: 178
http://xmlunit.svn.sourceforge.net/xmlunit/?rev=178&view=rev
Author: bodewig
Date: 2007-04-12 02:07:12 -0700 (Thu, 12 Apr 2007)
Log Message:
-----------
whitespace changes only
Modified Paths:
--------------
trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java
Modified: trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java
===================================================================
--- trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java 2007-04-12 04:43:38 UTC (rev 177)
+++ trunk/xmlunit/src/java/org/custommonkey/xmlunit/DifferenceEngine.java 2007-04-12 09:07:12 UTC (rev 178)
@@ -447,14 +447,15 @@
compareAttribute(nextAttr, compareTo, listener);
if (!XMLUnit.getIgnoreAttributeOrder()) {
- Attr attributeItem = (Attr) testAttr.item(i);
- String testAttrName = "[attribute absent]";
- if (attributeItem != null) {
- testAttrName = getUnNamespacedNodeName(attributeItem);
+ Attr attributeItem = (Attr) testAttr.item(i);
+ String testAttrName = "[attribute absent]";
+ if (attributeItem != null) {
+ testAttrName =
+ getUnNamespacedNodeName(attributeItem);
+ }
+ compare(attrName, testAttrName,
+ nextAttr, compareTo, listener, ATTR_SEQUENCE);
}
- compare(attrName, testAttrName,
- nextAttr, compareTo, listener, ATTR_SEQUENCE);
- }
} else {
compare(attrName, null, control, test, listener,
ATTR_NAME_NOT_FOUND);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|