本文整理汇总了Java中org.custommonkey.xmlunit.Diff.overrideElementQualifier方法的典型用法代码示例。如果您正苦于以下问题:Java Diff.overrideElementQualifier方法的具体用法?Java Diff.overrideElementQualifier怎么用?Java Diff.overrideElementQualifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.custommonkey.xmlunit.Diff
的用法示例。
在下文中一共展示了Diff.overrideElementQualifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertModelEqualsFile
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
protected void assertModelEqualsFile(String expectedPath) throws Exception {
File actualFile = tmpFolder.newFile();
Dmn.writeModelToFile(actualFile, modelInstance);
File expectedFile = ReflectUtil.getResourceAsFile(expectedPath);
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document actualDocument = docBuilder.parse(actualFile);
Document expectedDocument = docBuilder.parse(expectedFile);
Diff diff = new Diff(expectedDocument, actualDocument);
if (!diff.similar()) {
diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
DetailedDiff detailedDiff = new DetailedDiff(diff);
String failMsg = "XML differs:\n" + detailedDiff.getAllDifferences() + "\n\nActual XML:\n" + Dmn.convertToString(modelInstance);
fail(failMsg);
}
}
示例2: validateProcessingNodes
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
@Test
public void validateProcessingNodes() {
// Assemble
final String newPrefix = "changedFoo";
final String oldPrefix = "foo";
final String originalXml = getXmlDocumentSample(oldPrefix);
final String changedXml = getXmlDocumentSample(newPrefix);
final NodeProcessor changeNamespacePrefixProcessor = new ChangeNamespacePrefixProcessor(oldPrefix, newPrefix);
// Act
final Document processedDocument = XsdGeneratorHelper.parseXmlStream(new StringReader(originalXml));
XsdGeneratorHelper.process(processedDocument.getFirstChild(), true, changeNamespacePrefixProcessor);
// Assert
final Document expectedDocument = XsdGeneratorHelper.parseXmlStream(new StringReader(changedXml));
final Diff diff = new Diff(expectedDocument, processedDocument, null, new ElementNameAndAttributeQualifier());
diff.overrideElementQualifier(new ElementNameAndAttributeQualifier());
XMLAssert.assertXMLEqual(processedDocument, expectedDocument);
}
示例3: testUserGuideExample
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
public void testUserGuideExample() throws Exception {
String control =
"<table>\n"
+ " <tr>\n"
+ " <td>foo</td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td>bar</td>\n"
+ " </tr>\n"
+ "</table>\n";
String test =
"<table>\n"
+ " <tr>\n"
+ " <td>bar</td>\n"
+ " </tr>\n"
+ " <tr>\n"
+ " <td>foo</td>\n"
+ " </tr>\n"
+ "</table>\n";
Diff d = new Diff(control, test);
d.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
assertTrue(d.toString(), d.similar());
}
示例4: doAssertXmlEquals
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
private static void doAssertXmlEquals(String expectedXml, String actualXml) throws Exception {
Diff diff = new Diff(expectedXml, actualXml);
diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier());
if (!diff.similar()) {
fail(String.format("\nExpected the following XML\n" + formatXml(expectedXml) +
"\nbut actual XML was\n\n" +
formatXml(actualXml)));
}
}
示例5: testBackupUsageScheduleSerialization
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
@Test
public void testBackupUsageScheduleSerialization() throws Exception {
String xmlBackupUsageSchedule = xmlSerializer.serialize(backupUsageSchedule, false);
Diff diff = new Diff(BACKUP_USAGE_SCHEDULE, xmlBackupUsageSchedule);
diff.overrideElementQualifier(new ElementNameAndTextQualifier());
XMLAssert.assertXMLEqual(diff, true);
}
示例6: testSelectServerSerialization
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
@Test
public void testSelectServerSerialization() throws Exception {
String xmlSelectServer = xmlSerializer.serialize(selectServer, false);
Diff diff = new Diff(SELECT_SERVER, xmlSelectServer);
diff.overrideElementQualifier(new ElementNameAndTextQualifier());
XMLAssert.assertXMLEqual(diff, true);
}
示例7: testServicePathsSerialization
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
@Test
public void testServicePathsSerialization() throws Exception {
String xmlServicePaths = xmlSerializer.serialize(servicePaths, false);
Diff diff = new Diff(PATHS_SERVICE, xmlServicePaths);
diff.overrideElementQualifier(new ElementNameAndTextQualifier());
XMLAssert.assertXMLEqual(diff, true);
}
示例8: testDistributionSerialization
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
@Test
public void testDistributionSerialization() throws Exception {
String xmlDistribution = xmlSerializer.serialize(distribution, false);
Diff diff = new Diff(DISTRIBUTION, xmlDistribution);
diff.overrideElementQualifier(new ElementNameAndTextQualifier());
XMLAssert.assertXMLEqual(diff, true);
}
示例9: testWhitelistedSerialization
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
@Test
public void testWhitelistedSerialization() throws Exception {
String xmlWhitelisted = xmlSerializer.serialize(whitelisted, false);
Diff diff = new Diff(WHITELISTED, xmlWhitelisted);
diff.overrideElementQualifier(new ElementNameAndTextQualifier());
XMLAssert.assertXMLEqual(diff, true);
}
示例10: testRuleSerialization
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
@Test
public void testRuleSerialization() throws Exception {
String xmlRule = xmlSerializer.serialize(rule, false);
Diff diff = new Diff(RULE, xmlRule);
diff.overrideElementQualifier(new ElementNameAndTextQualifier());
XMLAssert.assertXMLEqual(diff, true);
}
示例11: testUrlRuleSerialization
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
@Test
public void testUrlRuleSerialization() throws Exception {
String xmlUrlRule = xmlSerializer.serialize(urlRule, false);
Diff diff = new Diff(URL_RULE, xmlUrlRule);
diff.overrideElementQualifier(new ElementNameAndTextQualifier());
XMLAssert.assertXMLEqual(diff, true);
}
示例12: testServerSerialization
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
@Test
public void testServerSerialization() throws Exception {
String xmlServer = xmlSerializer.serialize(server, false);
Diff diff = new Diff(SERVER, xmlServer);
diff.overrideElementQualifier(new ElementNameAndTextQualifier());
XMLAssert.assertXMLEqual(diff, true);
}
示例13: testNamespacesSerialization
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
@Test
public void testNamespacesSerialization() throws Exception {
String xmlNamespaces = xmlSerializer.serialize(namespaces, false);
Diff diff = new Diff(NAMESPACES, xmlNamespaces);
diff.overrideElementQualifier(new ElementNameAndTextQualifier());
XMLAssert.assertXMLEqual(diff, true);
}
示例14: testExtensions
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
@Ignore("Re-enable when it passes")
@Test
public void testExtensions() throws InterruptedException, SAXException, IOException {
// test to see that documentation and annotations get written correctly
String metadata = this.rtFacade.getWebResource(endpointUri + "$metadata").getEntity();
//System.out.println(metadata);
String expected = readFileToString("/META-INF/uri-conventions/xml/DocAnnotTest.xml");
XMLUnit.setIgnoreWhitespace(true);
Diff myDiff = new Diff(expected, metadata);
myDiff.overrideElementQualifier(new ElementNameAndTextQualifier());
assertXMLEqual("bad $metadata", myDiff, true);
EdmDataServices pds = new EdmxFormatParser().parseMetadata(StaxUtil.newXMLEventReader(new StringReader(metadata)));
Assert.assertTrue(pds != null); // we parsed it!
// TODO: once EdmxFormatParser supports doc and annotations we can check pds
// for the expected objects.
// TODO: once we support doc and annots for all EdmItem types we should
// include them.
// also, this test doesn't ensure the placement of annotations and documenation in the edmx,
// for example, Documentation is always the first sub-element.
}
示例15: assertXMLEquals
import org.custommonkey.xmlunit.Diff; //导入方法依赖的package包/类
private static void assertXMLEquals(final String name, final Document expectedXMLDoc, final String output)
throws SAXException, IOException {
final String expected = YinExportTestUtils.toString(expectedXMLDoc.getDocumentElement());
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setNormalize(true);
XMLUnit.setNormalizeWhitespace(true);
final Diff diff = new Diff(expected, output);
diff.overrideElementQualifier(new ElementNameAndAttributeQualifier());
XMLAssert.assertXMLEqual(name, diff, true);
}