Package org.apache.camel.component.mock

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


*/
public class DelayerTest extends ContextTestSupport {

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

        template.sendBodyAndHeader("seda:a", "<hello>world!</hello>", "JMSTimestamp", System
            .currentTimeMillis());
        resultEndpoint.assertIsSatisfied();

View Full Code Here


        template.sendBodyAndHeader("seda:a", "<hello>world!</hello>", "JMSTimestamp", System
            .currentTimeMillis());
        resultEndpoint.assertIsSatisfied();

        // now if we wait a bit longer we should receive the message!
        resultEndpoint.expectedMessageCount(1);
        resultEndpoint.assertIsSatisfied();
    }

    @Override
    protected void setUp() throws Exception {
View Full Code Here

*/
public class FilterTest extends ContextTestSupport {

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

        template.sendBodyAndHeader("direct:start", "<matched/>", "foo", "bar");

        resultEndpoint.assertIsSatisfied();
    }
View Full Code Here

        resultEndpoint.assertIsSatisfied();
    }

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

        template.sendBodyAndHeader("direct:start", "<notMatched/>", "foo", "notMatchedHeaderValue");

        resultEndpoint.assertIsSatisfied();
    }
View Full Code Here

        app2.start();

        CamelContext camel = app.getBean("camelContext", CamelContext.class);

        MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedMessageCount(1);
        mock.expectedBodiesReceived("clustering PINGS!");

        // wait a bit to make sure the route has already been properly started through the given route policy
        Thread.sleep(5000);
View Full Code Here

        // 2013-09-29 08:15:32,024 [eduler_Worker-1] INFO  SpringCamelContext            :2183 - Route: myRoute started and consuming from: Endpoint[direct://start]

        CamelContext camel2 = app2.getBean("camelContext2", CamelContext.class);

        MockEndpoint mock2 = camel2.getEndpoint("mock:result", MockEndpoint.class);
        mock2.expectedMessageCount(1);
        mock2.expectedBodiesReceived("clustering PONGS!");

        app2.getBean("template", ProducerTemplate.class).sendBody("direct:start", "clustering");

        mock2.assertIsSatisfied();
View Full Code Here

    private static final Logger LOG = LoggerFactory.getLogger(ToObservableTest.class);

    @Test
    public void testConsume() throws Exception {
        final MockEndpoint mockEndpoint = camelContext.getEndpoint("mock:results", MockEndpoint.class);
        mockEndpoint.expectedMessageCount(4);

        Observable<Message> observable = reactiveCamel.toObservable("timer://foo?fixedRate=true&period=100");
        observable.take(4).subscribe(new Action1<Message>() {
            @Override
            public void call(Message message) {
View Full Code Here

    private static final Logger LOG = LoggerFactory.getLogger(ToObservableAndMapTest.class);

    @Test
    public void testConsume() throws Exception {
        final MockEndpoint mockEndpoint = camelContext.getEndpoint("mock:results", MockEndpoint.class);
        mockEndpoint.expectedMessageCount(4);

        Observable<Message> observableMessage = reactiveCamel.toObservable(
                "timer://foo?fixedRate=true&period=100");

        // transform the stream
View Full Code Here

        // add breakpoint at bar
        mbeanServer.invoke(on, "addBreakpoint", new Object[]{"bar"}, new String[]{"java.lang.String"});

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(0);
        mock.setSleepForEmptyTest(1000);

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

        assertMockEndpointsSatisfied();
View Full Code Here

        assertTrue("Should contain our body", xml.contains("Hello World"));
        assertTrue("Should contain bar node", xml.contains("<toNode>bar</toNode>"));

        resetMocks();
        mock.expectedMessageCount(1);

        // resume breakpoint
        mbeanServer.invoke(on, "resumeBreakpoint", new Object[]{"bar"}, new String[]{"java.lang.String"});

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