【问题标题】:Apache Camel JUnit test warningsApache Camel JUnit 测试警告
【发布时间】:2012-03-14 03:57:53
【问题描述】:
我正试图弄清楚如何摆脱在我的 JUnit 测试中出现的警告。该测试扩展了 CamelTestSupport,但所有测试方法都抛出
WARN : Caught unhandled exception while processing ExchangedId:...
java.lang.IllegalArgumentException: connectionFactory must be specified
任何想法如何解决这个问题?
【问题讨论】:
标签:
java
junit
apache-camel
【解决方案1】:
如果您使用的是 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;
}