* sent to the first one will be correctly transferred and consumed by the
* other one.
*/
@Test
public void testJaxrsRelayRoute() throws Exception {
final Main main = new Main();
try {
main.setApplicationContextUri("org/apache/camel/component/cxf/jaxrs/CxfRsSpringRelay.xml");
main.start();
Thread t = new Thread(new Runnable() {
/**
* Sends a request to the first endpoint in the route
*/
public void run() {
try {
JAXRSClientFactory.create("http://localhost:" + port6 + "/CxfRsRelayTest/rest", UploadService.class)
.upload(CamelRouteBuilder.class.getResourceAsStream(SAMPLE_CONTENT_PATH),
SAMPLE_NAME);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
});
t.start();
LATCH.await(10, TimeUnit.SECONDS);
assertEquals(SAMPLE_NAME, name);
StringWriter writer = new StringWriter();
IOUtils.copyAndCloseInput(new InputStreamReader(CamelRouteBuilder.class
.getResourceAsStream(SAMPLE_CONTENT_PATH)), writer);
assertEquals(writer.toString(), content);
} finally {
main.stop();
}
}