简体   繁体   中英

Apache Camel JUnit test warnings

I am trying to figure out how to get rid of a warning that is showing up in my JUnit tests. The test extends CamelTestSupport, but all of the test methods throw

WARN : Caught unhandled exception while processing ExchangedId:...

java.lang.IllegalArgumentException: connectionFactory must be specified

Any ideas how to solve this?

if you are using JMS/AMQ, then you likely need to add this to setup your component/connectionFactory...

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    String url = "vm://test-broker?broker.persistent=false&broker.useJmx=false";
    ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(url);
    camelContext.addComponent("activemq", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
    return camelContext;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM