Package org.apache.camel.component.mock

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


        // first poll should happend immediately
        mock.setResultWaitTime(2000L);
        mock.assertIsSatisfied();

        long start = System.currentTimeMillis();
        mock.reset();
        template.sendBody("smtp://bond@localhost", "Hello Paris");
        mock.expectedBodiesReceived("Hello Paris");
        // poll next mail and that is should be done within the default delay + 2 sec slack
        mock.setResultWaitTime(MailConsumer.DEFAULT_CONSUMER_DELAY + 2000L);
        mock.assertIsSatisfied();
View Full Code Here


        mock.assertIsSatisfied();

        // now change content in the file in the classpath and try again
        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/velocity?append=false", "Bye $headers.name", FileComponent.HEADER_FILE_NAME, "hello.vm");

        mock.reset();
        mock.expectedBodiesReceived("Bye Paris");

        template.sendBodyAndHeader("direct:a", "Body", "name", "Paris");
        mock.assertIsSatisfied();
    }
View Full Code Here

        mock.assertIsSatisfied();

        // now change content in the file in the classpath and try again
        template.sendBodyAndHeader("file://target/test-classes/org/apache/camel/component/velocity?append=false", "Bye $headers.name", FileComponent.HEADER_FILE_NAME, "hello.vm");

        mock.reset();
        // we must expected the original filecontent as the cache is enabled, so its Hello and not Bye
        mock.expectedBodiesReceived("Hello Paris");

        template.sendBodyAndHeader("direct:b", "Body", "name", "Paris");
        mock.assertIsSatisfied();
View Full Code Here

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

        assertMockEndpointsSatisfied();

        // now start the first route, which should cause a failure due multiple consumers is not allowed
        mock.reset();
        mock.expectedMessageCount(0);

        context.startRoute("first");
        template.sendBody("seda:foo", "Bye World");
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

        // route is stopped so we do not get the file
        mock.assertIsNotSatisfied();

        // prepare mock for starting route
        mock.reset();
        mock.expectedBodiesReceived("Bye World");

        // start
        log.info(">>>>>>>>>>>>>>>>> invoking start <<<<<<<<<<<<<<<<<<");
        mbeanServer.invoke(on, "start", null, null);
View Full Code Here

    public void testRecipientListParallelALot() throws Exception {
        String before = context.getExecutorServiceManager().resolveThreadName("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

    }
   
    @Test
    public void testMessageHeadersAfterCxfBeanEndpoint() throws Exception {
        MockEndpoint endpoint = (MockEndpoint)camelContext.getEndpoint("mock:endpointA");
        endpoint.reset();
        invokeRsService("http://localhost:" + PORT1 + "/customerservice/customers/123",
            "{\"Customer\":{\"id\":123,\"name\":\"John\"}}");
        endpoint.expectedMessageCount(1);
        endpoint.expectedHeaderReceived("key", "customer");
        endpoint.assertIsSatisfied();
View Full Code Here

        result.expectedBodiesReceived("Hello my friends!");
       
        anotherSender.greeting("Hello my friends!");
        result.assertIsSatisfied();
       
        result.reset();
        // test sending inOnly message with other sender
        MyProxySender myProxySenderWithCamelContextId = ac.getBean("myProxySenderWithCamelContextId", MyProxySender.class);
       
        result.expectedBodiesReceived("Hello my friends again!");
        myProxySenderWithCamelContextId.greeting("Hello my friends again!");
View Full Code Here

        assertMockEndpointsSatisfied();

        // restart route
        context().stopRoute("myRoute");
        mock.reset();
        mock.expectedMessageCount(0);

        // wait a bit
        Thread.sleep(2000);
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.