Package org.apache.camel.example

Examples of org.apache.camel.example.Foo


public class CamelJaxbFallbackConverterTest extends CamelTestSupport {

    @Test
    public void testFallbackConverterWithoutObjectFactory() throws Exception {
        TypeConverter converter = context.getTypeConverter();
        Foo foo = converter.convertTo(Foo.class, "<foo><zot name=\"bar1\" value=\"value\" otherValue=\"otherValue\"/></foo>");
        assertNotNull("foo should not be null", foo);
        assertEquals("value", foo.getBarRefs().get(0).getValue());

        foo.getBarRefs().clear();
        Bar bar = new Bar();
        bar.setName("myName");
        bar.setValue("myValue");
        foo.getBarRefs().add(bar);

        Exchange exchange = new DefaultExchange(context);
        exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");

        String value = converter.convertTo(String.class, exchange, foo);
View Full Code Here


    @Test
    public void testFallbackConverterUnmarshalWithNonJAXBComplaintValue() throws Exception {
        TypeConverter converter = context.getTypeConverter();

        Foo foo = converter.convertTo(Foo.class, "Not every String is XML");
        assertNull("Should not be able to convert non XML String", foo);

        Bar bar = converter.convertTo(Bar.class, "<bar></bar");
        assertNull("Should not be able to convert misspelled XML String", bar);
    }
View Full Code Here

public class FallbackTypeConverterShouldNotThrowExceptionTest extends CamelTestSupport {

    @Test
    public void testJaxbModel() throws Exception {
        Object foo = new Foo();
        getMockEndpoint("mock:a").expectedBodiesReceived(foo);
        getMockEndpoint("mock:b").expectedBodiesReceived(foo);

        template.sendBody("direct:a", foo);
View Full Code Here

                from("direct:a").process(new Processor() {

                    @Override
                    public void process(Exchange exchange) throws Exception {
                        // should return null and not throw any exception if the conversion fails
                        Foo foo = exchange.getIn().getBody(Foo.class);
                        if (!(exchange.getIn().getBody() instanceof Foo)) {
                            assertNull("Failed conversion didn't return null", foo);
                        }
                    }
View Full Code Here

public class CamelJaxbFallbackConverterTest extends CamelTestSupport {
   
    @Test
    public void testFallbackConverterWithoutObjectFactory() throws Exception {
        TypeConverter converter = context.getTypeConverter();
        Foo foo = converter.convertTo(Foo.class,
            "<foo><zot name=\"bar1\" value=\"value\" otherValue=\"otherValue\"/></foo>");
        assertNotNull("foo should not be null", foo);
        assertEquals("value", foo.getBarRefs().get(0).getValue());
       
        foo.getBarRefs().clear();
        Bar bar = new Bar();
        bar.setName("myName");
        bar.setValue("myValue");
        foo.getBarRefs().add(bar);
       
        Exchange exchange = new DefaultExchange(context);
        exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
      
        String value = converter.convertTo(String.class, exchange, foo);
View Full Code Here

public class CamelJaxbFallbackConverterTest extends CamelTestSupport {

    @Test
    public void testFallbackConverterWithoutObjectFactory() throws Exception {
        TypeConverter converter = context.getTypeConverter();
        Foo foo = converter.convertTo(Foo.class, "<foo><zot name=\"bar1\" value=\"value\" otherValue=\"otherValue\"/></foo>");
        assertNotNull("foo should not be null", foo);
        assertEquals("value", foo.getBarRefs().get(0).getValue());

        foo.getBarRefs().clear();
        Bar bar = new Bar();
        bar.setName("myName");
        bar.setValue("myValue");
        foo.getBarRefs().add(bar);

        Exchange exchange = new DefaultExchange(context);
        exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");

        String value = converter.convertTo(String.class, exchange, foo);
View Full Code Here

    private final AtomicInteger failed = new AtomicInteger();
    private final AtomicInteger failed2 = new AtomicInteger();

    @Test
    public void testJaxbModel() throws Exception {
        Object foo = new Foo();
        getMockEndpoint("mock:a").expectedBodiesReceived(foo);
        getMockEndpoint("mock:b").expectedBodiesReceived(foo);

        template.sendBody("direct:a", foo);
View Full Code Here

TOP

Related Classes of org.apache.camel.example.Foo

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.