我有路由調用cxfbean:如何在Apache Camel中模擬cxfbean調用?
.to("cxfbean:reservationService")
嘗試這種模擬在我的測試與
@EndpointInject(uri = "mock:reservationService")
MockEndpoint reservationSystemMock;
@BeforeMethod
private void setUpContext() throws Exception
{
context.getRouteDefinition("send.to.res.svc.endpoint").adviceWith(
context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception
{
interceptSendToEndpoint("cxfbean:reservationService")
.skipSendToOriginalEndpoint()
.to("mock:reservationService");
}
});
}
還試圖模擬與weaveByToString("**reservationService").replace().to("mock:reservationService");
。在這兩種情況下,我得到:
Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: reservationService
我想測試我的路線沒有cxf bean實例化。我使用CamelTestSupport類作爲父項。
PS:你也可以使用'@ MockEndpointsAndSkip' –
有價值的信息,謝謝 – divideByZero