我升級到駝峯2.16,我的一個路由單元測試開始失敗。阿帕奇駱駝2.16補充 - 沒有消費者可用在JUnit端點
這裏是我的路由定義:
public class Route extends RouteBuilder{
@Override
public void configure() throws Exception {
from(start).enrich("second");
from("direct:second")
.log(LoggingLevel.DEBUG, "foo", "Route [direct:second] started.");
}
}
這裏是我的測試:
@RunWith(MockitoJUnitRunner.class)
public class RouteTest extends CamelTestSupport {
private Route builder;
@Produce(uri = "direct:start")
protected ProducerTemplate template;
@Before
public void config() {
BasicConfigurator.configure();
}
@Override
protected RouteBuilder createRouteBuilder() {
builder = new Route();
return builder;
}
@Override
protected CamelContext createCamelContext() throws Exception {
SimpleRegistry registry = new SimpleRegistry();
return new DefaultCamelContext(registry);
}
@Test
public void testPrimeRouteForSubscriptionId() {
Exchange exchange = ExchangeBuilder.anExchange(new DefaultCamelContext()).build();
exchange.getIn().setBody(new String("test"));
template.send(exchange);
}
}
當我運行測試,我得到的錯誤是:
org.apache.camel.component.direct.DirectConsumerNotAvailableException: No consumers available on endpoint: Endpoint[direct://second]. Exchange[][Message: test]
沃西值得注意的是駱駝下面的一行2.16備註: http://camel.apache.org/camel-2160-release.html
resourceUri和resourceRef屬性已被刪除,因爲它們現在支持從表達式計算出的動態uris。
在此先感謝您的幫助。
嗨克勞斯,感謝您的建議。他們沒有解決這個問題,但我看到了相同的錯誤信息。 現在我已經選擇重寫我的路線,避免豐富,但知道如何使豐富的工作是很好的。 再次感謝。 –