Package org.apache.camel.component.mock

Examples of org.apache.camel.component.mock.MockEndpoint.expectedBodiesReceived()


    protected int messageCount = 100;

    public void testSendingLotsOfMessagesGetAggregatedToTheLatestMessage() throws Exception {
        MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);

        resultEndpoint.expectedBodiesReceived("message:" + messageCount);

        // lets send a large batch of messages
        for (int i = 1; i <= messageCount; i++) {
            String body = "message:" + i;
            template.sendBodyAndHeader("direct:start", body, "cheese", 123);
View Full Code Here


        MockEndpoint result = getMockEndpoint("mock:result");

        // we only expect two messages as they have reached the completed predicate
        // that we want 3 messages that has the same header id
        result.expectedMessageCount(2);
        result.expectedBodiesReceived("Message 1c", "Message 3c");

        // then we sent all the message at once
        template.sendBodyAndHeader("direct:start", "Message 1a", "id", "1");
        template.sendBodyAndHeader("direct:start", "Message 2a", "id", "2");
        template.sendBodyAndHeader("direct:start", "Message 3a", "id", "3");
View Full Code Here

public class MinaConsumerTest extends ContextTestSupport {

    public void testSendTextlineText() throws Exception {
        // START SNIPPET: e2
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceived("Hello World");

        template.sendBody("mina:tcp://localhost:6200?textline=true", "Hello World");

        assertMockEndpointsSatisifed();
        // END SNIPPET: e2
View Full Code Here

    private String uri = "mina:tcp://localhost:11300?sync=true&codec=myCodec";

    public void testMyCodec() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);
        mock.expectedBodiesReceived("Bye World");

        template.sendBody(uri, "Hello World");

        mock.assertIsSatisfied();
    }
View Full Code Here

*/
public class SplitterTest extends ContextTestSupport {

    public void testSendingAMessageUsingMulticastReceivesItsOwnExchange() throws Exception {
        MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
        resultEndpoint.expectedBodiesReceived("James", "Guillaume", "Hiram", "Rob");

        template.send("direct:seqential", new Processor() {
            public void process(Exchange exchange) {
                Message in = exchange.getIn();
                in.setBody("James,Guillaume,Hiram,Rob");
View Full Code Here

        }
    }

    public void testSpliterWithAggregationStrategy() throws Exception {
        MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
        resultEndpoint.expectedBodiesReceived("James", "Guillaume", "Hiram", "Rob", "Roman");

        Exchange result = template.send("direct:seqential", new Processor() {
            public void process(Exchange exchange) {
                Message in = exchange.getIn();
                in.setBody("James,Guillaume,Hiram,Rob,Roman");
View Full Code Here

public class CamelTargetAdapterTest extends SpringTestSupport {
    private static final String MESSAGE_BODY = "hello world";

    public void testSendingOneWayMessage() throws Exception {
        MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
        resultEndpoint.expectedBodiesReceived(MESSAGE_BODY);
        MessageChannel outputChannel = (MessageChannel) applicationContext.getBean("channelA");
        outputChannel.send(new StringMessage(MESSAGE_BODY));
        resultEndpoint.assertIsSatisfied();
    }
View Full Code Here

*/
public class XQueryExampleTest extends SpringTestSupport {

    public void testExample() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceived("<employee id=\"James\"><name><firstName>James</firstName>"
                                    + "<lastName>Strachan</lastName></name><location><city>London</city></location></employee>");

        template.sendBody("direct:start", "<person user='James'><firstName>James</firstName>"
                          + "<lastName>Strachan</lastName><city>London</city></person>");

View Full Code Here

    private void invokeHttpClient(String uri) throws Exception {
        System.getProperties().put("HTTPClient.dontChunkRequests", "yes");

        MockEndpoint mockEndpoint = getMockEndpoint("mock:a");
        mockEndpoint.expectedBodiesReceived("<b>Hello World</b>");

        template.sendBodyAndHeader(uri, new ByteArrayInputStream("This is a test".getBytes()), "Content-Type", "application/xml");
       
        mockEndpoint.assertIsSatisfied();
        List<Exchange> list = mockEndpoint.getReceivedExchanges();
View Full Code Here

        Person bob3 = new Person( "bob" );
        Person mark1 = new Person( "mark" );
       
        MockEndpoint bobs = getMockEndpoint("mock:bobs");
        bobs.expectedMessageCount(3);
        bobs.expectedBodiesReceived( bob1, bob2, bob3 );
       
        MockEndpoint marks = getMockEndpoint("mock:marks");
        marks.expectedMessageCount(1);
        marks.expectedBodiesReceived( mark1 );
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.