Package org.apache.camel.component.mock

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


        String[] files = new File("target/suspended/").getAbsoluteFile().list();
        assertNotNull(files);
        assertEquals("The file should exists", 1, files.length);

        // reset mock
        mock.reset();
        mock.expectedMessageCount(1);

        // now resume it
        mbeanServer.invoke(on, "resume", null, null);
View Full Code Here


        template.sendBodyAndHeader("seda:a", "<hello>world!</hello>", "MyDelay", 1000);
        // we should not receive it as we wait at most 0.5 sec and it take 1 sec to send
        resultEndpoint.assertIsSatisfied();

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

    public void testDelayConstant() throws Exception {
View Full Code Here

        Thread.sleep(2000);
        template.sendBody("direct:start", "B");

        result.assertIsSatisfied();

        result.reset();
        result.expectedBodiesReceived("B");

        // trigger seda:bar to complete now, which should signal
        // to the throttler to resume the seda:foo consumer, so B can get done
        latch.countDown();
View Full Code Here

    public void testRecipientListParallelALot() throws Exception {
        String before = context.getExecutorServiceStrategy().getThreadName("foo");

        for (int i = 0; i < 10; i++) {
            MockEndpoint mock = getMockEndpoint("mock:result");
            mock.reset();
            mock.expectedBodiesReceivedInAnyOrder("c", "b", "a");

            template.sendBodyAndHeader("direct:start", "Hello World", "foo", "direct:a,direct:b,direct:c");

            assertMockEndpointsSatisfied();
View Full Code Here

        assertMockEndpointsSatisfied();

        Thread.sleep(1000);

        // reset mock and set new expectations
        mock.reset();
        mock.expectedMessageCount(0);

        // move file back
        File file = new File("target/idempotent/done/report.txt");
        File renamed = new File("target/idempotent/report.txt");
View Full Code Here

        assertMockEndpointsSatisfied();
        oneExchangeDone.matchesMockWaitTime();

        // reset and drop the same file again
        mock.reset();
        oneExchangeDone.reset();
        mock.expectedBodiesReceived("Hello Again World");

        template.sendBodyAndHeader("file://target/premove", "Hello Again World", Exchange.FILE_NAME, "hello.txt");
View Full Code Here

        mbeanServer.setAttribute(camel, new Attribute("Tracing", Boolean.FALSE));

        // without tracing
        traced.reset();
        traced.setExpectedMessageCount(0);
        result.reset();
        result.setExpectedMessageCount(1);

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

        assertMockEndpointsSatisfied();
View Full Code Here

        assertEquals("Should be 0 consumer", 0, set.size());

        set = mbeanServer.queryNames(new ObjectName("*:type=processors,*"), null);
        assertEquals("Should be 0 processor", 0, set.size());

        mock.reset();
        mock.expectedBodiesReceived("Bye World");
        // wait 3 seconds while route is stopped to verify that file was not consumed
        mock.setResultWaitTime(3000);

        template.sendBodyAndHeader("file://target/managed", "Bye World", Exchange.FILE_NAME, "bye.txt");
View Full Code Here

        resultEndpoint.expectedBodiesReceived(expected);
        resultEndpoint.expectedHeaderReceived("foo", "bar");
        template.sendBodyAndHeader("direct:getJAXBElementValue", xml, "foo", "bar");

        resultEndpoint.assertIsSatisfied();
        resultEndpoint.reset();
        resultEndpoint.expectedMessageCount(1);       
        template.sendBody("direct:getJAXBElement", xml);       
        resultEndpoint.assertIsSatisfied();
        assertTrue("We should get the JAXBElement here", resultEndpoint.getExchanges().get(0).getIn().getBody() instanceof JAXBElement);
    }
View Full Code Here

        mbeanServer.invoke(on, "stop", null, null);

        state = (String) mbeanServer.getAttribute(on, "State");
        assertEquals("Should be stopped", ServiceStatus.Stopped.name(), state);

        mock.reset();
        mock.expectedBodiesReceived("Bye World");
        // wait 3 seconds while route is stopped to verify that file was not consumed
        mock.setResultWaitTime(3000);

        template.sendBodyAndHeader("file://target/managed", "Bye World", Exchange.FILE_NAME, "bye.txt");
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.