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 be9b98b852f Flaky test
be9b98b852f is described below

commit be9b98b852f419757172ccd415001369cf35cf50
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Feb 27 21:13:56 2025 +0100

    Flaky test
---
 ...FileConsumePollEnrichFileUsingProcessorTest.java | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumePollEnrichFileUsingProcessorTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumePollEnrichFileUsingProcessorTest.java
index 76754f2f9b2..def5ac6202c 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumePollEnrichFileUsingProcessorTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumePollEnrichFileUsingProcessorTest.java
@@ -51,6 +51,8 @@ public class FileConsumePollEnrichFileUsingProcessorTest 
extends ContextTestSupp
 
     @Override
     protected RouteBuilder createRouteBuilder() {
+        ConsumerTemplate con = context.createConsumerTemplate();
+
         return new RouteBuilder() {
             @Override
             public void configure() {
@@ -60,20 +62,11 @@ public class FileConsumePollEnrichFileUsingProcessorTest 
extends ContextTestSupp
                                 String name = 
exchange.getIn().getHeader(Exchange.FILE_NAME_ONLY, String.class);
                                 name = FileUtil.stripExt(name) + ".dat";
 
-                                // use a consumer template to get the data file
-                                Exchange data = null;
-                                ConsumerTemplate con = 
exchange.getContext().createConsumerTemplate();
-                                try {
-                                    // try to get the data file
-                                    data = con.receive(
-                                            
fileUri("enrichdata?initialDelay=0&delay=10&move=.done&fileName="
-                                                    + name),
-                                            5000);
-                                } finally {
-                                    // stop the consumer as it does not need 
to poll for
-                                    // files anymore
-                                    con.stop();
-                                }
+                                // try to get the data file
+                                Exchange data = con.receive(
+                                        
fileUri("enrichdata?initialDelay=0&delay=10&move=.done&fileName="
+                                                + name),
+                                        5000);
 
                                 // if we found the data file then process it 
by sending
                                 // it to the direct:data endpoint

Reply via email to