JiriOndrusek commented on a change in pull request #2548:
URL: https://github.com/apache/camel-quarkus/pull/2548#discussion_r625545431



##########
File path: 
integration-tests/file/src/test/java/org/apache/camel/quarkus/component/file/it/FileTest.java
##########
@@ -99,36 +200,78 @@ public void fileReadLock_minLength() throws Exception {
         Thread.sleep(10_000L);
 
         // Read the file that should not be there
-        RestAssured
-                .get("/file/get/{folder}/{name}", FileRoutes.READ_LOCK_OUT, 
Paths.get(fileName).getFileName())
+        RestAssured.given()
+                .post("/file/get/{folder}/{name}", FileRoutes.READ_LOCK_OUT, 
Paths.get(fileName).getFileName())
                 .then()
                 .statusCode(204);
     }
 
     @Test
     public void quartzSchedulerFilePollingConsumer() throws 
InterruptedException {
-        String fileName = RestAssured.given()
-                .contentType(ContentType.TEXT)
-                .body(FILE_BODY)
-                .post("/file/create/quartz")
-                .then()
-                .statusCode(201)
-                .extract()
-                .body()
-                .asString();
+        String fileName = createFile(FILE_BODY, "/file/create/quartz");
 
         String targetFileName = Paths.get(fileName).toFile().getName();
         await().atMost(10, TimeUnit.SECONDS).until(() -> {
             return Files.exists(Paths.get("target/quartz/out", 
targetFileName));
         });
 
         RestAssured
-                .get("/file/get/{folder}/{name}", "quartz/out", targetFileName)
+                .given()
+                .post("/file/get/{folder}/{name}", "quartz/out", 
targetFileName)
                 .then()
                 .statusCode(200)
                 .body(equalTo(FILE_BODY));
     }
 
+    private static String createFile(String content, String path) {
+        return createFile(content.getBytes(), path, null, null);
+    }
+
+    private static String createFile(String content, String path, String 
charset, String prefix)
+            throws UnsupportedEncodingException {
+        return createFile(content.getBytes(), path, charset, prefix);
+    }
+
+    private static String createFile(byte[] content, String path, String 
charset, String fileName) {
+        return RestAssured.given()
+                .urlEncodingEnabled(true)
+                .queryParam("charset", charset)
+                .contentType(ContentType.TEXT)

Review comment:
       Didn't occur to me, but it make sense




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to