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

[camel] branch main updated (10301996622 -> c16b7c09842)

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

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


    from 10301996622 CAMEL-18042: Rollback with doTry .. doCatch should execute entire doCatch block and not only first processor.
     new 7239aff82c9 (chores) camel-atom: removed usages of Thread.sleep
     new 191a11578cd (chores) camel-chatscript removed usages of Thread.sleep
     new da72108cc0b (chores) camel-ignite removed usages of Thread.sleep
     new c16b7c09842 (chores) camel-mongodb removed usages of Thread.sleep

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 components/camel-atom/pom.xml                         |  5 +++++
 .../atom/AtomPollingConsumerIdleMessageTest.java      | 19 ++++++++++++-------
 components/camel-chatscript/pom.xml                   |  6 ++++++
 .../apache/camel/component/ChatScriptComponentIT.java |  6 ++++--
 .../camel/component/ignite/IgniteEventsTest.java      |  8 +++++---
 .../camel/component/ignite/IgniteMessagingTest.java   |  6 ++++--
 components/camel-mongodb/pom.xml                      |  5 +++++
 .../integration/MongoDbTailableCursorConsumerIT.java  |  8 ++++----
 8 files changed, 45 insertions(+), 18 deletions(-)


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

Posted by or...@apache.org.
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);
     }
 


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

Posted by or...@apache.org.
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 da72108cc0b5ee56f091b45ba9e621ffa8376643
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jun 3 14:28:09 2022 +0200

    (chores) camel-ignite removed usages of Thread.sleep
---
 .../java/org/apache/camel/component/ignite/IgniteEventsTest.java  | 8 +++++---
 .../org/apache/camel/component/ignite/IgniteMessagingTest.java    | 6 ++++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteEventsTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteEventsTest.java
index b1b8a046dee..b5c55d0a224 100644
--- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteEventsTest.java
+++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteEventsTest.java
@@ -34,10 +34,13 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.events.EventType;
 import org.assertj.core.api.Assertions;
+import org.hamcrest.Matchers;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.TestInstance;
 
+import static org.awaitility.Awaitility.await;
+
 @TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class IgniteEventsTest extends AbstractIgniteTest {
 
@@ -71,9 +74,8 @@ public class IgniteEventsTest extends AbstractIgniteTest {
         cache.withExpiryPolicy(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MILLISECONDS, 100)).create())
                 .put(resourceUid, "123");
 
-        Thread.sleep(150);
-
-        cache.get(resourceUid);
+        await().atMost(150, TimeUnit.MILLISECONDS)
+                .until(() -> cache.get(resourceUid), Matchers.nullValue());
 
         assertMockEndpointsSatisfied();
 
diff --git a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java
index 60750d13545..0817b78cded 100644
--- a/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java
+++ b/components/camel-ignite/src/test/java/org/apache/camel/component/ignite/IgniteMessagingTest.java
@@ -32,6 +32,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.component.ignite.messaging.IgniteMessagingComponent;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.assertj.core.api.Assertions;
+import org.hamcrest.Matchers;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.TestInstance;
@@ -78,8 +79,9 @@ public class IgniteMessagingTest extends AbstractIgniteTest implements Serializa
 
         template.requestBodyAndHeader("ignite-messaging:" + TOPIC1, 1, IgniteConstants.IGNITE_MESSAGING_TOPIC, "TOPIC2");
 
-        Thread.sleep(1000);
-        Assertions.assertThat(messages1.size()).isEqualTo(0);
+        await().atMost(1, TimeUnit.SECONDS)
+                .until(() -> messages1.size(), Matchers.equalTo(0));
+
         Assertions.assertThat(messages2.size()).isEqualTo(1);
     }
 


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

Posted by or...@apache.org.
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 7239aff82c984e0794acc4b07417bbfd086e741c
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jun 3 14:00:15 2022 +0200

    (chores) camel-atom: removed usages of Thread.sleep
---
 components/camel-atom/pom.xml                         |  5 +++++
 .../atom/AtomPollingConsumerIdleMessageTest.java      | 19 ++++++++++++-------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/components/camel-atom/pom.xml b/components/camel-atom/pom.xml
index 76651ddbcb2..a472bd9d171 100644
--- a/components/camel-atom/pom.xml
+++ b/components/camel-atom/pom.xml
@@ -197,5 +197,10 @@
             <version>${jetty-version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerIdleMessageTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerIdleMessageTest.java
index 15bd11b7e32..835bfc762f3 100644
--- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerIdleMessageTest.java
+++ b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerIdleMessageTest.java
@@ -16,9 +16,12 @@
  */
 package org.apache.camel.component.atom;
 
+import java.time.Duration;
+
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit5.CamelTestSupport;
+import org.awaitility.Awaitility;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.condition.DisabledOnOs;
 import org.junit.jupiter.api.condition.OS;
@@ -33,13 +36,15 @@ import static org.junit.jupiter.api.Assertions.assertNull;
 public class AtomPollingConsumerIdleMessageTest extends CamelTestSupport {
 
     @Test
-    void testConsumeIdleMessages() throws Exception {
-        Thread.sleep(110);
-        MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMinimumMessageCount(2);
-        assertMockEndpointsSatisfied();
-        assertNull(mock.getExchanges().get(0).getIn().getBody());
-        assertNull(mock.getExchanges().get(1).getIn().getBody());
+    void testConsumeIdleMessages() {
+        Awaitility.await().atMost(Duration.ofMillis(500)).untilAsserted(() -> {
+            MockEndpoint mock = getMockEndpoint("mock:result");
+            mock.expectedMinimumMessageCount(2);
+            assertMockEndpointsSatisfied();
+
+            assertNull(mock.getExchanges().get(0).getIn().getBody());
+            assertNull(mock.getExchanges().get(1).getIn().getBody());
+        });
     }
 
     @Override


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

Posted by or...@apache.org.
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