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

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


The following commit(s) were added to refs/heads/master by this push:
     new c379408  Camel-AWS-S3: Use awaility everywhere and not thread.sleep
c379408 is described below

commit c379408bbda3a09a720b241f8becdca060304138
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Apr 28 17:21:04 2020 +0200

    Camel-AWS-S3: Use awaility everywhere and not thread.sleep
---
 components/camel-aws-s3/pom.xml                                      | 5 +++++
 .../org/apache/camel/component/aws/s3/S3ConsumerIdleMessageTest.java | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/components/camel-aws-s3/pom.xml b/components/camel-aws-s3/pom.xml
index f7ecdc4..2470554 100644
--- a/components/camel-aws-s3/pom.xml
+++ b/components/camel-aws-s3/pom.xml
@@ -67,5 +67,10 @@
             <artifactId>mockito-core</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git 
a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ConsumerIdleMessageTest.java
 
b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ConsumerIdleMessageTest.java
index fa06cf2..43756bb 100644
--- 
a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ConsumerIdleMessageTest.java
+++ 
b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ConsumerIdleMessageTest.java
@@ -16,10 +16,13 @@
  */
 package org.apache.camel.component.aws.s3;
 
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.BindToRegistry;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.awaitility.Awaitility;
 import org.junit.Test;
 
 /**
@@ -34,7 +37,7 @@ public class S3ConsumerIdleMessageTest extends 
CamelTestSupport {
 
     @Test
     public void testConsumeIdleMessages() throws Exception {
-        Thread.sleep(110);
+        Awaitility.await().atMost(110, TimeUnit.MILLISECONDS);
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(2);
         assertMockEndpointsSatisfied();

Reply via email to