Package org.apache.camel.builder

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


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

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

        boolean matches = notify.matches(60, TimeUnit.SECONDS);
        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


* @version
*/
public class NotifyBuilderExactlyDoneSplitterWhereSentToIssueTest extends ContextTestSupport {

    public void testReceiveTiAnalyticsArrayOfJsonEvents() {
        NotifyBuilder notifier = new NotifyBuilder(context)
                .wereSentTo("stub:direct:somewhere")
                .whenExactlyDone(7)
                .create();

        template.sendBody("direct:split", "A,B,C,D,E,F,G");

        assertTrue(notifier.matches(10, TimeUnit.SECONDS));
    }
View Full Code Here

        super.setUp();
    }

    public void testZipFileUnmarshalDelete() throws Exception {
        // there are 2 exchanges
        NotifyBuilder event = event().whenDone(2).create();

        getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
        template.sendBodyAndHeader("file:target/zip", "Hello World", Exchange.FILE_NAME, "hello.txt");
        assertMockEndpointsSatisfied();

        event.matchesMockWaitTime();

        File in = new File("target/zip/hello.txt").getAbsoluteFile();
        assertFalse("Should have been deleted " + in, in.exists());

        File out = new File("target/zip/out/hello.txt.zip").getAbsoluteFile();
View Full Code Here

        producer.stop();
    }

    @Test
    public void testLocalWorkDirectory() throws Exception {
        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
        assertTrue("Should process one file", notify.matchesMockWaitTime());

        // and the out file should exists
        File out = new File("target/out/hello.txt").getAbsoluteFile();
        assertTrue("file should exists", out.exists());
        assertEquals("Hello World", IOConverter.toString(out, null));
View Full Code Here

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

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

        getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");

        template.sendBodyAndHeader("file:target/gzip", "Hello World", Exchange.FILE_NAME, "hello.txt");

        assertMockEndpointsSatisfied();
        notify.matchesMockWaitTime();

        File in = new File("target/gzip/hello.txt").getAbsoluteFile();
        assertFalse("Should have been deleted " + in, in.exists());

        File out = new File("target/gzip/out/hello.txt.gz").getAbsoluteFile();
View Full Code Here

    }

    public void testRetryUntilRecipientListFailOnly() throws Exception {
        invoked.set(0);

        NotifyBuilder event = event().whenDone(1).create();

        getMockEndpoint("mock:result").expectedMessageCount(0);
        getMockEndpoint("mock:foo").expectedMessageCount(0);

        template.sendBodyAndHeader("seda:start", "Hello World", "recipientListHeader", "fail");

        assertMockEndpointsSatisfied();

        // wait until its done before we stop and check that retry was invoked
        boolean matches = event.matches(10, TimeUnit.SECONDS);
        assertTrue(matches);

        context.stop();

        assertEquals(3, invoked.get());
View Full Code Here

    }

    public void testRetryUntilRecipientListFailAndOk() throws Exception {
        invoked.set(0);

        NotifyBuilder event = event().whenDone(1).create();

        getMockEndpoint("mock:result").expectedMessageCount(0);
        getMockEndpoint("mock:foo").expectedMinimumMessageCount(0);

        template.sendBodyAndHeader("seda:start", "Hello World", "recipientListHeader", "fail,direct:foo");

        assertMockEndpointsSatisfied();

        // wait until its done before we stop and check that retry was invoked
        boolean matches = event.matches(10, TimeUnit.SECONDS);
        assertTrue(matches);

        context.stop();

        assertEquals(3, invoked.get());
View Full Code Here

    }

    public void testRetryUntilRecipientListOkAndFail() throws Exception {
        invoked.set(0);

        NotifyBuilder event = event().whenFailed(1).create();

        getMockEndpoint("mock:result").expectedMessageCount(0);
        getMockEndpoint("mock:foo").expectedMessageCount(1);

        template.sendBodyAndHeader("seda:start", "Hello World", "recipientListHeader", "direct:foo,fail");

        assertMockEndpointsSatisfied();

        // wait until its done before we stop and check that retry was invoked
        boolean matches = event.matches(10, TimeUnit.SECONDS);
        assertTrue(matches);

        context.stop();

        assertEquals(3, invoked.get());
View Full Code Here

    }

    public void testRetryUntilRecipientFailAndNotFail() throws Exception {
        invoked.set(0);

        NotifyBuilder event = event().whenDone(1).create();

        getMockEndpoint("mock:result").expectedMessageCount(0);
        getMockEndpoint("mock:foo").expectedMinimumMessageCount(0);

        template.sendBodyAndHeader("seda:start", "Hello World", "recipientListHeader", "fail,not-fail");

        assertMockEndpointsSatisfied();

        // wait until its done before we stop and check that retry was invoked
        boolean matches = event.matches(10, TimeUnit.SECONDS);
        assertTrue(matches);

        context.stop();

        assertEquals(3, invoked.get());
View Full Code Here

    }

    public void testRetryUntilRecipientNotFailAndFail() throws Exception {
        invoked.set(0);

        NotifyBuilder event = event().whenDone(1).create();

        getMockEndpoint("mock:result").expectedMessageCount(0);
        getMockEndpoint("mock:foo").expectedMinimumMessageCount(0);

        template.sendBodyAndHeader("seda:start", "Hello World", "recipientListHeader", "not-fail,fail");
        assertMockEndpointsSatisfied();

        // wait until its done before we stop and check that retry was invoked
        boolean matches = event.matches(10, TimeUnit.SECONDS);
        assertTrue(matches);

        context.stop();

        assertEquals(3, invoked.get());
View Full Code Here

TOP

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

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.