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 910ff395ef95 (#29365)
910ff395ef95 is described below
commit 910ff395ef95b28fac04083354baf51aaa1ae420
Author: Adriano Machado <[email protected]>
AuthorDate: Sat Nov 7 02:00:54 2026 -0500
(#29365)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---
components/camel-mina-sftp/pom.xml | 18 ++++++++++++++++++
.../remote/mina/integration/MinaSftpConcurrencyIT.java | 5 +++++
.../integration/MinaSftpConfigurationValidationIT.java | 18 +++++++++++++++++-
.../file/remote/mina/sftp/SftpChangedReadLockIT.java | 7 +++++++
.../remote/mina/sftp/SftpDisconnectThreadLeakIT.java | 5 +++++
5 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/components/camel-mina-sftp/pom.xml
b/components/camel-mina-sftp/pom.xml
index 96873700dbd4..bdc9ac370480 100644
--- a/components/camel-mina-sftp/pom.xml
+++ b/components/camel-mina-sftp/pom.xml
@@ -135,11 +135,29 @@
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
+ <id>standard-integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
+
<excludedGroups>require-isolated-jvm</excludedGroups>
+ <forkCount>1</forkCount>
+ <reuseForks>true</reuseForks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>default</id>
+ <phase>none</phase>
+ </execution>
+ <execution>
+ <id>isolated-integration-tests</id>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <groups>require-isolated-jvm</groups>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration>
diff --git
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/integration/MinaSftpConcurrencyIT.java
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/integration/MinaSftpConcurrencyIT.java
index bde4f3dc1255..a309638aaeb1 100644
---
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/integration/MinaSftpConcurrencyIT.java
+++
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/integration/MinaSftpConcurrencyIT.java
@@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.camel.Exchange;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.condition.EnabledIf;
@@ -37,8 +38,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Integration tests for MINA SFTP concurrency and thread safety.
+ * <p/>
+ * These tests run in their own JVM (tag {@code require-isolated-jvm}): they
open many concurrent and rapidly reused
+ * SFTP connections and are sensitive to connections and threads left behind
by other tests in a shared JVM.
*/
@EnabledIf(value =
"org.apache.camel.test.infra.ftp.services.embedded.SftpUtil#hasRequiredAlgorithms('src/test/resources/hostkey.pem')")
+@Tag("require-isolated-jvm")
public class MinaSftpConcurrencyIT extends MinaSftpServerTestSupport {
private static final Logger log =
LoggerFactory.getLogger(MinaSftpConcurrencyIT.class);
diff --git
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/integration/MinaSftpConfigurationValidationIT.java
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/integration/MinaSftpConfigurationValidationIT.java
index 6bdfaae51407..b6b394efdc45 100644
---
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/integration/MinaSftpConfigurationValidationIT.java
+++
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/integration/MinaSftpConfigurationValidationIT.java
@@ -27,6 +27,7 @@ import org.apache.camel.ResolveEndpointFailedException;
import org.apache.camel.RuntimeCamelException;
import org.apache.sshd.common.util.io.PathUtils;
import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.condition.EnabledIf;
@@ -40,6 +41,20 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Integration tests for MINA SFTP configuration validation and error messages.
* <p>
+ * <b>Why this test requires isolation:</b> This test class modifies the global
+ * {@code PathUtils.setUserHomeFolderResolver()} to test username resolution
fallback behavior. MINA SSHD's
+ * {@code PathUtils} lazily caches the home folder path on first access via
{@code DefaultConfigFileHostEntryResolver},
+ * and this cache cannot be reset once populated. Running this test in a
shared JVM with other tests would cause
+ * interference.
+ * <p>
+ * <b>How isolation is achieved:</b> The {@code @Tag("require-isolated-jvm")}
annotation marks this class for separate
+ * execution. The Maven Failsafe plugin is configured in pom.xml with two
executions:
+ * <ul>
+ * <li>{@code standard-integration-tests} - runs all tests EXCEPT those tagged
"require-isolated-jvm"</li>
+ * <li>{@code isolated-integration-tests} - runs ONLY tests tagged
"require-isolated-jvm" with {@code reuseForks=false}
+ * to ensure a fresh JVM</li>
+ * </ul>
+ * <p>
* <b>Username resolution fallback:</b> When no username is specified in the
URI, MINA SSHD (like JSch/camel-sftp) uses
* this priority order:
* <ol>
@@ -52,6 +67,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*
"https://github.com/apache/mina-sshd/blob/master/sshd-common/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java">MINA
* SSHD HostConfigEntry</a>
*/
+@Tag("require-isolated-jvm")
@EnabledIf(value =
"org.apache.camel.test.infra.ftp.services.embedded.SftpUtil#hasRequiredAlgorithms('src/test/resources/hostkey.pem')")
public class MinaSftpConfigurationValidationIT extends
MinaSftpServerTestSupport {
@@ -375,7 +391,7 @@ public class MinaSftpConfigurationValidationIT extends
MinaSftpServerTestSupport
@Timeout(30)
public void testSpecialCharactersInPassword() throws Exception {
// Password with special characters
- String specialPassword = "p@ss#word!$%^&*()";
+ String specialPassword = "p@ss#word!$%^&*()"; // gitleaks:allow (test
fixture, not a secret)
String uri = "mina-sftp://localhost:" + service.getPort() + "/" +
ftpRootDir
+ "?username=admin&password=" + specialPassword
+ "&strictHostKeyChecking=no&useUserKnownHostsFile=false";
diff --git
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpChangedReadLockIT.java
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpChangedReadLockIT.java
index ae3d64ccd5ec..c6fb989418b3 100644
---
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpChangedReadLockIT.java
+++
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpChangedReadLockIT.java
@@ -25,6 +25,7 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.spi.PropertiesComponent;
import org.apache.camel.test.junit6.TestSupport;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIf;
import org.junit.jupiter.api.io.TempDir;
@@ -34,6 +35,12 @@ import org.slf4j.LoggerFactory;
import static org.apache.camel.test.junit6.TestSupport.createDirectory;
import static org.junit.jupiter.api.Assertions.assertEquals;
+/**
+ * Tests the {@code changed} read lock, which is timing sensitive (it polls
the file size and modification time). It
+ * runs in its own JVM (tag {@code require-isolated-jvm}), so that load from
other tests in a shared JVM does not skew
+ * the read lock check interval.
+ */
+@Tag("require-isolated-jvm")
@EnabledIf(value =
"org.apache.camel.test.infra.ftp.services.embedded.SftpUtil#hasRequiredAlgorithms('src/test/resources/sftp/hostkey.pem')")
public class SftpChangedReadLockIT extends SftpServerTestSupport {
diff --git
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpDisconnectThreadLeakIT.java
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpDisconnectThreadLeakIT.java
index 4bfe4e4dbfd5..1b481cdab21f 100644
---
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpDisconnectThreadLeakIT.java
+++
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpDisconnectThreadLeakIT.java
@@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.camel.Exchange;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIf;
@@ -35,8 +36,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* <p/>
* Before the fix, each SFTP connect/disconnect cycle left behind NIO2 and
timer daemon threads from the SshClient,
* causing the thread count to grow continuously until the system's thread
limit was exhausted.
+ * <p/>
+ * It counts the live SshClient threads of the JVM, so it runs in its own JVM
(tag {@code require-isolated-jvm}):
+ * clients of other tests in a shared JVM would make the count unreliable.
*/
@EnabledIf(value =
"org.apache.camel.test.infra.ftp.services.embedded.SftpUtil#hasRequiredAlgorithms('src/test/resources/sftp/hostkey.pem')")
+@Tag("require-isolated-jvm")
class SftpDisconnectThreadLeakIT extends SftpServerTestSupport {
@Test