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 2023/11/20 14:24:52 UTC

(camel) branch main updated: (chores) camel-rocketmq: try to make the tests a bit more reliable

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


The following commit(s) were added to refs/heads/main by this push:
     new d27a1c7ff1c (chores) camel-rocketmq: try to make the tests a bit more reliable
d27a1c7ff1c is described below

commit d27a1c7ff1c28365c354fc73d39637aa70385b0c
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Mon Nov 20 14:11:37 2023 +0100

    (chores) camel-rocketmq: try to make the tests a bit more reliable
---
 .../apache/camel/component/rocketmq/RocketMQRouteTest.java | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/components/camel-rocketmq/src/test/java/org/apache/camel/component/rocketmq/RocketMQRouteTest.java b/components/camel-rocketmq/src/test/java/org/apache/camel/component/rocketmq/RocketMQRouteTest.java
index ba4c6780fa6..855495ad150 100644
--- a/components/camel-rocketmq/src/test/java/org/apache/camel/component/rocketmq/RocketMQRouteTest.java
+++ b/components/camel-rocketmq/src/test/java/org/apache/camel/component/rocketmq/RocketMQRouteTest.java
@@ -18,13 +18,14 @@
 package org.apache.camel.component.rocketmq;
 
 import java.io.IOException;
-import java.time.Duration;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.awaitility.Awaitility;
 import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -42,6 +43,8 @@ public class RocketMQRouteTest extends RocketMQTestSupport {
 
     private MockEndpoint resultEndpoint;
 
+    private CountDownLatch latch = new CountDownLatch(1);
+
     @BeforeAll
     static void beforeAll() throws Exception {
         rocketMQService.createTopic("START_TOPIC");
@@ -70,7 +73,9 @@ public class RocketMQRouteTest extends RocketMQTestSupport {
 
             @Override
             public void configure() {
-                from(START_ENDPOINT_URI).to(RESULT_ENDPOINT_URI);
+                from(START_ENDPOINT_URI)
+                        .process(e -> latch.countDown())
+                        .to(RESULT_ENDPOINT_URI);
             }
         };
     }
@@ -84,7 +89,8 @@ public class RocketMQRouteTest extends RocketMQTestSupport {
 
         template.sendBody(START_ENDPOINT_URI, EXPECTED_MESSAGE);
 
-        Awaitility.await().atMost(Duration.ofSeconds(5)).untilAsserted(() -> resultEndpoint.assertIsSatisfied());
+        Assertions.assertTrue(latch.await(5, TimeUnit.SECONDS), "Should have received a message");
+        resultEndpoint.assertIsSatisfied();
     }
 
     @AfterAll