Examples of DefaultMessage


Examples of org.apache.camel.impl.DefaultMessage

   
    private Message message;
   
    @Override
    protected void setUp() throws Exception {
        message = new DefaultMessage();
    }
View Full Code Here

Examples of org.apache.camel.impl.DefaultMessage

        File file = endpoint.getFile();
        String path = file.getPath();
        assertEquals("For uri: " + endpointUri + " the file is not equal", expectedPath, path);

        File consumedFile = new File(expectedPath + (expectedPath.endsWith(File.separator) ? "" : File.separator) + EXPECT_FILE);
        Message message = new DefaultMessage();
        endpoint.configureMessage(consumedFile, message);
        assertEquals(EXPECT_FILE, message.getHeader(FileComponent.HEADER_FILE_NAME));
    }
View Full Code Here

Examples of org.apache.camel.impl.DefaultMessage

        // copy the nmrExchange's properties
        answer.getProperties().putAll(nmrExchange.getProperties());
       
        org.apache.servicemix.nmr.api.Message inMessage = nmrExchange.getIn();
        if (inMessage != null) {
            Message message = new DefaultMessage();
            copyNmrMessageToCamelMessage(inMessage, message);
            answer.setIn(message);
        }
       
        answer.setProperty(NMR_EXCHANGE, nmrExchange);
View Full Code Here

Examples of org.apache.camel.impl.DefaultMessage

        Object newBody = expression.evaluate(exchange, Object.class);

        Message old = exchange.getIn();

        // create a new message container so we do not drag specialized message objects along
        Message msg = new DefaultMessage();
        msg.copyFrom(old);
        msg.setBody(newBody);
        exchange.setIn(msg);
    }
View Full Code Here

Examples of org.apache.camel.impl.DefaultMessage

        }
        // use mandatory conversion
        Object value = in.getMandatoryBody(type);

        // create a new message container so we do not drag specialized message objects along
        Message msg = new DefaultMessage();
        msg.copyFrom(in);
        msg.setBody(value);

        if (exchange.getPattern().isOutCapable()) {
            exchange.setOut(msg);
        } else {
            exchange.setIn(msg);
View Full Code Here

Examples of org.apache.camel.impl.DefaultMessage

            if (lines.size() >= endpoint.getGroupLines()) {
                // spit out lines
                Exchange exchange = endpoint.createExchange();

                // create message with the lines
                Message msg = new DefaultMessage();
                List<Object> copy = new ArrayList<Object>(lines);
                msg.setBody(copy);
                exchange.setIn(msg);

                // clear lines
                lines.clear();

                getProcessor().process(exchange);
            }
        } else {
            // single line
            Exchange exchange = endpoint.createExchange();

            Message msg = new DefaultMessage();
            msg.setBody(line);
            exchange.setIn(msg);

            getProcessor().process(exchange);
        }
    }
View Full Code Here

Examples of org.apache.camel.impl.DefaultMessage

        return false;
    }
   
    @Test
    public void testHttpConverter() throws Exception {
        Message message = new DefaultMessage();
        message.setHeader(Exchange.HTTP_SERVLET_RESPONSE, servletResponse);
        HttpServletResponse result = context.getTypeConverter().convertTo(HttpServletResponse.class, message);
        Assert.assertNotNull("The http conveter doesn't work", result);
       
    }
View Full Code Here

Examples of org.apache.camel.impl.DefaultMessage

        assertEquals(Boolean.FALSE, ObjectHelper.toBoolean(Integer.valueOf("0")));
        assertEquals(null, ObjectHelper.toBoolean(new Date()));
    }

    public void testIteratorWithMessage() {
        Message msg = new DefaultMessage();
        msg.setBody("a,b,c");

        Iterator<String> it = CastUtils.cast(ObjectHelper.createIterator(msg));
        assertEquals("a", it.next());
        assertEquals("b", it.next());
        assertEquals("c", it.next());
View Full Code Here

Examples of org.apache.camel.impl.DefaultMessage

        assertEquals("c", it.next());
        assertFalse(it.hasNext());
    }

    public void testIteratorWithEmptyMessage() {
        Message msg = new DefaultMessage();
        msg.setBody("");

        Iterator<Object> it = ObjectHelper.createIterator(msg);
        assertFalse(it.hasNext());
    }
View Full Code Here

Examples of org.apache.camel.impl.DefaultMessage

        Iterator<Object> it = ObjectHelper.createIterator(msg);
        assertFalse(it.hasNext());
    }

    public void testIteratorWithNullMessage() {
        Message msg = new DefaultMessage();
        msg.setBody(null);

        Iterator<Object> it = ObjectHelper.createIterator(msg);
        assertFalse(it.hasNext());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.