Reputation: 21
I'm trying to rest my route with a new Camel Rest component available from version 2.14 :
@Produce(uri = "rest:test.get/company/{name}")
protected ProducerTemplate testProducer;
And ProducerTemplate
which corresponds to this kind of rest endpoint is basically not yet implemented in that version.
What would be the best way to test that kind of endpoints?
Upvotes: 2
Views: 5369
Reputation: 141
use camel-restlet or HttpClient
**application.properties**
@Produce(uri = "{{url.router}}")
protected ProducerTemplate testProducer;
or
@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();
}
Upvotes: 1
Reputation: 3291
Current Camel Rest component only work for the Consumer (Server) side. By suggestion is you can use camel-restlet or HttpClient to send the plain HTTP request for testing.
@Produce(uri = "restlet:http://localhost:808/test.get/company/{name}")
protected ProducerTemplate testProducer;
testProducer.requestBodyAndHeader(null, "name", 123, String.class);
Upvotes: 3