use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class XPathSplitChoicePerformanceTest method testXPathPerformanceRoute.
@Test
@Ignore("Manual test")
public void testXPathPerformanceRoute() 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");
log.info("Processed " + large.get() + " large messages");
assertEquals((size / 10) * 4, tiny.get());
assertEquals((size / 10) * 2, small.get());
assertEquals((size / 10) * 3, med.get());
assertEquals((size / 10) * 1, large.get());
assertTrue("Should complete route", matches);
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class NettyConcurrentTest method doSendMessages.
private void doSendMessages(int files, int poolSize) throws Exception {
StopWatch watch = new StopWatch();
NotifyBuilder notify = new NotifyBuilder(context).whenDone(files).create();
ExecutorService executor = Executors.newFixedThreadPool(poolSize);
// we access the responses Map below only inside the main thread,
// so no need for a thread-safe Map implementation
Map<Integer, Future<String>> responses = new HashMap<Integer, Future<String>>();
for (int i = 0; i < files; i++) {
final int index = i;
Future<String> out = executor.submit(new Callable<String>() {
public String call() throws Exception {
String reply = template.requestBody("netty4:tcp://localhost:{{port}}", index, String.class);
log.debug("Sent {} received {}", index, reply);
assertEquals("Bye " + index, reply);
return reply;
}
});
responses.put(index, out);
}
notify.matches(2, TimeUnit.MINUTES);
log.info("Took " + watch.taken() + " millis to process " + files + " messages using " + poolSize + " client threads.");
assertEquals(files, responses.size());
// get all responses
Set<String> unique = new HashSet<String>();
for (Future<String> future : responses.values()) {
unique.add(future.get());
}
// should be 'files' unique responses
assertEquals("Should be " + files + " unique responses", files, unique.size());
executor.shutdownNow();
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class RouteConcurrentTest method testSingleInvocationsOfRoute.
@Test
public void testSingleInvocationsOfRoute() throws Exception {
NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();
template.sendBody("seda:foo", "Hello World");
assertTrue(notify.matches(30, TimeUnit.SECONDS));
verify();
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class RouteConcurrentTest method testConcurrentInvocationsOfRoute.
@Test
public void testConcurrentInvocationsOfRoute() throws Exception {
NotifyBuilder notify = new NotifyBuilder(context).whenDone(10).create();
for (int i = 0; i < 5; i++) {
template.sendBody("seda:foo", "Hello World");
}
assertTrue(notify.matches(30, TimeUnit.SECONDS));
verifyTraceSpanNumbers(5, testdata.length);
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class SpringOpenTracingSimpleRouteTest method testRoute.
@Test
public void testRoute() throws Exception {
NotifyBuilder notify = new NotifyBuilder(context).whenDone(5).create();
for (int i = 0; i < 5; i++) {
template.sendBody("seda:dude", "Hello World");
}
assertTrue(notify.matches(30, TimeUnit.SECONDS));
MockTracer tracer = (MockTracer) context().getRegistry().lookupByName("mockTracer");
// Four spans per invocation, one for client, two for dude route (server and client to), one for car route
assertEquals(20, tracer.finishedSpans().size());
}
Aggregations