0

次のようなルートがあります

from(direct:start)
.process(new Processor() {
                    @Override
                public void process(Exchange exchange) throws Exception {
                   exchange.setProperty("doc_url", "http://myhost:5984/test/record/doc.csv"); 
                }
}).setHeader(Exchange.HTTP_METHOD, constant("GET"))
.convertBodyTo(String.class)
.recipientList(header("doc_url")
.split().streaming.process(new MyProcessor());

テストのために毎回apacheのcouchdbを実行したくありません。この http エンドポイントがコードベースのリソース ファイルを参照するようにしたいと考えています。これはどうやって書くの?

4

1 に答える 1

2

Camel AdviceWith機能を使用して、テストのためにエンドポイントをインターセプト/置換できます...

 camelContext.getRouteDefinition("myRouteId")
  .adviceWith(camelContext, new AdviceWithRouteBuilder() {
    @Override
    public void configure() throws Exception
    {
        interceptSendToEndpoint("couchdb:http://localhost/database)
        .skipSendToOriginalEndpoint()
        .to("http://localhost:5984/test/record/doc.csv");
    }
});
于 2014-06-23T20:46:55.457 に答える