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:23 UTC

[camel] 04/04: (chores) camel-mongodb 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 c16b7c09842fee4085ad29cdf242feebad5c8a1b
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jun 3 14:40:15 2022 +0200

    (chores) camel-mongodb removed usages of Thread.sleep
---
 components/camel-mongodb/pom.xml                                  | 5 +++++
 .../mongodb/integration/MongoDbTailableCursorConsumerIT.java      | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/components/camel-mongodb/pom.xml b/components/camel-mongodb/pom.xml
index 7bfbb8a51e2..5fdae6a0069 100644
--- a/components/camel-mongodb/pom.xml
+++ b/components/camel-mongodb/pom.xml
@@ -97,5 +97,10 @@
             <artifactId>log4j-slf4j-impl</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbTailableCursorConsumerIT.java b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbTailableCursorConsumerIT.java
index b8789074be4..66158467457 100644
--- a/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbTailableCursorConsumerIT.java
+++ b/components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbTailableCursorConsumerIT.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.mongodb.integration;
 
 import java.util.Calendar;
+import java.util.concurrent.TimeUnit;
 
 import com.mongodb.client.MongoCollection;
 import com.mongodb.client.model.CreateCollectionOptions;
@@ -24,6 +25,7 @@ import org.apache.camel.ServiceStatus;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.component.mongodb.MongoDbTailTrackingConfig;
+import org.awaitility.Awaitility;
 import org.bson.Document;
 import org.junit.jupiter.api.Test;
 
@@ -62,8 +64,7 @@ public class MongoDbTailableCursorConsumerIT extends AbstractMongoDbITSupport {
 
         addTestRoutes();
         context.getRouteController().startRoute("tailableCursorConsumer1");
-        Thread.sleep(1000);
-        mock.assertIsSatisfied();
+        Awaitility.await().atMost(1, TimeUnit.SECONDS).untilAsserted(() -> mock.assertIsSatisfied());
         context.getRouteController().stopRoute("tailableCursorConsumer1");
 
     }
@@ -408,8 +409,7 @@ public class MongoDbTailableCursorConsumerIT extends AbstractMongoDbITSupport {
 
         addTestRoutes();
         context.getRouteController().startRoute(routeId);
-        Thread.sleep(1000);
-        mock.assertIsSatisfied();
+        Awaitility.await().atMost(1, TimeUnit.SECONDS).untilAsserted(() -> mock.assertIsSatisfied());
         context.getRouteController().stopRoute(routeId);
     }