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 42e5350ba93 Flaky test
42e5350ba93 is described below
commit 42e5350ba93bf3f0d87c1c4171119f8cef691f7e
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Nov 28 11:21:42 2024 +0100
Flaky test
---
.../file/FileConsumePollEnrichFileIdleEventTest.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git
a/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumePollEnrichFileIdleEventTest.java
b/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumePollEnrichFileIdleEventTest.java
index b5ecacf8d6a..09175be21b2 100644
---
a/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumePollEnrichFileIdleEventTest.java
+++
b/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumePollEnrichFileIdleEventTest.java
@@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
public class FileConsumePollEnrichFileIdleEventTest extends ContextTestSupport
{
@Test
- public void testNonEmptyAfterEmpty() {
+ public void testNonEmptyAfterEmpty() throws Exception {
getMockEndpoint("mock:start").expectedBodiesReceived("Event1",
"Event2");
MockEndpoint mock = getMockEndpoint("mock:result");
@@ -40,6 +40,8 @@ public class FileConsumePollEnrichFileIdleEventTest extends
ContextTestSupport {
template.sendBodyAndHeader(fileUri("enrich"), "Event1",
Exchange.FILE_NAME,
"Event1.txt");
+ context.getRouteController().startAllRoutes();
+
log.info("Sleeping for 1 sec before writing enrichdata file");
Awaitility.await().pollDelay(1, TimeUnit.SECONDS).untilAsserted(() -> {
@@ -55,14 +57,16 @@ public class FileConsumePollEnrichFileIdleEventTest extends
ContextTestSupport {
@Test
public void testPollEmptyEnrich() throws Exception {
- getMockEndpoint("mock:start").expectedBodiesReceived("Event1");
+ getMockEndpoint("mock:start").expectedBodiesReceived("Event3");
MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedBodiesReceived("Event1");
- mock.expectedFileExists(testFile("enrich/.done/Event1.txt"));
+ mock.expectedBodiesReceived("Event3");
+ mock.expectedFileExists(testFile("enrich/.done/Event3.txt"));
- template.sendBodyAndHeader(fileUri("enrich"), "Event1",
Exchange.FILE_NAME,
- "Event1.txt");
+ template.sendBodyAndHeader(fileUri("enrich"), "Event3",
Exchange.FILE_NAME,
+ "Event3.txt");
+
+ context.getRouteController().startAllRoutes();
assertMockEndpointsSatisfied();
}
@@ -72,7 +76,7 @@ public class FileConsumePollEnrichFileIdleEventTest extends
ContextTestSupport {
return new RouteBuilder() {
@Override
public void configure() {
- from(fileUri("enrich?initialDelay=0&delay=10&move=.done"))
+
from(fileUri("enrich?initialDelay=0&delay=10&move=.done")).autoStartup(false)
.to("mock:start")
.pollEnrich(
fileUri("enrichdata?initialDelay=0&delay=10&move=.done&sendEmptyMessageWhenIdle=true"),
1000)