Package org.apache.camel.converter.jaxp

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


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

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


        return getExpression().evaluate(createDynamicContext(exchange));
    }

    public Object evaluateAsStringSource(E exchange) throws Exception {
        String text = evaluateAsString(exchange);
        return new StringSource(text);
    }
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 Object evaluateAsStringSource(Exchange exchange) throws Exception {
        initialize();

        String text = evaluateAsString(exchange);
        return new StringSource(text);
    }
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 class StringSourceTest extends TestCase {
    protected TypeConverter converter = new DefaultTypeConverter(new ReflectionInjector());
    protected String expectedBody = "<hello>world!</hello>";

    public void testSerialization() throws Exception {
        StringSource expected = new StringSource(expectedBody, "mySystemID", "utf-8");
        expected.setPublicId("myPublicId");

        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        ObjectOutputStream output = new ObjectOutputStream(buffer);
        output.writeObject(expected);
        output.close();


        ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
        Object object = in.readObject();
        assertTrue("is a StringSource", object instanceof StringSource);
        StringSource actual = (StringSource) object;

        assertEquals("source.text", expected.getPublicId(), actual.getPublicId());
        assertEquals("source.text", expected.getSystemId(), actual.getSystemId());
        assertEquals("source.text", expected.getEncoding(), actual.getEncoding());
        assertEquals("source.text", expected.getText(), actual.getText());

        String value = converter.convertTo(String.class, actual);
        assertEquals("text value of StringSource", expectedBody, value);
    }
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 Object evaluateAsStringSource(Exchange exchange) throws Exception {
        initialize(exchange);

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

    public Object transform(Object body) {
        if (verbose) {
            System.out.println(">>>> " + value);
        }
        LOG.info(">>>> " + value);
        return new StringSource(value);
    }
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.