当前位置: 首页>>代码示例>>Java>>正文


Java Diff.overrideElementQualifier方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:camunda,项目名称:camunda-dmn-model,代码行数:20,代码来源:DmnModelTest.java

示例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);
}
 
开发者ID:mojohaus,项目名称:jaxb2-maven-plugin,代码行数:22,代码来源:XsdGeneratorHelperTest.java

示例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());
}
 
开发者ID:xmlunit,项目名称:xmlunit,代码行数:25,代码来源:test_RecursiveElementNameAndTextQualifier.java

示例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)));
    }
}
 
开发者ID:aws,项目名称:aws-sdk-java-v2,代码行数:10,代码来源:XmlAsserts.java

示例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);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:8,代码来源:XMLSerializerTest.java

示例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);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:8,代码来源:XMLSerializerTest.java

示例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);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:8,代码来源:XMLSerializerTest.java

示例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);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:8,代码来源:XMLSerializerTest.java

示例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);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:8,代码来源:XMLSerializerTest.java

示例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);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:8,代码来源:XMLSerializerTest.java

示例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);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:8,代码来源:XMLSerializerTest.java

示例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);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:8,代码来源:XMLSerializerTest.java

示例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);
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:8,代码来源:XMLSerializerTest.java

示例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.
}
 
开发者ID:teiid,项目名称:oreva,代码行数:30,代码来源:EdmxFormatWriterTest.java

示例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);
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:13,代码来源:EffectiveSchemaContextEmitterTest.java


注:本文中的org.custommonkey.xmlunit.Diff.overrideElementQualifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。