use of org.apache.camel.util.StopWatch in project camel by apache.
the class JmsRequestReplyExclusiveReplyToTest method testJmsRequestReplyExclusiveFixedReplyTo.
@Test
public void testJmsRequestReplyExclusiveFixedReplyTo() throws Exception {
StopWatch watch = new StopWatch();
assertEquals("Hello A", template.requestBody("activemq:queue:foo?replyTo=bar&replyToType=Exclusive", "A"));
assertEquals("Hello B", template.requestBody("activemq:queue:foo?replyTo=bar&replyToType=Exclusive", "B"));
assertEquals("Hello C", template.requestBody("activemq:queue:foo?replyTo=bar&replyToType=Exclusive", "C"));
assertEquals("Hello D", template.requestBody("activemq:queue:foo?replyTo=bar&replyToType=Exclusive", "D"));
assertEquals("Hello E", template.requestBody("activemq:queue:foo?replyTo=bar&replyToType=Exclusive", "E"));
long delta = watch.stop();
assertTrue("Should be faster than about 4 seconds, was: " + delta, delta < 4200);
}
use of org.apache.camel.util.StopWatch in project camel by apache.
the class AsyncJmsInOutTest method testAsyncJmsInOut.
@Test
public void testAsyncJmsInOut() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(100);
mock.expectsNoDuplicates(body());
StopWatch watch = new StopWatch();
for (int i = 0; i < 100; i++) {
template.sendBody("seda:start", "" + i);
}
// just in case we run on slow boxes
assertMockEndpointsSatisfied(20, TimeUnit.SECONDS);
log.info("Took " + watch.stop() + " ms. to process 100 messages request/reply over JMS");
}
use of org.apache.camel.util.StopWatch in project camel by apache.
the class MailDefaultDelayForMailConsumeTest method testConsuming.
@Test
public void testConsuming() throws Exception {
// clear mailbox
Mailbox.clearAll();
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello London");
template.sendBody("smtp://bond@localhost", "Hello London");
// first poll should happen immediately
mock.setResultWaitTime(2000L);
mock.assertIsSatisfied();
mock.reset();
mock.expectedBodiesReceived("Hello Paris");
mock.setResultWaitTime(5000L + 2000L);
StopWatch watch = new StopWatch();
template.sendBody("smtp://bond@localhost", "Hello Paris");
// poll next mail and that is should be done within the default delay (overrule to 5 sec) + 2 sec slack
mock.assertIsSatisfied();
long delta = watch.stop();
assertTrue("Camel should not default poll the mailbox to often", delta > 5000 - 1000L);
}
use of org.apache.camel.util.StopWatch in project camel by apache.
the class ConnectionResourceIT method testConnectionResourceRouter.
@Test
public void testConnectionResourceRouter() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(100);
mock.expectsNoDuplicates(body());
StopWatch watch = new StopWatch();
for (int i = 0; i < 100; i++) {
template.sendBody("seda:start", "" + i);
}
// just in case we run on slow boxes
assertMockEndpointsSatisfied(20, TimeUnit.SECONDS);
log.info("Took " + watch.stop() + " ms. to process 100 messages request/reply over JMS");
}
use of org.apache.camel.util.StopWatch in project camel by apache.
the class SyncJmsInOutTempDestIT method testSynchronous.
@Test
public void testSynchronous() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(100);
mock.expectsNoDuplicates(body());
StopWatch watch = new StopWatch();
for (int i = 0; i < 100; i++) {
template.sendBody("seda:start", "" + i);
}
// just in case we run on slow boxes
assertMockEndpointsSatisfied(20, TimeUnit.SECONDS);
log.info("Took " + watch.stop() + " ms. to process 100 messages request/reply over JMS");
}
Aggregations