繁体   English   中英

测试Camel REST组件端点生产者模板

[英]Testing Camel REST component endpoint producer template

我正在尝试使用版本2.14中提供的新的Camel Rest组件休息

@Produce(uri = "rest:test.get/company/{name}")
protected ProducerTemplate testProducer;    

与此类型的其余端点相对应的ProducerTemplate基本上尚未在该版本中实现。 测试这种端点的最佳方法是什么?

当前的Camel Rest组件仅适用于使用者(服务器)端。 根据建议,您可以使用camel-restletHttpClient发送纯HTTP请求进行测试。

@Produce(uri = "restlet:http://localhost:808/test.get/company/{name}")
protected ProducerTemplate testProducer;

testProducer.requestBodyAndHeader(null, "name", 123, String.class);

使用camel-restletHttpClient

**application.properties**

@Produce(uri = "{{url.router}}")
protected ProducerTemplate testProducer;

要么

@Produce(uri = "http://localhost:8080/test/router")
protected ProducerTemplate testProducer;
@Test
public void testHttpMock() throws InterruptedException {
    testProducer.requestBodyAndHeader(null, userApi, passwordApi);
    mockEndpoint.expectedMessageCount(1);
    assertMockEndpointsSatisfied();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM