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

        super.setUp();
        ServiceHelper.startService(converter);
    }

    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

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

        String text = evaluateAsString(exchange);
        return new StringSource(text);
    }
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

    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("<person user=\"james\">\n"
                + "  <firstName>James</firstName>\n"
                + "  <lastName>Strachan</lastName>\n"
                + "  <city>London</city>\n"
                + "</person>");
        assertNotNull(source);
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("<person user=\"james\">\n"
                + "  <firstName>James</firstName>\n"
                + "  <lastName>Strachan</lastName>\n"
                + "  <city>London</city>\n"
                + "</person>");
        assertNotNull(source);
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 evaluateAsStringSource(Exchange exchange) throws Exception {
        initialize(exchange);

        String text = evaluateAsString(exchange);
        return new StringSource(text);
    }
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.