mirror of https://github.com/apache/jclouds.git
Issue 637: moved to sshj and tested on aws-ec2 gogrid cloudservers elastichosts-lon-p trmk-*
This commit is contained in:
parent
732491fe17
commit
edc1b10610
|
@ -77,7 +77,7 @@ Compute Example (Java):
|
|||
accesskeyid,
|
||||
secretaccesskey,
|
||||
ImmutableSet.of(new Log4JLoggingModule(),
|
||||
new JschSshClientModule()));
|
||||
new SshjSshClientModule()));
|
||||
client = context.getComputeService();
|
||||
|
||||
// define the requirements of your node
|
||||
|
@ -96,9 +96,9 @@ Compute Example (Java):
|
|||
Compute Example (Clojure):
|
||||
(use 'org.jclouds.compute2)
|
||||
|
||||
; create a compute service using ssh and log4j extensions
|
||||
; create a compute service using sshj and log4j extensions
|
||||
(def compute
|
||||
(*compute* "trmk`-ecloud" "user" "password" :ssh :log4j))
|
||||
(*compute* "trmk`-ecloud" "user" "password" :sshj :log4j))
|
||||
|
||||
; launch a couple nodes with the default operating system, installing your user.
|
||||
(create-nodes *compute* "mycluster" 2
|
||||
|
|
|
@ -57,12 +57,6 @@
|
|||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
|
@ -71,15 +65,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
|
|
|
@ -24,8 +24,8 @@ import static org.jclouds.scriptbuilder.domain.Statements.exec;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
|
@ -33,7 +33,7 @@ import org.jclouds.compute.domain.ExecResponse;
|
|||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.scriptbuilder.domain.OsFamily;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -74,7 +74,7 @@ public class BYONComputeServiceLiveTest {
|
|||
contextProperties.setProperty("byon.nodes", nodes.toString());
|
||||
|
||||
context = new ComputeServiceContextFactory().createContext("byon", "foo", "bar", ImmutableSet.<Module> of(
|
||||
new JschSshClientModule(), new Log4JLoggingModule()), contextProperties);
|
||||
new SshjSshClientModule(), new Log4JLoggingModule()), contextProperties);
|
||||
}
|
||||
|
||||
public void testCanRunCommandAsCurrentUser() throws Exception {
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.byon.functions.NodesFromYamlTest;
|
|||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
|
@ -64,7 +64,7 @@ public class BYONComputeServiceTest {
|
|||
Properties props = new Properties();
|
||||
props.setProperty("byon.endpoint", endpoint);
|
||||
context = new ComputeServiceContextFactory().createContext("byon", "foo", "bar", ImmutableSet
|
||||
.<Module> of(new JschSshClientModule()), props);
|
||||
.<Module> of(new SshjSshClientModule()), props);
|
||||
|
||||
assertEquals(context.getProviderSpecificContext().getEndpoint(), URI.create(endpoint));
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class BYONComputeServiceTest {
|
|||
Properties props = new Properties();
|
||||
props.setProperty("byon.endpoint", endpoint);
|
||||
context = new ComputeServiceContextFactory().createContext("byon", "foo", "bar", ImmutableSet
|
||||
.<Module> of(new JschSshClientModule()), props);
|
||||
.<Module> of(new SshjSshClientModule()), props);
|
||||
|
||||
assertEquals(context.getProviderSpecificContext().getEndpoint(), URI.create(endpoint));
|
||||
|
||||
|
|
|
@ -76,27 +76,16 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -58,7 +58,7 @@ import org.jclouds.predicates.SocketOpen;
|
|||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.SshException;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.testng.annotations.AfterTest;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
|
@ -116,7 +116,7 @@ public class CloudServersClientLiveTest {
|
|||
Properties overrides = setupProperties();
|
||||
|
||||
Injector injector = new RestContextFactory().createContextBuilder(provider,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides).buildInjector();
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides).buildInjector();
|
||||
|
||||
client = injector.getInstance(CloudServersClient.class);
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
|
|
|
@ -29,9 +29,11 @@ import org.jclouds.compute.ComputeServiceContextFactory;
|
|||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
*
|
||||
* Generally disabled, as it incurs higher fees.
|
||||
|
@ -45,8 +47,8 @@ public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTe
|
|||
}
|
||||
|
||||
@Override
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
public void testAssignability() throws Exception {
|
||||
|
|
|
@ -78,21 +78,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jclouds.domain.Credentials;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
@ -134,7 +134,7 @@ public class DeltacloudClientLiveTest extends ReadOnlyDeltacloudClientLiveTest {
|
|||
}
|
||||
|
||||
protected void doConnectViaSsh(Instance instance, Credentials creds) throws IOException {
|
||||
SshClient ssh = Guice.createInjector(new JschSshClientModule()).getInstance(SshClient.Factory.class).create(
|
||||
SshClient ssh = Guice.createInjector(new SshjSshClientModule()).getInstance(SshClient.Factory.class).create(
|
||||
new IPSocket(Iterables.get(instance.getPublicAddresses(), 0), 22), creds);
|
||||
try {
|
||||
ssh.connect();
|
||||
|
|
|
@ -29,9 +29,11 @@ import org.jclouds.deltacloud.DeltacloudAsyncClient;
|
|||
import org.jclouds.deltacloud.DeltacloudClient;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
|
@ -44,8 +46,8 @@ public class DeltacloudComputeServiceLiveTest extends BaseComputeServiceLiveTest
|
|||
}
|
||||
|
||||
@Override
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
public void testAssignability() throws Exception {
|
||||
|
|
|
@ -78,21 +78,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -47,7 +47,7 @@ import org.jclouds.ec2.services.ElasticBlockStoreClient;
|
|||
import org.jclouds.ec2.services.InstanceClient;
|
||||
import org.jclouds.ec2.services.KeyPairClient;
|
||||
import org.jclouds.ec2.services.SecurityGroupClient;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
@ -69,7 +69,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
|
||||
@Override
|
||||
protected Module getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
@Test(enabled = true, dependsOnMethods = "testCorrectAuthException")
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.compute.RunNodesException;
|
|||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.predicates.NodePredicates;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -81,7 +81,7 @@ public class TestCanRecreateGroupLiveTest {
|
|||
setupCredentials();
|
||||
Properties overrides = setupProperties();
|
||||
context = new ComputeServiceContextFactory().createContext(provider,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides);
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides);
|
||||
}
|
||||
|
||||
public void testCanRecreateGroup() throws Exception {
|
||||
|
|
|
@ -64,17 +64,6 @@
|
|||
<artifactId>jclouds-compute</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-core</artifactId>
|
||||
|
@ -90,14 +79,14 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -52,7 +52,7 @@ import org.jclouds.predicates.InetSocketAddressConnect;
|
|||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
|
@ -312,7 +312,7 @@ public class ElasticStackClientLiveTest {
|
|||
}
|
||||
|
||||
protected void doConnectViaSsh(Server server, Credentials creds) throws IOException {
|
||||
SshClient ssh = Guice.createInjector(new JschSshClientModule()).getInstance(SshClient.Factory.class).create(
|
||||
SshClient ssh = Guice.createInjector(new SshjSshClientModule()).getInstance(SshClient.Factory.class).create(
|
||||
new IPSocket(server.getVnc().getIp(), 22), creds);
|
||||
try {
|
||||
ssh.connect();
|
||||
|
|
|
@ -21,9 +21,11 @@ package org.jclouds.elasticstack.compute;
|
|||
import org.jclouds.compute.BaseComputeServiceLiveTest;
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
|
@ -34,8 +36,8 @@ public class ElasticStackComputeServiceLiveTest extends BaseComputeServiceLiveTe
|
|||
}
|
||||
|
||||
@Override
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -68,17 +68,6 @@
|
|||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
|
@ -86,9 +75,9 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -55,12 +55,13 @@ import org.jclouds.net.IPSocket;
|
|||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.ssh.SshException;
|
||||
import org.jclouds.ssh.jsch.JschSshClient;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.SshjSshClient;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* @author Victor Galkin
|
||||
|
@ -91,8 +92,8 @@ public class ComputeBase {
|
|||
return new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
private Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
protected TemplateBuilder getDefaultTemplateBuilder() {
|
||||
|
@ -150,7 +151,7 @@ public class ComputeBase {
|
|||
protected void awaitForSshPort(String address, Credentials credentials) throws URISyntaxException {
|
||||
IPSocket socket = new IPSocket(address, 22);
|
||||
|
||||
JschSshClient ssh = new JschSshClient(
|
||||
SshjSshClient ssh = new SshjSshClient(
|
||||
new BackoffLimitedRetryHandler(), socket, 10000, credentials.identity, null, credentials.credential.getBytes());
|
||||
while (true) {
|
||||
try {
|
||||
|
|
|
@ -18,7 +18,14 @@
|
|||
*/
|
||||
package org.jclouds.openstack.nova.live.compute;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import static org.jclouds.openstack.nova.live.PropertyHelper.setupOverrides;
|
||||
import static org.jclouds.openstack.nova.live.PropertyHelper.setupProperties;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
|
@ -27,18 +34,12 @@ import org.jclouds.compute.domain.NodeMetadata;
|
|||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterTest;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.jclouds.openstack.nova.live.PropertyHelper.setupOverrides;
|
||||
import static org.jclouds.openstack.nova.live.PropertyHelper.setupProperties;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Not intended to be run with maven and does not performs a cleanup after tests
|
||||
|
@ -54,7 +55,7 @@ public class ComputeServiceCheck {
|
|||
contextFactory = new ComputeServiceContextFactory();
|
||||
Properties properties = setupOverrides(setupProperties(this.getClass()));
|
||||
context = contextFactory.createContext("nova",
|
||||
ImmutableSet.of(new JschSshClientModule(), new SLF4JLoggingModule()), properties);
|
||||
ImmutableSet.of(new SshjSshClientModule(), new SLF4JLoggingModule()), properties);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -18,16 +18,52 @@
|
|||
*/
|
||||
package org.jclouds.openstack.nova.live.compute;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.inject.Module;
|
||||
import com.jcraft.jsch.JSchException;
|
||||
import static com.google.common.base.Predicates.and;
|
||||
import static com.google.common.base.Predicates.not;
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.collect.Maps.newLinkedHashMap;
|
||||
import static com.google.common.collect.Maps.uniqueIndex;
|
||||
import static com.google.common.collect.Sets.filter;
|
||||
import static com.google.common.collect.Sets.newTreeSet;
|
||||
import static org.jclouds.compute.ComputeTestUtils.buildScript;
|
||||
import static org.jclouds.compute.options.TemplateOptions.Builder.overrideCredentialsWith;
|
||||
import static org.jclouds.compute.predicates.NodePredicates.TERMINATED;
|
||||
import static org.jclouds.compute.predicates.NodePredicates.all;
|
||||
import static org.jclouds.compute.predicates.NodePredicates.inGroup;
|
||||
import static org.jclouds.compute.predicates.NodePredicates.runningInGroup;
|
||||
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
|
||||
import static org.jclouds.compute.util.ComputeServiceUtils.parseGroupFromName;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.compute.RunNodesException;
|
||||
import org.jclouds.compute.RunScriptOnNodesException;
|
||||
import org.jclouds.compute.domain.*;
|
||||
import org.jclouds.compute.domain.ComputeMetadata;
|
||||
import org.jclouds.compute.domain.ComputeType;
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.domain.Hardware;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.compute.domain.OperatingSystem;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.Location;
|
||||
|
@ -40,25 +76,10 @@ import org.testng.annotations.AfterTest;
|
|||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import static com.google.common.base.Predicates.and;
|
||||
import static com.google.common.base.Predicates.not;
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.collect.Maps.newLinkedHashMap;
|
||||
import static com.google.common.collect.Maps.uniqueIndex;
|
||||
import static com.google.common.collect.Sets.filter;
|
||||
import static com.google.common.collect.Sets.newTreeSet;
|
||||
import static org.jclouds.compute.ComputeTestUtils.buildScript;
|
||||
import static org.jclouds.compute.options.TemplateOptions.Builder.overrideCredentialsWith;
|
||||
import static org.jclouds.compute.predicates.NodePredicates.*;
|
||||
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
|
||||
import static org.jclouds.compute.util.ComputeServiceUtils.parseGroupFromName;
|
||||
import static org.testng.Assert.*;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* Generally disabled, as it incurs higher fees.
|
||||
|
@ -129,7 +150,7 @@ public class NovaComputeServiceLiveTest extends ComputeBase {
|
|||
.family(OsFamily.UBUNTU).description("ffoo").build()));
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = JSchException.class, expectedExceptionsMessageRegExp = "Auth fail", timeOut = 120000)
|
||||
@Test(expectedExceptions = AuthorizationException.class, expectedExceptionsMessageRegExp = "Auth fail", timeOut = 120000)
|
||||
void testScriptExecutionWithWrongCredentials() throws Throwable, RunScriptOnNodesException, URISyntaxException, InterruptedException {
|
||||
NodeMetadata node = getDefaultNodeImmediately(group);
|
||||
String address = awaitForPublicAddressAssigned(node.getId());
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.jclouds.predicates.RetryablePredicate;
|
|||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
@ -65,7 +65,7 @@ public class ClientBase {
|
|||
Properties properties = setupOverrides(setupProperties(this.getClass()));
|
||||
|
||||
Injector injector = new RestContextFactory().createContextBuilder(provider,
|
||||
ImmutableSet.<Module>of(new SLF4JLoggingModule(), new JschSshClientModule()), properties)
|
||||
ImmutableSet.<Module>of(new SLF4JLoggingModule(), new SshjSshClientModule()), properties)
|
||||
.buildInjector();
|
||||
|
||||
client = injector.getInstance(NovaClient.class);
|
||||
|
|
|
@ -18,11 +18,16 @@
|
|||
*/
|
||||
package org.jclouds.openstack.nova.live.novaclient;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import static org.jclouds.openstack.nova.live.PropertyHelper.setupKeyPair;
|
||||
import static org.jclouds.openstack.nova.live.PropertyHelper.setupOverrides;
|
||||
import static org.jclouds.openstack.nova.live.PropertyHelper.setupProperties;
|
||||
import static org.jclouds.openstack.nova.options.CreateServerOptions.Builder.withFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||
import org.jclouds.net.IPSocket;
|
||||
|
@ -33,18 +38,16 @@ import org.jclouds.predicates.RetryablePredicate;
|
|||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.jclouds.openstack.nova.live.PropertyHelper.*;
|
||||
import static org.jclouds.openstack.nova.options.CreateServerOptions.Builder.withFile;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* @author Victor Galkin
|
||||
|
@ -67,7 +70,7 @@ public class ServerCreateLiveTest {
|
|||
Properties properties = setupOverrides(setupProperties(this.getClass()));
|
||||
|
||||
Injector injector = new RestContextFactory().createContextBuilder(provider,
|
||||
ImmutableSet.<Module>of(new SLF4JLoggingModule(), new JschSshClientModule()), properties)
|
||||
ImmutableSet.<Module>of(new SLF4JLoggingModule(), new SshjSshClientModule()), properties)
|
||||
.buildInjector();
|
||||
|
||||
client = injector.getInstance(NovaClient.class);
|
||||
|
|
|
@ -74,21 +74,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.compute.domain.ComputeMetadata;
|
|||
import org.jclouds.compute.domain.ComputeType;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.vcloud.VCloudAsyncClient;
|
||||
import org.jclouds.vcloud.VCloudClient;
|
||||
import org.jclouds.vcloud.domain.VApp;
|
||||
|
@ -48,8 +48,8 @@ public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
public void testAssignability() throws Exception {
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jclouds.predicates.InetSocketAddressConnect;
|
|||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.ssh.SshClient.Factory;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.vcloud.VCloudClient;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
|
@ -104,8 +104,8 @@ public abstract class BaseVCloudClientLiveTest {
|
|||
return RestContextFactory.getPropertiesFromResource("/rest.properties");
|
||||
}
|
||||
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
@AfterGroups(groups = { "live" })
|
||||
|
|
|
@ -68,16 +68,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -54,7 +54,7 @@ import org.jclouds.rest.RestContextFactory;
|
|||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.SshClient.Factory;
|
||||
import org.jclouds.ssh.SshException;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Catalog;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CustomizationParameters;
|
||||
|
@ -469,7 +469,7 @@ public abstract class TerremarkClientLiveTest {
|
|||
Properties overrides = setupProperties();
|
||||
|
||||
injector = new RestContextFactory().createContextBuilder(provider,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides).buildInjector();
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides).buildInjector();
|
||||
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
socketTester = new RetryablePredicate<IPSocket>(injector.getInstance(SocketOpen.class), 130, 10, TimeUnit.SECONDS);// make
|
||||
|
|
|
@ -30,9 +30,8 @@ import org.jclouds.compute.domain.Image;
|
|||
import org.jclouds.lifecycle.Closer;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.compute.suppliers.VAppTemplatesInOrgs;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.AllCatalogItemsInOrg;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
|
@ -88,7 +87,7 @@ public class VAppTemplatesInOrgsLiveTest {
|
|||
Properties overrides = setupProperties();
|
||||
|
||||
Injector injector = new RestContextFactory().createContextBuilder(provider,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()),overrides).buildInjector();
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()),overrides).buildInjector();
|
||||
|
||||
tmClient = injector.getInstance(TerremarkVCloudClient.class);
|
||||
allCatalogItemsInOrg = injector.getInstance(AllCatalogItemsInOrg.class);
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jclouds.predicates.InetSocketAddressConnect;
|
|||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.ssh.SshClient.Factory;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
|
@ -105,8 +105,8 @@ public abstract class BaseTerremarkClientLiveTest <T extends TerremarkVCloudClie
|
|||
return RestContextFactory.getPropertiesFromResource("/rest.properties");
|
||||
}
|
||||
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
@AfterGroups(groups = { "live" })
|
||||
|
|
|
@ -52,7 +52,7 @@ webserver:
|
|||
;; create a compute service using ssh and log4j extensions
|
||||
(def compute
|
||||
(compute-service
|
||||
provider provider-identity provider-credential :ssh :log4j))
|
||||
provider provider-identity provider-credential :sshj :log4j))
|
||||
|
||||
(create-node \"webserver\" compute)
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ Here's an example of creating and running a small linux node in the group webser
|
|||
;; create a compute service using ssh and log4j extensions
|
||||
(def compute
|
||||
(compute-service
|
||||
provider provider-identity provider-credential :ssh :log4j))
|
||||
provider provider-identity provider-credential :sshj :log4j))
|
||||
|
||||
(create-node \"webserver\" compute)
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
:slf4j 'org.jclouds.logging.slf4j.config.SLF4JLoggingModule
|
||||
:lognull 'org.jclouds.logging.config.NullLoggingModule
|
||||
:ssh 'org.jclouds.ssh.jsch.config.JschSshClientModule
|
||||
:jsch 'org.jclouds.ssh.jsch.config.JschSshClientModule
|
||||
:sshj 'org.jclouds.sshj.config.SshjSshClientModule
|
||||
:enterprise 'org.jclouds.enterprise.config.EnterpriseConfigurationModule
|
||||
:apachehc 'org.jclouds.http.apachehc.config.ApacheHCHttpCommandExecutorServiceModule
|
||||
:ning 'org.jclouds.http.ning.config.NingHttpCommandExecutorServiceModule
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
<module>bouncycastle</module>
|
||||
<module>log4j</module>
|
||||
<module>slf4j</module>
|
||||
<module>sshj</module>
|
||||
<module>jsch</module>
|
||||
<module>netty</module>
|
||||
<module>enterprise</module>
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
|
||||
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
|
||||
====================================================================
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
====================================================================
|
||||
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-project</artifactId>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
<relativePath>../../project/pom.xml</relativePath>
|
||||
</parent>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<name>jclouds sshj ssh client</name>
|
||||
<description>jclouds sshj ssh client</description>
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<!-- bootstrapping: need to fetch the project POM -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jclouds-sona-snapshots-nexus</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-compute</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-slf4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-bouncycastle</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.schmizz</groupId>
|
||||
<artifactId>sshj</artifactId>
|
||||
<version>0.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||
<Export-Package>org.jclouds.sshj.*;version="${project.version}"</Export-Package>
|
||||
<Import-Package>org.jclouds.*;version="${project.version}",*</Import-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,483 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.jclouds.sshj;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.base.Predicates.instanceOf;
|
||||
import static com.google.common.base.Predicates.or;
|
||||
import static com.google.common.base.Throwables.getCausalChain;
|
||||
import static com.google.common.collect.Iterables.any;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Named;
|
||||
|
||||
import net.schmizz.sshj.common.IOUtils;
|
||||
import net.schmizz.sshj.connection.ConnectionException;
|
||||
import net.schmizz.sshj.connection.channel.direct.Session;
|
||||
import net.schmizz.sshj.connection.channel.direct.Session.Command;
|
||||
import net.schmizz.sshj.sftp.SFTPClient;
|
||||
import net.schmizz.sshj.transport.TransportException;
|
||||
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;
|
||||
import net.schmizz.sshj.userauth.UserAuthException;
|
||||
import net.schmizz.sshj.userauth.keyprovider.OpenSSHKeyFile;
|
||||
import net.schmizz.sshj.xfer.InMemorySourceFile;
|
||||
|
||||
import org.apache.commons.io.input.ProxyInputStream;
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.SshException;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* This class needs refactoring. It is not thread safe.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class SshjSshClient implements SshClient {
|
||||
|
||||
private final class CloseFtpChannelOnCloseInputStream extends ProxyInputStream {
|
||||
|
||||
private final SFTPClient sftp;
|
||||
|
||||
private CloseFtpChannelOnCloseInputStream(InputStream proxy, SFTPClient sftp) {
|
||||
super(proxy);
|
||||
this.sftp = sftp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
super.close();
|
||||
if (sftp != null)
|
||||
sftp.close();
|
||||
}
|
||||
}
|
||||
|
||||
private final String host;
|
||||
private final int port;
|
||||
private final String username;
|
||||
private final String password;
|
||||
|
||||
@Inject(optional = true)
|
||||
@Named("jclouds.ssh.max-retries")
|
||||
@VisibleForTesting
|
||||
int sshRetries = 5;
|
||||
|
||||
@Inject(optional = true)
|
||||
@Named("jclouds.ssh.retry-auth")
|
||||
@VisibleForTesting
|
||||
boolean retryAuth;
|
||||
|
||||
@Inject(optional = true)
|
||||
@Named("jclouds.ssh.retryable-messages")
|
||||
@VisibleForTesting
|
||||
String retryableMessages = "";
|
||||
|
||||
@Inject(optional = true)
|
||||
@Named("jclouds.ssh.retry-predicate")
|
||||
// NOTE cannot retry io exceptions, as SSHException is a part of the chain
|
||||
private Predicate<Throwable> retryPredicate = or(instanceOf(ConnectionException.class),
|
||||
instanceOf(TransportException.class));
|
||||
|
||||
@Resource
|
||||
@Named("jclouds.ssh")
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
private net.schmizz.sshj.SSHClient ssh;
|
||||
private final byte[] privateKey;
|
||||
final byte[] emptyPassPhrase = new byte[0];
|
||||
private final int timeoutMillis;
|
||||
private final BackoffLimitedRetryHandler backoffLimitedRetryHandler;
|
||||
|
||||
public SshjSshClient(BackoffLimitedRetryHandler backoffLimitedRetryHandler, IPSocket socket, int timeout,
|
||||
String username, String password, byte[] privateKey) {
|
||||
this.host = checkNotNull(socket, "socket").getAddress();
|
||||
checkArgument(socket.getPort() > 0, "ssh port must be greater then zero" + socket.getPort());
|
||||
checkArgument(password != null || privateKey != null, "you must specify a password or a key");
|
||||
this.port = socket.getPort();
|
||||
this.username = checkNotNull(username, "username");
|
||||
this.backoffLimitedRetryHandler = checkNotNull(backoffLimitedRetryHandler, "backoffLimitedRetryHandler");
|
||||
this.timeoutMillis = timeout;
|
||||
this.password = password;
|
||||
this.privateKey = privateKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(String path, String contents) {
|
||||
put(path, Payloads.newStringPayload(checkNotNull(contents, "contents")));
|
||||
}
|
||||
|
||||
private void checkConnected() {
|
||||
checkState(ssh != null && ssh.isConnected(), String.format("(%s) ssh not connected!", toString()));
|
||||
}
|
||||
|
||||
public static interface Connection<T> {
|
||||
void clear() throws Exception;
|
||||
|
||||
T create() throws Exception;
|
||||
}
|
||||
|
||||
Connection<net.schmizz.sshj.SSHClient> sshConnection = new Connection<net.schmizz.sshj.SSHClient>() {
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
if (ssh != null && ssh.isConnected()) {
|
||||
try {
|
||||
ssh.disconnect();
|
||||
} catch (IOException e) {
|
||||
Throwables.propagate(e);
|
||||
}
|
||||
ssh = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.schmizz.sshj.SSHClient create() throws Exception {
|
||||
net.schmizz.sshj.SSHClient ssh = new net.schmizz.sshj.SSHClient();
|
||||
ssh.addHostKeyVerifier(new PromiscuousVerifier());
|
||||
if (timeoutMillis != 0) {
|
||||
ssh.setTimeout(timeoutMillis);
|
||||
ssh.setConnectTimeout(timeoutMillis);
|
||||
}
|
||||
ssh.connect(host, port);
|
||||
if (password != null) {
|
||||
ssh.authPassword(username, password);
|
||||
} else {
|
||||
OpenSSHKeyFile key = new OpenSSHKeyFile();
|
||||
key.init(new String(privateKey), null);
|
||||
ssh.authPublickey(username, key);
|
||||
}
|
||||
return ssh;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("SSHClient(%s)", SshjSshClient.this.toString());
|
||||
}
|
||||
};
|
||||
|
||||
private void backoffForAttempt(int retryAttempt, String message) {
|
||||
backoffLimitedRetryHandler.imposeBackoffExponentialDelay(200L, 2, retryAttempt, sshRetries, message);
|
||||
}
|
||||
|
||||
protected <T, C extends Connection<T>> T acquire(C connection) {
|
||||
String errorMessage = String.format("(%s) error acquiring %s", toString(), connection);
|
||||
for (int i = 0; i < sshRetries; i++) {
|
||||
try {
|
||||
connection.clear();
|
||||
logger.debug(">> (%s) acquiring %s", toString(), connection);
|
||||
T returnVal = connection.create();
|
||||
logger.debug("<< (%s) acquired %s", toString(), returnVal);
|
||||
return returnVal;
|
||||
} catch (Exception from) {
|
||||
try {
|
||||
connection.clear();
|
||||
} catch (Exception e1) {
|
||||
logger.warn(from, "<< (%s) error closing connection", toString());
|
||||
}
|
||||
if (i + 1 == sshRetries) {
|
||||
throw propagate(from, errorMessage);
|
||||
} else if (shouldRetry(from)) {
|
||||
logger.warn(from, "<< " + errorMessage + ": " + from.getMessage());
|
||||
backoffForAttempt(i + 1, errorMessage + ": " + from.getMessage());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert false : "should not reach here";
|
||||
return null;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void connect() {
|
||||
try {
|
||||
ssh = acquire(sshConnection);
|
||||
} catch (Exception e) {
|
||||
Throwables.propagate(e);
|
||||
}
|
||||
}
|
||||
|
||||
Connection<SFTPClient> sftpConnection = new Connection<SFTPClient>() {
|
||||
|
||||
private SFTPClient sftp;
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
if (sftp != null)
|
||||
try {
|
||||
sftp.close();
|
||||
} catch (IOException e) {
|
||||
Throwables.propagate(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SFTPClient create() throws IOException {
|
||||
checkConnected();
|
||||
sftp = ssh.newSFTPClient();
|
||||
return sftp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SFTPClient(" + SshjSshClient.this.toString() + ")";
|
||||
}
|
||||
};
|
||||
|
||||
class GetConnection implements Connection<Payload> {
|
||||
private final String path;
|
||||
private SFTPClient sftp;
|
||||
|
||||
GetConnection(String path) {
|
||||
this.path = checkNotNull(path, "path");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() throws IOException {
|
||||
if (sftp != null)
|
||||
sftp.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Payload create() throws Exception {
|
||||
sftp = acquire(sftpConnection);
|
||||
return Payloads.newInputStreamPayload(new CloseFtpChannelOnCloseInputStream(sftp.getSFTPEngine().open(path)
|
||||
.getInputStream(), sftp));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Payload(" + SshjSshClient.this.toString() + ")[" + path + "]";
|
||||
}
|
||||
};
|
||||
|
||||
public Payload get(String path) {
|
||||
return acquire(new GetConnection(path));
|
||||
}
|
||||
|
||||
class PutConnection implements Connection<Void> {
|
||||
private final String path;
|
||||
private final Payload contents;
|
||||
private SFTPClient sftp;
|
||||
|
||||
PutConnection(String path, Payload contents) {
|
||||
this.path = checkNotNull(path, "path");
|
||||
this.contents = checkNotNull(contents, "contents");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
if (sftp != null)
|
||||
try {
|
||||
sftp.close();
|
||||
} catch (IOException e) {
|
||||
Throwables.propagate(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void create() throws Exception {
|
||||
sftp = acquire(sftpConnection);
|
||||
try {
|
||||
sftp.put(new InMemorySourceFile() {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength() {
|
||||
return contents.getContentMetadata().getContentLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return checkNotNull(contents.getInput(), "inputstream for path %s", path);
|
||||
}
|
||||
|
||||
}, path);
|
||||
} finally {
|
||||
contents.release();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Put(" + SshjSshClient.this.toString() + ")[" + path + "]";
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void put(String path, Payload contents) {
|
||||
acquire(new PutConnection(path, contents));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
boolean shouldRetry(Exception from) {
|
||||
Predicate<Throwable> predicate = retryAuth ? Predicates.<Throwable>or(retryPredicate, instanceOf(AuthorizationException.class))
|
||||
: retryPredicate;
|
||||
if (any(getCausalChain(from), predicate))
|
||||
return true;
|
||||
if (!retryableMessages.equals(""))
|
||||
return any(Splitter.on(",").split(retryableMessages), causalChainHasMessageContaining(from));
|
||||
return false;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
Predicate<String> causalChainHasMessageContaining(final Exception from) {
|
||||
return new Predicate<String>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(final String input) {
|
||||
return any(getCausalChain(from), new Predicate<Throwable>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(Throwable arg0) {
|
||||
return arg0.getMessage() != null && arg0.getMessage().indexOf(input) != -1;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
SshException propagate(Exception e, String message) {
|
||||
message += ": " + e.getMessage();
|
||||
logger.error(e, "<< " + message);
|
||||
if (e instanceof UserAuthException)
|
||||
throw new AuthorizationException("(" + toString() + ") " + message, e);
|
||||
throw e instanceof SshException ? SshException.class.cast(e) : new SshException(
|
||||
"(" + toString() + ") " + message, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s@%s:%d", username, host, port);
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void disconnect() {
|
||||
try {
|
||||
sshConnection.clear();
|
||||
} catch (Exception e) {
|
||||
Throwables.propagate(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected Connection<Session> execConnection() {
|
||||
|
||||
return new Connection<Session>() {
|
||||
|
||||
private Session session = null;
|
||||
|
||||
@Override
|
||||
public void clear() throws TransportException, ConnectionException {
|
||||
if (session != null)
|
||||
session.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Session create() throws Exception {
|
||||
checkConnected();
|
||||
session = ssh.startSession();
|
||||
session.allocateDefaultPTY();
|
||||
return session;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Session(" + SshjSshClient.this.toString() + ")";
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class ExecConnection implements Connection<ExecResponse> {
|
||||
private final String command;
|
||||
private Session session;
|
||||
|
||||
ExecConnection(String command) {
|
||||
this.command = checkNotNull(command, "command");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() throws TransportException, ConnectionException {
|
||||
if (session != null)
|
||||
session.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecResponse create() throws Exception {
|
||||
try {
|
||||
session = acquire(execConnection());
|
||||
Command output = session.exec(checkNotNull(command, "command"));
|
||||
String outputString = IOUtils.readFully(output.getInputStream()).toString();
|
||||
output.join(timeoutMillis, TimeUnit.SECONDS);
|
||||
int errorStatus = output.getExitStatus();
|
||||
String errorString = IOUtils.readFully(output.getErrorStream()).toString();
|
||||
return new ExecResponse(outputString, errorString, errorStatus);
|
||||
} finally {
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ExecResponse(" + SshjSshClient.this.toString() + ")[" + command + "]";
|
||||
}
|
||||
}
|
||||
|
||||
public ExecResponse exec(String command) {
|
||||
return acquire(new ExecConnection(command));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHostAddress() {
|
||||
return this.host;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.jclouds.sshj.config;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.ssh.ConfiguresSshClient;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.sshj.SshjSshClient;
|
||||
import org.jclouds.util.CredentialUtils;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Scopes;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@ConfiguresSshClient
|
||||
public class SshjSshClientModule extends AbstractModule {
|
||||
|
||||
protected void configure() {
|
||||
bind(SshClient.Factory.class).to(Factory.class).in(Scopes.SINGLETON);
|
||||
bind(SocketOpen.class).to(InetSocketAddressConnect.class).in(Scopes.SINGLETON);
|
||||
}
|
||||
|
||||
private static class Factory implements SshClient.Factory {
|
||||
@Named(Constants.PROPERTY_CONNECTION_TIMEOUT)
|
||||
@Inject(optional = true)
|
||||
int timeout = 60000;
|
||||
|
||||
private final BackoffLimitedRetryHandler backoffLimitedRetryHandler;
|
||||
private final Injector injector;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Inject
|
||||
public Factory(BackoffLimitedRetryHandler backoffLimitedRetryHandler, Injector injector) {
|
||||
this.backoffLimitedRetryHandler = backoffLimitedRetryHandler;
|
||||
this.injector = injector;
|
||||
}
|
||||
|
||||
public SshClient create(IPSocket socket, String username, String password) {
|
||||
SshClient client = new SshjSshClient(backoffLimitedRetryHandler, socket, timeout, username, password, null);
|
||||
injector.injectMembers(client);// add logger
|
||||
return client;
|
||||
}
|
||||
|
||||
public SshClient create(IPSocket socket, String username, byte[] privateKey) {
|
||||
SshClient client = new SshjSshClient(backoffLimitedRetryHandler, socket, timeout, username, null, privateKey);
|
||||
injector.injectMembers(client);// add logger
|
||||
return client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SshClient create(IPSocket socket, Credentials credentials) {
|
||||
return CredentialUtils.isPrivateKeyCredential(credentials) ? create(socket, credentials.identity,
|
||||
credentials.credential.getBytes()) : create(socket, credentials.identity, credentials.credential);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.jclouds.sshj;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
* Tests the ability of a {@link SshjSshClient}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live")
|
||||
public class SshjSshClientLiveTest {
|
||||
protected static final String sshHost = System.getProperty("test.ssh.host", "localhost");
|
||||
protected static final String sshPort = System.getProperty("test.ssh.port", "22");
|
||||
protected static final String sshUser = System.getProperty("test.ssh.username");
|
||||
protected static final String sshPass = System.getProperty("test.ssh.password");
|
||||
protected static final String sshKeyFile = System.getProperty("test.ssh.keyfile");
|
||||
private File temp;
|
||||
|
||||
@BeforeGroups(groups = { "live" })
|
||||
public SshClient setupClient() throws NumberFormatException, FileNotFoundException, IOException {
|
||||
int port = Integer.parseInt(sshPort);
|
||||
if (sshUser == null
|
||||
|| ((sshPass == null || sshPass.trim().equals("")) && (sshKeyFile == null || sshKeyFile.trim().equals("")))
|
||||
|| sshUser.trim().equals("")) {
|
||||
System.err.println("ssh credentials not present. Tests will be lame");
|
||||
return new SshClient() {
|
||||
|
||||
public void connect() {
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
}
|
||||
|
||||
public Payload get(String path) {
|
||||
if (path.equals("/etc/passwd")) {
|
||||
return Payloads.newStringPayload("root");
|
||||
} else if (path.equals(temp.getAbsolutePath())) {
|
||||
return Payloads.newStringPayload("rabbit");
|
||||
}
|
||||
throw new RuntimeException("path " + path + " not stubbed");
|
||||
}
|
||||
|
||||
public ExecResponse exec(String command) {
|
||||
if (command.equals("hostname")) {
|
||||
return new ExecResponse(sshHost, "", 0);
|
||||
}
|
||||
throw new RuntimeException("command " + command + " not stubbed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(String path, Payload contents) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHostAddress() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void put(String path, String contents) {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
} else {
|
||||
Injector i = Guice.createInjector(new SshjSshClientModule());
|
||||
SshClient.Factory factory = i.getInstance(SshClient.Factory.class);
|
||||
SshClient connection;
|
||||
if (sshKeyFile != null && !sshKeyFile.trim().equals("")) {
|
||||
connection = factory.create(new IPSocket(sshHost, port),
|
||||
new Credentials(sshUser, Strings2.toStringAndClose(new FileInputStream(sshKeyFile))));
|
||||
} else {
|
||||
connection = factory.create(new IPSocket(sshHost, port), new Credentials(sshUser, sshPass));
|
||||
}
|
||||
connection.connect();
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
|
||||
public void testPutAndGet() throws IOException {
|
||||
temp = File.createTempFile("foo", "bar");
|
||||
temp.deleteOnExit();
|
||||
SshClient client = setupClient();
|
||||
client.put(temp.getAbsolutePath(), Payloads.newStringPayload("rabbit"));
|
||||
Payload input = setupClient().get(temp.getAbsolutePath());
|
||||
String contents = Strings2.toStringAndClose(input.getInput());
|
||||
assertEquals(contents, "rabbit");
|
||||
}
|
||||
|
||||
public void testGetEtcPassword() throws IOException {
|
||||
Payload input = setupClient().get("/etc/passwd");
|
||||
String contents = Strings2.toStringAndClose(input.getInput());
|
||||
assert contents.indexOf("root") >= 0 : "no root in " + contents;
|
||||
}
|
||||
|
||||
public void testExecHostname() throws IOException {
|
||||
ExecResponse response = setupClient().exec("hostname");
|
||||
assertEquals(response.getError(), "");
|
||||
assertEquals(response.getOutput().trim(), sshHost);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.jclouds.sshj;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import net.schmizz.sshj.common.SSHException;
|
||||
import net.schmizz.sshj.connection.ConnectionException;
|
||||
import net.schmizz.sshj.transport.TransportException;
|
||||
import net.schmizz.sshj.userauth.UserAuthException;
|
||||
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test
|
||||
public class SshjSshClientTest {
|
||||
|
||||
protected SshjSshClient ssh;
|
||||
|
||||
@BeforeTest
|
||||
public void setupSsh() throws UnknownHostException {
|
||||
ssh = createClient();
|
||||
}
|
||||
|
||||
protected SshjSshClient createClient() throws UnknownHostException {
|
||||
Injector i = Guice.createInjector(module());
|
||||
SshClient.Factory factory = i.getInstance(SshClient.Factory.class);
|
||||
SshjSshClient ssh = SshjSshClient.class.cast(factory.create(new IPSocket("localhost", 22), new Credentials(
|
||||
"username", "password")));
|
||||
return ssh;
|
||||
}
|
||||
|
||||
protected Module module() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = AuthorizationException.class)
|
||||
public void testPropateConvertsAuthException() {
|
||||
ssh.propagate(new UserAuthException(""), "");
|
||||
}
|
||||
|
||||
public void testExceptionClassesRetry() {
|
||||
assert ssh.shouldRetry(new TransportException("socket closed"));
|
||||
assert ssh.shouldRetry(new ConnectionException("problem"));
|
||||
assert !ssh.shouldRetry(new IOException("channel %s is not open", new NullPointerException()));
|
||||
}
|
||||
|
||||
public void testOnlyRetryAuthWhenSet() throws UnknownHostException {
|
||||
SshjSshClient ssh1 = createClient();
|
||||
assert !ssh1.shouldRetry(new AuthorizationException("problem", null));
|
||||
ssh1.retryAuth = true;
|
||||
assert ssh1.shouldRetry(new AuthorizationException("problem", null));
|
||||
}
|
||||
|
||||
public void testExceptionMessagesRetry() {
|
||||
assert !ssh.shouldRetry(new SSHException(""));
|
||||
assert !ssh.shouldRetry(new NullPointerException((String) null));
|
||||
}
|
||||
|
||||
public void testCausalChainHasMessageContaining() {
|
||||
assert ssh.causalChainHasMessageContaining(
|
||||
new SSHException("Session.connect: java.io.IOException: End of IO Stream Read")).apply(
|
||||
" End of IO Stream Read");
|
||||
assert ssh.causalChainHasMessageContaining(
|
||||
new SSHException("Session.connect: java.net.SocketException: Connection reset")).apply("java.net.Socket");
|
||||
assert !ssh.causalChainHasMessageContaining(new NullPointerException()).apply(" End of IO Stream Read");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||
*
|
||||
* ====================================================================
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ====================================================================
|
||||
*/
|
||||
package org.jclouds.sshj.config;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.sshj.SshjSshClient;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
* Tests the ability to configure a {@link SshjSshClient}
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test
|
||||
public class SshjSshClientModuleTest {
|
||||
|
||||
public void testConfigureBindsClient() throws UnknownHostException {
|
||||
|
||||
Injector i = Guice.createInjector(new SshjSshClientModule());
|
||||
SshClient.Factory factory = i.getInstance(SshClient.Factory.class);
|
||||
SshClient connection = factory.create(new IPSocket("localhost", 22), new Credentials("username", "password"));
|
||||
assert connection instanceof SshjSshClient;
|
||||
}
|
||||
}
|
|
@ -81,21 +81,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -85,7 +85,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
|||
.build();
|
||||
|
||||
assert (template.getImage().getProviderId().startsWith("ami-")) : template;
|
||||
assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.10");
|
||||
assertEquals(template.getImage().getOperatingSystem().getVersion(), "11.04");
|
||||
assertEquals(template.getImage().getOperatingSystem().is64Bit(), false);
|
||||
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
|
||||
|
@ -146,7 +146,7 @@ public class AWSEC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
|
|||
fastestTemplate = context.getComputeService().templateBuilder().fastest().build();
|
||||
assert (fastestTemplate.getImage().getProviderId().startsWith("ami-")) : fastestTemplate;
|
||||
assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC1_4XLARGE);
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "11.04");
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||
assertEquals(fastestTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
|
||||
|
|
|
@ -144,7 +144,7 @@ public class AMIClientLiveTest {
|
|||
.put("root-device-type", "ebs")//
|
||||
.build()).ownedBy("137112412989", "099720109477"));
|
||||
assertNotNull(twoResults);
|
||||
assertEquals(twoResults.size(), 26);
|
||||
assertEquals(twoResults.size(), 28);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
|
|
@ -52,7 +52,7 @@ import org.jclouds.domain.Credentials;
|
|||
import org.jclouds.ec2.domain.KeyPair;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterTest;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -104,7 +104,7 @@ public class AWSKeyPairClientLiveTest {
|
|||
setupCredentials();
|
||||
Properties overrides = setupProperties();
|
||||
computeContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.<Module> of(
|
||||
new Log4JLoggingModule(), new JschSshClientModule()), overrides);
|
||||
new Log4JLoggingModule(), new SshjSshClientModule()), overrides);
|
||||
context = computeContext.getProviderSpecificContext();
|
||||
client = context.getApi().getKeyPairServices();
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.jclouds.compute.predicates.NodePredicates;
|
|||
import org.jclouds.ec2.domain.InstanceType;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
|
@ -108,7 +108,7 @@ public class PlacementGroupClientLiveTest {
|
|||
setupCredentials();
|
||||
Properties overrides = setupProperties();
|
||||
context = new ComputeServiceContextFactory().createContext(provider,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides);
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides);
|
||||
keyPair = setupKeyPair();
|
||||
|
||||
client = AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi());
|
||||
|
|
|
@ -47,7 +47,7 @@ import org.jclouds.compute.ComputeServiceContextFactory;
|
|||
import org.jclouds.ec2.domain.InstanceType;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
|
@ -105,7 +105,7 @@ public class SpotInstanceClientLiveTest {
|
|||
setupCredentials();
|
||||
Properties overrides = setupProperties();
|
||||
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.<Module> of(
|
||||
new Log4JLoggingModule(), new JschSshClientModule()), overrides);
|
||||
new Log4JLoggingModule(), new SshjSshClientModule()), overrides);
|
||||
|
||||
client = AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi());
|
||||
activeTester = new RetryablePredicate<SpotInstanceRequest>(new SpotInstanceRequestActive(client),
|
||||
|
|
|
@ -76,21 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -76,21 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -76,21 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -81,21 +81,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -81,21 +81,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -53,15 +53,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-core</artifactId>
|
||||
|
@ -76,12 +71,6 @@
|
|||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
|
|
|
@ -55,7 +55,7 @@ import org.jclouds.predicates.InetSocketAddressConnect;
|
|||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -411,7 +411,7 @@ public class CloudSigmaClientLiveTest {
|
|||
}
|
||||
|
||||
protected void doConnectViaSsh(Server server, Credentials creds) throws IOException {
|
||||
SshClient ssh = Guice.createInjector(new JschSshClientModule()).getInstance(SshClient.Factory.class)
|
||||
SshClient ssh = Guice.createInjector(new SshjSshClientModule()).getInstance(SshClient.Factory.class)
|
||||
.create(new IPSocket(server.getVnc().getIp(), 22), creds);
|
||||
try {
|
||||
ssh.connect();
|
||||
|
|
|
@ -19,9 +19,11 @@
|
|||
package org.jclouds.cloudsigma.compute;
|
||||
|
||||
import org.jclouds.compute.BaseComputeServiceLiveTest;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
|
@ -32,8 +34,8 @@ public class CloudSigmaComputeServiceLiveTest extends BaseComputeServiceLiveTest
|
|||
}
|
||||
|
||||
@Override
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -76,21 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -76,21 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -76,21 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -82,17 +82,6 @@
|
|||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
|
@ -100,9 +89,9 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -50,12 +50,8 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -72,12 +68,6 @@
|
|||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
|
|
|
@ -62,7 +62,7 @@ import org.jclouds.predicates.InetSocketAddressConnect;
|
|||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.jsch.JschSshClient;
|
||||
import org.jclouds.sshj.SshjSshClient;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.TestException;
|
||||
import org.testng.annotations.AfterTest;
|
||||
|
@ -379,7 +379,7 @@ public class GoGridLiveTestDisabled {
|
|||
|
||||
socketOpen.apply(socket);
|
||||
|
||||
SshClient sshClient = new JschSshClient(new BackoffLimitedRetryHandler(), socket, 60000,
|
||||
SshClient sshClient = new SshjSshClient(new BackoffLimitedRetryHandler(), socket, 60000,
|
||||
instanceCredentials.identity, instanceCredentials.credential, null);
|
||||
sshClient.connect();
|
||||
String output = sshClient.exec("df").getOutput();
|
||||
|
|
|
@ -21,9 +21,11 @@ package org.jclouds.gogrid.compute;
|
|||
import org.jclouds.compute.BaseComputeServiceLiveTest;
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* @author Oleksiy Yarmula
|
||||
*/
|
||||
|
@ -35,8 +37,8 @@ public class GoGridComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node1) {
|
||||
|
|
|
@ -77,21 +77,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -76,21 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -83,21 +83,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.Properties;
|
|||
|
||||
import org.jclouds.Constants;
|
||||
import org.jclouds.compute.BaseComputeServiceLiveTest;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
@ -38,7 +38,7 @@ public class VPDCComputeServiceLiveTestDisabled extends BaseComputeServiceLiveTe
|
|||
|
||||
@Override
|
||||
protected Module getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jclouds.savvis.vpdc.VPDCAsyncClient;
|
|||
import org.jclouds.savvis.vpdc.VPDCClient;
|
||||
import org.jclouds.savvis.vpdc.predicates.TaskSuccess;
|
||||
import org.jclouds.savvis.vpdc.reference.VPDCConstants;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -91,7 +91,7 @@ public class BaseVPDCClientLiveTest {
|
|||
setupCredentials();
|
||||
Properties overrides = setupProperties();
|
||||
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.<Module> of(
|
||||
new Log4JLoggingModule(), new JschSshClientModule()), overrides);
|
||||
new Log4JLoggingModule(), new SshjSshClientModule()), overrides);
|
||||
restContext = context.getProviderSpecificContext();
|
||||
taskTester = new RetryablePredicate<String>(new TaskSuccess(restContext.getApi()), 7200, 10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
|
|
@ -76,21 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -76,21 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -60,12 +60,6 @@
|
|||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
|
@ -74,15 +68,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.jclouds.slicehost.domain.Image;
|
|||
import org.jclouds.slicehost.domain.Slice;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.SshException;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterTest;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -96,7 +96,7 @@ public class SlicehostClientLiveTest {
|
|||
Properties overrides = setupProperties();
|
||||
|
||||
Injector injector = new RestContextFactory().createContextBuilder(provider,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides).buildInjector();
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides).buildInjector();
|
||||
|
||||
client = injector.getInstance(SlicehostClient.class);
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package org.jclouds.slicehost.compute;
|
||||
|
||||
import org.jclouds.compute.BaseComputeServiceLiveTest;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
|
@ -35,8 +35,8 @@ public class SlicehostComputeServiceLiveTest extends BaseComputeServiceLiveTest
|
|||
}
|
||||
|
||||
@Override
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected SshjSshClientModule getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = UnsupportedOperationException.class)
|
||||
|
|
|
@ -76,21 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -77,21 +77,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -32,12 +32,14 @@ import org.jclouds.compute.domain.OsFamily;
|
|||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VApp;
|
||||
import org.jclouds.trmk.vcloud_0_8.reference.VCloudConstants;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* This test is disabled, as it doesn't work while there are too few public ip
|
||||
* addresses.
|
||||
|
@ -108,8 +110,8 @@ public class TerremarkECloudComputeServiceLiveTest extends BaseComputeServiceLiv
|
|||
}
|
||||
|
||||
@Override
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
}
|
|
@ -76,21 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -30,12 +30,10 @@ import org.jclouds.Constants;
|
|||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.InternetService;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.Node;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress;
|
||||
import org.jclouds.trmk.vcloudexpress.TerremarkVCloudExpressAsyncClient;
|
||||
import org.jclouds.trmk.vcloudexpress.TerremarkVCloudExpressClient;
|
||||
import org.testng.annotations.AfterTest;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -123,7 +121,7 @@ public class InternetServiceLiveTest {
|
|||
Properties overrides = setupProperties();
|
||||
|
||||
context = new ComputeServiceContextFactory().createContext(provider,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides)
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides)
|
||||
.getProviderSpecificContext();
|
||||
|
||||
tmClient = context.getApi();
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.compute.domain.OsFamily;
|
|||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.VApp;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -93,8 +93,8 @@ public class TerremarkVCloudExpressComputeServiceLiveTest extends BaseComputeSer
|
|||
}
|
||||
|
||||
@Override
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected SshjSshClientModule getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
}
|
|
@ -83,21 +83,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.jclouds.compute.ComputeTestUtils;
|
|||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -82,7 +82,7 @@ public abstract class BaseIBMSmartCloudClientLiveTest {
|
|||
setupCredentials();
|
||||
Properties overrides = setupProperties();
|
||||
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule(),
|
||||
new JschSshClientModule()), overrides);
|
||||
new SshjSshClientModule()), overrides);
|
||||
|
||||
connection = context.getApi();
|
||||
keyPair = ComputeTestUtils.setupKeyPair();
|
||||
|
|
|
@ -37,14 +37,14 @@ import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
|
|||
import org.jclouds.ibm.smartcloud.domain.Address;
|
||||
import org.jclouds.ibm.smartcloud.domain.Image;
|
||||
import org.jclouds.ibm.smartcloud.domain.Instance;
|
||||
import org.jclouds.ibm.smartcloud.domain.Instance.Software;
|
||||
import org.jclouds.ibm.smartcloud.domain.InstanceType;
|
||||
import org.jclouds.ibm.smartcloud.domain.Key;
|
||||
import org.jclouds.ibm.smartcloud.domain.Location;
|
||||
import org.jclouds.ibm.smartcloud.domain.Offering;
|
||||
import org.jclouds.ibm.smartcloud.domain.StorageOffering;
|
||||
import org.jclouds.ibm.smartcloud.domain.Volume;
|
||||
import org.jclouds.ibm.smartcloud.domain.Instance.Software;
|
||||
import org.jclouds.ibm.smartcloud.domain.StorageOffering.Format;
|
||||
import org.jclouds.ibm.smartcloud.domain.Volume;
|
||||
import org.jclouds.ibm.smartcloud.predicates.AddressFree;
|
||||
import org.jclouds.ibm.smartcloud.predicates.InstanceActive;
|
||||
import org.jclouds.ibm.smartcloud.predicates.InstanceActiveOrFailed;
|
||||
|
@ -55,7 +55,7 @@ import org.jclouds.predicates.InetSocketAddressConnect;
|
|||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.SshException;
|
||||
import org.jclouds.ssh.jsch.JschSshClient;
|
||||
import org.jclouds.sshj.SshjSshClient;
|
||||
import org.testng.annotations.AfterTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -498,7 +498,7 @@ public class IBMSmartCloudClientLiveTest extends BaseIBMSmartCloudClientLiveTest
|
|||
|
||||
socketOpen.apply(socket);
|
||||
|
||||
SshClient ssh = new JschSshClient(new BackoffLimitedRetryHandler(), socket, 60000, credentials.identity, null,
|
||||
SshClient ssh = new SshjSshClient(new BackoffLimitedRetryHandler(), socket, 60000, credentials.identity, null,
|
||||
credentials.credential.getBytes());
|
||||
try {
|
||||
ssh.connect();
|
||||
|
|
|
@ -19,10 +19,12 @@
|
|||
package org.jclouds.ibm.smartcloud.compute;
|
||||
|
||||
import org.jclouds.compute.BaseComputeServiceLiveTest;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
|
@ -36,7 +38,7 @@ public class IBMSmartCloudComputeServiceLiveTest extends BaseComputeServiceLiveT
|
|||
}
|
||||
|
||||
@Override
|
||||
protected JschSshClientModule getSshModule() {
|
||||
return new JschSshClientModule();
|
||||
protected Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,15 +76,10 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-jsch</artifactId>
|
||||
<artifactId>jclouds-sshj</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcraft</groupId>
|
||||
<artifactId>jsch</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
Loading…
Reference in New Issue