You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ted <na...@pritchard.uk.net> on 2015/06/26 16:23:14 UTC
CamelTestSupport and POJO consumer
Hi,
Hopefully an easy one to answer but I've been unable to find the answer
myself. I've created a test class that extends CamelTestSupport. I have a
POJO class with a method that is annotated with
@Consume(uri="direct:someEndpoint"). The problem is that when I use a
producer template in my unit test method to send to the above endpoint I get
the error message "No consumers available on endpoint:
Endpoint[direct://someEndpoint]".
I figured it might be something to do with the consumer POJO not being
registered so I overrode the method
protected JndiRegistry createRegistry()
created a new instance of the bean and added it to the registry. I also
created a jndi.properties as per http://camel.apache.org/camel-test.html
Other than that it's worth mentioning that I am developing my application
using CDI.
Thanks in advance for your help.
--
View this message in context: http://camel.465427.n5.nabble.com/CamelTestSupport-and-POJO-consumer-tp5768600.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CamelTestSupport and POJO consumer
Posted by nabbleuser12221 <br...@gmail.com>.
Ted,
I am not sure if this is the correct answer, but this is how I was able to
get my POJO consumers to work in my unit tests:
protected RouteBuilder createRouteBuilder() throws Exception {
BeanComponent enricher= new BeanComponent();
enricher.setCamelContext(this.context);
context.addEndpoint("direct-vm:someEndpoint",
enricher.createEndpoint(new PojoEnricher()));
from("direct:start").to("direct-vm:someEndPoint").to("mock:result");
}
--
View this message in context: http://camel.465427.n5.nabble.com/CamelTestSupport-and-POJO-consumer-tp5768600p5769753.html
Sent from the Camel - Users mailing list archive at Nabble.com.