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/12 14:28:24 UTC

[camel] branch main updated: camel-core - Attempt fo fix flaky test

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 72cc309a253 camel-core - Attempt fo fix flaky test
72cc309a253 is described below

commit 72cc309a253e32b409c09e02101e83bfe984b071
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Aug 12 16:28:13 2023 +0200

    camel-core - Attempt fo fix flaky test
---
 .../component/file/FileConsumerFileNameFilterTest.java  | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerFileNameFilterTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerFileNameFilterTest.java
index b77f5252bfa..6dd6040d5e6 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerFileNameFilterTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerFileNameFilterTest.java
@@ -20,24 +20,23 @@ import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 public class FileConsumerFileNameFilterTest extends ContextTestSupport {
+
     private final String fileUri = fileUri();
 
-    @BeforeEach
-    void sendMessages() {
+    @Test
+    public void testFileConsumer() throws Exception {
+        final MockEndpoint mockEndpoint = getMockEndpoint("mock:txt");
+        mockEndpoint.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World");
+
         template.sendBodyAndHeader(fileUri, "Hello World", Exchange.FILE_NAME, "hello.txt");
         template.sendBodyAndHeader(fileUri, "<customer>123</customer>", Exchange.FILE_NAME, "customer.xml");
         template.sendBodyAndHeader(fileUri, "<book>Camel Rocks</book>", Exchange.FILE_NAME, "book.xml");
         template.sendBodyAndHeader(fileUri, "Bye World", Exchange.FILE_NAME, "bye.txt");
-    }
 
-    @Test
-    public void testFileConsumer() throws Exception {
-        final MockEndpoint mockEndpoint = getMockEndpoint("mock:txt");
-        mockEndpoint.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World");
+        context.getRouteController().startAllRoutes();
 
         mockEndpoint.assertIsSatisfied();
     }
@@ -47,7 +46,7 @@ public class FileConsumerFileNameFilterTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() {
-                from(fileUri("?initialDelay=0&delay=10&fileName=${file:onlyname.noext}.txt"))
+                from(fileUri("?initialDelay=0&delay=10&fileName=${file:onlyname.noext}.txt")).noAutoStartup()
                         .to("mock:txt");
             }
         };