Package org.milyn.delivery.dom

Examples of org.milyn.delivery.dom.DOMParser


    config = new SmooksResourceConfiguration();
        config.setResource(EDIReader.class.getName());
    // Set the mapping config on the resource config...
        config.setParameter(EDIReader.MODEL_CONFIG_KEY, TEST_XML_MAPPING_XML_URI);

    DOMParser parser;

    // Create 1st parser using the config, and run a parse through it...
    parser = new DOMParser(smooks.createExecutionContext(), config);
    parser.parse(new StreamSource(new ByteArrayInputStream(input)));

    // Check make sure the parsed and validated model was cached...
    Hashtable mappingTable = EDIReader.getMappingTable(smooks.getApplicationContext());
    assertNotNull("No mapping table in context!", mappingTable);

        EdifactModel mappingModel_request1 = (EdifactModel) mappingTable.get(config);
        assertNotNull("No mapping model in mapping table!", mappingModel_request1);

    // Create 2nd parser using the same config, and run a parse through it...
    parser = new DOMParser(smooks.createExecutionContext(), config);
    parser.parse(new StreamSource(new ByteArrayInputStream(input)));

    // Make sure the cached model was used on the 2nd parse...
    assertEquals("Not the same model instance => cache not working properly!", mappingModel_request1, (EdifactModel) mappingTable.get(config));
  }
View Full Code Here


    // Set the mapping config on the resource config...
    if(mapping != null) {
      config.setParameter(EDIReader.MODEL_CONFIG_KEY, mapping);
    }

    DOMParser parser = new DOMParser(smooks.createExecutionContext(), config);
    Document doc = parser.parse(new StreamSource(input));

    Diff diff = new Diff(expected, XmlUtil.serialize(doc.getChildNodes()));
    assertTrue(diff.toString(), diff.identical());
  }
View Full Code Here

    // Set the mapping config on the resource config...
    if(mapping != null) {
      config.setParameter(EDIReader.MODEL_CONFIG_KEY, mapping);
    }

    DOMParser parser = new DOMParser(smooks.createExecutionContext(), config);
        try {
            parser.parse(new StreamSource(input));
            assert false : "Parser should fail when importing importing message mappings with cyclic dependency";
        } catch (Exception e) {
            assert true : "Parser should fail when importing importing message mappings with cyclic dependency";
        }
View Full Code Here

TOP

Related Classes of org.milyn.delivery.dom.DOMParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.