Package org.apache.camel.builder

Examples of org.apache.camel.builder.NotifyBuilder$EventPredicateHolder


*/
public class JmsHttpPostIssueTest extends CamelTestSupport {

    @Test
    public void testJmsInOnlyHttpPostIssue() throws Exception {
        NotifyBuilder notify = new NotifyBuilder(context).whenCompleted(1).from("jms*").create();

        template.sendBody("jms:queue:in", "Hello World");

        assertTrue("Should complete the JMS route", notify.matchesMockWaitTime());
    }
View Full Code Here


        deleteDirectory("./target/deletefile");
        super.setUp();
    }

    public void testPollFileAndShouldBeDeletedAtThirdPoll() throws Exception {
        NotifyBuilder notify = new NotifyBuilder(context).whenDone(3).create();

        template.sendBodyAndHeader("file://target/deletefile", body, Exchange.FILE_NAME, "hello.txt");
        context.startRoute("FromFilePollThirdTimeOkTest");

        getMockEndpoint("mock:result").expectedBodiesReceived(body);

        assertMockEndpointsSatisfied();
        assertTrue(notify.matchesMockWaitTime());
        assertEquals(3, counter);

        // assert the file is deleted
        File file = new File("./target/deletefile/hello.txt").getAbsoluteFile();
        assertFalse("The file should have been deleted", file.exists());
View Full Code Here

    private static volatile String sync;
    private static volatile String lastOne;

    public void testSedaUOW() throws Exception {
        NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);

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

        assertMockEndpointsSatisfied();
        notify.matchesMockWaitTime();

        assertEquals("onCompleteA", sync);
        assertEquals("onCompleteA", lastOne);
    }
View Full Code Here

* @version
*/
public class SamplingThrottlerTest extends ContextTestSupport {

    public void testSamplingFromExchangeStream() throws Exception {
        NotifyBuilder notify = new NotifyBuilder(context).whenDone(15).create();

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMinimumMessageCount(2);
        mock.setResultWaitTime(3000);

        List<Exchange> sentExchanges = new ArrayList<Exchange>();
        sendExchangesThroughDroppingThrottler(sentExchanges, 15);

        notify.matchesMockWaitTime();
        mock.assertIsSatisfied();

        validateDroppedExchanges(sentExchanges, mock.getReceivedCounter());
    }
View Full Code Here

        validateDroppedExchanges(sentExchanges, mock.getReceivedCounter());
    }

    public void testBurstySampling() throws Exception {
        NotifyBuilder notify = new NotifyBuilder(context).whenDone(5).create();

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMinimumMessageCount(2);
        mock.setResultWaitTime(3000);

        List<Exchange> sentExchanges = new ArrayList<Exchange>();

        // send a burst of 5 exchanges, expecting only one to get through
        sendExchangesThroughDroppingThrottler(sentExchanges, 5);
        // sleep through a complete period
        Thread.sleep(1100);
        // send another 5 now
        sendExchangesThroughDroppingThrottler(sentExchanges, 5);

        notify.matchesMockWaitTime();
        mock.assertIsSatisfied();

        validateDroppedExchanges(sentExchanges, mock.getReceivedCounter());
    }
View Full Code Here

public class BeanBeforeAggregateIssueTest extends ContextTestSupport {

    private MyAggRepo myRepo = new MyAggRepo();

    public void testBeanBeforeAggregation() throws Exception {
        NotifyBuilder notify = new NotifyBuilder(context).whenDone(3).create();

        getMockEndpoint("mock:result").expectedBodiesReceived("A+B");

        template.sendBody("seda:start", "A");
        template.sendBody("seda:start", "B");

        assertMockEndpointsSatisfied();

        // wait for all exchanges to be done (2 input + 1 aggregated)
        notify.matches(5, TimeUnit.SECONDS);

        // should have confirmed
        assertTrue("Should have confirmed", myRepo.isConfirm());
    }
View Full Code Here

        template.sendBodyAndHeader("file://target/filenoop", "Hello World", Exchange.FILE_NAME, "hello.txt");
        template.sendBodyAndHeader("file://target/filenoop", "Bye World", Exchange.FILE_NAME, "bye.txt");
    }

    public void testNoop() throws Exception {
        NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(2);
        assertMockEndpointsSatisfied();

        notify.matchesMockWaitTime();

        File file = new File("target/filenoop").getAbsoluteFile();
        assertEquals("There should be 2 files", 2, file.list().length);
    }
View Full Code Here

    public void testDummy() {
        // this is a manual test
    }

    public void xxxtestTokenPairPerformanceRoute() throws Exception {
        NotifyBuilder notify = new NotifyBuilder(context).whenDone(size).create();

        boolean matches = notify.matches(5, TimeUnit.MINUTES);
        log.info("Processed file with " + size + " elements in: " + TimeUtils.printDuration(watch.stop()));

        log.info("Processed " + tiny.get() + " tiny messages");
        log.info("Processed " + small.get() + " small messages");
        log.info("Processed " + med.get() + " medium messages");
View Full Code Here

*
*/
public class NotifyBuilderOnFailureShutdownCamelIssueTest extends ContextTestSupport {

    public void testIssue() throws Exception {
        NotifyBuilder notify = new NotifyBuilder(context).whenDone(10).create();
        assertTrue(notify.matchesMockWaitTime());
    }
View Full Code Here

        RoutesDefinition routes = resource.getRoutesResource().getRouteDefinitions();
        List<RouteDefinition> list = routes.getRoutes();
        Object exchangesCompleted = statistics.getRouteStatistic(camelContext, list.get(0).getId(), "ExchangesCompleted");
        assertEquals("JMX value incorrect, should be 0", new Long(0), exchangesCompleted);

        NotifyBuilder notify = new NotifyBuilder(camelContext).whenDone(1).create();

        ProducerTemplate template = camelContext.createProducerTemplate();
        template.sendBody("seda:foo", "test");

        notify.matchesMockWaitTime();

        exchangesCompleted = statistics.getRouteStatistic(camelContext, list.get(0).getId(), "ExchangesCompleted");
        assertEquals("JMX value incorrect, should be 1", new Long(1), exchangesCompleted);
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.builder.NotifyBuilder$EventPredicateHolder

Copyright © 2018 www.massapicom. 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.