Package org.apache.camel.component.mock

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


        };
    }

    public void testConsumeBatch() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World");

        // test header keys
        mock.message(0).property(Exchange.BATCH_SIZE).isEqualTo(2);
        mock.message(0).property(Exchange.BATCH_INDEX).isEqualTo(0);
        mock.message(1).property(Exchange.BATCH_INDEX).isEqualTo(1);
View Full Code Here


        service.shutdownNow();
    }

    public void testSplitParallelNoStopOnExceptionOk() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:split");
        mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World", "Hi World");

        template.sendBody("direct:start", "Hello World,Bye World,Hi World");

        assertMockEndpointsSatisfied();
    }
View Full Code Here

    public void testSplitParallelNoStopOnExceptionStop() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:split");
        mock.expectedMinimumMessageCount(0);
        // we do NOT stop so we receive all messages except the one that goes kaboom
        mock.allMessages().body().isNotEqualTo("Kaboom");
        mock.expectedBodiesReceivedInAnyOrder("Hello World", "Goodday World", "Bye World", "Hi World");

        try {
            template.sendBody("direct:start", "Hello World,Goodday World,Kaboom,Bye World,Hi World");
            fail("Should thrown an exception");
        } catch (CamelExecutionException e) {
View Full Code Here

    }

    public void testIncludePreAndPostfixes() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(2);
        mock.expectedBodiesReceivedInAnyOrder("Report 2", "Report 3");

        sendFiles();

        mock.assertIsSatisfied();
    }
View Full Code Here

*/
public class SplitterParallelStopOnExceptionWithOnExceptionTest extends ContextTestSupport {

    public void testSplitStopOnExceptionOk() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:split");
        mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World");
        getMockEndpoint("mock:handled").expectedMessageCount(0);

        template.sendBody("direct:start", "Hello World,Bye World");

        assertMockEndpointsSatisfied();
View Full Code Here

public class FileRouteDelayTest extends OSGiIntegrationTestSupport {

    @Test
    public void testFileRouteDelay() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World");
        // should be moved to .camel when done
        mock.expectedFileExists("target/data/.camel/hello.txt");
        mock.expectedFileExists("target/data/.camel/bye.txt");

        StopWatch watch = new StopWatch();
View Full Code Here

    }

    public void testAttachments() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(2);
        mock.expectedBodiesReceivedInAnyOrder("log4j.properties", "jndi-example.properties");

        template.send("direct:begin", new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                Message m = exchange.getIn();
View Full Code Here

    public void testWhenReceivedSatisfied() throws Exception {
        // lets use a mock to set the expressions as it got many great assertions for that
        // notice we use mock:assert which does NOT exist in the route, its just a pseudo name
        MockEndpoint mock = getMockEndpoint("mock:assert");
        mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World", "Hi World");

        NotifyBuilder notify = new NotifyBuilder(context)
                .from("direct:foo").whenDoneSatisfied(mock)
                .create();
View Full Code Here

        assertEquals(true, notify.matches());
    }

    public void testComplexOrCamel() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:assert");
        mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World", "Hi World");

        NotifyBuilder notify = new NotifyBuilder(context)
                .from("direct:foo").whenReceivedSatisfied(mock)
                .and().from("direct:bar").whenExactlyDone(5).whenAnyReceivedMatches(body().contains("Camel"))
                .create();
View Full Code Here

    }

    @Test
    public void testPollFileAndShouldBeMoved() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceivedInAnyOrder("Hello", "Bye", "Goodday");
        mock.expectedFileExists(FTP_ROOT_DIR + "/movefile/.done/hello.txt");
        mock.expectedFileExists(FTP_ROOT_DIR + "/movefile/.done/bye.txt");
        mock.expectedFileExists(FTP_ROOT_DIR + "/movefile/.done/goodday.txt");

        mock.assertIsSatisfied();
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.