Package org.switchyard.internal

Examples of org.switchyard.internal.DefaultMessage


    @Test
    public void test_local_xslt_file_fail() throws IOException {
        try {
            Transformer transformer = getTransformer("xslt-config-03.xml");
            DefaultMessage message = newMessage(INITIAL_FAIL);
            Object result = transformer.transform(message);
            Assert.fail("xml to transform should be invalid");
        } catch (SwitchYardException e) {
          boolean exceptionMatch = e.getMessage().contains("SWITCHYARD016800");
          Assert.assertTrue(exceptionMatch);
View Full Code Here


    }

    @Test
    public void test_failonwarn_false_warn() throws IOException, SAXException {
        Transformer transformer = getTransformer("xslt-config-failonwarn-false-warn.xml");
        DefaultMessage message = newMessage(INITIAL);
        transformer.transform(message);
        String result = message.getContent(String.class);

        XMLUnit.setIgnoreWhitespace(true);
        Diff diff = new Diff(EXPECTED, result);
        Assert.assertTrue(diff.toString(), diff.identical());
    }
View Full Code Here

        XsltTransformer xslt = (XsltTransformer)getTransformer("xslt-config-07.xml");
        Assert.assertNull(xslt.getTransformerPool());
    }
   
    private DefaultMessage newMessage(Object content) {
        DefaultMessage message = new DefaultMessage().setContent(content);
        message.setTransformerRegistry(xformReg);
        return message;
    }
View Full Code Here

        new TransformerRegistryLoader(_transformerRegistry).loadOOTBTransforms();
        XMLUnit.setIgnoreWhitespace(true);
    }

    protected DefaultMessage newMessage() {
        DefaultMessage message = new DefaultMessage();
        message.setTransformerRegistry(_transformerRegistry);
        return message;
    }
View Full Code Here

public class BasicDOMTransformerTest extends AbstractTransformerTest {

    @Test
    public void test_Document2Document() throws IOException, SAXException {
        Document docIn = XMLUnit.buildTestDocument("<x><y/></x>");
        DefaultMessage message = newMessage();

        message.setContent(docIn);
        Document docOut = message.getContent(Document.class);

        Assert.assertTrue(docIn == docOut);
    }
View Full Code Here

    }

    @Test
    public void test_Document2Element() throws IOException, SAXException {
        Document docIn = XMLUnit.buildTestDocument("<x><y/></x>");
        DefaultMessage message = newMessage();

        message.setContent(docIn);
        Element elementOut = message.getContent(Element.class);

        Assert.assertTrue(docIn == elementOut.getParentNode());
    }
View Full Code Here

    }

    @Test
    public void test_Document2String() throws IOException, SAXException {
        Document docIn = XMLUnit.buildTestDocument("<x><y/></x>");
        DefaultMessage message = newMessage();

        message.setContent(docIn);
        String stringOut = message.getContent(String.class);

        XMLAssert.assertXMLEqual("<x><y/></x>", stringOut);
    }
View Full Code Here

    }

    @Test
    public void test_Element2String() throws IOException, SAXException {
        Document docIn = XMLUnit.buildTestDocument("<x><y/></x>");
        DefaultMessage message = newMessage();

        message.setContent(docIn);
        char[] charsOut = message.getContent(char[].class);

        XMLAssert.assertXMLEqual("<x><y/></x>", new String(charsOut));
    }
View Full Code Here

    }

    @Test
    public void test_DOMSource2String() throws IOException, SAXException {
        Document docIn = XMLUnit.buildTestDocument("<x><y/></x>");
        DefaultMessage message = newMessage();

        message.setContent(new DOMSource(docIn));
        String stringOut = message.getContent(String.class);

        XMLAssert.assertXMLEqual("<x><y/></x>", new String(stringOut));
    }
View Full Code Here

        testToDOM("<x><y/></x>", Node.class, Element.class);
    }

    @Test
    public void test_String2DOMSource() throws IOException, SAXException, TransformerException {
        DefaultMessage message = newMessage();

        message.setContent("<x><y/></x>");
        DOMSource doms = message.getContent(DOMSource.class);
        StringWriter writer = new StringWriter();
        StreamResult result = new StreamResult(writer);
        TransformerFactory.newInstance().newTransformer().transform(doms, result);
        XMLAssert.assertXMLEqual("<x><y/></x>", writer.toString());
    }
View Full Code Here

TOP

Related Classes of org.switchyard.internal.DefaultMessage

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.