You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/06/06 10:27:21 UTC

[camel] 02/04: (chores) camel-chatscript removed usages of Thread.sleep

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

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

commit 191a11578cd2e24849b3f23d78bedfbc09cc9a05
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jun 3 14:15:08 2022 +0200

    (chores) camel-chatscript removed usages of Thread.sleep
---
 components/camel-chatscript/pom.xml                                 | 6 ++++++
 .../test/java/org/apache/camel/component/ChatScriptComponentIT.java | 6 ++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/components/camel-chatscript/pom.xml b/components/camel-chatscript/pom.xml
index 3bbd0ca456d..847c5bef84a 100644
--- a/components/camel-chatscript/pom.xml
+++ b/components/camel-chatscript/pom.xml
@@ -65,5 +65,11 @@
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/components/camel-chatscript/src/test/java/org/apache/camel/component/ChatScriptComponentIT.java b/components/camel-chatscript/src/test/java/org/apache/camel/component/ChatScriptComponentIT.java
index 11e151d0ba6..e52f077ce29 100644
--- a/components/camel-chatscript/src/test/java/org/apache/camel/component/ChatScriptComponentIT.java
+++ b/components/camel-chatscript/src/test/java/org/apache/camel/component/ChatScriptComponentIT.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component;
 
+import java.time.Duration;
+
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.camel.builder.RouteBuilder;
@@ -29,6 +31,7 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testcontainers.shaded.org.awaitility.Awaitility;
 
 public class ChatScriptComponentIT extends CamelTestSupport {
     @RegisterExtension
@@ -40,8 +43,7 @@ public class ChatScriptComponentIT extends CamelTestSupport {
     public void testChatScript() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(1);
-        Thread.sleep(100);
-        assertMockEndpointsSatisfied();
+        Awaitility.await().atMost(Duration.ofMillis(100)).untilAsserted(() -> assertMockEndpointsSatisfied());
     }
 
     @Override