Package org.milyn.smooks.edi.unedifact.model.r41

Examples of org.milyn.smooks.edi.unedifact.model.r41.UNB41


    public void testToUNEDIFACTString_interchange() throws Exception {
        DefaultCamelContext camelContext = new DefaultCamelContext();
        TypeConverter typeConverter = camelContext.getTypeConverter();

        UNEdifactInterchange41 unEdifactInterchange41 = new UNEdifactInterchange41();
        unEdifactInterchange41.setInterchangeHeader(new UNB41());

        String serialized = typeConverter.convertTo(String.class, unEdifactInterchange41);
        assertEquals("UNB+++++++++++'", serialized);

    }
View Full Code Here


        return buildInterchange("D", "03B", messageTypes, builder);
    }

    public static UNEdifactInterchange41 buildInterchange(String versionNum, String releaseNum, Class<?>[] messageTypes, MessageBuilder messageBuilder) {
        UNEdifactInterchange41 interchange41 = messageBuilder.buildMessage(UNEdifactInterchange41.class);
        UNB41 unb = interchange41.getInterchangeHeader();
        List<UNEdifactMessage41> messages = interchange41.getMessages();

        interchange41.setInterchangeDelimiters(messageBuilder.getDelimiters());
        unb.getSyntaxIdentifier().setId("UNOW"); // UNOW is UTF-8.... as encoded above
        unb.getSyntaxIdentifier().setCodedCharacterEncoding("UNOW"); // UNOW is UTF-8.... as encoded above
        messages.clear();

        for (Class<?> messageType : messageTypes) {
            UNEdifactMessage41 message41 = messageBuilder.buildMessage(UNEdifactMessage41.class);
            Object messageInstance = messageBuilder.buildMessage(messageType);
View Full Code Here

    ExecutionContext execCtx = smooks.createExecutionContext();
   
    //execCtx.setEventListener(new HtmlReportGenerator("target/report.html"));
    smooks.filterSource(execCtx, new StreamSource(getClass().getResourceAsStream("unedifact-msg-02.edi")), jResult, sResult);
   
    UNEdifactInterchange41 interchange = jResult.getBean(UNEdifactInterchange41.class);

//    System.out.println(new XStream().toXML(interchange));
   
    XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-03.xml")), new StringReader(new XStream().toXML(interchange)));   
View Full Code Here

        ExecutionContext execCtx = smooks.createExecutionContext();

        //execCtx.setEventListener(new HtmlReportGenerator("target/report.html"));
        smooks.filterSource(execCtx, new StreamSource(getClass().getResourceAsStream("unedifact-msg-03.edi")), jResult, sResult);

        UNEdifactInterchange41 interchange = jResult.getBean(UNEdifactInterchange41.class);

//        System.out.println(new XStream().toXML(interchange));

        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("unedifact-msg-expected-04.xml")), new StringReader(new XStream().toXML(interchange)));
View Full Code Here

    public void testToUNEDIFACTString_interchange() throws Exception {
        DefaultCamelContext camelContext = new DefaultCamelContext();
        TypeConverter typeConverter = camelContext.getTypeConverter();

        UNEdifactInterchange41 unEdifactInterchange41 = new UNEdifactInterchange41();
        unEdifactInterchange41.setInterchangeHeader(new UNB41());

        String serialized = typeConverter.convertTo(String.class, unEdifactInterchange41);
        assertEquals("UNB+++++++++++'", serialized);

    }
View Full Code Here

        String expected = StreamUtils.readStreamAsString(InterchangeTestUtil.class.getResourceAsStream(messageInFile));
        assertEquals(expected, writer.toString());
    }

    public static void test_Interchange(UNEdifactInterchangeFactory factory, boolean dump, Class<?>... messageTypes) throws IOException {
        UNEdifactInterchange41 interchange41 = buildInterchange(messageTypes);
        test_Interchange(factory, dump, interchange41);
    }
View Full Code Here

        UNEdifactInterchange41 interchange41 = buildInterchange(messageTypes);
        test_Interchange(factory, dump, interchange41);
    }

    public static void test_Interchange_Comma_Decimal(UNEdifactInterchangeFactory factory, boolean dump, Class<?>... messageTypes) throws IOException {
        UNEdifactInterchange41 interchange41 = buildInterchange(commaDecimalSepUNAMessageBuilder, messageTypes);
        test_Interchange(factory, dump, interchange41);
    }
View Full Code Here

    public static UNEdifactInterchange41 buildInterchange(MessageBuilder builder, Class<?>... messageTypes) {
        return buildInterchange("D", "03B", messageTypes, builder);
    }

    public static UNEdifactInterchange41 buildInterchange(String versionNum, String releaseNum, Class<?>[] messageTypes, MessageBuilder messageBuilder) {
        UNEdifactInterchange41 interchange41 = messageBuilder.buildMessage(UNEdifactInterchange41.class);
        UNB41 unb = interchange41.getInterchangeHeader();
        List<UNEdifactMessage41> messages = interchange41.getMessages();

        interchange41.setInterchangeDelimiters(messageBuilder.getDelimiters());
        unb.getSyntaxIdentifier().setId("UNOW"); // UNOW is UTF-8.... as encoded above
        unb.getSyntaxIdentifier().setCodedCharacterEncoding("UNOW"); // UNOW is UTF-8.... as encoded above
        messages.clear();

        for (Class<?> messageType : messageTypes) {
View Full Code Here

        unb.getSyntaxIdentifier().setId("UNOW"); // UNOW is UTF-8.... as encoded above
        unb.getSyntaxIdentifier().setCodedCharacterEncoding("UNOW"); // UNOW is UTF-8.... as encoded above
        messages.clear();

        for (Class<?> messageType : messageTypes) {
            UNEdifactMessage41 message41 = messageBuilder.buildMessage(UNEdifactMessage41.class);
            Object messageInstance = messageBuilder.buildMessage(messageType);

            MessageIdentifier messageIdentifier = message41.getMessageHeader().getMessageIdentifier();
            messageIdentifier.setControllingAgencyCode("UN");
            messageIdentifier.setId(messageType.getSimpleName().toUpperCase());
            messageIdentifier.setVersionNum(versionNum);
            messageIdentifier.setReleaseNum(releaseNum);
            message41.setMessage(messageInstance);
            messages.add(message41);
        }

        return interchange41;
    }
View Full Code Here

        for (Class<?> messageType : messageTypes) {
            UNEdifactMessage41 message41 = messageBuilder.buildMessage(UNEdifactMessage41.class);
            Object messageInstance = messageBuilder.buildMessage(messageType);

            MessageIdentifier messageIdentifier = message41.getMessageHeader().getMessageIdentifier();
            messageIdentifier.setControllingAgencyCode("UN");
            messageIdentifier.setId(messageType.getSimpleName().toUpperCase());
            messageIdentifier.setVersionNum(versionNum);
            messageIdentifier.setReleaseNum(releaseNum);
            message41.setMessage(messageInstance);
            messages.add(message41);
        }

        return interchange41;
View Full Code Here

TOP

Related Classes of org.milyn.smooks.edi.unedifact.model.r41.UNB41

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.