mirror of https://github.com/apache/jclouds.git
Merge pull request #584 from mattstep/ipsocket-remove
Remove IPSocket class, replace with Guava's HostAndPort class.
This commit is contained in:
commit
dfd84a0666
|
@ -28,12 +28,12 @@ import org.jclouds.cloudloadbalancers.predicates.LoadBalancerActive;
|
|||
import org.jclouds.cloudloadbalancers.predicates.LoadBalancerDeleted;
|
||||
import org.jclouds.loadbalancer.LoadBalancerServiceContext;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -51,7 +51,7 @@ public class BaseCloudLoadBalancersClientLiveTest extends BaseViewLiveTest<LoadB
|
|||
protected CloudLoadBalancersClient client;
|
||||
protected RestContext<CloudLoadBalancersClient, CloudLoadBalancersAsyncClient> lbContext;
|
||||
protected String[] regions = {};
|
||||
protected Predicate<IPSocket> socketTester;
|
||||
protected Predicate<HostAndPort> socketTester;
|
||||
protected RetryablePredicate<LoadBalancer> loadBalancerActive;
|
||||
protected RetryablePredicate<LoadBalancer> loadBalancerDeleted;
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
|||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
|
@ -63,6 +62,7 @@ import com.google.common.base.Predicate;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
|
@ -79,7 +79,7 @@ public class CloudServersClientLiveTest extends BaseComputeServiceContextLiveTes
|
|||
|
||||
protected CloudServersClient client;
|
||||
protected SshClient.Factory sshFactory;
|
||||
protected Predicate<IPSocket> socketTester;
|
||||
protected Predicate<HostAndPort> socketTester;
|
||||
|
||||
@BeforeGroups(groups = { "integration", "live" })
|
||||
@Override
|
||||
|
@ -89,7 +89,7 @@ public class CloudServersClientLiveTest extends BaseComputeServiceContextLiveTes
|
|||
client = injector.getInstance(CloudServersClient.class);
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 120, 1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<HostAndPort>(socketOpen, 120, 1, TimeUnit.SECONDS);
|
||||
injector.injectMembers(socketOpen); // add logger
|
||||
}
|
||||
|
||||
|
@ -374,7 +374,7 @@ public class CloudServersClientLiveTest extends BaseComputeServiceContextLiveTes
|
|||
}
|
||||
|
||||
private void doCheckPass(Server newDetails, String pass) throws IOException {
|
||||
IPSocket socket = new IPSocket(Iterables.get(newDetails.getAddresses().getPublicAddresses(), 0), 22);
|
||||
HostAndPort socket = HostAndPort.fromParts(Iterables.get(newDetails.getAddresses().getPublicAddresses(), 0), 22);
|
||||
socketTester.apply(socket);
|
||||
|
||||
SshClient client = sshFactory.create(socket, LoginCredentials.builder().user("root").password(pass).build());
|
||||
|
@ -390,7 +390,7 @@ public class CloudServersClientLiveTest extends BaseComputeServiceContextLiveTes
|
|||
}
|
||||
|
||||
private ExecResponse exec(Server details, String pass, String command) throws IOException {
|
||||
IPSocket socket = new IPSocket(Iterables.get(details.getAddresses().getPublicAddresses(), 0), 22);
|
||||
HostAndPort socket = HostAndPort.fromParts(Iterables.get(details.getAddresses().getPublicAddresses(), 0), 22);
|
||||
socketTester.apply(socket);
|
||||
SshClient client = sshFactory.create(socket, LoginCredentials.builder().user("root").password(pass).build());
|
||||
try {
|
||||
|
|
|
@ -46,7 +46,6 @@ import org.jclouds.cloudsigma.util.Servers;
|
|||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContext;
|
||||
|
@ -61,6 +60,7 @@ import com.google.common.base.Predicates;
|
|||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.inject.Guice;
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
protected String vncPassword = "Il0veVNC";
|
||||
protected CloudSigmaClient client;
|
||||
protected RestContext<CloudSigmaClient, CloudSigmaAsyncClient> cloudSigmaContext;
|
||||
protected Predicate<IPSocket> socketTester;
|
||||
protected Predicate<HostAndPort> socketTester;
|
||||
|
||||
protected Predicate<DriveInfo> driveNotClaimed;
|
||||
|
||||
|
@ -94,7 +94,7 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
client = cloudSigmaContext.getApi();
|
||||
driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime,
|
||||
1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), maxDriveImageTime, 1,
|
||||
socketTester = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), maxDriveImageTime, 1,
|
||||
TimeUnit.SECONDS);
|
||||
|
||||
if (Strings.emptyToNull(imageId) == null) {
|
||||
|
@ -329,9 +329,9 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
@Test(dependsOnMethods = "testCreateAndStartServer")
|
||||
public void testConnectivity() throws Exception {
|
||||
Logger.getAnonymousLogger().info("awaiting vnc");
|
||||
assert socketTester.apply(new IPSocket(server.getVnc().getIp(), 5900)) : server;
|
||||
assert socketTester.apply(HostAndPort.fromParts(server.getVnc().getIp(), 5900)) : server;
|
||||
Logger.getAnonymousLogger().info("awaiting ssh");
|
||||
assert socketTester.apply(new IPSocket(server.getNics().get(0).getDhcp(), 22)) : server;
|
||||
assert socketTester.apply(HostAndPort.fromParts(server.getNics().get(0).getDhcp(), 22)) : server;
|
||||
doConnectViaSsh(server, getSshCredentials(server));
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,7 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
|
||||
protected void doConnectViaSsh(Server server, LoginCredentials creds) throws IOException {
|
||||
SshClient ssh = Guice.createInjector(new SshjSshClientModule()).getInstance(SshClient.Factory.class)
|
||||
.create(new IPSocket(server.getVnc().getIp(), 22), creds);
|
||||
.create(HostAndPort.fromParts(server.getVnc().getIp(), 22), creds);
|
||||
try {
|
||||
ssh.connect();
|
||||
ExecResponse hello = ssh.exec("echo hello");
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
//import org.jclouds.cloudstack.options.CreateInstanceOptions;
|
||||
//import org.jclouds.domain.Credentials;
|
||||
//import org.jclouds.http.HttpRequest;
|
||||
//import org.jclouds.net.IPSocket;
|
||||
//import com.google.common.net.HostAndPort;
|
||||
//import org.jclouds.ssh.SshClient;
|
||||
//import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
//import org.testng.annotations.AfterGroups;
|
||||
|
@ -79,7 +79,7 @@
|
|||
// public void testConnectivity() throws Exception {
|
||||
// Logger.getAnonymousLogger().info("awaiting ssh");
|
||||
// // TODO
|
||||
// // assert socketTester.apply(new IPSocket(Iterables.get(instance.getPublicAddresses(), 0),
|
||||
// // assert socketTester.apply(HostAndPort.fromParts(Iterables.get(instance.getPublicAddresses(), 0),
|
||||
// // 22)) : instance;
|
||||
// // doConnectViaSsh(instance, getSshCredentials(instance));
|
||||
// }
|
||||
|
@ -119,7 +119,7 @@
|
|||
//
|
||||
// protected void doConnectViaSsh(Instance instance, Credentials creds) throws IOException {
|
||||
// SshClient ssh = Guice.createInjector(new JschSshClientModule()).getInstance(SshClient.Factory.class)
|
||||
// .create(new IPSocket(Iterables.get(instance.getPublicAddresses(), 0), 22), creds);
|
||||
// .create(HostAndPort.fromParts(Iterables.get(instance.getPublicAddresses(), 0), 22), creds);
|
||||
// try {
|
||||
// ssh.connect();
|
||||
// ExecResponse hello = ssh.exec("echo hello");
|
||||
|
|
|
@ -53,14 +53,13 @@ import org.jclouds.cloudstack.suppliers.GetCurrentUser;
|
|||
import org.jclouds.cloudstack.suppliers.NetworksForCurrentUser;
|
||||
import org.jclouds.cloudstack.suppliers.ZoneIdToZoneSupplier;
|
||||
import org.jclouds.collect.Memoized;
|
||||
import org.jclouds.compute.ComputeTestUtils;
|
||||
import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
|
||||
import org.jclouds.compute.ComputeTestUtils;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials;
|
||||
import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.annotations.Identity;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
|
@ -74,6 +73,7 @@ import com.google.common.cache.CacheLoader;
|
|||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.common.net.InetAddresses;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
|
@ -180,7 +180,7 @@ public class CloudStackComputeServiceAdapterLiveTest extends BaseCloudStackClien
|
|||
loginCredentials = prioritizeCredentialsFromTemplate.apply(template, vm.getCredentials());
|
||||
|
||||
assert InetAddresses.isInetAddress(address) : vm;
|
||||
IPSocket socket = new IPSocket(address, 22);
|
||||
HostAndPort socket = HostAndPort.fromParts(address, 22);
|
||||
checkSSH(socket);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ import org.jclouds.cloudstack.strategy.BlockUntilJobCompletesAndReturnResult;
|
|||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.internal.BaseGenericComputeServiceContextLiveTest;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContext;
|
||||
|
@ -65,6 +64,7 @@ import com.google.common.base.Predicate;
|
|||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -156,7 +156,7 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte
|
|||
protected CloudStackClient adminClient;
|
||||
protected User user;
|
||||
|
||||
protected Predicate<IPSocket> socketTester;
|
||||
protected Predicate<HostAndPort> socketTester;
|
||||
protected RetryablePredicate<Long> jobComplete;
|
||||
protected RetryablePredicate<Long> adminJobComplete;
|
||||
protected RetryablePredicate<VirtualMachine> virtualMachineRunning;
|
||||
|
@ -181,7 +181,7 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte
|
|||
protected CloudStackGlobalClient globalAdminClient;
|
||||
protected User globalAdminUser;
|
||||
|
||||
protected void checkSSH(IPSocket socket) {
|
||||
protected void checkSSH(HostAndPort socket) {
|
||||
socketTester.apply(socket);
|
||||
SshClient client = sshFactory.create(socket, loginCredentials);
|
||||
try {
|
||||
|
@ -224,7 +224,7 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte
|
|||
|
||||
injector = Guice.createInjector(setupModules());
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 180, 1, 1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), 180, 1, 1, TimeUnit.SECONDS);
|
||||
injector.injectMembers(socketTester);
|
||||
jobComplete = new RetryablePredicate<Long>(new JobComplete(client), 1200, 1, 5, TimeUnit.SECONDS);
|
||||
injector.injectMembers(jobComplete);
|
||||
|
|
|
@ -36,13 +36,13 @@ import org.jclouds.cloudstack.domain.PublicIPAddress;
|
|||
import org.jclouds.cloudstack.domain.VirtualMachine;
|
||||
import org.jclouds.cloudstack.options.CreateFirewallRuleOptions;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code FirewallClientLiveTest}
|
||||
|
@ -112,7 +112,7 @@ public class FirewallClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
assertEquals(portForwardingRule.getProtocol(), PortForwardingRule.Protocol.TCP);
|
||||
|
||||
checkPortForwardingRule(portForwardingRule);
|
||||
checkSSH(new IPSocket(ip.getIPAddress(), 22));
|
||||
checkSSH(HostAndPort.fromParts(ip.getIPAddress(), 22));
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = "testCreatePortForwardingRule")
|
||||
|
|
|
@ -35,13 +35,12 @@ import javax.annotation.Nullable;
|
|||
import org.jclouds.cloudstack.domain.AsyncJob;
|
||||
import org.jclouds.cloudstack.domain.JobResult;
|
||||
import org.jclouds.cloudstack.domain.LoadBalancerRule;
|
||||
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
|
||||
import org.jclouds.cloudstack.domain.LoadBalancerRule.State;
|
||||
import org.jclouds.cloudstack.domain.Network;
|
||||
import org.jclouds.cloudstack.domain.PublicIPAddress;
|
||||
import org.jclouds.cloudstack.domain.VirtualMachine;
|
||||
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
|
||||
import org.jclouds.cloudstack.domain.LoadBalancerRule.State;
|
||||
import org.jclouds.cloudstack.predicates.LoadBalancerRuleActive;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.ssh.SshException;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
|
@ -50,6 +49,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code LoadBalancerClientLiveTest}
|
||||
|
@ -155,7 +155,7 @@ public class LoadBalancerClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
private void loopAndCheckSSH() throws IOException {
|
||||
for (int i = 0; i < 5; i++) {// retry loop TODO replace with predicate.
|
||||
try {
|
||||
checkSSH(new IPSocket(ip.getIPAddress(), 22));
|
||||
checkSSH(HostAndPort.fromParts(ip.getIPAddress(), 22));
|
||||
return;
|
||||
} catch (SshException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -176,7 +176,7 @@ public class LoadBalancerClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
rule.getId(), vm.getId())));
|
||||
assertEquals(client.getLoadBalancerClient().listVirtualMachinesAssignedToLoadBalancerRule(rule.getId()).size(), 0);
|
||||
assertEquals(rule.getState(), State.ADD);
|
||||
checkSSH(new IPSocket(ip.getIPAddress(), 22));
|
||||
checkSSH(HostAndPort.fromParts(ip.getIPAddress(), 22));
|
||||
}
|
||||
|
||||
@AfterGroups(groups = "live")
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.jclouds.cloudstack.domain.Zone;
|
|||
import org.jclouds.cloudstack.options.AccountInDomainOptions;
|
||||
import org.jclouds.cloudstack.options.DeployVirtualMachineOptions;
|
||||
import org.jclouds.cloudstack.options.ListSecurityGroupsOptions;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -41,6 +40,7 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code SecurityGroupClient}
|
||||
|
@ -178,7 +178,7 @@ public class SecurityGroupClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
if (vm.getPassword() != null && !loginCredentials.hasPasswordOption())
|
||||
loginCredentials = loginCredentials.toBuilder().password(vm.getPassword()).build();
|
||||
// ingress port 22
|
||||
checkSSH(new IPSocket(vm.getIPAddress(), 22));
|
||||
checkSSH(HostAndPort.fromParts(vm.getIPAddress(), 22));
|
||||
// ingress icmp disabled as this is platform dependent and may actually
|
||||
// just try tcp port 7
|
||||
// assert InetAddress.getByName(vm.getIPAddress()).isReachable(1000) : vm;
|
||||
|
|
|
@ -53,7 +53,6 @@ import org.jclouds.cloudstack.options.ListNetworkOfferingsOptions;
|
|||
import org.jclouds.cloudstack.options.ListNetworksOptions;
|
||||
import org.jclouds.cloudstack.options.ListTemplatesOptions;
|
||||
import org.jclouds.cloudstack.options.ListVirtualMachinesOptions;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.util.InetAddresses2;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
|
@ -67,6 +66,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.common.net.HostSpecifier;
|
||||
|
||||
/**
|
||||
|
@ -282,7 +282,7 @@ public class VirtualMachineClientLiveTest extends BaseCloudStackClientLiveTest {
|
|||
assert HostSpecifier.isValid(vm.getIPAddress());
|
||||
if (!InetAddresses2.isPrivateIPAddress(vm.getIPAddress())) {
|
||||
// not sure if the network is public or not, so we have to test
|
||||
IPSocket socket = new IPSocket(vm.getIPAddress(), 22);
|
||||
HostAndPort socket = HostAndPort.fromParts(vm.getIPAddress(), 22);
|
||||
System.err.printf("testing socket %s%n", socket);
|
||||
System.err.printf("testing ssh %s%n", socket);
|
||||
checkSSH(socket);
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.jclouds.cloudstack.features.NATClientLiveTest;
|
|||
import org.jclouds.cloudstack.features.VirtualMachineClientLiveTest;
|
||||
import org.jclouds.cloudstack.predicates.NetworkPredicates;
|
||||
import org.jclouds.cloudstack.strategy.BlockUntilJobCompletesAndReturnResult;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -45,6 +44,7 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.base.Predicate;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code StaticNATVirtualMachineInNetwork}
|
||||
|
@ -106,7 +106,7 @@ public class StaticNATVirtualMachineInNetworkLiveTest extends NATClientLiveTest
|
|||
assertEquals(rule.getStartPort(), 22);
|
||||
assertEquals(rule.getProtocol(), "tcp");
|
||||
checkRule(rule);
|
||||
IPSocket socket = new IPSocket(ip.getIPAddress(), 22);
|
||||
HostAndPort socket = HostAndPort.fromParts(ip.getIPAddress(), 22);
|
||||
checkSSH(socket);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.jclouds.deltacloud.domain.TransitionOnAction;
|
|||
import org.jclouds.deltacloud.options.CreateInstanceOptions;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterClass;
|
||||
|
@ -40,6 +39,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.inject.Guice;
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class DeltacloudClientLiveTest extends ReadOnlyDeltacloudClientLiveTest {
|
|||
@Test(dependsOnMethods = "testCreateInstance")
|
||||
public void testConnectivity() throws Exception {
|
||||
Logger.getAnonymousLogger().info("awaiting ssh");
|
||||
assert socketTester.apply(new IPSocket(Iterables.get(instance.getPublicAddresses(), 0), 22)) : instance;
|
||||
assert socketTester.apply(HostAndPort.fromParts(Iterables.get(instance.getPublicAddresses(), 0), 22)) : instance;
|
||||
if (creds != null) {
|
||||
Logger.getAnonymousLogger().info("will connect ssh");
|
||||
doConnectViaSsh(instance, creds);
|
||||
|
@ -136,7 +136,7 @@ public class DeltacloudClientLiveTest extends ReadOnlyDeltacloudClientLiveTest {
|
|||
|
||||
protected void doConnectViaSsh(Instance instance, LoginCredentials creds) throws IOException {
|
||||
SshClient ssh = Guice.createInjector(new SshjSshClientModule()).getInstance(SshClient.Factory.class).create(
|
||||
new IPSocket(Iterables.get(instance.getPublicAddresses(), 0), 22), creds);
|
||||
HostAndPort.fromParts(Iterables.get(instance.getPublicAddresses(), 0), 22), creds);
|
||||
try {
|
||||
ssh.connect();
|
||||
ExecResponse hello = ssh.exec("echo hello");
|
||||
|
|
|
@ -30,12 +30,11 @@ import org.jclouds.deltacloud.domain.DeltacloudCollection;
|
|||
import org.jclouds.deltacloud.domain.HardwareProfile;
|
||||
import org.jclouds.deltacloud.domain.Image;
|
||||
import org.jclouds.deltacloud.domain.Instance;
|
||||
import org.jclouds.deltacloud.domain.Instance.State;
|
||||
import org.jclouds.deltacloud.domain.Realm;
|
||||
import org.jclouds.deltacloud.domain.Transition;
|
||||
import org.jclouds.deltacloud.domain.Instance.State;
|
||||
import org.jclouds.deltacloud.predicates.InstanceFinished;
|
||||
import org.jclouds.deltacloud.predicates.InstanceRunning;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
|
@ -48,6 +47,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
|
@ -64,7 +64,7 @@ public class ReadOnlyDeltacloudClientLiveTest extends BaseComputeServiceContextL
|
|||
|
||||
protected DeltacloudClient client;
|
||||
|
||||
protected Predicate<IPSocket> socketTester;
|
||||
protected Predicate<HostAndPort> socketTester;
|
||||
protected ImmutableMap<State, Predicate<Instance>> stateChanges;
|
||||
|
||||
@Override
|
||||
|
@ -72,7 +72,7 @@ public class ReadOnlyDeltacloudClientLiveTest extends BaseComputeServiceContextL
|
|||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = view.unwrap(DeltacloudApiMetadata.CONTEXT_TOKEN).getApi();
|
||||
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 180, 1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), 180, 1, TimeUnit.SECONDS);
|
||||
stateChanges = ImmutableMap.<Instance.State, Predicate<Instance>> of(//
|
||||
Instance.State.RUNNING, new RetryablePredicate<Instance>(new InstanceRunning(client), 600, 1,
|
||||
TimeUnit.SECONDS),//
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.jclouds.compute.domain.ExecResponse;
|
|||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.ec2.domain.BlockDevice;
|
||||
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
|
||||
import org.jclouds.ec2.domain.InstanceState;
|
||||
import org.jclouds.ec2.domain.InstanceType;
|
||||
import org.jclouds.ec2.domain.IpProtocol;
|
||||
|
@ -44,12 +45,10 @@ import org.jclouds.ec2.domain.KeyPair;
|
|||
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
|
||||
import org.jclouds.ec2.domain.Reservation;
|
||||
import org.jclouds.ec2.domain.RunningInstance;
|
||||
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
|
||||
import org.jclouds.ec2.domain.Volume.InstanceInitiatedShutdownBehavior;
|
||||
import org.jclouds.ec2.predicates.InstanceHasIpAddress;
|
||||
import org.jclouds.ec2.predicates.InstanceStateRunning;
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.scriptbuilder.ScriptBuilder;
|
||||
|
@ -63,6 +62,7 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
|
@ -88,7 +88,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
|||
private String instanceId;
|
||||
private String address;
|
||||
|
||||
private RetryablePredicate<IPSocket> socketTester;
|
||||
private RetryablePredicate<HostAndPort> socketTester;
|
||||
private RetryablePredicate<RunningInstance> hasIpTester;
|
||||
private RetryablePredicate<RunningInstance> runningTester;
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
|||
TimeUnit.SECONDS);
|
||||
hasIpTester = new RetryablePredicate<RunningInstance>(new InstanceHasIpAddress(client), 180, 5, TimeUnit.SECONDS);
|
||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 180, 1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<HostAndPort>(socketOpen, 180, 1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -296,7 +296,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
|||
Thread.sleep(1000);
|
||||
instance = getInstance(instanceId);
|
||||
blockUntilWeCanSshIntoInstance(instance);
|
||||
SshClient ssh = sshFactory.create(new IPSocket(instance.getIpAddress(), 22),
|
||||
SshClient ssh = sshFactory.create(HostAndPort.fromParts(instance.getIpAddress(), 22),
|
||||
LoginCredentials.builder().user("root").privateKey(keyPair.getKeyMaterial()).build());
|
||||
try {
|
||||
ssh.connect();
|
||||
|
@ -357,14 +357,14 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
|||
assert hasIpTester.apply(instance);
|
||||
|
||||
System.out.printf("%d: %s awaiting ssh service to start%n", System.currentTimeMillis(), instance.getIpAddress());
|
||||
assert socketTester.apply(new IPSocket(instance.getIpAddress(), 22));
|
||||
assert socketTester.apply(HostAndPort.fromParts(instance.getIpAddress(), 22));
|
||||
|
||||
System.out.printf("%d: %s ssh service started%n", System.currentTimeMillis(), instance.getDnsName());
|
||||
sshPing(instance);
|
||||
System.out.printf("%d: %s ssh connection made%n", System.currentTimeMillis(), instance.getId());
|
||||
|
||||
System.out.printf("%d: %s awaiting http service to start%n", System.currentTimeMillis(), instance.getIpAddress());
|
||||
assert socketTester.apply(new IPSocket(instance.getIpAddress(), 80));
|
||||
assert socketTester.apply(HostAndPort.fromParts(instance.getIpAddress(), 80));
|
||||
System.out.printf("%d: %s http service started%n", System.currentTimeMillis(), instance.getDnsName());
|
||||
return instance;
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseComputeS
|
|||
}
|
||||
|
||||
private void doCheckKey(String address) {
|
||||
SshClient ssh = sshFactory.create(new IPSocket(address, 22),
|
||||
SshClient ssh = sshFactory.create(HostAndPort.fromParts(address, 22),
|
||||
LoginCredentials.builder().user("root").privateKey(keyPair.getKeyMaterial()).build());
|
||||
try {
|
||||
ssh.connect();
|
||||
|
|
|
@ -39,6 +39,8 @@ import org.jclouds.domain.LoginCredentials;
|
|||
import org.jclouds.ec2.domain.Attachment;
|
||||
import org.jclouds.ec2.domain.BlockDevice;
|
||||
import org.jclouds.ec2.domain.Image;
|
||||
import org.jclouds.ec2.domain.Image.Architecture;
|
||||
import org.jclouds.ec2.domain.Image.ImageType;
|
||||
import org.jclouds.ec2.domain.InstanceState;
|
||||
import org.jclouds.ec2.domain.InstanceType;
|
||||
import org.jclouds.ec2.domain.IpProtocol;
|
||||
|
@ -48,8 +50,6 @@ import org.jclouds.ec2.domain.RootDeviceType;
|
|||
import org.jclouds.ec2.domain.RunningInstance;
|
||||
import org.jclouds.ec2.domain.Snapshot;
|
||||
import org.jclouds.ec2.domain.Volume;
|
||||
import org.jclouds.ec2.domain.Image.Architecture;
|
||||
import org.jclouds.ec2.domain.Image.ImageType;
|
||||
import org.jclouds.ec2.domain.Volume.InstanceInitiatedShutdownBehavior;
|
||||
import org.jclouds.ec2.predicates.InstanceStateRunning;
|
||||
import org.jclouds.ec2.predicates.InstanceStateStopped;
|
||||
|
@ -59,7 +59,6 @@ import org.jclouds.ec2.predicates.VolumeAttached;
|
|||
import org.jclouds.ec2.predicates.VolumeAvailable;
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.scriptbuilder.InitScript;
|
||||
|
@ -76,6 +75,7 @@ import com.google.common.base.Predicate;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
|
@ -107,7 +107,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
private KeyPair keyPair;
|
||||
private String securityGroupName;
|
||||
|
||||
private RetryablePredicate<IPSocket> socketTester;
|
||||
private RetryablePredicate<HostAndPort> socketTester;
|
||||
private RetryablePredicate<Attachment> attachTester;
|
||||
private RetryablePredicate<Volume> volumeTester;
|
||||
private RunningInstance instance;
|
||||
|
@ -130,7 +130,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
client = injector.getInstance(EC2Client.class);
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 120, 1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<HostAndPort>(socketOpen, 120, 1, TimeUnit.SECONDS);
|
||||
|
||||
VolumeAvailable volumeAvailable = injector.getInstance(VolumeAvailable.class);
|
||||
volumeTester = new RetryablePredicate<Volume>(volumeAvailable, 60, 1, TimeUnit.SECONDS);
|
||||
|
@ -273,7 +273,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
|
||||
@Test(enabled = false, dependsOnMethods = "testCreateAndAttachVolume")
|
||||
void testBundleInstance() {
|
||||
SshClient ssh = sshFactory.create(new IPSocket(instance.getIpAddress(), 22),
|
||||
SshClient ssh = sshFactory.create(HostAndPort.fromParts(instance.getIpAddress(), 22),
|
||||
LoginCredentials.builder().user("ubuntu").privateKey(keyPair.getKeyMaterial()).build());
|
||||
try {
|
||||
ssh.connect();
|
||||
|
@ -510,7 +510,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
}
|
||||
|
||||
private void doCheckKey(String address) {
|
||||
SshClient ssh = sshFactory.create(new IPSocket(address, 22),
|
||||
SshClient ssh = sshFactory.create(HostAndPort.fromParts(address, 22),
|
||||
LoginCredentials.builder().user("ubuntu").privateKey(keyPair.getKeyMaterial()).build());
|
||||
try {
|
||||
ssh.connect();
|
||||
|
@ -538,7 +538,7 @@ public class EBSBootEC2ClientLiveTest extends BaseComputeServiceContextLiveTest
|
|||
instance = Iterables.getOnlyElement(Iterables.getOnlyElement(reservations));
|
||||
|
||||
System.out.printf("%d: %s awaiting ssh service to start%n", System.currentTimeMillis(), instance.getIpAddress());
|
||||
assert socketTester.apply(new IPSocket(instance.getIpAddress(), 22));
|
||||
assert socketTester.apply(HostAndPort.fromParts(instance.getIpAddress(), 22));
|
||||
System.out.printf("%d: %s ssh service started%n", System.currentTimeMillis(), instance.getDnsName());
|
||||
sshPing(instance);
|
||||
System.out.printf("%d: %s ssh connection made%n", System.currentTimeMillis(), instance.getId());
|
||||
|
|
|
@ -54,7 +54,6 @@ 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.net.IPSocket;
|
||||
import org.jclouds.scriptbuilder.domain.Statements;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.util.InetAddresses2;
|
||||
|
@ -65,6 +64,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
|
@ -198,7 +198,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
|||
// Check that the address is public and port 22 is accessible
|
||||
String ip = Iterables.getOnlyElement(publicIps);
|
||||
assertFalse(InetAddresses2.isPrivateIPAddress(ip));
|
||||
IPSocket socket = new IPSocket(ip, 22);
|
||||
HostAndPort socket = HostAndPort.fromParts(ip, 22);
|
||||
assertTrue(socketTester.apply(socket), String.format("failed to open socket %s on node %s", socket, node));
|
||||
|
||||
// check that there is an elastic ip correlating to it
|
||||
|
|
|
@ -43,7 +43,6 @@ import org.jclouds.elasticstack.domain.ServerStatus;
|
|||
import org.jclouds.elasticstack.predicates.DriveClaimed;
|
||||
import org.jclouds.elasticstack.util.Servers;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContext;
|
||||
|
@ -59,6 +58,7 @@ import com.google.common.base.Predicates;
|
|||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.inject.Guice;
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class ElasticStackClientLiveTest
|
|||
protected String vncPassword = "Il0veVNC";
|
||||
protected ElasticStackClient client;
|
||||
protected RestContext<ElasticStackClient, ElasticStackAsyncClient> cloudStackContext;
|
||||
protected Predicate<IPSocket> socketTester;
|
||||
protected Predicate<HostAndPort> socketTester;
|
||||
protected Predicate<DriveInfo> driveNotClaimed;
|
||||
|
||||
@BeforeGroups(groups = { "integration", "live" })
|
||||
|
@ -93,7 +93,7 @@ public class ElasticStackClientLiveTest
|
|||
client = cloudStackContext.getApi();
|
||||
driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime,
|
||||
1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), maxDriveImageTime, 1,
|
||||
socketTester = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), maxDriveImageTime, 1,
|
||||
TimeUnit.SECONDS);
|
||||
|
||||
if (Strings.emptyToNull(imageId) == null) {
|
||||
|
@ -229,10 +229,10 @@ public class ElasticStackClientLiveTest
|
|||
|
||||
@Test(dependsOnMethods = "testCreateAndStartServer")
|
||||
public void testConnectivity() throws Exception {
|
||||
IPSocket vncsocket = new IPSocket(server.getVnc().getIp(), 5900);
|
||||
HostAndPort vncsocket = HostAndPort.fromParts(server.getVnc().getIp(), 5900);
|
||||
Logger.getAnonymousLogger().info("awaiting vnc: " + vncsocket);
|
||||
assert socketTester.apply(vncsocket) : server;
|
||||
IPSocket sshsocket = new IPSocket(server.getNics().get(0).getDhcp(), 22);
|
||||
HostAndPort sshsocket = HostAndPort.fromParts(server.getNics().get(0).getDhcp(), 22);
|
||||
Logger.getAnonymousLogger().info("awaiting ssh: " + sshsocket);
|
||||
assert socketTester.apply(sshsocket) : server;
|
||||
doConnectViaSsh(server, getSshCredentials(server));
|
||||
|
@ -290,7 +290,7 @@ public class ElasticStackClientLiveTest
|
|||
|
||||
protected void doConnectViaSsh(Server server, LoginCredentials creds) throws IOException {
|
||||
SshClient ssh = Guice.createInjector(new SshjSshClientModule()).getInstance(SshClient.Factory.class).create(
|
||||
new IPSocket(server.getVnc().getIp(), 22), creds);
|
||||
HostAndPort.fromParts(server.getVnc().getIp(), 22), creds);
|
||||
try {
|
||||
ssh.connect();
|
||||
ExecResponse hello = ssh.exec("echo hello");
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
|||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.openstack.nova.domain.Flavor;
|
||||
import org.jclouds.openstack.nova.domain.Image;
|
||||
import org.jclouds.openstack.nova.domain.ImageStatus;
|
||||
|
@ -56,6 +55,7 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
|
@ -72,7 +72,7 @@ public class NovaClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
|
||||
protected NovaClient client;
|
||||
protected SshClient.Factory sshFactory;
|
||||
protected Predicate<IPSocket> socketTester;
|
||||
protected Predicate<HostAndPort> socketTester;
|
||||
|
||||
@BeforeGroups(groups = { "integration", "live" })
|
||||
@Override
|
||||
|
@ -82,7 +82,7 @@ public class NovaClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
client = injector.getInstance(NovaClient.class);
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 120, 1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<HostAndPort>(socketOpen, 120, 1, TimeUnit.SECONDS);
|
||||
injector.injectMembers(socketOpen); // add logger
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ public class NovaClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
}
|
||||
|
||||
private void doCheckPass(Server newDetails, String pass) throws IOException {
|
||||
IPSocket socket = new IPSocket(Iterables.get(newDetails.getAddresses().getPublicAddresses(), 0).getAddress(), 22);
|
||||
HostAndPort socket = HostAndPort.fromParts(Iterables.get(newDetails.getAddresses().getPublicAddresses(), 0).getAddress(), 22);
|
||||
socketTester.apply(socket);
|
||||
|
||||
SshClient client = sshFactory.create(socket, LoginCredentials.builder().user("root").password(pass).build());
|
||||
|
|
|
@ -28,7 +28,6 @@ import static org.testng.Assert.assertNotNull;
|
|||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.vcloud.VCloudApiMetadata;
|
||||
import org.jclouds.vcloud.VCloudMediaType;
|
||||
import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
|
||||
|
@ -41,6 +40,7 @@ import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
/**
|
||||
* This tests that we can use guest customization as an alternative to bootstrapping with ssh. There
|
||||
|
@ -157,8 +157,8 @@ public class VmClientLiveTest extends BaseVCloudClientLiveTest {
|
|||
assertEquals(apiOutput, script.replace("\n", ""));
|
||||
}
|
||||
|
||||
protected IPSocket getSocket(NodeMetadata node) {
|
||||
return new IPSocket(get(node.getPublicAddresses(), 0), 22);
|
||||
protected HostAndPort getSocket(NodeMetadata node) {
|
||||
return HostAndPort.fromParts(get(node.getPublicAddresses(), 0), 22);
|
||||
}
|
||||
|
||||
}
|
|
@ -32,9 +32,9 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
@ -43,14 +43,13 @@ import org.jclouds.cim.CIMPredicates;
|
|||
import org.jclouds.cim.ResourceAllocationSettingData;
|
||||
import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.SshException;
|
||||
import org.jclouds.ssh.SshClient.Factory;
|
||||
import org.jclouds.ssh.SshException;
|
||||
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;
|
||||
|
@ -80,6 +79,7 @@ import com.google.common.base.Function;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
@Test(groups = "live", singleThreaded = true)
|
||||
|
@ -93,7 +93,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
|
|||
protected InternetService is;
|
||||
protected Node node;
|
||||
protected VApp vApp;
|
||||
protected RetryablePredicate<IPSocket> socketTester;
|
||||
protected RetryablePredicate<HostAndPort> socketTester;
|
||||
protected RetryablePredicate<URI> successTester;
|
||||
protected Injector injector;
|
||||
|
||||
|
@ -429,7 +429,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
|
|||
}
|
||||
|
||||
protected void doCheckPass(String address) throws IOException {
|
||||
IPSocket socket = new IPSocket(address, 22);
|
||||
HostAndPort socket = HostAndPort.fromParts(address, 22);
|
||||
|
||||
System.out.printf("%d: %s awaiting ssh service to start%n", System.currentTimeMillis(), socket);
|
||||
assert socketTester.apply(socket);
|
||||
|
@ -448,7 +448,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract SshClient getConnectionFor(IPSocket socket);
|
||||
protected abstract SshClient getConnectionFor(HostAndPort socket);
|
||||
|
||||
@AfterGroups(groups = { "live" })
|
||||
void cleanup() throws InterruptedException, ExecutionException, TimeoutException {
|
||||
|
@ -485,7 +485,7 @@ public abstract class TerremarkClientLiveTest<S extends TerremarkVCloudClient, A
|
|||
injector = view.utils().injector();
|
||||
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
socketTester = new RetryablePredicate<IPSocket>(injector.getInstance(SocketOpen.class), 300, 10, TimeUnit.SECONDS);// make
|
||||
socketTester = new RetryablePredicate<HostAndPort>(injector.getInstance(SocketOpen.class), 300, 10, TimeUnit.SECONDS);// make
|
||||
// it
|
||||
// longer
|
||||
// then
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.compute.ComputeService;
|
||||
import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContext;
|
||||
|
@ -33,6 +32,7 @@ import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudClient;
|
|||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public abstract class BaseTerremarkClientLiveTest<S extends TerremarkVCloudClien
|
|||
provider = "trmk-ecloud";
|
||||
}
|
||||
|
||||
protected RetryablePredicate<IPSocket> socketTester;
|
||||
protected RetryablePredicate<HostAndPort> socketTester;
|
||||
protected Factory sshFactory;
|
||||
protected S connection;
|
||||
|
||||
|
@ -61,7 +61,7 @@ public abstract class BaseTerremarkClientLiveTest<S extends TerremarkVCloudClien
|
|||
public void setupContext() {
|
||||
super.setupContext();
|
||||
Injector injector = view.utils().injector();
|
||||
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 300, 1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), 300, 1, TimeUnit.SECONDS);
|
||||
sshFactory = injector.getInstance(Factory.class);
|
||||
connection = (S) RestContext.class.cast(view.unwrap()).getApi();
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ import javax.inject.Singleton;
|
|||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.predicates.RetryIfSocketNotYetOpen;
|
||||
import org.jclouds.compute.util.ComputeServiceUtils;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ public class CreateSshClientOncePortIsListeningOnNode implements Function<NodeMe
|
|||
checkNotNull(node.getCredentials().identity, "no login identity found for node %s", node.getId());
|
||||
checkNotNull(node.getCredentials().credential, "no credential found for %s on node %s", node
|
||||
.getCredentials().identity, node.getId());
|
||||
IPSocket socket = ComputeServiceUtils.findReachableSocketOnNode(socketTester, node, node.getLoginPort());
|
||||
HostAndPort socket = ComputeServiceUtils.findReachableSocketOnNode(socketTester, node, node.getLoginPort());
|
||||
return sshFactory.create(socket, node.getCredentials());
|
||||
}
|
||||
}
|
|
@ -27,11 +27,11 @@ import javax.inject.Named;
|
|||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -41,7 +41,7 @@ import com.google.common.base.Predicate;
|
|||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
public class RetryIfSocketNotYetOpen implements Predicate<IPSocket> {
|
||||
public class RetryIfSocketNotYetOpen implements Predicate<HostAndPort> {
|
||||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
private Logger logger = Logger.NULL;
|
||||
|
@ -84,11 +84,11 @@ public class RetryIfSocketNotYetOpen implements Predicate<IPSocket> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(IPSocket socket) {
|
||||
public boolean apply(HostAndPort socket) {
|
||||
logger.debug(">> blocking on socket %s for %d %s", socket, timeoutValue, timeoutUnits);
|
||||
// Specify a retry period of 1s, expressed in the same time units.
|
||||
long period = timeoutUnits.convert(1, TimeUnit.SECONDS);
|
||||
RetryablePredicate<IPSocket> tester = new RetryablePredicate<IPSocket>(socketTester, timeoutValue, period, timeoutUnits);
|
||||
RetryablePredicate<HostAndPort> tester = new RetryablePredicate<HostAndPort>(socketTester, timeoutValue, period, timeoutUnits);
|
||||
boolean passed = tester.apply(socket);
|
||||
if (passed)
|
||||
logger.debug("<< socket %s opened", socket);
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.jclouds.compute.domain.NodeState;
|
|||
import org.jclouds.compute.domain.Processor;
|
||||
import org.jclouds.compute.domain.Volume;
|
||||
import org.jclouds.compute.domain.internal.VolumeImpl;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.rest.annotations.Identity;
|
||||
|
||||
|
@ -41,6 +40,7 @@ import com.google.common.cache.CacheBuilder;
|
|||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
|
@ -128,10 +128,10 @@ public class StubComputeServiceDependenciesModule extends AbstractModule {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(IPSocket input) {
|
||||
if (input.getAddress().indexOf(publicIpPrefix) == -1)
|
||||
public boolean apply(HostAndPort input) {
|
||||
if (input.getHostText().indexOf(publicIpPrefix) == -1)
|
||||
return false;
|
||||
String id = input.getAddress().replace(publicIpPrefix, "");
|
||||
String id = input.getHostText().replace(publicIpPrefix, "");
|
||||
NodeMetadata node = nodes.get(id);
|
||||
return node != null && node.getState() == NodeState.RUNNING;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ import static org.jclouds.scriptbuilder.domain.Statements.pipeHttpResponseToBash
|
|||
import java.net.URI;
|
||||
import java.util.Formatter;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
|
@ -43,13 +43,13 @@ import org.jclouds.compute.domain.Processor;
|
|||
import org.jclouds.compute.domain.Volume;
|
||||
import org.jclouds.compute.predicates.RetryIfSocketNotYetOpen;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.scriptbuilder.domain.Statement;
|
||||
import org.jclouds.scriptbuilder.domain.Statements;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
||||
/**
|
||||
|
@ -165,17 +165,17 @@ public class ComputeServiceUtils {
|
|||
return org.jclouds.rest.Providers.getSupportedProvidersOfType(TypeToken.of(ComputeServiceContext.class));
|
||||
}
|
||||
|
||||
public static IPSocket findReachableSocketOnNode(RetryIfSocketNotYetOpen socketTester, final NodeMetadata node,
|
||||
public static HostAndPort findReachableSocketOnNode(RetryIfSocketNotYetOpen socketTester, final NodeMetadata node,
|
||||
final int port) {
|
||||
checkNodeHasIps(node);
|
||||
IPSocket socket = null;
|
||||
HostAndPort socket = null;
|
||||
try {
|
||||
socket = find(transform(concat(node.getPublicAddresses(), node.getPrivateAddresses()),
|
||||
new Function<String, IPSocket>() {
|
||||
new Function<String, HostAndPort>() {
|
||||
|
||||
@Override
|
||||
public IPSocket apply(String from) {
|
||||
return new IPSocket(from, port);
|
||||
public HostAndPort apply(String from) {
|
||||
return HostAndPort.fromParts(from, port);
|
||||
}
|
||||
}), socketTester);
|
||||
} catch (NoSuchElementException e) {
|
||||
|
|
|
@ -23,7 +23,8 @@ import org.jclouds.compute.domain.ExecResponse;
|
|||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.net.IPSocket;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -35,12 +36,12 @@ public interface SshClient {
|
|||
/**
|
||||
* To be removed in jclouds 1.5.0
|
||||
*
|
||||
* @see #create(IPSocket, LoginCredentials)
|
||||
* @see #create(com.google.common.net.HostAndPort, LoginCredentials)
|
||||
*/
|
||||
@Deprecated
|
||||
SshClient create(IPSocket socket, Credentials credentials);
|
||||
SshClient create(HostAndPort socket, Credentials credentials);
|
||||
|
||||
SshClient create(IPSocket socket, LoginCredentials credentials);
|
||||
SshClient create(HostAndPort socket, LoginCredentials credentials);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
org.jclouds.domain.Credentials
|
||||
org.jclouds.domain.LoginCredentials
|
||||
org.jclouds.io.Payload
|
||||
org.jclouds.net.IPSocket
|
||||
com.google.common.net.HostAndPort
|
||||
org.jclouds.compute.domain.ExecResponse))
|
||||
|
||||
(defn instantiate [impl-class & args]
|
||||
|
@ -67,7 +67,7 @@
|
|||
(^void put [this ^String path ^String content])
|
||||
(^void put [this ^String path ^org.jclouds.io.Payload content])
|
||||
(getUsername [this] username)
|
||||
(getHostAddress [this] (.getAddress socket)) )
|
||||
(getHostAddress [this] (.getHostText socket)) )
|
||||
|
||||
(defn no-op-ssh-client
|
||||
[socket username password]
|
||||
|
@ -79,11 +79,11 @@
|
|||
org.jclouds.ssh.SshClient$Factory
|
||||
(^org.jclouds.ssh.SshClient
|
||||
create
|
||||
[_ ^IPSocket socket ^Credentials credentials]
|
||||
[_ ^HostAndPort socket ^Credentials credentials]
|
||||
(factory-fn socket (.identity credentials) (.credential credentials)))
|
||||
(^org.jclouds.ssh.SshClient
|
||||
create
|
||||
[_ ^IPSocket socket ^LoginCredentials credentials]
|
||||
[_ ^HostAndPort socket ^LoginCredentials credentials]
|
||||
(factory-fn socket (.identity credentials) (.credential credentials)))
|
||||
)
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
|
|||
import org.jclouds.crypto.Pems;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
|
@ -54,6 +53,7 @@ import com.google.common.base.Supplier;
|
|||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Module;
|
||||
|
||||
|
@ -80,13 +80,13 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
|
|||
protected void buildSocketTester() {
|
||||
SocketOpen socketOpen = createMock(SocketOpen.class);
|
||||
|
||||
expect(socketOpen.apply(new IPSocket("144.175.1.1", 22))).andReturn(true).times(5);
|
||||
expect(socketOpen.apply(HostAndPort.fromParts("144.175.1.1", 22))).andReturn(true).times(5);
|
||||
// restart of jboss
|
||||
expect(socketOpen.apply(new IPSocket("144.175.1.1", 8080))).andReturn(true).times(2);
|
||||
expect(socketOpen.apply(HostAndPort.fromParts("144.175.1.1", 8080))).andReturn(true).times(2);
|
||||
|
||||
replay(socketOpen);
|
||||
|
||||
preciseSocketTester = socketTester = new RetryablePredicate<IPSocket>(socketOpen, 1, 1, TimeUnit.MILLISECONDS);
|
||||
preciseSocketTester = socketTester = new RetryablePredicate<HostAndPort>(socketOpen, 1, 1, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -140,26 +140,26 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
|
|||
SshClient client5 = createMock(SshClient.class);
|
||||
|
||||
expect(
|
||||
factory.create(new IPSocket("144.175.1.1", 22),
|
||||
factory.create(HostAndPort.fromParts("144.175.1.1", 22),
|
||||
LoginCredentials.builder().user("root").password("password1").build())).andReturn(client1);
|
||||
expect(
|
||||
factory.create(new IPSocket("144.175.1.1", 22),
|
||||
factory.create(HostAndPort.fromParts("144.175.1.1", 22),
|
||||
LoginCredentials.builder().user("web").privateKey(Pems.PRIVATE_PKCS1_MARKER).build())).andReturn(client1New)
|
||||
.times(10);
|
||||
runScriptAndService(client1, client1New);
|
||||
|
||||
expect(
|
||||
factory.create(new IPSocket("144.175.1.2", 22),
|
||||
factory.create(HostAndPort.fromParts("144.175.1.2", 22),
|
||||
LoginCredentials.builder().user("root").password("password2").build())).andReturn(client2)
|
||||
.times(4);
|
||||
expect(
|
||||
factory.create(new IPSocket("144.175.1.2", 22),
|
||||
factory.create(HostAndPort.fromParts("144.175.1.2", 22),
|
||||
LoginCredentials.builder().user("root").password("password2").build())).andReturn(client2New);
|
||||
expect(
|
||||
factory.create(new IPSocket("144.175.1.2", 22),
|
||||
factory.create(HostAndPort.fromParts("144.175.1.2", 22),
|
||||
LoginCredentials.builder().user("foo").privateKey(Pems.PRIVATE_PKCS1_MARKER).build())).andReturn(client2Foo);
|
||||
expect(
|
||||
factory.create(new IPSocket("144.175.1.2", 22),
|
||||
factory.create(HostAndPort.fromParts("144.175.1.2", 22),
|
||||
LoginCredentials.builder().user("root").password("romeo").build())).andThrow(
|
||||
new AuthorizationException("Auth fail", null));
|
||||
|
||||
|
@ -200,15 +200,15 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
|
|||
client2Foo.disconnect();
|
||||
|
||||
expect(
|
||||
factory.create(new IPSocket("144.175.1.3", 22),
|
||||
factory.create(HostAndPort.fromParts("144.175.1.3", 22),
|
||||
LoginCredentials.builder().user("root").password("password3").build())).andReturn(client3)
|
||||
.times(2);
|
||||
expect(
|
||||
factory.create(new IPSocket("144.175.1.4", 22),
|
||||
factory.create(HostAndPort.fromParts("144.175.1.4", 22),
|
||||
LoginCredentials.builder().user("root").password("password4").build())).andReturn(client4)
|
||||
.times(2);
|
||||
expect(
|
||||
factory.create(new IPSocket("144.175.1.5", 22),
|
||||
factory.create(HostAndPort.fromParts("144.175.1.5", 22),
|
||||
LoginCredentials.builder().user("root").password("password5").build())).andReturn(client5)
|
||||
.times(2);
|
||||
|
||||
|
@ -217,23 +217,23 @@ public class StubComputeServiceIntegrationTest extends BaseComputeServiceLiveTes
|
|||
runScriptAndInstallSsh(client5, "bootstrap", 5);
|
||||
|
||||
expect(
|
||||
factory.create(eq(new IPSocket("144.175.1.1", 22)),
|
||||
factory.create(eq(HostAndPort.fromParts("144.175.1.1", 22)),
|
||||
eq(LoginCredentials.builder().user("defaultAdminUsername").privateKey(Pems.PRIVATE_PKCS1_MARKER).build())))
|
||||
.andReturn(client1);
|
||||
expect(
|
||||
factory.create(eq(new IPSocket("144.175.1.2", 22)),
|
||||
factory.create(eq(HostAndPort.fromParts("144.175.1.2", 22)),
|
||||
eq(LoginCredentials.builder().user("defaultAdminUsername").privateKey(Pems.PRIVATE_PKCS1_MARKER).build())))
|
||||
.andReturn(client2);
|
||||
expect(
|
||||
factory.create(eq(new IPSocket("144.175.1.3", 22)),
|
||||
factory.create(eq(HostAndPort.fromParts("144.175.1.3", 22)),
|
||||
eq(LoginCredentials.builder().user("defaultAdminUsername").privateKey(Pems.PRIVATE_PKCS1_MARKER).build())))
|
||||
.andReturn(client3);
|
||||
expect(
|
||||
factory.create(eq(new IPSocket("144.175.1.4", 22)),
|
||||
factory.create(eq(HostAndPort.fromParts("144.175.1.4", 22)),
|
||||
eq(LoginCredentials.builder().user("defaultAdminUsername").privateKey(Pems.PRIVATE_PKCS1_MARKER).build())))
|
||||
.andReturn(client4);
|
||||
expect(
|
||||
factory.create(eq(new IPSocket("144.175.1.5", 22)),
|
||||
factory.create(eq(HostAndPort.fromParts("144.175.1.5", 22)),
|
||||
eq(LoginCredentials.builder().user("defaultAdminUsername").privateKey(Pems.PRIVATE_PKCS1_MARKER).build())))
|
||||
.andReturn(client5);
|
||||
|
||||
|
|
|
@ -50,10 +50,10 @@ import static org.testng.Assert.assertNotNull;
|
|||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
@ -84,7 +84,6 @@ import org.jclouds.domain.Credentials;
|
|||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
|
@ -105,6 +104,7 @@ import com.google.common.base.Stopwatch;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.inject.Module;
|
||||
|
||||
|
@ -117,8 +117,8 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
|||
|
||||
protected String group;
|
||||
|
||||
protected Predicate<IPSocket> socketTester;
|
||||
protected Predicate<IPSocket> preciseSocketTester;
|
||||
protected Predicate<HostAndPort> socketTester;
|
||||
protected Predicate<HostAndPort> preciseSocketTester;
|
||||
protected SortedSet<NodeMetadata> nodes;
|
||||
protected ComputeService client;
|
||||
|
||||
|
@ -151,12 +151,12 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
|||
|
||||
protected void buildSocketTester() {
|
||||
SocketOpen socketOpen = view.utils().injector().getInstance(SocketOpen.class);
|
||||
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<HostAndPort>(socketOpen, 60, 1, TimeUnit.SECONDS);
|
||||
// wait a maximum of 60 seconds for port 8080 to open.
|
||||
long maxWait = TimeUnit.SECONDS.toMillis(60);
|
||||
long interval = 50;
|
||||
// get more precise than default socket tester
|
||||
preciseSocketTester = new RetryablePredicate<IPSocket>(socketOpen, maxWait, interval, interval,
|
||||
preciseSocketTester = new RetryablePredicate<HostAndPort>(socketOpen, maxWait, interval, interval,
|
||||
TimeUnit.MILLISECONDS);
|
||||
}
|
||||
@Override
|
||||
|
@ -579,7 +579,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
|
|||
stats.backgroundProcessMilliseconds = watch.elapsedTime(TimeUnit.MILLISECONDS);
|
||||
watch.reset().start();
|
||||
|
||||
IPSocket socket = new IPSocket(Iterables.get(node.getPublicAddresses(), 0), 8080);
|
||||
HostAndPort socket = HostAndPort.fromParts(Iterables.get(node.getPublicAddresses(), 0), 8080);
|
||||
assert preciseSocketTester.apply(socket) : String.format("failed to open socket %s on node %s:%n%s%s", socket,
|
||||
node, init(node, processName, "stdout"), init(node, processName, "stderr"));
|
||||
stats.socketOpenMilliseconds = watch.elapsedTime(TimeUnit.MILLISECONDS);
|
||||
|
|
|
@ -26,9 +26,10 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants.Timeouts;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
|
||||
/**
|
||||
* Tests timeout behavior of {@link RetryIfSocketNotYetOpen} predicate.
|
||||
|
@ -36,7 +37,7 @@ import org.testng.annotations.Test;
|
|||
public class RetryIfSocketNotYetOpenTest {
|
||||
|
||||
private static final Logger logger = Logger.NULL;
|
||||
private static final IPSocket socket = new IPSocket("dummy", 0);
|
||||
private static final HostAndPort socket = HostAndPort.fromParts("dummy", 0);
|
||||
|
||||
@Test
|
||||
public void fromConstructor() {
|
||||
|
@ -70,7 +71,7 @@ public class RetryIfSocketNotYetOpenTest {
|
|||
doAsserts(uninitialised, socket, false, 0, 500);
|
||||
}
|
||||
|
||||
private void doAsserts(RetryIfSocketNotYetOpen predicate, IPSocket socket, boolean expectedResult, long minMilliseconds, long maxMilliseconds) {
|
||||
private void doAsserts(RetryIfSocketNotYetOpen predicate, HostAndPort socket, boolean expectedResult, long minMilliseconds, long maxMilliseconds) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
boolean result = predicate.apply(socket);
|
||||
long elapsedTime = System.currentTimeMillis() - startTime;
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
*/
|
||||
package org.jclouds.compute.predicates;
|
||||
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
|
||||
/**
|
||||
* For use in unit tests, e.g. {@link RetryIfSocketNotYetOpenTest}.
|
||||
|
@ -28,11 +29,11 @@ import org.jclouds.predicates.SocketOpen;
|
|||
public class SocketOpenPredicates {
|
||||
|
||||
public static final SocketOpen alwaysSucceed = new SocketOpen() {
|
||||
@Override public boolean apply(IPSocket socket) { return true; }
|
||||
@Override public boolean apply(HostAndPort socket) { return true; }
|
||||
};
|
||||
|
||||
public static final SocketOpen alwaysFail = new SocketOpen() {
|
||||
@Override public boolean apply(IPSocket socket) { return false; }
|
||||
@Override public boolean apply(HostAndPort socket) { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you 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.net;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* As google appengine prohibits use of java.net classes, this will serve as a replacement.
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class IPSocket implements Serializable {
|
||||
|
||||
/** The serialVersionUID */
|
||||
private static final long serialVersionUID = 2978329372952402188L;
|
||||
|
||||
private final String address;
|
||||
private final int port;
|
||||
|
||||
public IPSocket(String address, int port) {
|
||||
this.address = address;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((address == null) ? 0 : address.hashCode());
|
||||
result = prime * result + port;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
IPSocket other = (IPSocket) obj;
|
||||
if (address == null) {
|
||||
if (other.address != null)
|
||||
return false;
|
||||
} else if (!address.equals(other.address))
|
||||
return false;
|
||||
if (port != other.port)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[address=" + address + ", port=" + port + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -27,8 +27,8 @@ import javax.inject.Named;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.net.IPSocket;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
|
@ -48,8 +48,8 @@ public class InetSocketAddressConnect implements SocketOpen {
|
|||
private int timeout = 2000;
|
||||
|
||||
@Override
|
||||
public boolean apply(IPSocket socketA) {
|
||||
InetSocketAddress socketAddress = new InetSocketAddress(socketA.getAddress(), socketA
|
||||
public boolean apply(HostAndPort socketA) {
|
||||
InetSocketAddress socketAddress = new InetSocketAddress(socketA.getHostText(), socketA
|
||||
.getPort());
|
||||
Socket socket = null;
|
||||
try {
|
||||
|
|
|
@ -18,9 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.predicates;
|
||||
|
||||
import org.jclouds.net.IPSocket;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.ImplementedBy;
|
||||
|
||||
/**
|
||||
|
@ -30,6 +29,6 @@ import com.google.inject.ImplementedBy;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@ImplementedBy(SocketOpenUnsupported.class)
|
||||
public interface SocketOpen extends Predicate<IPSocket> {
|
||||
public interface SocketOpen extends Predicate<HostAndPort> {
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.predicates;
|
|||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.net.IPSocket;
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -31,7 +31,7 @@ import org.jclouds.net.IPSocket;
|
|||
public class SocketOpenUnsupported implements SocketOpen {
|
||||
|
||||
@Override
|
||||
public boolean apply(IPSocket socketA) {
|
||||
public boolean apply(HostAndPort socketA) {
|
||||
throw new UnsupportedOperationException("socket testing not configured");
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ 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;
|
||||
|
@ -122,10 +121,10 @@ public class JschSshClient implements SshClient {
|
|||
final String user;
|
||||
final String host;
|
||||
|
||||
public JschSshClient(BackoffLimitedRetryHandler backoffLimitedRetryHandler, IPSocket socket,
|
||||
public JschSshClient(BackoffLimitedRetryHandler backoffLimitedRetryHandler, HostAndPort socket,
|
||||
LoginCredentials loginCredentials, int timeout) {
|
||||
this.user = checkNotNull(loginCredentials, "loginCredentials").getUser();
|
||||
this.host = checkNotNull(socket, "socket").getAddress();
|
||||
this.host = checkNotNull(socket, "socket").getHostText();
|
||||
checkArgument(socket.getPort() > 0, "ssh port must be greater then zero" + socket.getPort());
|
||||
checkArgument(loginCredentials.getPassword() != null || loginCredentials.getPrivateKey() != null,
|
||||
"you must specify a password or a key");
|
||||
|
|
|
@ -24,13 +24,13 @@ import org.jclouds.Constants;
|
|||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
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.ssh.jsch.JschSshClient;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -64,14 +64,14 @@ public class JschSshClientModule extends AbstractModule {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SshClient create(IPSocket socket, LoginCredentials credentials) {
|
||||
public SshClient create(HostAndPort socket, LoginCredentials credentials) {
|
||||
SshClient client = new JschSshClient(backoffLimitedRetryHandler, socket, credentials, timeout);
|
||||
injector.injectMembers(client);// add logger
|
||||
return client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SshClient create(IPSocket socket, Credentials credentials) {
|
||||
public SshClient create(HostAndPort socket, Credentials credentials) {
|
||||
return create(socket, LoginCredentials.fromCredentials(credentials));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.jclouds.domain.LoginCredentials;
|
|||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.jclouds.util.Strings2;
|
||||
|
@ -46,6 +45,7 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.io.Closeables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
@ -136,10 +136,10 @@ public class JschSshClientLiveTest {
|
|||
SshClient.Factory factory = i.getInstance(SshClient.Factory.class);
|
||||
SshClient connection;
|
||||
if (Strings.emptyToNull(sshKeyFile) != null) {
|
||||
connection = factory.create(new IPSocket(sshHost, port), LoginCredentials.builder().user(sshUser)
|
||||
connection = factory.create(HostAndPort.fromParts(sshHost, port), LoginCredentials.builder().user(sshUser)
|
||||
.privateKey(Strings2.toStringAndClose(new FileInputStream(sshKeyFile))).build());
|
||||
} else {
|
||||
connection = factory.create(new IPSocket(sshHost, port),
|
||||
connection = factory.create(HostAndPort.fromParts(sshHost, port),
|
||||
LoginCredentials.builder().user(sshUser).password(sshPass).build());
|
||||
}
|
||||
connection.connect();
|
||||
|
|
|
@ -27,13 +27,13 @@ import java.util.Properties;
|
|||
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -68,7 +68,7 @@ public class JschSshClientTest {
|
|||
}
|
||||
}, new SLF4JLoggingModule());
|
||||
SshClient.Factory factory = i.getInstance(SshClient.Factory.class);
|
||||
JschSshClient ssh = JschSshClient.class.cast(factory.create(new IPSocket("localhost", 22), LoginCredentials
|
||||
JschSshClient ssh = JschSshClient.class.cast(factory.create(HostAndPort.fromParts("localhost", 22), LoginCredentials
|
||||
.builder().user("username").password("password").build()));
|
||||
return ssh;
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ import java.net.UnknownHostException;
|
|||
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.ssh.jsch.JschSshClient;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class JschSshClientModuleTest {
|
|||
|
||||
Injector i = Guice.createInjector(new JschSshClientModule(), new SLF4JLoggingModule());
|
||||
SshClient.Factory factory = i.getInstance(SshClient.Factory.class);
|
||||
SshClient connection = factory.create(new IPSocket("localhost", 22), LoginCredentials.builder().user("username")
|
||||
SshClient connection = factory.create(HostAndPort.fromParts("localhost", 22), LoginCredentials.builder().user("username")
|
||||
.password("password").build());
|
||||
assert connection instanceof JschSshClient;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ 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;
|
||||
|
@ -142,10 +141,10 @@ public class SshjSshClient implements SshClient {
|
|||
|
||||
private final BackoffLimitedRetryHandler backoffLimitedRetryHandler;
|
||||
|
||||
public SshjSshClient(BackoffLimitedRetryHandler backoffLimitedRetryHandler, IPSocket socket,
|
||||
public SshjSshClient(BackoffLimitedRetryHandler backoffLimitedRetryHandler, HostAndPort socket,
|
||||
LoginCredentials loginCredentials, int timeout) {
|
||||
this.user = checkNotNull(loginCredentials, "loginCredentials").getUser();
|
||||
this.host = checkNotNull(socket, "socket").getAddress();
|
||||
this.host = checkNotNull(socket, "socket").getHostText();
|
||||
checkArgument(socket.getPort() > 0, "ssh port must be greater then zero" + socket.getPort());
|
||||
checkArgument(loginCredentials.getPassword() != null || loginCredentials.getPrivateKey() != null,
|
||||
"you must specify a password or a key");
|
||||
|
|
|
@ -24,13 +24,13 @@ import org.jclouds.Constants;
|
|||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
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 com.google.common.net.HostAndPort;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -64,14 +64,14 @@ public class SshjSshClientModule extends AbstractModule {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SshClient create(IPSocket socket, LoginCredentials credentials) {
|
||||
public SshClient create(HostAndPort socket, LoginCredentials credentials) {
|
||||
SshClient client = new SshjSshClient(backoffLimitedRetryHandler, socket, credentials, timeout);
|
||||
injector.injectMembers(client);// add logger
|
||||
return client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SshClient create(IPSocket socket, Credentials credentials) {
|
||||
public SshClient create(HostAndPort socket, Credentials credentials) {
|
||||
return create(socket, LoginCredentials.fromCredentials(credentials));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.jclouds.domain.LoginCredentials;
|
|||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.util.Strings2;
|
||||
|
@ -46,6 +45,7 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.base.Strings;
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.io.Closeables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
@ -135,10 +135,10 @@ public class SshjSshClientLiveTest {
|
|||
SshClient.Factory factory = i.getInstance(SshClient.Factory.class);
|
||||
SshClient connection;
|
||||
if (Strings.emptyToNull(sshKeyFile) != null) {
|
||||
connection = factory.create(new IPSocket(sshHost, port), LoginCredentials.builder().user(sshUser)
|
||||
connection = factory.create(HostAndPort.fromParts(sshHost, port), LoginCredentials.builder().user(sshUser)
|
||||
.privateKey(Strings2.toStringAndClose(new FileInputStream(sshKeyFile))).build());
|
||||
} else {
|
||||
connection = factory.create(new IPSocket(sshHost, port),
|
||||
connection = factory.create(HostAndPort.fromParts(sshHost, port),
|
||||
LoginCredentials.builder().user(sshUser).password(sshPass).build());
|
||||
}
|
||||
connection.connect();
|
||||
|
|
|
@ -42,7 +42,6 @@ import org.jclouds.domain.LoginCredentials;
|
|||
import org.jclouds.logging.BufferLogger;
|
||||
import org.jclouds.logging.BufferLogger.Record;
|
||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.rest.AuthorizationException;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
|
@ -50,6 +49,7 @@ import org.testng.Assert;
|
|||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
@ -83,7 +83,7 @@ public class SshjSshClientTest {
|
|||
|
||||
}, new SLF4JLoggingModule());
|
||||
SshClient.Factory factory = i.getInstance(SshClient.Factory.class);
|
||||
SshjSshClient ssh = SshjSshClient.class.cast(factory.create(new IPSocket("localhost", 22), LoginCredentials
|
||||
SshjSshClient ssh = SshjSshClient.class.cast(factory.create(HostAndPort.fromParts("localhost", 22), LoginCredentials
|
||||
.builder().user("username").password("password").build()));
|
||||
return ssh;
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ package org.jclouds.sshj.config;
|
|||
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.sshj.SshjSshClient;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class SshjSshClientModuleTest {
|
|||
|
||||
Injector i = Guice.createInjector(new SshjSshClientModule(), new SLF4JLoggingModule());
|
||||
SshClient.Factory factory = i.getInstance(SshClient.Factory.class);
|
||||
SshClient connection = factory.create(new IPSocket("localhost", 22), LoginCredentials.builder().user("username")
|
||||
SshClient connection = factory.create(HostAndPort.fromParts("localhost", 22), LoginCredentials.builder().user("username")
|
||||
.password("password").build());
|
||||
assert connection instanceof SshjSshClient;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class IpClientLiveTest extends BaseGleSYSClientLiveTest {
|
|||
assertEquals(ipDetails.getIpversion(), "4");
|
||||
|
||||
// TODO: Ask Glesys to include address in response for OpenVZ?
|
||||
// assertEquals(ipDetails.getAddress(), openVzIp);
|
||||
// assertEquals(ipDetails.getHostText(), openVzIp);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.jclouds.cim.OSType;
|
|||
import org.jclouds.compute.domain.CIMOperatingSystem;
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.savvis.vpdc.domain.Network;
|
||||
|
@ -48,13 +47,14 @@ import com.google.common.base.Predicate;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
@Test(groups = "live")
|
||||
public class VMClientLiveTest extends BaseVPDCClientLiveTest {
|
||||
|
||||
private VMClient client;
|
||||
private VM vm;
|
||||
private RetryablePredicate<IPSocket> socketTester;
|
||||
private RetryablePredicate<HostAndPort> socketTester;
|
||||
|
||||
private String username = checkNotNull(System.getProperty("test." + provider + ".loginUser"), "test." + provider
|
||||
+ ".loginUser");
|
||||
|
@ -66,7 +66,7 @@ public class VMClientLiveTest extends BaseVPDCClientLiveTest {
|
|||
public void setupContext() {
|
||||
super.setupContext();
|
||||
client = restContext.getApi().getVMClient();
|
||||
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 130, 10, TimeUnit.SECONDS);// make
|
||||
socketTester = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), 130, 10, TimeUnit.SECONDS);// make
|
||||
}
|
||||
|
||||
private String billingSiteId;
|
||||
|
@ -277,7 +277,7 @@ public class VMClientLiveTest extends BaseVPDCClientLiveTest {
|
|||
assert clonedVM.getHref() != null : clonedVM;
|
||||
}
|
||||
|
||||
protected void checkSSH(IPSocket socket) {
|
||||
protected void checkSSH(HostAndPort socket) {
|
||||
socketTester.apply(socket);
|
||||
SshClient client = view.utils().sshFactory()
|
||||
.create(socket, LoginCredentials.builder().user(username).password(password).build());
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.jclouds.compute.options.RunScriptOptions;
|
|||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.virtualbox.domain.BridgedIf;
|
||||
import org.jclouds.virtualbox.statements.GetIPAddressFromMAC;
|
||||
|
@ -48,6 +47,7 @@ import com.google.common.base.Function;
|
|||
import com.google.common.base.Splitter;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
@Singleton
|
||||
|
@ -114,7 +114,7 @@ public class IMachineToSshClient implements Function<IMachine, SshClient> {
|
|||
|
||||
checkNotNull(clientIpAddress, "clientIpAddress");
|
||||
client = sshClientFactory.create(
|
||||
new IPSocket(clientIpAddress, Integer.parseInt(sshPort)),
|
||||
HostAndPort.fromParts(clientIpAddress, Integer.parseInt(sshPort)),
|
||||
loginCredentials);
|
||||
checkNotNull(client);
|
||||
return client;
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.jclouds.compute.predicates.RetryIfSocketNotYetOpen;
|
|||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.location.Provider;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.rest.annotations.Credential;
|
||||
import org.jclouds.rest.annotations.Identity;
|
||||
import org.jclouds.scriptbuilder.domain.Statements;
|
||||
|
@ -46,6 +45,7 @@ import org.virtualbox_4_1.VirtualBoxManager;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
@Singleton
|
||||
public class StartVBoxIfNotAlreadyRunning implements Supplier<VirtualBoxManager> {
|
||||
|
@ -78,7 +78,7 @@ public class StartVBoxIfNotAlreadyRunning implements Supplier<VirtualBoxManager>
|
|||
|
||||
public synchronized void start() {
|
||||
URI provider = providerSupplier.get();
|
||||
if (!socketTester.apply(new IPSocket(provider.getHost(), provider.getPort()))) {
|
||||
if (!socketTester.apply(HostAndPort.fromParts(provider.getHost(), provider.getPort()))) {
|
||||
logger.debug("disabling password access");
|
||||
runScriptOnNodeFactory.create(host.get(), Statements.exec("VBoxManage setproperty websrvauthlibrary null"),
|
||||
runAsRoot(false).wrapInInitScript(false)).init().call();
|
||||
|
@ -87,7 +87,7 @@ public class StartVBoxIfNotAlreadyRunning implements Supplier<VirtualBoxManager>
|
|||
runScriptOnNodeFactory.create(host.get(), Statements.exec(vboxwebsrv),
|
||||
runAsRoot(false).wrapInInitScript(false).blockOnComplete(false).nameTask("vboxwebsrv")).init().call();
|
||||
|
||||
if (!socketTester.apply(new IPSocket(provider.getHost(), provider.getPort()))){
|
||||
if (!socketTester.apply(HostAndPort.fromParts(provider.getHost(), provider.getPort()))){
|
||||
throw new RuntimeException("could not connect to virtualbox");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.jclouds.compute.domain.NodeMetadataBuilder;
|
|||
import org.jclouds.compute.domain.NodeState;
|
||||
import org.jclouds.compute.domain.OperatingSystem;
|
||||
import org.jclouds.compute.predicates.RetryIfSocketNotYetOpen;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.scriptbuilder.domain.Statements;
|
||||
import org.testng.annotations.Test;
|
||||
import org.virtualbox_4_1.VirtualBoxManager;
|
||||
|
@ -44,6 +43,7 @@ import org.virtualbox_4_1.VirtualBoxManager;
|
|||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
@Test(groups = "live", singleThreaded = true, testName = "StartVBoxIfNotAlreadyRunningLiveTest")
|
||||
public class StartVBoxIfNotAlreadyRunningLiveTest {
|
||||
|
@ -59,7 +59,7 @@ public class StartVBoxIfNotAlreadyRunningLiveTest {
|
|||
String identity = "adminstrator";
|
||||
String credential = "12345";
|
||||
expect(client.seconds(3)).andReturn(client);
|
||||
expect(client.apply(new IPSocket(provider.getHost(), provider.getPort()))).andReturn(true).anyTimes();
|
||||
expect(client.apply(HostAndPort.fromParts(provider.getHost(), provider.getPort()))).andReturn(true).anyTimes();
|
||||
manager.connect(provider.toASCIIString(), "", "");
|
||||
expectLastCall().anyTimes();
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class StartVBoxIfNotAlreadyRunningLiveTest {
|
|||
String credential = "12345";
|
||||
|
||||
expect(client.seconds(3)).andReturn(client);
|
||||
expect(client.apply(new IPSocket(provider.getHost(), provider.getPort()))).andReturn(false).once().andReturn(true).once();
|
||||
expect(client.apply(HostAndPort.fromParts(provider.getHost(), provider.getPort()))).andReturn(false).once().andReturn(true).once();
|
||||
expect(
|
||||
runScriptOnNodeFactory.create(host, Statements.exec("VBoxManage setproperty websrvauthlibrary null"),
|
||||
runAsRoot(false).wrapInInitScript(false))).andReturn(runScriptOnNode);
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.jclouds.compute.predicates.NodePredicates;
|
|||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.domain.LoginCredentials.Builder;
|
||||
import org.jclouds.loadbalancer.domain.LoadBalancerMetadata;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
|
@ -49,6 +48,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Module;
|
||||
|
@ -95,7 +95,7 @@ public abstract class BaseLoadBalancerServiceLiveTest extends BaseViewLiveTest<L
|
|||
protected SshClient.Factory sshFactory;
|
||||
protected String group;
|
||||
|
||||
protected RetryablePredicate<IPSocket> socketTester;
|
||||
protected RetryablePredicate<HostAndPort> socketTester;
|
||||
protected Set<? extends NodeMetadata> nodes;
|
||||
protected Template template;
|
||||
protected Map<String, String> keyPair;
|
||||
|
@ -139,7 +139,7 @@ public abstract class BaseLoadBalancerServiceLiveTest extends BaseViewLiveTest<L
|
|||
|
||||
protected void buildSocketTester() {
|
||||
SocketOpen socketOpen = Guice.createInjector(getSshModule()).getInstance(SocketOpen.class);
|
||||
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<HostAndPort>(socketOpen, 60, 1, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
abstract protected Module getSshModule();
|
||||
|
|
|
@ -53,7 +53,6 @@ import org.jclouds.gogrid.options.GetImageListOptions;
|
|||
import org.jclouds.gogrid.predicates.LoadBalancerLatestJobCompleted;
|
||||
import org.jclouds.gogrid.predicates.ServerLatestJobCompleted;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContext;
|
||||
|
@ -66,6 +65,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
/**
|
||||
* End to end live test for GoGrid
|
||||
|
@ -341,9 +341,9 @@ public class GoGridLiveTestDisabled extends BaseComputeServiceContextLiveTest {
|
|||
LoginCredentials instanceCredentials = LoginCredentials.fromCredentials(credsMap.get(createdServer.getName()));
|
||||
assertNotNull(instanceCredentials);
|
||||
|
||||
IPSocket socket = new IPSocket(createdServer.getIp().getIp(), 22);
|
||||
HostAndPort socket = HostAndPort.fromParts(createdServer.getIp().getIp(), 22);
|
||||
|
||||
RetryablePredicate<IPSocket> socketOpen = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 180,
|
||||
RetryablePredicate<HostAndPort> socketOpen = new RetryablePredicate<HostAndPort>(new InetSocketAddressConnect(), 180,
|
||||
5, TimeUnit.SECONDS);
|
||||
|
||||
socketOpen.apply(socket);
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
|
|||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.predicates.SocketOpen;
|
||||
import org.jclouds.slicehost.domain.Flavor;
|
||||
|
@ -46,6 +45,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ public class SlicehostClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
|
||||
protected SlicehostClient client;
|
||||
protected SshClient.Factory sshFactory;
|
||||
private Predicate<IPSocket> socketTester;
|
||||
private Predicate<HostAndPort> socketTester;
|
||||
|
||||
@BeforeGroups(groups = { "integration", "live" })
|
||||
@Override
|
||||
|
@ -73,7 +73,7 @@ public class SlicehostClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
client = injector.getInstance(SlicehostClient.class);
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
SocketOpen socketOpen = injector.getInstance(SocketOpen.class);
|
||||
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 120, 1, TimeUnit.SECONDS);
|
||||
socketTester = new RetryablePredicate<HostAndPort>(socketOpen, 120, 1, TimeUnit.SECONDS);
|
||||
injector.injectMembers(socketOpen); // add logger
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ public class SlicehostClientLiveTest extends BaseComputeServiceContextLiveTest {
|
|||
|
||||
private void doCreateMarkerFile(Slice newDetails, String pass) throws IOException {
|
||||
String ip = getIp(newDetails);
|
||||
IPSocket socket = new IPSocket(ip, 22);
|
||||
HostAndPort socket = HostAndPort.fromParts(ip, 22);
|
||||
socketTester.apply(socket);
|
||||
|
||||
SshClient client = sshFactory.create(socket, LoginCredentials.builder().user("root").password(pass).build());
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.jclouds.compute.domain.Template;
|
|||
import org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials;
|
||||
import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.softlayer.compute.options.SoftLayerTemplateOptions;
|
||||
import org.jclouds.softlayer.compute.strategy.SoftLayerComputeServiceAdapter;
|
||||
import org.jclouds.softlayer.domain.ProductItem;
|
||||
|
@ -41,6 +40,7 @@ import org.testng.annotations.BeforeGroups;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.google.common.net.InetAddresses;
|
||||
|
||||
@Test(groups = "live", singleThreaded = true, testName = "SoftLayerComputeServiceAdapterLiveTest")
|
||||
|
@ -82,7 +82,7 @@ public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerClientL
|
|||
}
|
||||
|
||||
protected void doConnectViaSsh(VirtualGuest guest, LoginCredentials creds) {
|
||||
SshClient ssh = view.utils().sshFactory().create(new IPSocket(guest.getPrimaryIpAddress(), 22), creds);
|
||||
SshClient ssh = view.utils().sshFactory().create(HostAndPort.fromParts(guest.getPrimaryIpAddress(), 22), creds);
|
||||
try {
|
||||
ssh.connect();
|
||||
ExecResponse hello = ssh.exec("echo hello");
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Map.Entry;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.trmk.ecloud.suppliers.TerremarkECloudInternetServiceAndPublicIpAddressSupplier;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkClientLiveTest;
|
||||
|
@ -33,6 +32,8 @@ 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.common.net.HostAndPort;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code TerremarkECloudClient}
|
||||
*
|
||||
|
@ -56,7 +57,7 @@ public class TerremarkECloudClientLiveTest extends TerremarkClientLiveTest<Terre
|
|||
}
|
||||
|
||||
@Override
|
||||
protected SshClient getConnectionFor(IPSocket socket) {
|
||||
protected SshClient getConnectionFor(HostAndPort socket) {
|
||||
return sshFactory.create(socket, LoginCredentials.builder().user("ecloud").password("TmrkCl0ud1s#1!").privateKey(
|
||||
key.getPrivateKey()).authenticateSudo(true).build());
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.jclouds.trmk.vcloudexpress;
|
|||
import java.util.Map.Entry;
|
||||
|
||||
import org.jclouds.domain.LoginCredentials;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.trmk.vcloud_0_8.TerremarkClientLiveTest;
|
||||
import org.jclouds.trmk.vcloud_0_8.domain.InternetService;
|
||||
|
@ -31,6 +30,8 @@ import org.jclouds.trmk.vcloud_0_8.domain.VApp;
|
|||
import org.jclouds.trmk.vcloudexpress.suppliers.TerremarkVCloudExpressInternetServiceAndPublicIpAddressSupplier;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code TerremarkVCloudExpressClient}
|
||||
*
|
||||
|
@ -40,7 +41,7 @@ import org.testng.annotations.Test;
|
|||
public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTest<TerremarkVCloudExpressClient, TerremarkVCloudExpressAsyncClient> {
|
||||
|
||||
@Override
|
||||
protected SshClient getConnectionFor(IPSocket socket) {
|
||||
protected SshClient getConnectionFor(HostAndPort socket) {
|
||||
return sshFactory.create(socket, LoginCredentials.builder().user("vcloud").password("TmrkCl0ud1s#1!").privateKey(
|
||||
key.getPrivateKey()).authenticateSudo(true).build());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue