This is an automated email from the ASF dual-hosted git repository. twolf pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mina-sshd.git
The following commit(s) were added to refs/heads/master by this push: new 82e0ed1ff GH-510: Fix class name in BuiltinIoServiceFactoryFactories 82e0ed1ff is described below commit 82e0ed1ff6e66ce025c5d3b6147cb9df5995a4d6 Author: JinHeap <heap2...@outlook.com> AuthorDate: Thu May 30 15:16:04 2024 +0800 GH-510: Fix class name in BuiltinIoServiceFactoryFactories The class name for the MinaServiceFactoryFactory was not updated in the refactoring in commit 5cbae28. Add a test that catches such mistakes, and exclude another test from being run with the MinaServiceFactoryFactory because it cannot work with a mocked ExecutorService. Bug: https://github.com/apache/mina-sshd/issues/510 --- .../sshd/common/io/BuiltinIoServiceFactoryFactories.java | 2 +- .../common/io/BuiltinIoServiceFactoryFactoriesTest.java | 15 +++++++++++++++ sshd-mina/pom.xml | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java b/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java index 80fd00e8d..04e8451ac 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactories.java @@ -34,7 +34,7 @@ import org.apache.sshd.common.util.ReflectionUtils; */ public enum BuiltinIoServiceFactoryFactories implements NamedFactory<IoServiceFactoryFactory>, OptionalFeature { NIO2(Nio2ServiceFactoryFactory.class), - MINA("org.apache.sshd.common.io.mina.MinaServiceFactoryFactory"), + MINA("org.apache.sshd.mina.MinaServiceFactoryFactory"), NETTY("org.apache.sshd.netty.NettyIoServiceFactoryFactory"); public static final Set<BuiltinIoServiceFactoryFactories> VALUES diff --git a/sshd-core/src/test/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactoriesTest.java b/sshd-core/src/test/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactoriesTest.java index 411159ed7..43fc0b357 100644 --- a/sshd-core/src/test/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactoriesTest.java +++ b/sshd-core/src/test/java/org/apache/sshd/common/io/BuiltinIoServiceFactoryFactoriesTest.java @@ -68,4 +68,19 @@ public class BuiltinIoServiceFactoryFactoriesTest extends BaseTestSupport { assertSame(clazz.getSimpleName(), expected, BuiltinIoServiceFactoryFactories.fromFactoryClass(clazz)); } } + + @Test + public void testClassNames() { + IoServiceFactoryFactory ioServiceProvider = getIoServiceProvider(); + Class<?> providerClass = ioServiceProvider.getClass(); + String providerClassName = providerClass.getName(); + boolean found = false; + for (BuiltinIoServiceFactoryFactories builtin : BuiltinIoServiceFactoryFactories.VALUES) { + if (providerClassName.equals(builtin.getFactoryClassName())) { + found = true; + break; + } + } + assertTrue("No BuiltinIoServiceFactoryFactories match for class name " + providerClassName, found); + } } diff --git a/sshd-mina/pom.xml b/sshd-mina/pom.xml index fcdb73fd0..406c34612 100644 --- a/sshd-mina/pom.xml +++ b/sshd-mina/pom.xml @@ -124,6 +124,8 @@ <exclude>**/StrictKexInteroperabilityTest.java</exclude> <!-- reading files from classpath doesn't work correctly w/ reusable test jar --> <exclude>**/OpenSSHCertificateTest.java</exclude> + <!-- A MinaServiceFactory cannot be instantiated with a mock CloseableExecutorService. --> + <exclude>**/DefaultIoServiceFactoryFactoryTest.java</exclude> </excludes> <!-- No need to re-run core tests that do not involve session creation --> <excludedGroups>org.apache.sshd.util.test.NoIoTestCase</excludedGroups>