You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/07/14 14:40:57 UTC
[camel] 01/04: (chores) camel-core: file test fixes and cleanups
This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 161fea3319a4ed901cac78cf2635832592899585
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jul 14 12:56:02 2023 +0200
(chores) camel-core: file test fixes and cleanups
- increase timeouts for asserting results
- send messages earlier
---
.../component/file/FileRecursiveNoopTest.java | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 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 6e14918fcf3..51fcb46b562 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
@@ -16,26 +16,33 @@
*/
package org.apache.camel.component.file;
+import java.util.concurrent.atomic.LongAdder;
+
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 FileRecursiveNoopTest extends ContextTestSupport {
+ private final LongAdder counter = new LongAdder();
- @Test
- public void testRecursiveNoop() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedBodiesReceivedInAnyOrder("a", "b", "a2", "c", "b2");
-
+ @BeforeEach
+ void sendMessages() {
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");
+ }
+
+ @Test
+ public void testRecursiveNoop() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedBodiesReceivedInAnyOrder("a", "b", "a2", "c", "b2");
- assertMockEndpointsSatisfied();
+ mock.assertIsSatisfied(5);
// reset mock and send in a new file to be picked up only
mock.reset();
@@ -43,7 +50,7 @@ public class FileRecursiveNoopTest extends ContextTestSupport {
template.sendBodyAndHeader(fileUri(), "c2", Exchange.FILE_NAME, "c.txt");
- assertMockEndpointsSatisfied();
+ mock.assertIsSatisfied(5);
}
@Override
@@ -52,6 +59,7 @@ public class FileRecursiveNoopTest extends ContextTestSupport {
@Override
public void configure() throws Exception {
from(fileUri("?initialDelay=0&delay=10&recursive=true&noop=true")).convertBodyTo(String.class)
+ .process(e -> counter.increment())
.to("mock:result");
}
};