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 85168ed82c0b chore: camel-as2 -
AS2ClientSendTest.sendTheFilesOfAFolder reads its own folder (#31355)
85168ed82c0b is described below
commit 85168ed82c0bb44a0d456bbdfaf411243d21f1f0
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Dec 4 12:41:46 2026 +0100
chore: camel-as2 - AS2ClientSendTest.sendTheFilesOfAFolder reads its own
folder (#31355)
The files route read every *.edi file of the static @TempDir inbox, where
sendFile() leaves message.edi. When JUnit ran sendFile() first, the route
sent two messages and the test failed (it passed on the surefire retry).
The route now reads a subfolder of its own.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../org/apache/camel/component/as2/AS2ClientSendTest.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git
a/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientSendTest.java
b/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientSendTest.java
index e2fff84e0f19..ff39f6272f83 100644
---
a/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientSendTest.java
+++
b/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientSendTest.java
@@ -83,6 +83,14 @@ public class AS2ClientSendTest extends AbstractAS2ITSupport {
});
}
+ /**
+ * The folder of the files route: a subfolder of its own, as other tests
write their files to the inbox, and JUnit
+ * can run them first.
+ */
+ private static Path folder() {
+ return inbox.resolve("folder");
+ }
+
private String asText(Object ediMessage) {
return context.getTypeConverter().convertTo(String.class, ediMessage);
}
@@ -129,7 +137,7 @@ public class AS2ClientSendTest extends AbstractAS2ITSupport
{
MockEndpoint sent = getMockEndpoint("mock:sent");
sent.expectedMessageCount(1);
- Files.writeString(inbox.resolve("order.edi"), EDI_MESSAGE);
+
Files.writeString(Files.createDirectories(folder()).resolve("order.edi"),
EDI_MESSAGE);
context.getRouteController().startRoute("files");
sent.assertIsSatisfied();
@@ -229,7 +237,7 @@ public class AS2ClientSendTest extends AbstractAS2ITSupport
{
from("direct://SEND_EDI_MESSAGE_TYPE")
.to("as2://client/send?inBody=ediMessage&ediMessageType=application/edifact");
- from("file:" + inbox +
"?include=.*\\.edi&noop=true&initialDelay=0&delay=10").routeId("files")
+ from("file:" + folder() +
"?include=.*\\.edi&noop=true&initialDelay=0&delay=10").routeId("files")
.autoStartup(false)
.setHeader("CamelAs2.requestUri", constant("/"))
.setHeader("CamelAs2.subject", constant("Test Case"))