This is an automated email from the ASF dual-hosted git repository.
Croway pushed a commit to branch camel-spring-boot-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/camel-spring-boot-4.22.x by
this push:
new 65a0d8daf08 camel-ftp-starter: reserve the embedded FTP server port up
front
65a0d8daf08 is described below
commit 65a0d8daf08e55f710c31557f34cebb201d746d2
Author: croway <[email protected]>
AuthorDate: Tue Sep 29 10:38:43 2026 +0200
camel-ftp-starter: reserve the embedded FTP server port up front
FtpEmbeddedService started the server in beforeEach on port 0 and only
learned the real port afterwards. Spring builds the Camel routes before
beforeEach runs, so the first FTP test class in the JVM (FromFtpFilterTest)
always consumed from ftp://admin@localhost:0/filter and never received a
file. Later classes passed only because the static service kept the port
from the previous run.
Reserve a free port in the constructor so every route sees the port the
server will actually listen on.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../component/file/remote/springboot/ftp/FtpEmbeddedService.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git
a/components-starter/camel-ftp-starter/src/test/java/org/apache/camel/component/file/remote/springboot/ftp/FtpEmbeddedService.java
b/components-starter/camel-ftp-starter/src/test/java/org/apache/camel/component/file/remote/springboot/ftp/FtpEmbeddedService.java
index ffece0b57ad..32634bb39d5 100644
---
a/components-starter/camel-ftp-starter/src/test/java/org/apache/camel/component/file/remote/springboot/ftp/FtpEmbeddedService.java
+++
b/components-starter/camel-ftp-starter/src/test/java/org/apache/camel/component/file/remote/springboot/ftp/FtpEmbeddedService.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.file.remote.springboot.ftp;
+import org.apache.camel.test.AvailablePortFinder;
import org.apache.camel.test.infra.common.services.AbstractTestService;
import org.apache.camel.test.infra.ftp.common.FtpProperties;
import org.apache.camel.test.infra.ftp.services.FtpService;
@@ -63,6 +64,9 @@ public class FtpEmbeddedService extends AbstractTestService
implements FtpServic
private ExtensionContext context;
public FtpEmbeddedService() {
+ // Reserve the port up front: Spring builds the Camel routes (and
their FTP URIs) before
+ // beforeEach starts the server, so the port must be known before the
first test runs
+ port = AvailablePortFinder.getNextAvailable();
}
public void setUp() throws Exception {