Search in sources :

Example 91 with NotifyBuilder

use of org.apache.camel.builder.NotifyBuilder in project camel by apache.

the class RetryRouteScopedUntilRecipientListIssueTest method testRetryUntilRecipientListOkAndFail.

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());
}
Also used : NotifyBuilder(org.apache.camel.builder.NotifyBuilder)

Example 92 with NotifyBuilder

use of org.apache.camel.builder.NotifyBuilder in project camel by apache.

the class RetryRouteScopedUntilRecipientListIssueTest method testRetryUntilRecipientListFailOnly.

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());
}
Also used : NotifyBuilder(org.apache.camel.builder.NotifyBuilder)

Example 93 with NotifyBuilder

use of org.apache.camel.builder.NotifyBuilder in project camel by apache.

the class RetryRouteScopedUntilRecipientListIssueTest method testRetryUntilRecipientFailAndNotFail.

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());
}
Also used : NotifyBuilder(org.apache.camel.builder.NotifyBuilder)

Example 94 with NotifyBuilder

use of org.apache.camel.builder.NotifyBuilder in project camel by apache.

the class RetryRouteScopedUntilRecipientListIssueTest method testRetryUntilRecipientListFailAndOk.

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());
}
Also used : NotifyBuilder(org.apache.camel.builder.NotifyBuilder)

Example 95 with NotifyBuilder

use of org.apache.camel.builder.NotifyBuilder in project camel by apache.

the class NotifyBuilderExactlyDoneSplitterWhereSentToIssueTest method testReceiveTiAnalyticsArrayOfJsonEvents.

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));
}
Also used : NotifyBuilder(org.apache.camel.builder.NotifyBuilder)

Aggregations

NotifyBuilder (org.apache.camel.builder.NotifyBuilder)109 Test (org.junit.Test)72 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)30 File (java.io.File)24 Exchange (org.apache.camel.Exchange)10 RouteBuilder (org.apache.camel.builder.RouteBuilder)9 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 HashSet (java.util.HashSet)4 MBeanServer (javax.management.MBeanServer)4 ObjectName (javax.management.ObjectName)4 Processor (org.apache.camel.Processor)4 StopWatch (org.apache.camel.util.StopWatch)4 ConnectException (java.net.ConnectException)3 ExecutorService (java.util.concurrent.ExecutorService)3 Ignore (org.junit.Ignore)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Future (java.util.concurrent.Future)2 ZipFile (java.util.zip.ZipFile)2