Package org.mule.module.xml.stax

Examples of org.mule.module.xml.stax.StaxSource


    public void testCloseStaxSourceOnComponentException()
        throws MuleException, InterruptedException, XMLStreamException,
        FactoryConfigurationError
    {

        StaxSource stream = new StaxSource(new TestXMLStreamReader(XMLInputFactory.newInstance()
            .createXMLStreamReader(inputStream)));

        client.dispatch("vm://inEcho?connector=vm", stream, null);

        Thread.sleep(timeoutMs);
        assertTrue(((TestXMLStreamReader) stream.getXMLStreamReader()).isClosed());
    }
View Full Code Here


        }
        else if (src instanceof String)
        {
            if (useStaxSource)
            {
                return new StaxSource(xmlInputFactory.createXMLStreamReader(new StringReader((String) src)));
            }
            else
            {
                return new StreamSource(new StringReader((String) src));
            }
        }
        else if (src instanceof org.dom4j.Document)
        {
            return new DocumentSource((org.dom4j.Document) src);
        }
        else if (src instanceof org.xml.sax.InputSource)
        {
            return new SAXSource((InputSource) src);
        }
        // TODO MULE-3555
        else if (src instanceof XMLStreamReader)
        {
            XMLStreamReader xsr = (XMLStreamReader) src;
           
            // StaxSource requires that we advance to a start element/document event
            if (!xsr.isStartElement() &&
                            xsr.getEventType() != XMLStreamConstants.START_DOCUMENT)
            {
                xsr.nextTag();
            }
           
            return new StaxSource((XMLStreamReader) src);
        }
        else if (src instanceof org.w3c.dom.Document || src instanceof org.w3c.dom.Element)
        {
            return new DOMSource((org.w3c.dom.Node) src);
        }
View Full Code Here

    {
        MuleClient client = new MuleClient(muleContext);
        InputStream xml = getClass().getResourceAsStream("/direct/direct-request.xml");
       
        XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(xml);
        test(client, new StaxSource(reader));
    }
View Full Code Here

            src.getEventType() != XMLStreamConstants.START_DOCUMENT)
        {
            src.nextTag();
        }

        return new StaxSource(src);
    }
View Full Code Here

        }
        else if (src instanceof String)
        {
            if (useStaxSource)
            {
                return new StaxSource(xmlInputFactory.createXMLStreamReader(new StringReader((String) src)));
            }
            else
            {
                return new StreamSource(new StringReader((String) src));
            }
View Full Code Here

    @Test
    public void testCloseStaxSourceOnComponentException() throws Exception
    {

        StaxSource stream = new StaxSource(new TestXMLStreamReader(XMLInputFactory.newInstance()
            .createXMLStreamReader(inputStream)));

        client.dispatch("vm://inEcho?connector=vm", stream, null);

        verifyInputStreamIsClosed(((TestXMLStreamReader) stream.getXMLStreamReader()));
    }
View Full Code Here

    {
        MuleClient client = muleContext.getClient();
        InputStream xml = getClass().getResourceAsStream("/direct/direct-request.xml");

        XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(xml);
        test(client, new StaxSource(reader));
    }
View Full Code Here

TOP

Related Classes of org.mule.module.xml.stax.StaxSource

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.