use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class SedaNoConsumerTest method testInOnly.
public void testInOnly() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("seda:foo?timeout=1000");
}
});
context.start();
NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
// no problem for in only as we do not expect a reply
template.sendBody("direct:start", "Hello World");
notify.matches(2, TimeUnit.SECONDS);
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class NotifyBuilderOnFailureShutdownCamelIssueTest method testIssue.
public void testIssue() throws Exception {
NotifyBuilder notify = new NotifyBuilder(context).whenDone(10).create();
assertTrue(notify.matchesMockWaitTime());
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class RetryRouteScopedUntilRecipientListIssueTest method testRetryUntilRecipientNotFailAndFail.
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());
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class SamplingThrottlerTest method testBurstySampling.
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());
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class SamplingThrottlerTest method testSamplingFromExchangeStream.
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());
}
Aggregations