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/10 14:39:06 UTC

[camel] 02/02: CAMEL-19684: Attempt to fix some flaky test

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

davsclaus pushed a commit to branch flaky
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 409a0e31394fd0692adb189b7aafc6f7d3310319
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 10 16:38:42 2023 +0200

    CAMEL-19684: Attempt to fix some flaky test
---
 .../apache/camel/component/file/FileRecursiveNoopTest.java    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/FileRecursiveNoopTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/FileRecursiveNoopTest.java
index e93f05c7b2d..8e5a109ac12 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/file/FileRecursiveNoopTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/file/FileRecursiveNoopTest.java
@@ -24,12 +24,13 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 public class FileRecursiveNoopTest extends ContextTestSupport {
-    private final String fileUri = fileUri();
 
     @BeforeEach
     void sendMessages() {
-        template.sendBodyAndHeader(fileUri, "a", Exchange.FILE_NAME, "a.txt");
-        template.sendBodyAndHeader(fileUri, "b", Exchange.FILE_NAME, "b.txt");
+        testDirectory(true);
+
+        template.sendBodyAndHeader(fileUri(), "a", Exchange.FILE_NAME, "a.txt");
+        template.sendBodyAndHeader(fileUri(), "b", Exchange.FILE_NAME, "b.txt");
         template.sendBodyAndHeader(fileUri("foo"), "a2", Exchange.FILE_NAME, "a.txt");
         template.sendBodyAndHeader(fileUri("bar"), "c", Exchange.FILE_NAME, "c.txt");
         template.sendBodyAndHeader(fileUri("bar"), "b2", Exchange.FILE_NAME, "b.txt");
@@ -37,6 +38,8 @@ public class FileRecursiveNoopTest extends ContextTestSupport {
 
     @Test
     public void testRecursiveNoop() throws Exception {
+        context.getRouteController().startAllRoutes();
+
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedBodiesReceivedInAnyOrder("a", "b", "a2", "c", "b2");
 
@@ -56,7 +59,7 @@ public class FileRecursiveNoopTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from(fileUri("?initialDelay=0&delay=10&recursive=true&noop=true")).convertBodyTo(String.class)
+                from(fileUri("?initialDelay=0&delay=10&recursive=true&noop=true")).convertBodyTo(String.class).noAutoStartup()
                         .to("mock:result");
             }
         };