Package org.milyn.edisax.model

Examples of org.milyn.edisax.model.EdifactModel$Node


            fail("Expected SAXException");
        }
    }
 
  public void test_parseMappingModel() throws IOException, SAXException, EDIConfigurationException {
    EdifactModel map = EDIParser.parseMappingModel(getClass().getResourceAsStream("edi-mapping_01.xml"));
   
    // Some basic checks on the model produced by xmlbeans...
   
    // Make sure xml character refs are rewritten on the delimiters
    assertEquals("\n", map.getDelimiters().getSegment());
    assertEquals("*", map.getDelimiters().getField());
    assertEquals("^", map.getDelimiters().getComponent());
    assertEquals("~", map.getDelimiters().getSubComponent());
   
    assertEquals("message-x", map.getEdimap().getSegments().getXmltag());
    List<SegmentGroup> segments = map.getEdimap().getSegments().getSegments();
    assertEquals(2, segments.size());

        Segment segment = (Segment) segments.get(0);
        assertEquals(1, segment.getSegments().size());
    assertEquals(1, segment.getFields().size());
View Full Code Here


* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
public class UNEdifactInterchangeParser_with_ung_Test extends TestCase {

  public void test_with_groupref() throws IOException, SAXException, EDIConfigurationException {
    EdifactModel model1 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG1-model.xml"));
    EdifactModel model2 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG2-model.xml"));
   
    UNEdifactInterchangeParser parser = new UNEdifactInterchangeParser();
    parser.setMappingsRegistry(new DefaultMappingsRegistry(model1, model2));
    parser.ignoreNewLines(true);

View Full Code Here

        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-01.xml")), new StringReader(handler.xmlMapping.toString()));
  }

  public void test_without_groupref() throws IOException, SAXException, EDIConfigurationException {
    EdifactModel model1 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG1-model.xml"));
    EdifactModel model2 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG2-model.xml"));
   
    UNEdifactInterchangeParser parser = new UNEdifactInterchangeParser();
    parser.setMappingsRegistry(new DefaultMappingsRegistry(model1, model2));
    parser.ignoreNewLines(true);
View Full Code Here

      assertEquals("EDI message processing failed [EDI Message Interchange Control Model][N/A].  Segment [UNG], field 5 (groupRef) expected to contain a value.  Currently at segment number 2.", e.getMessage());
    }
  }

  public void test_full_group_header() throws IOException, SAXException, EDIConfigurationException {
    EdifactModel model1 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG1-model.xml"));
    EdifactModel model2 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG2-model.xml"));
   
    UNEdifactInterchangeParser parser = new UNEdifactInterchangeParser();
    parser.setMappingsRegistry(new DefaultMappingsRegistry(model1, model2));
    parser.ignoreNewLines(true);
View Full Code Here

        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-02.xml")), new StringReader(handler.xmlMapping.toString()));
  }

  public void test_with_unknown_ucd_segment() throws IOException, SAXException, EDIConfigurationException {
    EdifactModel model1 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG1-model.xml"));
    EdifactModel model2 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG2-model.xml"));
   
    UNEdifactInterchangeParser parser = new UNEdifactInterchangeParser();
    parser.setMappingsRegistry(new DefaultMappingsRegistry(model1, model2));
    parser.ignoreNewLines(true);
View Full Code Here

* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
*/
public class UNEdifactInterchangeParser_no_ung_Test extends TestCase {

  public void test_unzipped() throws IOException, SAXException, EDIConfigurationException {
    EdifactModel model1 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG1-model.xml"));
    EdifactModel model2 = EDIParser.parseMappingModel(getClass().getResourceAsStream("../MSG2-model.xml"));
   
    UNEdifactInterchangeParser parser = new UNEdifactInterchangeParser();
    parser.setMappingsRegistry(new DefaultMappingsRegistry(model1, model2));

    testExchanges(parser);
View Full Code Here

    public static EdifactModel parseMappingModel(Reader mappingConfigStream, Description mappingDescription, URI resourceURI, URI importBaseURI) throws IOException, SAXException, EDIConfigurationException {
        AssertArgument.isNotNull(mappingConfigStream, "mappingConfigStream");
        AssertArgument.isNotNull(importBaseURI, "importBaseURI");
        // The resourceURI can be null e.g. when the mapping model was inlined in the Smooks config.

        EdifactModel edifactModel;

        edifactModel = new EdifactModel(resourceURI, importBaseURI, mappingConfigStream);
        edifactModel.setDescription(mappingDescription);

    return edifactModel;
    }
View Full Code Here

            this.containerManagedNamespaceStack = true;
        }
        controlSegmentParser.setNamespaceDeclarationStack(this.namespaceDeclarationStack);

        Edimap controlMap = new Edimap();
        EdifactModel controlModel = new EdifactModel(controlMap);

        controlMap.setDescription(new Description().setName("EDI Message Interchange Control Model").setVersion("N/A"));
        controlSegmentParser.setMappingModel(controlModel);
    }
View Full Code Here

 
  private String packageName = "/" + EdifactModelTest.class.getPackage().getName().replace('.', '/');

    public void testImport_truncatableSegmentsExists() throws IOException, EDIConfigurationException, SAXException {
        InputStream input = new ByteArrayInputStream(StreamUtils.readStream(getClass().getResourceAsStream("edi-config-truncatableSegmentsExists.xml")));
        EdifactModel ediModel = new EdifactModel(input);

        assertTrue("The truncatable attribute should have value [true] in Segment.", ((Segment)ediModel.getEdimap().getSegments().getSegments().get(0).getSegments().get(0)).isTruncatable());
    }
View Full Code Here

        assertTrue("The truncatable attribute should have value [true] in Segment.", ((Segment)ediModel.getEdimap().getSegments().getSegments().get(0).getSegments().get(0)).isTruncatable());
    }

    public void testImport_truncatableSegmentsExists_relative() throws IOException, EDIConfigurationException, SAXException {
        InputStream input = new ByteArrayInputStream(StreamUtils.readStream(getClass().getResourceAsStream("edi-config-truncatableSegmentsExists-relativepath.xml")));
        EdifactModel ediModel = new EdifactModel(URI.create(packageName + "/" + "edi-config-truncatableSegmentsExists-relativepath.xml"), URI.create(packageName), input);

        assertTrue("The truncatable attribute should have value [true] in Segment.", ((Segment)ediModel.getEdimap().getSegments().getSegments().get(0).getSegments().get(0)).isTruncatable());
    }
View Full Code Here

TOP

Related Classes of org.milyn.edisax.model.EdifactModel$Node

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.