【问题标题】:Using alternate endpoints when testing Apache Camel + SpringBoot测试 Apache Camel + SpringBoot 时使用备用端点
【发布时间】:2018-07-18 21:09:38
【问题描述】:

我有一个简单的 Apache Camel 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 端点,然后只指定不同的开始和结束位置?

【问题讨论】:

    标签: spring-boot apache-camel spring-camel


    【解决方案1】:

    您可以制作一些“子”路线,例如:

      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:splitSubRouteOne”来仅测试您想要的部分(大概),这将测试该部分,而不是第二部分。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-31
      • 1970-01-01
      • 2018-11-19
      • 2015-01-30
      • 1970-01-01
      相关资源
      最近更新 更多