我试图弄清楚如何消除在JUnit测试中显示的警告。该测试扩展了CamelTestSupport,但是所有测试方法都抛出

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

java.lang.IllegalArgumentException: connectionFactory must be specified


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

最佳答案

如果您使用的是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;
}

关于java - Apache Camel JUnit测试警告,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9418248/

10-10 12:26