This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 8dbb3d78b612baeb9c6b9e4826a064e454a808e3 Author: Philippe Schaller <[email protected]> AuthorDate: Fri Apr 17 16:22:01 2020 +0200 Client defined folders for file-watch tests --- .../camel/quarkus/component/file/it/FileResource.java | 13 ++++++------- .../apache/camel/quarkus/component/file/it/FileTest.java | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileResource.java b/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileResource.java index 10c91ed..ad8cd98 100644 --- a/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileResource.java +++ b/integration-tests/file/src/main/java/org/apache/camel/quarkus/component/file/it/FileResource.java @@ -43,20 +43,19 @@ public class FileResource { @Inject ConsumerTemplate consumerTemplate; - @Path("/get/{name}") + @Path("/get/{folder}/{name}") @GET @Produces(MediaType.TEXT_PLAIN) - public String getFile(@PathParam("name") String name) throws Exception { - final String fileContent = consumerTemplate.receiveBodyNoWait("file:target/in?fileName=" + name, String.class); - return fileContent; + public String getFile(@PathParam("folder") String folder, @PathParam("name") String name) throws Exception { + return consumerTemplate.receiveBodyNoWait("file:target/" + folder + "?fileName=" + name, String.class); } - @Path("/create") + @Path("/create/{folder}") @POST @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) - public Response createFile(String content) throws Exception { - Exchange response = producerTemplate.request("file:target/in", exchange -> exchange.getIn().setBody(content)); + public Response createFile(@PathParam("folder") String folder, String content) throws Exception { + Exchange response = producerTemplate.request("file:target/" + folder, exchange -> exchange.getIn().setBody(content)); return Response .created(new URI("https://camel.apache.org/")) .entity(response.getMessage().getHeader(Exchange.FILE_NAME_PRODUCED)) diff --git a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java index 3546687..6497cea 100644 --- a/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java +++ b/integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java @@ -44,7 +44,7 @@ class FileTest { String fileName = RestAssured.given() .contentType(ContentType.TEXT) .body(FILE_BODY) - .post("/file/create") + .post("/file/create/in") .then() .statusCode(201) .extract() @@ -53,7 +53,7 @@ class FileTest { // Read the file RestAssured - .get("/file/get/" + Paths.get(fileName).getFileName()) + .get("/file/get/in/" + Paths.get(fileName).getFileName()) .then() .statusCode(200) .body(equalTo(FILE_BODY));
