You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/10/18 15:58:54 UTC

[camel] branch main updated: CAMEL-18608: Fix the tests of type PollEnrichConsumeWithDisconnectAndDeleteIT (part 2)

This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new c77b143ee51 CAMEL-18608: Fix the tests of type PollEnrichConsumeWithDisconnectAndDeleteIT (part 2)
c77b143ee51 is described below

commit c77b143ee518d2ffd5b86163cd42b63144d0418a
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Tue Oct 18 17:58:04 2022 +0200

    CAMEL-18608: Fix the tests of type PollEnrichConsumeWithDisconnectAndDeleteIT (part 2)
---
 .../FtpPollEnrichConsumeWithDisconnectAndDeleteIT.java      |  8 ++++++--
 .../SftpPollEnrichConsumeWithDisconnectAndDeleteIT.java     | 13 ++++++++-----
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollEnrichConsumeWithDisconnectAndDeleteIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollEnrichConsumeWithDisconnectAndDeleteIT.java
index b72472e2e1c..bf36fd9f470 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollEnrichConsumeWithDisconnectAndDeleteIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/FtpPollEnrichConsumeWithDisconnectAndDeleteIT.java
@@ -27,6 +27,7 @@ import org.junit.jupiter.api.Test;
 
 import static org.awaitility.Awaitility.await;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 class FtpPollEnrichConsumeWithDisconnectAndDeleteIT extends FtpServerTestSupport {
 
@@ -37,6 +38,10 @@ class FtpPollEnrichConsumeWithDisconnectAndDeleteIT extends FtpServerTestSupport
         // create file using regular file
         template.sendBodyAndHeader("file://{{ftp.root.dir}}/poll", expected, Exchange.FILE_NAME, "hello.txt");
 
+        File file = service.ftpFile("poll/hello.txt").toFile();
+        await().atMost(1, TimeUnit.MINUTES)
+                .untilAsserted(() -> assertTrue(file.exists(), "The file should have been created"));
+
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
         mock.expectedHeaderReceived(Exchange.FILE_NAME, "hello.txt");
@@ -45,10 +50,9 @@ class FtpPollEnrichConsumeWithDisconnectAndDeleteIT extends FtpServerTestSupport
         ProducerTemplate triggerTemplate = context.createProducerTemplate();
         triggerTemplate.sendBody("vm:trigger", "");
 
-        mock.setResultWaitTime(TimeUnit.MINUTES.toMillis(1));
+        mock.setResultWaitTime(TimeUnit.MINUTES.toMillis(3));
         mock.assertIsSatisfied();
 
-        File file = service.ftpFile("poll/hello.txt").toFile();
         await().atMost(3, TimeUnit.SECONDS)
                 .untilAsserted(() -> assertFalse(file.exists(), "The file should have been deleted"));
     }
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/SftpPollEnrichConsumeWithDisconnectAndDeleteIT.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/SftpPollEnrichConsumeWithDisconnectAndDeleteIT.java
index 3f3807461a5..117e104853e 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/SftpPollEnrichConsumeWithDisconnectAndDeleteIT.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/integration/SftpPollEnrichConsumeWithDisconnectAndDeleteIT.java
@@ -25,21 +25,25 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.file.remote.sftp.integration.SftpServerTestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.api.condition.EnabledIf;
 
 import static org.awaitility.Awaitility.await;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 @EnabledIf(value = "org.apache.camel.test.infra.ftp.services.embedded.SftpUtil#hasRequiredAlgorithms('src/test/resources/hostkey.pem')")
 class SftpPollEnrichConsumeWithDisconnectAndDeleteIT extends SftpServerTestSupport {
-    @Timeout(value = 60)
+
     @Test
     void testSftpSimpleConsume() throws Exception {
         String expected = "Hello World";
 
         // create file using regular file
-        template.sendBodyAndHeader("file://" + service.getFtpRootDir(), expected, Exchange.FILE_NAME, "hello.txt");
+        template.sendBodyAndHeader("file://{{ftp.root.dir}}", expected, Exchange.FILE_NAME, "hello.txt");
+
+        File file = ftpFile("hello.txt").toFile();
+        await().atMost(1, TimeUnit.MINUTES)
+                .untilAsserted(() -> assertTrue(file.exists(), "The file should have been created"));
 
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(1);
@@ -49,10 +53,9 @@ class SftpPollEnrichConsumeWithDisconnectAndDeleteIT extends SftpServerTestSuppo
         ProducerTemplate triggerTemplate = context.createProducerTemplate();
         triggerTemplate.sendBody("vm:trigger", "");
 
-        mock.setResultWaitTime(TimeUnit.MINUTES.toMillis(1));
+        mock.setResultWaitTime(TimeUnit.MINUTES.toMillis(3));
         mock.assertIsSatisfied();
 
-        File file = ftpFile("hello.txt").toFile();
         await().atMost(3, TimeUnit.SECONDS)
                 .untilAsserted(() -> assertFalse(file.exists(), "The file should have been deleted"));
     }