You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/08/11 13:31:23 UTC

[camel] branch main updated: camel-sjms - Run test fast that was waiting for a latch with a wrong count (#11082)

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

davsclaus 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 045bd3adb7a camel-sjms - Run test fast that was waiting for a latch with a wrong count (#11082)
045bd3adb7a is described below

commit 045bd3adb7af218d4f2519d0b21dfa7fd78cd77c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 11 15:31:15 2023 +0200

    camel-sjms - Run test fast that was waiting for a latch with a wrong count (#11082)
---
 .../camel/component/sjms/tx/TransactedConsumerSupport.java  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedConsumerSupport.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedConsumerSupport.java
index 09c1980f39e..8c2c312df71 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedConsumerSupport.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/tx/TransactedConsumerSupport.java
@@ -51,7 +51,7 @@ public abstract class TransactedConsumerSupport extends CamelTestSupport {
         // unit all the messages have been processed. It is also
         // set to time out on the await. Our values are multiplied
         // by the number of routes we have.
-        CountDownLatch latch = new CountDownLatch((totalRedeliverdFalse * routeCount) + (totalRedeliveredTrue * routeCount));
+        CountDownLatch latch = new CountDownLatch((totalRedeliverdFalse * routeCount));
 
         for (int i = 1; i <= routeCount; i++) {
             // We add a route here so we can pass our latch into it.
@@ -68,13 +68,16 @@ public abstract class TransactedConsumerSupport extends CamelTestSupport {
         // Send only 10 messages
         for (int i = 1; i <= messageCount; i++) {
             String message = "Hello World " + i;
-            template.sendBody("direct:start", message);
+            template.sendBody("direct:start?block=false", message);
             log.trace("Sending message: {}", message);
         }
 
-        // Await on our countdown for 30 seconds at most then move on
-        latch.await(30, TimeUnit.SECONDS);
-        MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS);
+        // Await on our countdown for 20 seconds at most then move on
+        log.info("Waiting for latch to count down from: {}", latch.getCount());
+        boolean zero = latch.await(20, TimeUnit.SECONDS);
+        log.info("Latch wait done: {} with count: {}", zero, latch.getCount());
+
+        MockEndpoint.assertIsSatisfied(context);
     }
 
     @Override