Package org.apache.camel.converter.jaxp

Examples of org.apache.camel.converter.jaxp.StringSource


    public void testLondonWithStringSourceAsBytes() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:london");
        mock.expectedMessageCount(1);
        mock.message(0).body(String.class).contains("James");

        Source source = new StringSource("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                + "<person user=\"james\">\n"
                + "  <firstName>James</firstName>\n"
                + "  <lastName>Strachan</lastName>\n"
                + "  <city>London</city>\n"
                + "</person>");
View Full Code Here


    public void testLondonWithStringSourceAsDefault() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:london");
        mock.expectedMessageCount(1);
        mock.message(0).body(String.class).contains("James");

        Source source = new StringSource("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                + "<person user=\"james\">\n"
                + "  <firstName>James</firstName>\n"
                + "  <lastName>Strachan</lastName>\n"
                + "  <city>London</city>\n"
                + "</person>");
View Full Code Here

    public Object evaluateAsStringSource(Exchange exchange) throws Exception {
        initialize(exchange);

        String text = evaluateAsString(exchange);
        return new StringSource(text);
    }
View Full Code Here

                from("seda:xslttest")
                        .setHeader("testheader", el("hello"))
                        .setBody(el("header:${in.headers.testheader}"))
                        .to("mock:Before")
                        .setBody(el("<cats><cat id=\"1\"/><cat id=\"2\"/></cats>"))
                        .process(XsltBuilder.xslt(new StringSource(xslt)))
                        .setBody(el("header:${in.headers.testheader}"))
                        .to("mock:After");
            }
        };
    }
View Full Code Here

    public void testReReadable() throws Exception {
        Exchange e = new ExchangeImpl(Pattern.InOnly);
        Message msg = e.getIn();
        msg.addAttachment("id", new BufferedInputStream(new ByteArrayInputStream(new byte[] { 1, 2, 3, 4 })));
        msg.setBody(new StringSource("<hello/>"));

        e.ensureReReadable();

        assertNotNull(msg.getBody());
        assertTrue(msg.getBody() instanceof DOMSource);
View Full Code Here

        e.setProperty("key", "value");
        e.setStatus(Status.Done);
        Message msg = e.getIn();
        msg.setHeader("header", "value");
        msg.addAttachment("id", new BufferedInputStream(new ByteArrayInputStream(new byte[] { 1, 2, 3, 4 })));
        msg.setBody(new StringSource("<hello/>"));

        String str = e.display(false);
        LOG.info(str);
        assertNotNull(msg.getBody());
        assertTrue(msg.getBody() instanceof StringSource);
View Full Code Here

   
    public void testNoConversionForOtherXmlSourceTypes() throws Exception {
        a.expectedMessageCount(3);

        send(converter.toDOMSource(MESSAGE));
        send(new StringSource(MESSAGE));
        send(new BytesSource(MESSAGE.getBytes()));

        assertMockEndpointsSatisfied();
        for (Exchange exchange : a.getExchanges()) {
            assertFalse(exchange.getIn().getHeader(BODY_TYPE, Class.class).toString() + " shouldn't have been converted to StreamCache",
View Full Code Here

   
    public void testNoConversionForOtherXmlSourceTypes() throws Exception {
        a.expectedMessageCount(3);

        send(converter.toDOMSource(MESSAGE));
        send(new StringSource(MESSAGE));
        send(new BytesSource(MESSAGE.getBytes()));

        assertMockEndpointsSatisfied();
        for (Exchange exchange : a.getExchanges()) {
            assertFalse(exchange.getIn().getHeader(BODY_TYPE, Class.class).toString() + " shouldn't have been converted to StreamCache",
View Full Code Here

    public void testSendStringSource() throws Exception {
        x.expectedMessageCount(1);
        y.expectedMessageCount(1);
    
        sendBody("direct:start", new StringSource("<message>xx</message>"));
        sendBody("direct:start", new StringSource("<message>yy</message>"));
       
        assertMockEndpointsSatisfied();
    }
View Full Code Here

    public void testLondonWithStringSourceAsObject() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:london");
        mock.expectedMessageCount(1);
        mock.message(0).body(String.class).contains("James");

        Source source = new StringSource("<person user=\"james\">\n"
                + "  <firstName>James</firstName>\n"
                + "  <lastName>Strachan</lastName>\n"
                + "  <city>London</city>\n"
                + "</person>");
        assertNotNull(source);
View Full Code Here

TOP

Related Classes of org.apache.camel.converter.jaxp.StringSource

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.