use of org.apache.camel.Processor in project camel by apache.
the class CxfEndpointUtilsTest method testCheckServiceClassConsumer.
@Test
public void testCheckServiceClassConsumer() throws Exception {
CxfEndpoint endpoint = createEndpoint(getNoServiceClassURI());
try {
endpoint.createConsumer(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
// noop
}
});
fail("Should have thrown exception");
} catch (IllegalArgumentException exception) {
assertNotNull("Should get a CamelException here", exception);
assertTrue(exception.getMessage().startsWith("serviceClass must be specified"));
}
}
use of org.apache.camel.Processor in project camel by apache.
the class DisruptorWaitForTaskCompleteTest method testInOnly.
@Test
public void testInOnly() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
// we send an in only but we use Always to wait for it to complete
// and since the route changes the payload we can get the response anyway
final Exchange out = template.send("direct:start", new Processor() {
@Override
public void process(final Exchange exchange) throws Exception {
exchange.getIn().setBody("Hello World");
exchange.setPattern(ExchangePattern.InOnly);
}
});
assertEquals("Bye World", out.getIn().getBody());
assertMockEndpointsSatisfied();
}
use of org.apache.camel.Processor in project camel by apache.
the class DisruptorWaitForTaskIfReplyExpectedTest method testInOnly.
@Test
public void testInOnly() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
final Exchange out = template.send("direct:start", new Processor() {
@Override
public void process(final Exchange exchange) throws Exception {
exchange.getIn().setBody("Hello World");
exchange.setPattern(ExchangePattern.InOnly);
}
});
// we do not expecy a reply and thus do no wait so we just get our own
// input back
assertEquals("Hello World", out.getIn().getBody());
assertEquals(null, out.getOut().getBody());
assertMockEndpointsSatisfied();
}
use of org.apache.camel.Processor in project camel by apache.
the class DisruptorWaitForTaskNeverOnCompletionTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
errorHandler(deadLetterChannel("mock:dead").maximumRedeliveries(3).redeliveryDelay(0));
from("direct:start").process(new Processor() {
@Override
public void process(final Exchange exchange) throws Exception {
exchange.addOnCompletion(new SynchronizationAdapter() {
@Override
public void onDone(final Exchange exchange) {
done = done + "A";
latch.countDown();
}
});
}
}).to("disruptor:foo?waitForTaskToComplete=Never").process(new Processor() {
@Override
public void process(final Exchange exchange) throws Exception {
done = done + "B";
}
}).to("mock:result");
from("disruptor:foo").errorHandler(noErrorHandler()).delay(1000).process(new Processor() {
@Override
public void process(final Exchange exchange) throws Exception {
done = done + "C";
}
}).throwException(new IllegalArgumentException("Forced"));
}
};
}
use of org.apache.camel.Processor in project camel by apache.
the class DisruptorWaitForTaskNeverTest method testInOnly.
@Test
public void testInOnly() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
final Exchange out = template.send("direct:start", new Processor() {
@Override
public void process(final Exchange exchange) throws Exception {
exchange.getIn().setBody("Hello World");
exchange.setPattern(ExchangePattern.InOnly);
}
});
// we do not wait for the response so we just get our own input back
assertEquals("Hello World", out.getIn().getBody());
assertEquals(null, out.getOut().getBody());
assertMockEndpointsSatisfied();
}
Aggregations