Package org.milyn.edisax.model.internal

Examples of org.milyn.edisax.model.internal.Edimap


    public void test_MILYN_476() throws IOException, EDIConfigurationException, SAXException {
        ZipInputStream zipInputStream = new ZipInputStream(getClass().getResourceAsStream("d93a.zip"));
        UnEdifactSpecificationReader specReader = new UnEdifactSpecificationReader(zipInputStream, false, false);
        ByteArrayOutputStream serializedMap = new ByteArrayOutputStream();

        Edimap jupreq = specReader.getMappingModel("INVOIC");
        Writer writer = new OutputStreamWriter(serializedMap);

        jupreq.write(writer);

        EDIConfigDigester.digestConfig(new ByteArrayInputStream(serializedMap.toByteArray()));
    }
View Full Code Here


    public Edimap getDefinitionModel() throws IOException {
        return createEdimap();
    }

    private Edimap createEdimap() {
        Edimap edimap = new Edimap();

        Description description = new Description();
        description.setName("Custom Config Reader");
        description.setVersion("1.0");
        edimap.setDescription(description);

        Delimiters delimiters = new Delimiters();
        delimiters.setSegment("'");
        delimiters.setField("+");
        delimiters.setComponent(":");
        delimiters.setSubComponent("^");
        delimiters.setEscape("?");
        edimap.setDelimiters(delimiters);

        SegmentGroup root = new SegmentGroup();
        root.setXmltag("Root");
        edimap.setSegments(root);

        return edimap;
    }
View Full Code Here

  private static final ExtendedMetaData METADATA = ExtendedMetaData.INSTANCE;

  public void testConversion() throws Exception {
    InputStream is = ConvertBuildinSegmentsTest.class.getResourceAsStream("/org/milyn/edisax/unedifact/handlers/r41/v41-segments.xml");
    assertNotNull("Can't find a v41-segments.xml", is);
    Edimap edimap = EDIConfigDigester.digestConfig(is);
    EPackage pkg = ECoreGenerator.INSTANCE.generateSinglePackage(edimap);
    assertEquals("urn:org.milyn.edi.unedifact.v41", pkg.getNsURI());
    assertEquals("unedifact", pkg.getNsPrefix());
    assertEquals(21, pkg.getEClassifiers().size());
    List<String> codz = new ArrayList<String>();
View Full Code Here

    @Test
    public void test_getMessagesLongName() throws InstantiationException, IllegalAccessException, IOException {
        Set<String> messages = d08AReader_longnames.getMessageNames();
        for(String message : messages) {
            Edimap model = d08AReader_longnames.getMappingModel(message);
            StringWriter writer = new StringWriter();
            model.write(writer);
        }
    }
View Full Code Here

    @Test
    public void test_getMessagesShortName() throws InstantiationException, IllegalAccessException, IOException {
        Set<String> messages = d08AReader_shortnames.getMessageNames();
        for(String message : messages) {
            Edimap model = d08AReader_shortnames.getMappingModel(message);
            StringWriter writer = new StringWriter();
            model.write(writer);
        }
    }
View Full Code Here

    }

    @Test
    public void test_D08A_SegmentsLongName() throws InstantiationException, IllegalAccessException, IOException, EdiParseException, ParserConfigurationException, SAXException, JDOMException {

        Edimap edimap = d08AReader_longnames.getDefinitionModel();

        StringWriter stringWriter = new StringWriter();
        edimap.write(stringWriter);

        Document document = new SAXBuilder().build(new StringReader(stringWriter.toString()));

        testSegment("BGM", document, false);
        testSegment("DTM", document, false);
View Full Code Here

    }

    @Test
    public void test_D08A_Segments_ShortName() throws InstantiationException, IllegalAccessException, IOException, EdiParseException, ParserConfigurationException, SAXException, JDOMException {

        Edimap edimap = d08AReader_shortnames.getDefinitionModel();

        StringWriter stringWriter = new StringWriter();
        edimap.write(stringWriter);

        Document document = new SAXBuilder().build(new StringReader(stringWriter.toString()));

        testSegment("BGM", document, true);
        testSegment("DTM", document, true);
View Full Code Here

            fail(e.getMessage());
        }
    }

    private String getEdiMessageAsString(EdiSpecificationReader ediSpecificationReader, String messageType) throws IllegalAccessException, InstantiationException, IOException {
        Edimap edimap = ediSpecificationReader.getMappingModel(messageType);
        StringWriter sw = new StringWriter();
        edimap.write(sw);
        return sw.toString();
    }
View Full Code Here

        XMLUnit.setIgnoreAttributeOrder(true);
      XMLAssert.assertXMLEqual("Failed to compare XMLs for " + segmentCode, new StringReader(expected), new StringReader(out.outputString(node)));
    }

    private void test(String messageName, EdiSpecificationReader ediSpecificationReader) throws IOException {
      Edimap edimap = ediSpecificationReader.getMappingModel(messageName);

        StringWriter stringWriter = new StringWriter();
        edimap.write(stringWriter);
//    String expected = new String(StreamUtils.readStream(getClass().getResourceAsStream("d08a/message/expected-" + messageName.toLowerCase() + ".xml"))).trim();
//
//        String result = removeCRLF(stringWriter.toString());
//    expected = removeCRLF(expected);
//
//        if(!result.equals(expected)) {
//            System.out.println("Expected: \n[" + expected + "]");
//            System.out.println("Actual: \n[" + result + "]");
//            assertEquals("Message [" + messageName + "] failed.", expected, result);
//        }

        StringWriter result = new StringWriter();
        edimap.write(result);
    String expected = new String(StreamUtils.readStream(getClass().getResourceAsStream("d08a/message/expected-" + messageName.toLowerCase() + ".xml"))).trim();


//        System.out.println(result);
        XMLUnit.setIgnoreWhitespace( true );
View Full Code Here

        Map<String, Component> datas = UnEdifactDefinitionReader.readComponents(dataReader, useShortName);
        Map<String, Field> composites = UnEdifactDefinitionReader.readFields(compositeReader, datas, useShortName);
        List<Segment> segments = UnEdifactDefinitionReader.readSegments(segmentReader, composites, datas, useShortName);

        Edimap edimap = new Edimap();
        edimap.setSegments(new SegmentGroup());
        edimap.getSegments().getSegments().addAll(segments);
        return edimap;
    }
View Full Code Here

TOP

Related Classes of org.milyn.edisax.model.internal.Edimap

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.