我想测试使用Blueprint-XML实现的骆驼路线。当尝试使用简单的“直接”-从端点测试路由时,一切正常。
但是将“ from”端点更改为netty或码头组件,测试失败,但有以下例外:
java.lang.RuntimeException:放弃等待捆绑'MyRouteTest'中的BlueprintContainer]
我的路线看起来像这样:
<route id="test">
<from uri="jetty:http://test:8080/sample/test?matchOnUriPrefix=true" />
<log id="_log1" loggingLevel="INFO" message="Test " />
</route>
我扩展CamelBlueprintTestSupport的测试类如下:
// imports...
public class MyRouteTest extends CamelBlueprintTestSupport {
@Override
protected String getBlueprintDescriptor() {
return "/OSGI-INF/blueprint/blueprint2.xml";
}
@Test
public void testRoute() throws Exception {
context.getRouteDefinition("test").adviceWith(context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
replaceFromWith("direct:myMock");
}
});
assert (true);
}
}
更改到]的路线>
<route id="test"> <from uri="direct:halloTest" /> <log id="_log1" loggingLevel="INFO" message="Test " /> </route>
通过将码头的零件替换为直接零件可以很好地工作(例如,测试运行没有错误,并且由于assert(true)检查,结果肯定是肯定的]
有人可以帮我吗?
mvn test的输出是
ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 31.843 s <<< FAILURE! - myPackage.MyRouteTest
[ERROR] testRoute(myPackage.MyRouteTest) Time elapsed: 31.544 s <<< ERROR!
java.lang.RuntimeException: Gave up waiting for BlueprintContainer from bundle "MyRouteTest"
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] MyRouteTest>CamelBlueprintTestSupport.setUp:241->CamelBlueprintTestSupport.createBundleContext:175 ▒ Runtime
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
我想测试使用Blueprint-XML实现的骆驼路线。当尝试使用简单的“直接”-从端点测试路由时,一切正常。但是将“从”端点更改为净值...
灵魂是将以下代码添加到测试类: