Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ updates:
versions: [ ">= 2.0.0" ]
- dependency-name: "ch.qos.logback:*"
versions: [ ">= 1.3.0" ]
# We *do* test against 2.2.X. We only want to get patch version updates for mina-core
- dependency-name: "org.apache.mina:mina-core"
update-types: [ "version-update:semver-major", "version-update:semver-minor" ]
67 changes: 67 additions & 0 deletions sshd-mina/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,71 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>test-mina-2.2.X</id>
<activation>
<property>
<name>test.mina22</name>
<value>!disable</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>test-mina-2.2.X</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<reportsDirectory>${project.build.directory}/surefire-reports-mina-22</reportsDirectory>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<excludes>
<!-- These tests use NIO2 explicitly -->
<exclude>**/Nio2ServiceTest.java</exclude>
<!-- testcontainers filesystem building from classpath doesn't work from reusable test jar classpath -->
<exclude>**/ArcFourOpenSshTest.java</exclude>
<exclude>**/ClientOpenSSHCertificatesTest.java</exclude>
<exclude>**/SessionReKeyHostKeyExchangeTest.java</exclude>
<exclude>**/HostBoundPubKeyAuthTest.java</exclude>
<exclude>**/OpenSshCipherTest.java</exclude>
<exclude>**/OpenSshMlKemTest.java</exclude>
<exclude>**/PortForwardingWithOpenSshTest.java</exclude>
<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>NoIoTestCase</excludedGroups>
<!-- Tests are located in the sshd-core reusable test jar -->
<dependenciesToScan>
<dependency>org.apache.sshd:sshd-core</dependency>
</dependenciesToScan>
<classpathDependencyExcludes>
<classpathDependencyExclude>org.apache.mina:mina-core</classpathDependencyExclude>
</classpathDependencyExcludes>
<additionalClasspathDependencies>
<additionalClasspathDependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-core</artifactId>
<version>2.2.4</version>
</additionalClasspathDependency>
</additionalClasspathDependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
19 changes: 12 additions & 7 deletions sshd-mina/src/test/java/org/apache/sshd/mina/MinaSessionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,35 @@
package org.apache.sshd.mina;

import java.lang.reflect.Field;
import java.util.stream.Stream;

import org.apache.mina.core.service.IoHandler;
import org.apache.mina.core.service.IoProcessor;
import org.apache.sshd.client.SshClient;
import org.apache.sshd.common.helpers.AbstractFactoryManager;
import org.apache.sshd.common.io.IoServiceFactory;
import org.apache.sshd.server.SshServer;
import org.apache.sshd.util.test.BaseTestSupport;
import org.junit.jupiter.api.MethodOrderer.MethodName;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* Tests specific to the MINA connection back-end.
*
* @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a>
*/
@TestMethodOrder(MethodName.class)
public class MinaSessionTest extends BaseTestSupport {
class MinaSessionTest extends BaseTestSupport {

public MinaSessionTest() {
MinaSessionTest() {
super();
}

@BeforeAll
static void minaVersion() {
boolean is22x = Stream.of(IoHandler.class.getMethods()).anyMatch(m -> "event".equals(m.getName()));
System.err.println("Testing with MINA " + (is22x ? "2.2.X" : "2.0.X"));
}

private IoProcessor<?> getProcessor(AbstractFactoryManager manager) throws Exception {
IoServiceFactory ioServiceFactory = manager.getIoServiceFactory();
assertTrue(ioServiceFactory instanceof MinaServiceFactory, "Unexpected type " + ioServiceFactory.getClass());
Expand All @@ -70,4 +74,5 @@ void ioProcessorClosed() throws Exception {
}
assertTrue(ioProcessor.isDisposed() || ioProcessor.isDisposing(), "MINA server IoProcessor should be closed");
}

}
Loading