Apache Camel JUnit测试警告

时间:2012-02-23 17:42:05

标签: java junit apache-camel

我试图弄清楚如何摆脱我的JUnit测试中出现的警告。测试扩展了CamelTestSupport,但所有测试方法都抛出

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

java.lang.IllegalArgumentException: connectionFactory must be specified

任何想法如何解决这个问题?

1 个答案:

答案 0 :(得分:3)

如果您使用的是JMS / AMQ,那么您可能需要添加它来设置您的组件/ 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;
}