Spring boot 在测试Apache Camel+;弹簧靴
我有一个简单的Apache CamelSpring boot 在测试Apache Camel+;弹簧靴,spring-boot,apache-camel,spring-camel,Spring Boot,Apache Camel,Spring Camel,我有一个简单的Apache CamelRouteBuilder类,大致如下所示: from("an FTP server") // log stuff .to("direct:split"); from("direct:split") // split CSV and aggregate the messages into separate files .to("direct:save"); from("direct:save"
RouteBuilder
类,大致如下所示:
from("an FTP server")
// log stuff
.to("direct:split");
from("direct:split")
// split CSV and aggregate the messages into separate files
.to("direct:save");
from("direct:save")
// save the files to a different FTP server
.end();
在我将要编写的测试中,我只想使用direct:split
端点进行测试——我将加载CSV并在本地保存新的CSV,然后编写测试以将输出与预期的输出进行比较。我会在测试中重写RouteBuilder
吗?或者我会以某种方式拉入direct:split
端点,然后只指定不同的起始和结束位置吗?您可以创建一些“子”路由,例如:
from("direct:split")
// make two subroutes
.to("direct:splitSubRouteOne")
.to("direct:splitSubRouteTwo");
from("direct:splitSubRouteOne")
// split CSV and aggregate the messages into separate files
// etc
;
from("direct:splitSubRouteTwo")
.to("direct:save");
然后,您可以通过发送到“direct:splitsubruteone”来测试您想要的部分(大概),该命令将测试该部分,但不会测试第二部分