春のブートを使用しています。私はラクダを追加しました。簡単なキャメルテストが失敗し、メッセージが受信されない
私はシンプルなラクダのルートを設定している:私はこのルートの簡単なテストを作成しようとすると
import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;
@Component
public class MyRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("file://in").to("file://out");
}
}
:
@RunWith(CamelSpringBootRunner.class)
@SpringBootTest
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
public class MyRouteTest extends CamelTestSupport {
@Autowired
private CamelContext camelContext;
@Produce(uri = "file://in")
private ProducerTemplate producerTemplate;
@EndpointInject(uri = "mock:file://out")
private MockEndpoint mockEndpoint;
@Test
public void routeTest() throws Exception {
mockEndpoint.expectedMessageCount(1);
producerTemplate.sendBody("Test");
mockEndpoint.assertIsSatisfied();
}
}
それは
mock://file://out Received message count. Expected: <1> but was: <0>
わからないと失敗しますここで何が問題になるかもしれない。私はポイントから私のルートとしてuriを持っていて、EndpointInjectと偽のuriとエンドポイントに嘲笑している生産者のテンプレートがありますか?
Configurを?! e [AdviceWith](http://camel.apache.org/advicewith.html) 詳細な例:http://opensourceconnections.com/blog/2014/04/24/correctly-using-camels-advicewith-in-unit - テスト/ – mgyongyosi
試した、同じエラー、奇妙な – George96