diff options
Diffstat (limited to 'org.eclipse.jgit.junit.ssh')
-rw-r--r-- | org.eclipse.jgit.junit.ssh/BUILD | 2 | ||||
-rw-r--r-- | org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF | 43 | ||||
-rw-r--r-- | org.eclipse.jgit.junit.ssh/pom.xml | 2 | ||||
-rw-r--r-- | org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java | 30 |
4 files changed, 41 insertions, 36 deletions
diff --git a/org.eclipse.jgit.junit.ssh/BUILD b/org.eclipse.jgit.junit.ssh/BUILD index e9a04c7173..8c17cb7238 100644 --- a/org.eclipse.jgit.junit.ssh/BUILD +++ b/org.eclipse.jgit.junit.ssh/BUILD @@ -7,7 +7,7 @@ java_library( resource_strip_prefix = "org.eclipse.jgit.junit.ssh/resources", resources = glob(["resources/**"]), deps = [ - "//lib:sshd-core", + "//lib:sshd-osgi", "//lib:sshd-sftp", # We want these deps to be provided_deps "//org.eclipse.jgit:jgit", diff --git a/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF index 91dd1aa857..0d66eccbbf 100644 --- a/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF +++ b/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF @@ -8,27 +8,28 @@ Bundle-Localization: plugin Bundle-Vendor: %provider_name Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Import-Package: org.apache.sshd.common;version="[2.0.0,2.1.0)", - org.apache.sshd.common.config.keys;version="[2.0.0,2.1.0)", - org.apache.sshd.common.file.virtualfs;version="[2.0.0,2.1.0)", - org.apache.sshd.common.helpers;version="[2.0.0,2.1.0)", - org.apache.sshd.common.io;version="[2.0.0,2.1.0)", - org.apache.sshd.common.kex;version="[2.0.0,2.1.0)", - org.apache.sshd.common.keyprovider;version="[2.0.0,2.1.0)", - org.apache.sshd.common.session;version="[2.0.0,2.1.0)", - org.apache.sshd.common.util.buffer;version="[2.0.0,2.1.0)", - org.apache.sshd.common.util.logging;version="[2.0.0,2.1.0)", - org.apache.sshd.common.util.security;version="[2.0.0,2.1.0)", - org.apache.sshd.server;version="[2.0.0,2.1.0)", - org.apache.sshd.server.auth;version="[2.0.0,2.1.0)", - org.apache.sshd.server.auth.gss;version="[2.0.0,2.1.0)", - org.apache.sshd.server.auth.keyboard;version="[2.0.0,2.1.0)", - org.apache.sshd.server.auth.password;version="[2.0.0,2.1.0)", - org.apache.sshd.server.command;version="[2.0.0,2.1.0)", - org.apache.sshd.server.session;version="[2.0.0,2.1.0)", - org.apache.sshd.server.shell;version="[2.0.0,2.1.0)", - org.apache.sshd.server.subsystem;version="[2.0.0,2.1.0)", - org.apache.sshd.server.subsystem.sftp;version="[2.0.0,2.1.0)", +Import-Package: org.apache.sshd.common;version="[2.2.0,2.3.0)", + org.apache.sshd.common.config.keys;version="[2.2.0,2.3.0)", + org.apache.sshd.common.file.virtualfs;version="[2.2.0,2.3.0)", + org.apache.sshd.common.helpers;version="[2.2.0,2.3.0)", + org.apache.sshd.common.io;version="[2.2.0,2.3.0)", + org.apache.sshd.common.kex;version="[2.2.0,2.3.0)", + org.apache.sshd.common.keyprovider;version="[2.2.0,2.3.0)", + org.apache.sshd.common.session;version="[2.2.0,2.3.0)", + org.apache.sshd.common.util.buffer;version="[2.2.0,2.3.0)", + org.apache.sshd.common.util.logging;version="[2.2.0,2.3.0)", + org.apache.sshd.common.util.security;version="[2.2.0,2.3.0)", + org.apache.sshd.common.util.threads;version="[2.2.0,2.3.0)", + org.apache.sshd.server;version="[2.2.0,2.3.0)", + org.apache.sshd.server.auth;version="[2.2.0,2.3.0)", + org.apache.sshd.server.auth.gss;version="[2.2.0,2.3.0)", + org.apache.sshd.server.auth.keyboard;version="[2.2.0,2.3.0)", + org.apache.sshd.server.auth.password;version="[2.2.0,2.3.0)", + org.apache.sshd.server.command;version="[2.2.0,2.3.0)", + org.apache.sshd.server.session;version="[2.2.0,2.3.0)", + org.apache.sshd.server.shell;version="[2.2.0,2.3.0)", + org.apache.sshd.server.subsystem;version="[2.2.0,2.3.0)", + org.apache.sshd.server.subsystem.sftp;version="[2.2.0,2.3.0)", org.eclipse.jgit.annotations;version="[5.4.0,5.5.0)", org.eclipse.jgit.lib;version="[5.4.0,5.5.0)", org.eclipse.jgit.transport;version="[5.4.0,5.5.0)", diff --git a/org.eclipse.jgit.junit.ssh/pom.xml b/org.eclipse.jgit.junit.ssh/pom.xml index 2310ec0e19..1c2830e3bf 100644 --- a/org.eclipse.jgit.junit.ssh/pom.xml +++ b/org.eclipse.jgit.junit.ssh/pom.xml @@ -74,7 +74,7 @@ <dependency> <groupId>org.apache.sshd</groupId> - <artifactId>sshd-core</artifactId> + <artifactId>sshd-osgi</artifactId> <version>${apache-sshd-version}</version> </dependency> diff --git a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java index f5af2e5ce1..25d952f189 100644 --- a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java +++ b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java @@ -55,10 +55,9 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Locale; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import org.apache.sshd.common.NamedFactory; +import org.apache.sshd.common.NamedResource; import org.apache.sshd.common.SshConstants; import org.apache.sshd.common.config.keys.AuthorizedKeyEntry; import org.apache.sshd.common.config.keys.KeyUtils; @@ -67,6 +66,8 @@ import org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory; import org.apache.sshd.common.session.Session; import org.apache.sshd.common.util.buffer.Buffer; import org.apache.sshd.common.util.security.SecurityUtils; +import org.apache.sshd.common.util.threads.CloseableExecutorService; +import org.apache.sshd.common.util.threads.ThreadUtils; import org.apache.sshd.server.ServerAuthenticationManager; import org.apache.sshd.server.SshServer; import org.apache.sshd.server.auth.UserAuth; @@ -110,8 +111,8 @@ public class SshTestGitServer { @NonNull protected PublicKey testKey; - private final ExecutorService executorService = Executors - .newFixedThreadPool(2); + private final CloseableExecutorService executorService = ThreadUtils + .newFixedThreadPool("SshTestGitServerPool", 2); /** * Creates a ssh git <em>test</em> server. It serves one single repository, @@ -138,11 +139,12 @@ public class SshTestGitServer { server = SshServer.setUpDefaultServer(); // Set host key try (ByteArrayInputStream in = new ByteArrayInputStream(hostKey)) { - hostKeys.add(SecurityUtils.loadKeyPairIdentity("", in, null)); + SecurityUtils.loadKeyPairIdentities(null, null, in, null) + .forEach((k) -> hostKeys.add(k)); } catch (IOException | GeneralSecurityException e) { // Ignore. } - server.setKeyPairProvider(() -> hostKeys); + server.setKeyPairProvider((session) -> hostKeys); configureAuthentication(); @@ -276,8 +278,10 @@ public class SshTestGitServer { public void addHostKey(@NonNull Path key, boolean inFront) throws IOException, GeneralSecurityException { try (InputStream in = Files.newInputStream(key)) { - KeyPair pair = SecurityUtils.loadKeyPairIdentity(key.toString(), in, - null); + KeyPair pair = SecurityUtils + .loadKeyPairIdentities(null, + NamedResource.ofName(key.toString()), in, null) + .iterator().next(); if (inFront) { hostKeys.add(0, pair); } else { @@ -335,14 +339,14 @@ public class SshTestGitServer { public void setTestUserPublicKey(Path key) throws IOException, GeneralSecurityException { this.testKey = AuthorizedKeyEntry.readAuthorizedKeys(key).get(0) - .resolvePublicKey(PublicKeyEntryResolver.IGNORING); + .resolvePublicKey(null, PublicKeyEntryResolver.IGNORING); } private class GitUploadPackCommand extends AbstractCommandSupport { protected GitUploadPackCommand(String command, - ExecutorService executorService) { - super(command, executorService, false); + CloseableExecutorService executorService) { + super(command, ThreadUtils.noClose(executorService)); } @Override @@ -370,8 +374,8 @@ public class SshTestGitServer { private class GitReceivePackCommand extends AbstractCommandSupport { protected GitReceivePackCommand(String command, - ExecutorService executorService) { - super(command, executorService, false); + CloseableExecutorService executorService) { + super(command, ThreadUtils.noClose(executorService)); } @Override |