refactored LiveTest code to share property initialization

This commit is contained in:
Adrian Cole 2012-01-05 17:51:03 -08:00
parent 42137677da
commit 99fb37f6cf
47 changed files with 355 additions and 1040 deletions

View File

@ -18,12 +18,9 @@
*/ */
package org.jclouds.cloudloadbalancers.features; package org.jclouds.cloudloadbalancers.features;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.Constants;
import org.jclouds.cloudloadbalancers.CloudLoadBalancersAsyncClient; import org.jclouds.cloudloadbalancers.CloudLoadBalancersAsyncClient;
import org.jclouds.cloudloadbalancers.CloudLoadBalancersClient; import org.jclouds.cloudloadbalancers.CloudLoadBalancersClient;
import org.jclouds.cloudloadbalancers.domain.LoadBalancer; import org.jclouds.cloudloadbalancers.domain.LoadBalancer;
@ -33,6 +30,7 @@ import org.jclouds.loadbalancer.LoadBalancerServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.net.IPSocket; import org.jclouds.net.IPSocket;
import org.jclouds.predicates.RetryablePredicate; import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.rest.BaseRestClientLiveTest;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.testng.annotations.AfterGroups; import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
@ -47,44 +45,20 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class BaseCloudLoadBalancersClientLiveTest { public class BaseCloudLoadBalancersClientLiveTest extends BaseRestClientLiveTest {
protected String prefix = System.getProperty("user.name"); public BaseCloudLoadBalancersClientLiveTest() {
provider = "cloudloadbalancers";
}
protected CloudLoadBalancersClient client; protected CloudLoadBalancersClient client;
protected RestContext<CloudLoadBalancersClient, CloudLoadBalancersAsyncClient> context; protected RestContext<CloudLoadBalancersClient, CloudLoadBalancersAsyncClient> context;
protected String provider = "cloudloadbalancers";
protected String[] regions = {}; protected String[] regions = {};
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected Predicate<IPSocket> socketTester; protected Predicate<IPSocket> socketTester;
protected RetryablePredicate<LoadBalancer> loadBalancerActive; protected RetryablePredicate<LoadBalancer> loadBalancerActive;
protected RetryablePredicate<LoadBalancer> loadBalancerDeleted; protected RetryablePredicate<LoadBalancer> loadBalancerDeleted;
protected Injector injector; protected Injector injector;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider
+ ".identity must be set. ex. apiKey");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential must be set. ex. secretKey");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = "live") @BeforeGroups(groups = "live")
public void setupClient() { public void setupClient() {

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.cloudsigma; package org.jclouds.cloudsigma;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@ -28,7 +27,6 @@ import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jclouds.Constants;
import org.jclouds.cloudsigma.domain.ClaimType; import org.jclouds.cloudsigma.domain.ClaimType;
import org.jclouds.cloudsigma.domain.CreateDriveRequest; import org.jclouds.cloudsigma.domain.CreateDriveRequest;
import org.jclouds.cloudsigma.domain.DriveData; import org.jclouds.cloudsigma.domain.DriveData;
@ -46,6 +44,8 @@ import org.jclouds.cloudsigma.domain.VLANInfo;
import org.jclouds.cloudsigma.options.CloneDriveOptions; import org.jclouds.cloudsigma.options.CloneDriveOptions;
import org.jclouds.cloudsigma.predicates.DriveClaimed; import org.jclouds.cloudsigma.predicates.DriveClaimed;
import org.jclouds.cloudsigma.util.Servers; import org.jclouds.cloudsigma.util.Servers;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
@ -62,6 +62,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.gson.Gson; import com.google.gson.Gson;
@ -73,56 +74,39 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true) @Test(groups = "live", singleThreaded = true, testName = "CloudSigmaClientLiveTest")
public class CloudSigmaClientLiveTest { public class CloudSigmaClientLiveTest extends BaseVersionedServiceLiveTest {
public CloudSigmaClientLiveTest() {
provider = "cloudsigma";
}
protected long driveSize = 8 * 1024 * 1024 * 1024l; protected long driveSize = 8 * 1024 * 1024 * 1024l;
protected int maxDriveImageTime = 300; protected int maxDriveImageTime = 300;
protected String vncPassword = "Il0veVNC"; protected String vncPassword = "Il0veVNC";
protected String bootDrive = "f3c7c665-cd54-4a78-8fd2-7ec2f028cf29";
protected CloudSigmaClient client; protected CloudSigmaClient client;
protected RestContext<CloudSigmaClient, CloudSigmaAsyncClient> context; protected RestContext<CloudSigmaClient, CloudSigmaAsyncClient> context;
protected Predicate<IPSocket> socketTester; protected Predicate<IPSocket> socketTester;
protected String provider = "cloudsigma";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected Predicate<DriveInfo> driveNotClaimed; protected Predicate<DriveInfo> driveNotClaimed;
protected ComputeServiceContext computeContext;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = "live") @BeforeGroups(groups = "live")
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();
Properties overrides = setupProperties(); Properties overrides = setupProperties();
context = new ComputeServiceContextFactory().createContext(provider, computeContext = new ComputeServiceContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getProviderSpecificContext(); ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides);
context = computeContext.getProviderSpecificContext();
client = context.getApi(); client = context.getApi();
driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime,
1, TimeUnit.SECONDS); 1, TimeUnit.SECONDS);
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), maxDriveImageTime, 1, socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), maxDriveImageTime, 1,
TimeUnit.SECONDS); TimeUnit.SECONDS);
if (Strings.emptyToNull(imageId) == null) {
imageId = computeContext.getComputeService().templateBuilder().build().getImage().getId();
}
} }
@Test @Test
@ -459,7 +443,7 @@ public class CloudSigmaClientLiveTest {
protected void prepareDrive() { protected void prepareDrive() {
client.destroyDrive(drive.getUuid()); client.destroyDrive(drive.getUuid());
drive = client.cloneDrive(bootDrive, drive.getName(), drive = client.cloneDrive(imageId, drive.getName(),
new CloneDriveOptions() new CloneDriveOptions()
.size(driveSize) .size(driveSize)
.tags("cat:mouse", "monkey:banana") .tags("cat:mouse", "monkey:banana")

View File

@ -25,12 +25,12 @@ import java.util.Date;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.cloudwatch.domain.Datapoint; import org.jclouds.cloudwatch.domain.Datapoint;
import org.jclouds.cloudwatch.domain.Statistics; import org.jclouds.cloudwatch.domain.Statistics;
import org.jclouds.cloudwatch.domain.Unit; import org.jclouds.cloudwatch.domain.Unit;
import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions; import org.jclouds.cloudwatch.options.GetMetricStatisticsOptions;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.BaseRestClientLiveTest;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextFactory; import org.jclouds.rest.RestContextFactory;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
@ -45,37 +45,15 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true)
public class CloudWatchClientLiveTest { public class CloudWatchClientLiveTest extends BaseRestClientLiveTest {
public CloudWatchClientLiveTest() {
provider = "cloudwatch";
}
private CloudWatchClient client; private CloudWatchClient client;
private RestContext<CloudWatchClient, CloudWatchAsyncClient> context; private RestContext<CloudWatchClient, CloudWatchAsyncClient> context;
protected String provider = "cloudwatch";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint", null);
apiVersion = System.getProperty("test." + provider + ".api-version", null);
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {

View File

@ -26,7 +26,7 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.Constants; import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.deltacloud.domain.DeltacloudCollection; import org.jclouds.deltacloud.domain.DeltacloudCollection;
import org.jclouds.deltacloud.domain.HardwareProfile; import org.jclouds.deltacloud.domain.HardwareProfile;
@ -59,40 +59,19 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true, testName = "ReadOnlyDeltacloudClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "ReadOnlyDeltacloudClientLiveTest")
public class ReadOnlyDeltacloudClientLiveTest { public class ReadOnlyDeltacloudClientLiveTest extends BaseVersionedServiceLiveTest {
public ReadOnlyDeltacloudClientLiveTest() {
provider = "deltacloud";
}
protected DeltacloudClient client; protected DeltacloudClient client;
protected RestContext<DeltacloudClient, DeltacloudAsyncClient> context; protected RestContext<DeltacloudClient, DeltacloudAsyncClient> context;
protected String provider = "deltacloud";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected Predicate<IPSocket> socketTester; protected Predicate<IPSocket> socketTester;
protected ImmutableMap<State, Predicate<Instance>> stateChanges; protected ImmutableMap<State, Predicate<Instance>> stateChanges;
protected void setupCredentials() {
identity = System.getProperty("test." + provider + ".identity", "mockuser");
credential = System.getProperty("test." + provider + ".credential", "mockpassword");
endpoint = System.getProperty("test." + provider + ".endpoint", "http://localhost:3001/api");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = "live") @BeforeGroups(groups = "live")
public void setupClient() { public void setupClient() {

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.ec2; package org.jclouds.ec2;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.ec2.options.RunInstancesOptions.Builder.asType; import static org.jclouds.ec2.options.RunInstancesOptions.Builder.asType;
import static org.jclouds.scriptbuilder.domain.Statements.exec; import static org.jclouds.scriptbuilder.domain.Statements.exec;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
@ -34,12 +33,11 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException; import org.jclouds.aws.AWSResponseException;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
import org.jclouds.ec2.domain.BlockDevice; import org.jclouds.ec2.domain.BlockDevice;
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
import org.jclouds.ec2.domain.InstanceState; import org.jclouds.ec2.domain.InstanceState;
import org.jclouds.ec2.domain.InstanceType; import org.jclouds.ec2.domain.InstanceType;
import org.jclouds.ec2.domain.IpProtocol; import org.jclouds.ec2.domain.IpProtocol;
@ -47,6 +45,7 @@ import org.jclouds.ec2.domain.KeyPair;
import org.jclouds.ec2.domain.PublicIpInstanceIdPair; import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
import org.jclouds.ec2.domain.Reservation; import org.jclouds.ec2.domain.Reservation;
import org.jclouds.ec2.domain.RunningInstance; import org.jclouds.ec2.domain.RunningInstance;
import org.jclouds.ec2.domain.Image.EbsBlockDevice;
import org.jclouds.ec2.domain.Volume.InstanceInitiatedShutdownBehavior; import org.jclouds.ec2.domain.Volume.InstanceInitiatedShutdownBehavior;
import org.jclouds.ec2.predicates.InstanceHasIpAddress; import org.jclouds.ec2.predicates.InstanceHasIpAddress;
import org.jclouds.ec2.predicates.InstanceStateRunning; import org.jclouds.ec2.predicates.InstanceStateRunning;
@ -80,8 +79,11 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", enabled = false, sequential = true) @Test(groups = "live", enabled = false, singleThreaded = true, testName = "CloudApplicationArchitecturesEC2ClientLiveTest")
public class CloudApplicationArchitecturesEC2ClientLiveTest { public class CloudApplicationArchitecturesEC2ClientLiveTest extends BaseVersionedServiceLiveTest {
public CloudApplicationArchitecturesEC2ClientLiveTest() {
provider = "ec2";
}
private EC2Client client; private EC2Client client;
protected SshClient.Factory sshFactory; protected SshClient.Factory sshFactory;
@ -95,32 +97,6 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
private RetryablePredicate<RunningInstance> hasIpTester; private RetryablePredicate<RunningInstance> hasIpTester;
private RetryablePredicate<RunningInstance> runningTester; private RetryablePredicate<RunningInstance> runningTester;
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiVersion = checkNotNull(System.getProperty("test." + provider + ".api-version"), "test." + provider
+ ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".endpoint", endpoint);
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.ec2; package org.jclouds.ec2;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.ec2.options.CreateSnapshotOptions.Builder.withDescription; import static org.jclouds.ec2.options.CreateSnapshotOptions.Builder.withDescription;
import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.imageIds; import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.imageIds;
import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.withKernelId; import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.withKernelId;
@ -34,15 +33,13 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException; import org.jclouds.aws.AWSResponseException;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
import org.jclouds.ec2.domain.Attachment; import org.jclouds.ec2.domain.Attachment;
import org.jclouds.ec2.domain.BlockDevice; import org.jclouds.ec2.domain.BlockDevice;
import org.jclouds.ec2.domain.Image; 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.InstanceState;
import org.jclouds.ec2.domain.InstanceType; import org.jclouds.ec2.domain.InstanceType;
import org.jclouds.ec2.domain.IpProtocol; import org.jclouds.ec2.domain.IpProtocol;
@ -52,6 +49,8 @@ import org.jclouds.ec2.domain.RootDeviceType;
import org.jclouds.ec2.domain.RunningInstance; import org.jclouds.ec2.domain.RunningInstance;
import org.jclouds.ec2.domain.Snapshot; import org.jclouds.ec2.domain.Snapshot;
import org.jclouds.ec2.domain.Volume; 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.domain.Volume.InstanceInitiatedShutdownBehavior;
import org.jclouds.ec2.predicates.InstanceStateRunning; import org.jclouds.ec2.predicates.InstanceStateRunning;
import org.jclouds.ec2.predicates.InstanceStateStopped; import org.jclouds.ec2.predicates.InstanceStateStopped;
@ -95,13 +94,19 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", enabled = false, sequential = true) @Test(groups = "live", enabled = false, singleThreaded = true, testName = "EBSBootEC2ClientLiveTest")
public class EBSBootEC2ClientLiveTest { public class EBSBootEC2ClientLiveTest extends BaseVersionedServiceLiveTest {
public EBSBootEC2ClientLiveTest() {
provider = "ec2";
}
// TODO: parameterize
private static final String IMAGE_ID = "ami-7e28ca17";
// don't need a lot of space. 2GB should be more than enough for testing // don't need a lot of space. 2GB should be more than enough for testing
private static final int VOLUME_SIZE = 2; private static final int VOLUME_SIZE = 2;
private static final String SCRIPT_END = "----COMPLETE----"; private static final String SCRIPT_END = "----COMPLETE----";
private static final String INSTANCE_PREFIX = System.getProperty("user.name") + ".ec2ebs"; private static final String INSTANCE_PREFIX = System.getProperty("user.name") + ".ec2ebs";
private static final String IMAGE_ID = "ami-7e28ca17";
private EC2Client client; private EC2Client client;
private SshClient.Factory sshFactory; private SshClient.Factory sshFactory;
@ -124,32 +129,6 @@ public class EBSBootEC2ClientLiveTest {
private Attachment attachment; private Attachment attachment;
private String mkEbsBoot; private String mkEbsBoot;
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiVersion = checkNotNull(System.getProperty("test." + provider + ".api-version"), "test." + provider
+ ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".endpoint", endpoint);
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();

View File

@ -18,13 +18,11 @@
*/ */
package org.jclouds.ec2.compute; package org.jclouds.ec2.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.Properties; import java.util.Properties;
import org.jclouds.Constants; import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.RunNodesException; import org.jclouds.compute.RunNodesException;
@ -32,7 +30,6 @@ import org.jclouds.compute.domain.Template;
import org.jclouds.compute.predicates.NodePredicates; import org.jclouds.compute.predicates.NodePredicates;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.sshj.config.SshjSshClientModule; import org.jclouds.sshj.config.SshjSshClientModule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -44,37 +41,13 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live") @Test(groups = "live", testName="TestCanRecreateGroupLiveTest")
public class TestCanRecreateGroupLiveTest { public class TestCanRecreateGroupLiveTest extends BaseVersionedServiceLiveTest {
public TestCanRecreateGroupLiveTest() {
provider = "ec2";
}
private ComputeServiceContext context; private ComputeServiceContext context;
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws FileNotFoundException, IOException { public void setupClient() throws FileNotFoundException, IOException {

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.ec2.services; package org.jclouds.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.availabilityZones; import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.availabilityZones;
import static org.jclouds.ec2.options.DescribeRegionsOptions.Builder.regions; import static org.jclouds.ec2.options.DescribeRegionsOptions.Builder.regions;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
@ -26,13 +25,13 @@ import static org.testng.Assert.assertNotNull;
import java.net.URI; import java.net.URI;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.Map.Entry;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.ec2.EC2AsyncClient; import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
@ -40,7 +39,6 @@ import org.jclouds.ec2.domain.AvailabilityZoneInfo;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -54,38 +52,14 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "AvailabilityZoneAndRegionClientLiveTest")
public class AvailabilityZoneAndRegionClientLiveTest { public class AvailabilityZoneAndRegionClientLiveTest extends BaseVersionedServiceLiveTest {
public AvailabilityZoneAndRegionClientLiveTest() {
provider = "ec2";
}
private AvailabilityZoneAndRegionClient client; private AvailabilityZoneAndRegionClient client;
private RestContext<EC2Client, EC2AsyncClient> context; private RestContext<EC2Client, EC2AsyncClient> context;
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {

View File

@ -30,6 +30,7 @@ import java.util.concurrent.TimeUnit;
import org.jclouds.Constants; import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.ec2.EC2AsyncClient; import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
@ -57,39 +58,16 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "ElasticBlockStoreClientLiveTest")
public class ElasticBlockStoreClientLiveTest { public class ElasticBlockStoreClientLiveTest extends BaseVersionedServiceLiveTest {
public ElasticBlockStoreClientLiveTest() {
provider = "ec2";
}
private ElasticBlockStoreClient client; private ElasticBlockStoreClient client;
private RestContext<EC2Client, EC2AsyncClient> context; private RestContext<EC2Client, EC2AsyncClient> context;
private String volumeId; private String volumeId;
private Snapshot snapshot; private Snapshot snapshot;
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {

View File

@ -18,15 +18,14 @@
*/ */
package org.jclouds.ec2.services; package org.jclouds.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import java.util.Properties; import java.util.Properties;
import java.util.SortedSet; import java.util.SortedSet;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.ec2.EC2AsyncClient; import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
@ -47,38 +46,15 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "ElasticIPAddressClientLiveTest")
public class ElasticIPAddressClientLiveTest { public class ElasticIPAddressClientLiveTest extends BaseVersionedServiceLiveTest {
public ElasticIPAddressClientLiveTest() {
provider = "ec2";
}
private ElasticIPAddressClient client; private ElasticIPAddressClient client;
private RestContext<EC2Client, EC2AsyncClient> context; private RestContext<EC2Client, EC2AsyncClient> context;
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiVersion = checkNotNull(System.getProperty("test." + provider + ".api-version"), "test." + provider
+ ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".endpoint", endpoint);
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();

View File

@ -18,14 +18,13 @@
*/ */
package org.jclouds.ec2.services; package org.jclouds.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.ec2.EC2AsyncClient; import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
@ -46,37 +45,15 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "InstanceClientLiveTest")
public class InstanceClientLiveTest { public class InstanceClientLiveTest extends BaseVersionedServiceLiveTest {
public static final String PREFIX = System.getProperty("user.name") + "-ec2"; public InstanceClientLiveTest() {
provider = "ec2";
}
private InstanceClient client; private InstanceClient client;
private RestContext<EC2Client, EC2AsyncClient> context; private RestContext<EC2Client, EC2AsyncClient> context;
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiVersion = checkNotNull(System.getProperty("test." + provider + ".api-version"), "test." + provider
+ ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".endpoint", endpoint);
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.ec2.services; package org.jclouds.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@ -26,8 +25,8 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.ec2.EC2AsyncClient; import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
@ -48,37 +47,15 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "KeyPairClientLiveTest")
public class KeyPairClientLiveTest { public class KeyPairClientLiveTest extends BaseVersionedServiceLiveTest {
public KeyPairClientLiveTest() {
provider = "ec2";
}
private KeyPairClient client; private KeyPairClient client;
private RestContext<EC2Client, EC2AsyncClient> context; private RestContext<EC2Client, EC2AsyncClient> context;
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiVersion = checkNotNull(System.getProperty("test." + provider + ".api-version"), "test." + provider
+ ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".endpoint", endpoint);
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.ec2.services; package org.jclouds.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@ -27,8 +26,8 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.ec2.EC2AsyncClient; import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
@ -55,39 +54,15 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true) @Test(groups = "live", singleThreaded = true, testName = "SecurityGroupClientLiveTest")
public class SecurityGroupClientLiveTest { public class SecurityGroupClientLiveTest extends BaseVersionedServiceLiveTest {
public SecurityGroupClientLiveTest() {
provider = "ec2";
}
protected SecurityGroupClient client; protected SecurityGroupClient client;
private RestContext<EC2Client, EC2AsyncClient> context; private RestContext<EC2Client, EC2AsyncClient> context;
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();

View File

@ -18,14 +18,12 @@
*/ */
package org.jclouds.ec2.services; package org.jclouds.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Properties; import java.util.Properties;
import org.jclouds.Constants; import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.ec2.EC2AsyncClient; import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
@ -39,8 +37,11 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "WindowsClientLiveTest")
public class WindowsClientLiveTest { public class WindowsClientLiveTest extends BaseVersionedServiceLiveTest {
public WindowsClientLiveTest() {
provider = "ec2";
}
private WindowsClient client; private WindowsClient client;
private static final String DEFAULT_INSTANCE = "i-TODO"; private static final String DEFAULT_INSTANCE = "i-TODO";
@ -48,31 +49,6 @@ public class WindowsClientLiveTest {
private RestContext<EC2Client, EC2AsyncClient> context; private RestContext<EC2Client, EC2AsyncClient> context;
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiVersion = checkNotNull(System.getProperty("test." + provider + ".api-version"), "test." + provider
+ ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".endpoint", endpoint);
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.elasticstack; package org.jclouds.elasticstack;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@ -28,7 +27,8 @@ import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.jclouds.Constants; import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
@ -60,6 +60,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.gson.Gson; import com.google.gson.Gson;
@ -71,57 +72,39 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live") @Test(groups = "live", singleThreaded = true, testName = "ElasticStackClientLiveTest")
public class ElasticStackClientLiveTest { public class ElasticStackClientLiveTest extends BaseVersionedServiceLiveTest {
public ElasticStackClientLiveTest() {
provider = "elasticstack";
}
protected long driveSize = 1 * 1024 * 1024 * 1024l; protected long driveSize = 1 * 1024 * 1024 * 1024l;
protected int maxDriveImageTime = 360; protected int maxDriveImageTime = 360;
protected String vncPassword = "Il0veVNC"; protected String vncPassword = "Il0veVNC";
protected ElasticStackClient client; protected ElasticStackClient client;
protected ComputeServiceContext computeContext;
protected RestContext<ElasticStackClient, ElasticStackAsyncClient> context; protected RestContext<ElasticStackClient, ElasticStackAsyncClient> context;
protected Predicate<IPSocket> socketTester; protected Predicate<IPSocket> socketTester;
protected String bootDrive = "38df0986-4d85-4b76-b502-3878ffc80161";
protected String provider = "elasticstack";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected Predicate<DriveInfo> driveNotClaimed; protected Predicate<DriveInfo> driveNotClaimed;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = "live") @BeforeGroups(groups = "live")
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();
Properties overrides = setupProperties(); Properties overrides = setupProperties();
context = new ComputeServiceContextFactory().createContext(provider, computeContext = new ComputeServiceContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getProviderSpecificContext(); ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides);
context = computeContext.getProviderSpecificContext();
client = context.getApi(); client = context.getApi();
driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime, driveNotClaimed = new RetryablePredicate<DriveInfo>(Predicates.not(new DriveClaimed(client)), maxDriveImageTime,
1, TimeUnit.SECONDS); 1, TimeUnit.SECONDS);
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), maxDriveImageTime, 1, socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), maxDriveImageTime, 1,
TimeUnit.SECONDS); TimeUnit.SECONDS);
if (Strings.emptyToNull(imageId) == null) {
imageId = computeContext.getComputeService().templateBuilder().build().getImage().getId();
}
} }
@Test @Test
@ -377,7 +360,7 @@ public class ElasticStackClientLiveTest {
protected void prepareDrive() { protected void prepareDrive() {
System.err.println("before prepare" + client.getDriveInfo(drive.getUuid())); System.err.println("before prepare" + client.getDriveInfo(drive.getUuid()));
client.imageDrive(bootDrive, drive.getUuid(), ImageConversionType.GUNZIP); client.imageDrive(imageId, drive.getUuid(), ImageConversionType.GUNZIP);
assert driveNotClaimed.apply(drive) : client.getDriveInfo(drive.getUuid()); assert driveNotClaimed.apply(drive) : client.getDriveInfo(drive.getUuid());
System.err.println("after prepare" + client.getDriveInfo(drive.getUuid())); System.err.println("after prepare" + client.getDriveInfo(drive.getUuid()));
} }

View File

@ -18,14 +18,13 @@
*/ */
package org.jclouds.trmk.vcloud_0_8.compute.suppliers; package org.jclouds.trmk.vcloud_0_8.compute.suppliers;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.io.IOException; import java.io.IOException;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants; import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.lifecycle.Closer; import org.jclouds.lifecycle.Closer;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
@ -48,38 +47,17 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "VAppTemplatesInOrgsLiveTest")
public class VAppTemplatesInOrgsLiveTest { public class VAppTemplatesInOrgsLiveTest extends BaseVersionedServiceLiveTest {
public VAppTemplatesInOrgsLiveTest() {
provider = "trmk-vcloudexpress";
}
private TerremarkVCloudClient tmClient; private TerremarkVCloudClient tmClient;
private VAppTemplatesInOrgs parser; private VAppTemplatesInOrgs parser;
private Closer closer; private Closer closer;
private AllCatalogItemsInOrg allCatalogItemsInOrg; private AllCatalogItemsInOrg allCatalogItemsInOrg;
protected String provider = "trmk-vcloudexpress";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiVersion = checkNotNull(System.getProperty("test." + provider + ".api-version"), "test." + provider
+ ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".endpoint", endpoint);
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {

View File

@ -18,15 +18,11 @@
*/ */
package org.jclouds.compute; package org.jclouds.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.emptyToNull;
import java.util.Properties; import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
import org.jclouds.domain.LoginCredentials.Builder; import org.jclouds.domain.LoginCredentials.Builder;
import org.jclouds.rest.RestContextFactory; import org.jclouds.rest.BaseRestClientLiveTest;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
@ -36,42 +32,16 @@ import com.google.common.collect.Iterables;
* *
* @author Jason King * @author Jason King
*/ */
public abstract class BaseVersionedServiceLiveTest { public abstract class BaseVersionedServiceLiveTest extends BaseRestClientLiveTest {
protected String prefix = System.getProperty("user.name");
protected String provider;
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected String imageId; protected String imageId;
protected String loginUser; protected String loginUser;
protected String authenticateSudo; protected String authenticateSudo;
protected LoginCredentials loginCredentials = LoginCredentials.builder().user("root").build(); protected LoginCredentials loginCredentials = LoginCredentials.builder().user("root").build();
protected Properties setupRestProperties() { @Override
return RestContextFactory.getPropertiesFromResource("/rest.properties");
}
protected Properties setupProperties() { protected Properties setupProperties() {
Properties overrides= super.setupProperties();
if (emptyToNull(provider) == null)
throw new NullPointerException("provider must not be null or empty:" + provider);
if (emptyToNull(identity) == null)
throw new NullPointerException("identity must not be null or empty:" + provider);
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
if (imageId != null) if (imageId != null)
overrides.setProperty(provider + ".image-id", imageId); overrides.setProperty(provider + ".image-id", imageId);
if (loginUser != null) if (loginUser != null)
@ -84,10 +54,7 @@ public abstract class BaseVersionedServiceLiveTest {
@BeforeClass @BeforeClass
protected void setupCredentials() { protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); super.setupCredentials();
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
imageId = System.getProperty("test." + provider + ".image-id"); imageId = System.getProperty("test." + provider + ".image-id");
loginUser = System.getProperty("test." + provider + ".image.login-user"); loginUser = System.getProperty("test." + provider + ".image.login-user");
authenticateSudo = System.getProperty("test." + provider + ".image.authenticate-sudo"); authenticateSudo = System.getProperty("test." + provider + ".image.authenticate-sudo");

View File

@ -0,0 +1,82 @@
/**
* 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.rest;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.emptyToNull;
import java.util.Properties;
import org.jclouds.Constants;
import org.testng.annotations.BeforeClass;
/**
*
* @author Adrian Cole
*/
public abstract class BaseRestClientLiveTest {
protected String prefix = System.getProperty("user.name");
protected String provider;
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected String buildVersion;
protected Properties setupRestProperties() {
return RestContextFactory.getPropertiesFromResource("/rest.properties");
}
protected Properties setupProperties() {
if (emptyToNull(provider) == null)
throw new NullPointerException("provider must not be null or empty:" + provider);
if (emptyToNull(identity) == null)
throw new NullPointerException("identity must not be null or empty:" + provider);
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
if (buildVersion != null)
overrides.setProperty(provider + ".build-version", buildVersion);
return overrides;
}
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
buildVersion = System.getProperty("test." + provider + ".build-version");
}
}

View File

@ -55,7 +55,7 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true)
public abstract class BaseLoadBalancerServiceLiveTest extends BaseVersionedServiceLiveTest { public abstract class BaseLoadBalancerServiceLiveTest extends BaseVersionedServiceLiveTest {
protected SshClient.Factory sshFactory; protected SshClient.Factory sshFactory;
@ -74,6 +74,7 @@ public abstract class BaseLoadBalancerServiceLiveTest extends BaseVersionedServi
protected String computeCredential; protected String computeCredential;
protected String computeEndpoint; protected String computeEndpoint;
protected String computeApiversion; protected String computeApiversion;
protected String computeBuildversion;
protected ComputeServiceContext computeContext; protected ComputeServiceContext computeContext;
@Override @Override
@ -86,6 +87,7 @@ public abstract class BaseLoadBalancerServiceLiveTest extends BaseVersionedServi
computeCredential = System.getProperty("test." + provider + ".compute.credential"); computeCredential = System.getProperty("test." + provider + ".compute.credential");
computeEndpoint = System.getProperty("test." + provider + ".compute.endpoint"); computeEndpoint = System.getProperty("test." + provider + ".compute.endpoint");
computeApiversion = System.getProperty("test." + provider + ".compute.api-version"); computeApiversion = System.getProperty("test." + provider + ".compute.api-version");
computeBuildversion = System.getProperty("test." + provider + ".compute.build-version");
} }
protected Properties setupComputeProperties() { protected Properties setupComputeProperties() {
@ -99,6 +101,8 @@ public abstract class BaseLoadBalancerServiceLiveTest extends BaseVersionedServi
overrides.setProperty(computeProvider + ".endpoint", computeEndpoint); overrides.setProperty(computeProvider + ".endpoint", computeEndpoint);
if (computeApiversion != null) if (computeApiversion != null)
overrides.setProperty(computeProvider + ".api-version", computeApiversion); overrides.setProperty(computeProvider + ".api-version", computeApiversion);
if (computeBuildversion != null)
overrides.setProperty(computeProvider + ".build-version", computeBuildversion);
return overrides; return overrides;
} }

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.aws.ec2.services; package org.jclouds.aws.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.aws.ec2.options.AWSDescribeImagesOptions.Builder.filters; import static org.jclouds.aws.ec2.options.AWSDescribeImagesOptions.Builder.filters;
import static org.jclouds.aws.ec2.options.AWSDescribeImagesOptions.Builder.imageIds; import static org.jclouds.aws.ec2.options.AWSDescribeImagesOptions.Builder.imageIds;
import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.addNewBlockDevice; import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.addNewBlockDevice;
@ -30,8 +29,8 @@ import java.util.Iterator;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.ec2.EC2AsyncClient; import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
@ -42,7 +41,6 @@ import org.jclouds.ec2.services.AMIClient;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -59,44 +57,20 @@ import com.google.inject.Module;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true) @Test(groups = "live", singleThreaded = true)
public class AMIClientLiveTest { public class AMIClientLiveTest extends BaseVersionedServiceLiveTest {
public AMIClientLiveTest() {
provider = "aws-ec2";
// TODO: parameterize this.
imageId = "ami-cdf819a4";
}
private AMIClient client; private AMIClient client;
private String imageId = "ami-cdf819a4";
private static final String DEFAULT_MANIFEST = "adrianimages/image.manifest.xml"; private static final String DEFAULT_MANIFEST = "adrianimages/image.manifest.xml";
private static final String DEFAULT_SNAPSHOT = "TODO"; private static final String DEFAULT_SNAPSHOT = "TODO";
private RestContext<EC2Client, EC2AsyncClient> context; private RestContext<EC2Client, EC2AsyncClient> context;
private Set<String> imagesToDeregister = Sets.newHashSet(); private Set<String> imagesToDeregister = Sets.newHashSet();
protected String provider = "aws-ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.aws.ec2.services; package org.jclouds.aws.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.aws.ec2.options.AWSDescribeImagesOptions.Builder.imageIds; import static org.jclouds.aws.ec2.options.AWSDescribeImagesOptions.Builder.imageIds;
import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.addNewBlockDevice; import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.addNewBlockDevice;
import static org.jclouds.ec2.options.RegisterImageOptions.Builder.withDescription; import static org.jclouds.ec2.options.RegisterImageOptions.Builder.withDescription;
@ -29,9 +28,9 @@ import java.util.Iterator;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.AWSEC2AsyncClient;
import org.jclouds.aws.ec2.AWSEC2Client; import org.jclouds.aws.ec2.AWSEC2Client;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.ec2.domain.Image; import org.jclouds.ec2.domain.Image;
import org.jclouds.ec2.domain.RootDeviceType; import org.jclouds.ec2.domain.RootDeviceType;
@ -40,7 +39,6 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -55,45 +53,21 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "AWSAMIClientLiveTest")
public class AWSAMIClientLiveTest { public class AWSAMIClientLiveTest extends BaseVersionedServiceLiveTest {
public AWSAMIClientLiveTest() {
provider = "aws-ec2";
// TODO: parameterize this.
imageId = "ami-7ea24a17";
}
private AWSAMIClient client; private AWSAMIClient client;
private String imageId = "ami-7ea24a17";
private static final String DEFAULT_MANIFEST = "adrianimages/image.manifest.xml"; private static final String DEFAULT_MANIFEST = "adrianimages/image.manifest.xml";
private static final String DEFAULT_SNAPSHOT = "TODO"; private static final String DEFAULT_SNAPSHOT = "TODO";
private RestContext<AWSEC2Client, AWSEC2AsyncClient> context; private RestContext<AWSEC2Client, AWSEC2AsyncClient> context;
private Set<String> imagesToDeregister = Sets.newHashSet(); private Set<String> imagesToDeregister = Sets.newHashSet();
protected String provider = "aws-ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();

View File

@ -18,15 +18,14 @@
*/ */
package org.jclouds.aws.ec2.services; package org.jclouds.aws.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.AWSEC2AsyncClient;
import org.jclouds.aws.ec2.AWSEC2Client; import org.jclouds.aws.ec2.AWSEC2Client;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.ec2.domain.Reservation; import org.jclouds.ec2.domain.Reservation;
import org.jclouds.ec2.domain.RunningInstance; import org.jclouds.ec2.domain.RunningInstance;
@ -44,39 +43,17 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true)
public class AWSInstanceClientLiveTest { public class AWSInstanceClientLiveTest extends BaseVersionedServiceLiveTest {
public AWSInstanceClientLiveTest() {
provider = "aws-ec2";
}
public static final String PREFIX = System.getProperty("user.name") + "-ec2"; public static final String PREFIX = System.getProperty("user.name") + "-ec2";
private AWSInstanceClient client; private AWSInstanceClient client;
private RestContext<AWSEC2Client, AWSEC2AsyncClient> context; private RestContext<AWSEC2Client, AWSEC2AsyncClient> context;
protected String provider = "aws-ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.aws.ec2.services; package org.jclouds.aws.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.get; import static com.google.common.collect.Iterables.get;
import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.collect.Sets.newTreeSet; import static com.google.common.collect.Sets.newTreeSet;
@ -36,12 +35,12 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.AWSEC2AsyncClient;
import org.jclouds.aws.ec2.AWSEC2Client; import org.jclouds.aws.ec2.AWSEC2Client;
import org.jclouds.aws.ec2.compute.AWSEC2TemplateOptions; import org.jclouds.aws.ec2.compute.AWSEC2TemplateOptions;
import org.jclouds.aws.ec2.domain.AWSRunningInstance; import org.jclouds.aws.ec2.domain.AWSRunningInstance;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.ComputeTestUtils; import org.jclouds.compute.ComputeTestUtils;
@ -66,39 +65,16 @@ import com.google.inject.Module;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true) @Test(groups = "live", singleThreaded = true)
public class AWSKeyPairClientLiveTest { public class AWSKeyPairClientLiveTest extends BaseVersionedServiceLiveTest {
public AWSKeyPairClientLiveTest() {
provider = "aws-ec2";
}
private AWSKeyPairClient client; private AWSKeyPairClient client;
private RestContext<AWSEC2Client, AWSEC2AsyncClient> context; private RestContext<AWSEC2Client, AWSEC2AsyncClient> context;
protected String provider = "aws-ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
private ComputeServiceContext computeContext; private ComputeServiceContext computeContext;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint", null);
apiVersion = System.getProperty("test." + provider + ".api-version", null);
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();

View File

@ -18,16 +18,15 @@
*/ */
package org.jclouds.aws.ec2.services; package org.jclouds.aws.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.AWSEC2AsyncClient;
import org.jclouds.aws.ec2.AWSEC2Client; import org.jclouds.aws.ec2.AWSEC2Client;
import org.jclouds.aws.ec2.domain.MonitoringState; import org.jclouds.aws.ec2.domain.MonitoringState;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
@ -42,37 +41,16 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true)
public class MonitoringClientLiveTest { public class MonitoringClientLiveTest extends BaseVersionedServiceLiveTest {
public MonitoringClientLiveTest() {
provider = "aws-ec2";
}
private MonitoringClient client; private MonitoringClient client;
private static final String DEFAULT_INSTANCE = "i-TODO"; private static final String DEFAULT_INSTANCE = "i-TODO";
private RestContext<AWSEC2Client, AWSEC2AsyncClient> context; private RestContext<AWSEC2Client, AWSEC2AsyncClient> context;
protected String provider = "aws-ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiVersion = checkNotNull(System.getProperty("test." + provider + ".api-version"), "test." + provider
+ ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".endpoint", endpoint);
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.aws.ec2.services; package org.jclouds.aws.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.newTreeSet; import static com.google.common.collect.Sets.newTreeSet;
@ -33,13 +32,13 @@ import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.AWSEC2Client; import org.jclouds.aws.ec2.AWSEC2Client;
import org.jclouds.aws.ec2.domain.PlacementGroup; import org.jclouds.aws.ec2.domain.PlacementGroup;
import org.jclouds.aws.ec2.domain.PlacementGroup.State; import org.jclouds.aws.ec2.domain.PlacementGroup.State;
import org.jclouds.aws.ec2.predicates.PlacementGroupAvailable; import org.jclouds.aws.ec2.predicates.PlacementGroupAvailable;
import org.jclouds.aws.ec2.predicates.PlacementGroupDeleted; import org.jclouds.aws.ec2.predicates.PlacementGroupDeleted;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.RunNodesException; import org.jclouds.compute.RunNodesException;
@ -54,7 +53,6 @@ import org.jclouds.scriptbuilder.domain.Statements;
import org.jclouds.scriptbuilder.statements.login.AdminAccess; import org.jclouds.scriptbuilder.statements.login.AdminAccess;
import org.jclouds.sshj.config.SshjSshClientModule; import org.jclouds.sshj.config.SshjSshClientModule;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -68,40 +66,16 @@ import com.google.inject.Module;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true, testName = "PlacementGroupClientLiveTest") @Test(groups = "live", singleThreaded = true, testName = "PlacementGroupClientLiveTest")
public class PlacementGroupClientLiveTest { public class PlacementGroupClientLiveTest extends BaseVersionedServiceLiveTest {
public PlacementGroupClientLiveTest() {
provider = "aws-ec2";
}
private AWSEC2Client client; private AWSEC2Client client;
private ComputeServiceContext context; private ComputeServiceContext context;
private RetryablePredicate<PlacementGroup> availableTester; private RetryablePredicate<PlacementGroup> availableTester;
private RetryablePredicate<PlacementGroup> deletedTester; private RetryablePredicate<PlacementGroup> deletedTester;
private PlacementGroup group; private PlacementGroup group;
protected String provider = "aws-ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws FileNotFoundException, IOException { public void setupClient() throws FileNotFoundException, IOException {

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.aws.ec2.services; package org.jclouds.aws.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Predicates.in; import static com.google.common.base.Predicates.in;
import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Iterables.getOnlyElement;
import static org.jclouds.aws.ec2.options.DescribeSpotPriceHistoryOptions.Builder.from; import static org.jclouds.aws.ec2.options.DescribeSpotPriceHistoryOptions.Builder.from;
@ -34,7 +33,6 @@ import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.AWSEC2Client; import org.jclouds.aws.ec2.AWSEC2Client;
import org.jclouds.aws.ec2.domain.AWSRunningInstance; import org.jclouds.aws.ec2.domain.AWSRunningInstance;
@ -42,6 +40,7 @@ import org.jclouds.aws.ec2.domain.LaunchSpecification;
import org.jclouds.aws.ec2.domain.Spot; import org.jclouds.aws.ec2.domain.Spot;
import org.jclouds.aws.ec2.domain.SpotInstanceRequest; import org.jclouds.aws.ec2.domain.SpotInstanceRequest;
import org.jclouds.aws.ec2.predicates.SpotInstanceRequestActive; import org.jclouds.aws.ec2.predicates.SpotInstanceRequestActive;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.ec2.domain.InstanceType; import org.jclouds.ec2.domain.InstanceType;
@ -49,7 +48,6 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.predicates.RetryablePredicate; import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.sshj.config.SshjSshClientModule; import org.jclouds.sshj.config.SshjSshClientModule;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -63,43 +61,19 @@ import com.google.inject.Module;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true) @Test(groups = "live", singleThreaded = true)
public class SpotInstanceClientLiveTest { public class SpotInstanceClientLiveTest extends BaseVersionedServiceLiveTest {
public SpotInstanceClientLiveTest() {
provider = "aws-ec2";
}
private static final int SPOT_DELAY_SECONDS = 600; private static final int SPOT_DELAY_SECONDS = 600;
private AWSEC2Client client; private AWSEC2Client client;
private ComputeServiceContext context; private ComputeServiceContext context;
private RetryablePredicate<SpotInstanceRequest> activeTester; private RetryablePredicate<SpotInstanceRequest> activeTester;
private Set<SpotInstanceRequest> requests; private Set<SpotInstanceRequest> requests;
protected String provider = "aws-ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
private AWSRunningInstance instance; private AWSRunningInstance instance;
private long start; private long start;
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws FileNotFoundException, IOException { public void setupClient() throws FileNotFoundException, IOException {
setupCredentials(); setupCredentials();

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.aws.ec2.services; package org.jclouds.aws.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.collect.Iterables.getOnlyElement;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@ -26,13 +25,13 @@ import static org.testng.Assert.assertNotNull;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.aws.ec2.AWSEC2AsyncClient; import org.jclouds.aws.ec2.AWSEC2AsyncClient;
import org.jclouds.aws.ec2.AWSEC2Client; import org.jclouds.aws.ec2.AWSEC2Client;
import org.jclouds.aws.ec2.domain.AWSRunningInstance; import org.jclouds.aws.ec2.domain.AWSRunningInstance;
import org.jclouds.aws.ec2.domain.Tag; import org.jclouds.aws.ec2.domain.Tag;
import org.jclouds.aws.ec2.util.TagFilters; import org.jclouds.aws.ec2.util.TagFilters;
import org.jclouds.aws.ec2.util.TagFilters.ResourceType; import org.jclouds.aws.ec2.util.TagFilters.ResourceType;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
@ -55,38 +54,17 @@ import com.google.inject.Module;
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@Test(groups = "live", singleThreaded = true) @Test(groups = "live", singleThreaded = true)
public class TagClientLiveTest { public class TagClientLiveTest extends BaseVersionedServiceLiveTest {
public TagClientLiveTest() {
provider = "aws-ec2";
}
private TagClient client; private TagClient client;
private RestContext<AWSEC2Client, AWSEC2AsyncClient> context; private RestContext<AWSEC2Client, AWSEC2AsyncClient> context;
protected String provider = "aws-ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected String testGroup; protected String testGroup;
private ComputeServiceContext computeContext; private ComputeServiceContext computeContext;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint", null);
apiVersion = System.getProperty("test." + provider + ".api-version", null);
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClientAndSecurityGroup() { public void setupClientAndSecurityGroup() {

View File

@ -18,10 +18,9 @@
*/ */
package org.jclouds.azureblob; package org.jclouds.azureblob;
import static com.google.common.base.Preconditions.checkNotNull; import static org.jclouds.azure.storage.options.ListOptions.Builder.includeMetadata;
import static org.jclouds.azureblob.options.CreateContainerOptions.Builder.withMetadata; import static org.jclouds.azureblob.options.CreateContainerOptions.Builder.withMetadata;
import static org.jclouds.azureblob.options.CreateContainerOptions.Builder.withPublicAccess; import static org.jclouds.azureblob.options.CreateContainerOptions.Builder.withPublicAccess;
import static org.jclouds.azure.storage.options.ListOptions.Builder.includeMetadata;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
@ -32,16 +31,15 @@ import java.security.SecureRandom;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.azure.storage.AzureStorageResponseException; import org.jclouds.azure.storage.AzureStorageResponseException;
import org.jclouds.azure.storage.domain.BoundedSet;
import org.jclouds.azure.storage.options.ListOptions;
import org.jclouds.azureblob.domain.AzureBlob; import org.jclouds.azureblob.domain.AzureBlob;
import org.jclouds.azureblob.domain.BlobProperties; import org.jclouds.azureblob.domain.BlobProperties;
import org.jclouds.azureblob.domain.ContainerProperties; import org.jclouds.azureblob.domain.ContainerProperties;
import org.jclouds.azureblob.domain.ListBlobsResponse; import org.jclouds.azureblob.domain.ListBlobsResponse;
import org.jclouds.azureblob.domain.PublicAccess; import org.jclouds.azureblob.domain.PublicAccess;
import org.jclouds.azureblob.options.ListBlobsOptions; import org.jclouds.azureblob.options.ListBlobsOptions;
import org.jclouds.azure.storage.domain.BoundedSet;
import org.jclouds.azure.storage.options.ListOptions;
import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory; import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.blobstore.ContainerNotFoundException; import org.jclouds.blobstore.ContainerNotFoundException;
@ -50,6 +48,7 @@ import org.jclouds.http.HttpResponseException;
import org.jclouds.http.options.GetOptions; import org.jclouds.http.options.GetOptions;
import org.jclouds.io.Payloads; import org.jclouds.io.Payloads;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.BaseRestClientLiveTest;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -65,40 +64,14 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true)
public class AzureBlobClientLiveTest { public class AzureBlobClientLiveTest extends BaseRestClientLiveTest {
public AzureBlobClientLiveTest() {
provider = "azureblob";
}
protected AzureBlobClient client; protected AzureBlobClient client;
private String containerPrefix = System.getProperty("user.name") + "-azureblob";
private BlobStoreContext context; private BlobStoreContext context;
protected String provider = "azureblob";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
@ -125,7 +98,7 @@ public class AzureBlobClientLiveTest {
public void testCreateContainer() throws Exception { public void testCreateContainer() throws Exception {
boolean created = false; boolean created = false;
while (!created) { while (!created) {
privateContainer = containerPrefix + new SecureRandom().nextInt(); privateContainer = prefix + new SecureRandom().nextInt();
try { try {
created = client.createContainer(privateContainer, withMetadata(ImmutableMultimap.of("foo", "bar"))); created = client.createContainer(privateContainer, withMetadata(ImmutableMultimap.of("foo", "bar")));
} catch (UndeclaredThrowableException e) { } catch (UndeclaredThrowableException e) {
@ -149,7 +122,7 @@ public class AzureBlobClientLiveTest {
public void testCreatePublicContainer() throws Exception { public void testCreatePublicContainer() throws Exception {
boolean created = false; boolean created = false;
while (!created) { while (!created) {
publicContainer = containerPrefix + new SecureRandom().nextInt(); publicContainer = prefix + new SecureRandom().nextInt();
try { try {
created = client.createContainer(publicContainer, withPublicAccess(PublicAccess.BLOB)); created = client.createContainer(publicContainer, withPublicAccess(PublicAccess.BLOB));
} catch (UndeclaredThrowableException e) { } catch (UndeclaredThrowableException e) {

View File

@ -29,6 +29,5 @@ import org.testng.annotations.Test;
public class CloudSigmaLasVegasLondonClientLiveTest extends CloudSigmaClientLiveTest { public class CloudSigmaLasVegasLondonClientLiveTest extends CloudSigmaClientLiveTest {
public CloudSigmaLasVegasLondonClientLiveTest() { public CloudSigmaLasVegasLondonClientLiveTest() {
provider = "cloudsigma-lvs"; provider = "cloudsigma-lvs";
bootDrive = "af8bfee4-d249-4d91-b157-b01ee1ce1943";
} }
} }

View File

@ -29,6 +29,5 @@ import org.testng.annotations.Test;
public class CloudSigmaZurichClientLiveTest extends CloudSigmaClientLiveTest { public class CloudSigmaZurichClientLiveTest extends CloudSigmaClientLiveTest {
public CloudSigmaZurichClientLiveTest() { public CloudSigmaZurichClientLiveTest() {
provider = "cloudsigma-zrh"; provider = "cloudsigma-zrh";
bootDrive = "7fad4fe1-daf3-4cb8-a847-082aae4d8506";
} }
} }

View File

@ -25,10 +25,10 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1LosAngelesClientLiveTest")
public class ElasticHostsPeer1LosAngelesClientLiveTest extends ElasticStackClientLiveTest { public class ElasticHostsPeer1LosAngelesClientLiveTest extends ElasticStackClientLiveTest {
public ElasticHostsPeer1LosAngelesClientLiveTest() { public ElasticHostsPeer1LosAngelesClientLiveTest() {
provider = "elastichosts-lax-p"; provider = "elastichosts-lax-p";
bootDrive = "aee5589a-88c3-43ef-bb0a-9cab6e64192d";
} }
} }

View File

@ -25,10 +25,9 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "ElasticHostsBlueSquareLondonClientLiveTest")
public class ElasticHostsBlueSquareLondonClientLiveTest extends ElasticStackClientLiveTest { public class ElasticHostsBlueSquareLondonClientLiveTest extends ElasticStackClientLiveTest {
public ElasticHostsBlueSquareLondonClientLiveTest() { public ElasticHostsBlueSquareLondonClientLiveTest() {
provider = "elastichosts-lon-b"; provider = "elastichosts-lon-b";
bootDrive = "aee5589a-88c3-43ef-bb0a-9cab6e64192d";
} }
} }

View File

@ -25,10 +25,9 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1LondonClientLiveTest")
public class ElasticHostsPeer1LondonClientLiveTest extends ElasticStackClientLiveTest { public class ElasticHostsPeer1LondonClientLiveTest extends ElasticStackClientLiveTest {
public ElasticHostsPeer1LondonClientLiveTest() { public ElasticHostsPeer1LondonClientLiveTest() {
provider = "elastichosts-lon-p"; provider = "elastichosts-lon-p";
bootDrive = "aee5589a-88c3-43ef-bb0a-9cab6e64192d";
} }
} }

View File

@ -25,10 +25,9 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1SanAntonioClientLiveTest")
public class ElasticHostsPeer1SanAntonioClientLiveTest extends ElasticStackClientLiveTest { public class ElasticHostsPeer1SanAntonioClientLiveTest extends ElasticStackClientLiveTest {
public ElasticHostsPeer1SanAntonioClientLiveTest() { public ElasticHostsPeer1SanAntonioClientLiveTest() {
provider = "elastichosts-sat-p"; provider = "elastichosts-sat-p";
bootDrive = "aee5589a-88c3-43ef-bb0a-9cab6e64192d";
} }
} }

View File

@ -25,10 +25,9 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "ElasticHostsPeer1TorontoClientLiveTest")
public class ElasticHostsPeer1TorontoClientLiveTest extends ElasticStackClientLiveTest { public class ElasticHostsPeer1TorontoClientLiveTest extends ElasticStackClientLiveTest {
public ElasticHostsPeer1TorontoClientLiveTest() { public ElasticHostsPeer1TorontoClientLiveTest() {
provider = "elastichosts-tor-p"; provider = "elastichosts-tor-p";
bootDrive = "aee5589a-88c3-43ef-bb0a-9cab6e64192d";
} }
} }

View File

@ -25,10 +25,9 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true) @Test(groups = "live", singleThreaded = true, testName = "Go2CloudJohannesburg1ClientLiveTest")
public class Go2CloudJohannesburg1ClientLiveTest extends ElasticStackClientLiveTest { public class Go2CloudJohannesburg1ClientLiveTest extends ElasticStackClientLiveTest {
public Go2CloudJohannesburg1ClientLiveTest() { public Go2CloudJohannesburg1ClientLiveTest() {
provider = "go2cloud-jhb1"; provider = "go2cloud-jhb1";
bootDrive = "14c88d27-1f5e-4ad5-9f3a-28e5d2282f61";
} }
} }

View File

@ -18,10 +18,9 @@
*/ */
package org.jclouds.gogrid.services; package org.jclouds.gogrid.services;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Properties; import java.util.Properties;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.gogrid.GoGridAsyncClient; import org.jclouds.gogrid.GoGridAsyncClient;
@ -41,36 +40,14 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live") @Test(groups = "live", singleThreaded = true, testName = "BaseGoGridClientLiveTest")
public class BaseGoGridClientLiveTest { public class BaseGoGridClientLiveTest extends BaseVersionedServiceLiveTest {
public BaseGoGridClientLiveTest() {
provider = "gogrid";
}
protected RestContext<GoGridClient, GoGridAsyncClient> restContext; protected RestContext<GoGridClient, GoGridAsyncClient> restContext;
protected String provider = "gogrid";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected ComputeServiceContext context; protected ComputeServiceContext context;
protected String prefix = System.getProperty("user.name");
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {

View File

@ -25,10 +25,9 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "OpenHostingEast1ClientLiveTest")
public class OpenHostingEast1ClientLiveTest extends ElasticStackClientLiveTest { public class OpenHostingEast1ClientLiveTest extends ElasticStackClientLiveTest {
public OpenHostingEast1ClientLiveTest() { public OpenHostingEast1ClientLiveTest() {
provider = "openhosting-east1"; provider = "openhosting-east1";
bootDrive = "8023b089-7b0e-4fcb-8016-01e82f2a9716";
} }
} }

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.rimuhosting.miro; package org.jclouds.rimuhosting.miro;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
@ -26,7 +25,7 @@ import static org.testng.Assert.assertTrue;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants; import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextFactory; import org.jclouds.rest.RestContextFactory;
@ -47,41 +46,21 @@ import com.google.inject.Module;
* *
* @author Ivan Meredith * @author Ivan Meredith
*/ */
@Test(groups = "live") @Test(groups = "live", singleThreaded = true, testName = "RimuHostingClientLiveTest")
public class RimuHostingClientLiveTest { public class RimuHostingClientLiveTest extends BaseVersionedServiceLiveTest {
public RimuHostingClientLiveTest() {
provider = "rimuhosting";
}
private RimuHostingClient connection; private RimuHostingClient connection;
private RestContext<RimuHostingClient, RimuHostingAsyncClient> context; private RestContext<RimuHostingClient, RimuHostingAsyncClient> context;
protected String provider = "rimuhosting";
protected String identity;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();
Properties overrides = setupProperties(); Properties overrides = setupProperties();
this.context = new RestContextFactory().createContext("rimuhosting", ImmutableSet this.context = new RestContextFactory().createContext(provider, ImmutableSet
.<Module> of(new Log4JLoggingModule()), overrides); .<Module> of(new Log4JLoggingModule()), overrides);
this.connection = context.getApi(); this.connection = context.getApi();

View File

@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.Constants; import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
@ -46,42 +46,28 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live") @Test(groups = "live", singleThreaded = true, testName = "BaseVPDCClientLiveTest")
public class BaseVPDCClientLiveTest { public class BaseVPDCClientLiveTest extends BaseVersionedServiceLiveTest {
public BaseVPDCClientLiveTest() {
provider = "savvis-symphonyvpdc";
}
protected RestContext<VPDCClient, VPDCAsyncClient> restContext; protected RestContext<VPDCClient, VPDCAsyncClient> restContext;
protected String provider = "savvis-symphonyvpdc";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected ComputeServiceContext context; protected ComputeServiceContext context;
protected String email; protected String email;
protected RetryablePredicate<String> taskTester; protected RetryablePredicate<String> taskTester;
protected String prefix = System.getProperty("user.name");
@Override
protected void setupCredentials() { protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); super.setupCredentials();
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
email = checkNotNull(System.getProperty("test." + VPDCConstants.PROPERTY_VPDC_VDC_EMAIL), "test." email = checkNotNull(System.getProperty("test." + VPDCConstants.PROPERTY_VPDC_VDC_EMAIL), "test."
+ VPDCConstants.PROPERTY_VPDC_VDC_EMAIL); + VPDCConstants.PROPERTY_VPDC_VDC_EMAIL);
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
} }
@Override
protected Properties setupProperties() { protected Properties setupProperties() {
Properties overrides = new Properties(); Properties overrides = super.setupProperties();
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(VPDCConstants.PROPERTY_VPDC_VDC_EMAIL, email); overrides.setProperty(VPDCConstants.PROPERTY_VPDC_VDC_EMAIL, email);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiVersion != null)
overrides.setProperty(provider + ".api-version", apiVersion);
// TODO savvis uses untrusted certificates, remove these once savvis fixes the issue
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
return overrides; return overrides;
} }

View File

@ -27,11 +27,10 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", singleThreaded = true) @Test(groups = "live", singleThreaded = true, testName = "ServerloveManchesterClientLiveTest")
public class ServerloveManchesterClientLiveTest extends ElasticStackClientLiveTest { public class ServerloveManchesterClientLiveTest extends ElasticStackClientLiveTest {
public ServerloveManchesterClientLiveTest() { public ServerloveManchesterClientLiveTest() {
provider = "serverlove-z1-man"; provider = "serverlove-z1-man";
bootDrive = "574a3921-2926-4a61-bdd9-8d9282b32810";
} }
@Override @Override

View File

@ -25,10 +25,9 @@ import org.testng.annotations.Test;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "SkaliCloudMalaysiaClientLiveTest")
public class SkaliCloudMalaysiaClientLiveTest extends ElasticStackClientLiveTest { public class SkaliCloudMalaysiaClientLiveTest extends ElasticStackClientLiveTest {
public SkaliCloudMalaysiaClientLiveTest() { public SkaliCloudMalaysiaClientLiveTest() {
provider = "skalicloud-sdg-my"; provider = "skalicloud-sdg-my";
bootDrive = "3051699a-a536-4220-aeb5-67f2ec101a09";
} }
} }

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.slicehost; package org.jclouds.slicehost;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
@ -30,7 +29,7 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.Constants; import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
import org.jclouds.http.HttpResponseException; import org.jclouds.http.HttpResponseException;
import org.jclouds.io.Payloads; import org.jclouds.io.Payloads;
@ -60,36 +59,16 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "SlicehostClientLiveTest")
public class SlicehostClientLiveTest { public class SlicehostClientLiveTest extends BaseVersionedServiceLiveTest {
public SlicehostClientLiveTest() {
provider = "slicehost";
}
protected SlicehostClient client; protected SlicehostClient client;
protected SshClient.Factory sshFactory; protected SshClient.Factory sshFactory;
private Predicate<IPSocket> socketTester; private Predicate<IPSocket> socketTester;
protected String provider = "slicehost";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiVersion = checkNotNull(System.getProperty("test." + provider + ".api-version"), "test." + provider
+ ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".endpoint", endpoint);
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();

View File

@ -18,14 +18,13 @@
*/ */
package org.jclouds.softlayer.compute; package org.jclouds.softlayer.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.sshj.config.SshjSshClientModule; import org.jclouds.sshj.config.SshjSshClientModule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -35,30 +34,18 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", testName = "SoftLayerExperimentLiveTest") @Test(groups = "live", singleThreaded = true, testName = "SoftLayerExperimentLiveTest")
public class SoftLayerExperimentLiveTest { public class SoftLayerExperimentLiveTest extends BaseVersionedServiceLiveTest {
protected String provider = "softlayer"; public SoftLayerExperimentLiveTest() {
protected String identity; provider = "softlayer";
protected String credential;
protected String endpoint;
protected String apiVersion;
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
} }
@Test @Test
public void testAndExperiment() { public void testAndExperiment() {
ComputeServiceContext context = null; ComputeServiceContext context = null;
try { try {
String identity = checkNotNull(System.getProperty("test.softlayer.identity"), "test.softlayer.identity");
String credential = checkNotNull(System.getProperty("test.softlayer.credential"), "test.softlayer.credential");
context = new ComputeServiceContextFactory().createContext("softlayer", identity, credential, ImmutableSet context = new ComputeServiceContextFactory().createContext(provider, identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule())); .<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()));
assertEquals(context.getComputeService().listAssignableLocations().size(), 7); assertEquals(context.getComputeService().listAssignableLocations().size(), 7);

View File

@ -18,15 +18,13 @@
*/ */
package org.jclouds.trmk.vcloudexpress; package org.jclouds.trmk.vcloudexpress;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import org.jclouds.Constants; import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
@ -47,8 +45,12 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true) @Test(groups = "live", singleThreaded = true, testName = "InternetServiceLiveTest")
public class InternetServiceLiveTest { public class InternetServiceLiveTest extends BaseVersionedServiceLiveTest {
public InternetServiceLiveTest() {
provider = "trmk-vcloudexpress";
}
TerremarkVCloudExpressClient tmClient; TerremarkVCloudExpressClient tmClient;
private Set<InternetService> services = Sets.newLinkedHashSet(); private Set<InternetService> services = Sets.newLinkedHashSet();
@ -89,31 +91,6 @@ public class InternetServiceLiveTest {
delete(services); delete(services);
} }
protected String provider = "trmk-vcloudexpress";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiVersion = checkNotNull(System.getProperty("test." + provider + ".api-version"), "test." + provider
+ ".api-version");
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
overrides.setProperty(provider + ".credential", credential);
overrides.setProperty(provider + ".endpoint", endpoint);
overrides.setProperty(provider + ".api-version", apiVersion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {

View File

@ -19,13 +19,12 @@
package org.jclouds.virtualbox; package org.jclouds.virtualbox;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.virtualbox.experiment.TestUtils.computeServiceForLocalhostAndGuest; import static org.jclouds.virtualbox.experiment.TestUtils.computeServiceForLocalhostAndGuest;
import java.net.URI; import java.net.URI;
import java.util.Properties;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
@ -36,7 +35,6 @@ import org.jclouds.virtualbox.config.VirtualBoxConstants;
import org.jclouds.virtualbox.functions.admin.StartJettyIfNotAlreadyRunning; import org.jclouds.virtualbox.functions.admin.StartJettyIfNotAlreadyRunning;
import org.jclouds.virtualbox.functions.admin.StartVBoxIfNotAlreadyRunning; import org.jclouds.virtualbox.functions.admin.StartVBoxIfNotAlreadyRunning;
import org.testng.annotations.AfterGroups; import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.virtualbox_4_1.SessionState; import org.virtualbox_4_1.SessionState;
@ -50,34 +48,20 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live") @Test(groups = "live", singleThreaded = true, testName = "BaseVirtualBoxClientLiveTest")
public class BaseVirtualBoxClientLiveTest { public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest {
public BaseVirtualBoxClientLiveTest() {
protected String provider = "virtualbox"; provider = "virtualbox";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiVersion;
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint", "http://localhost:18083/");
apiVersion = System.getProperty("test." + provider + ".api-version", "4.1.2r73507");
} }
protected ComputeServiceContext context; protected ComputeServiceContext context;
protected VirtualBoxManager manager; protected VirtualBoxManager manager;
protected Server jetty; protected Server jetty;
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
Properties properties = new Properties();
properties.setProperty(provider + ".endpoint", endpoint);
properties.setProperty(provider + ".api-version", apiVersion);
context = new ComputeServiceContextFactory().createContext(provider, identity, credential, context = new ComputeServiceContextFactory().createContext(provider, identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule())); ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), setupProperties());
jetty = new StartJettyIfNotAlreadyRunning(port).apply(basebaseResource); jetty = new StartJettyIfNotAlreadyRunning(port).apply(basebaseResource);
startVboxIfNotAlreadyRunning(); startVboxIfNotAlreadyRunning();
} }

View File

@ -18,8 +18,7 @@
*/ */
package org.jclouds.servermanager.compute; package org.jclouds.servermanager.compute;
import static com.google.common.base.Preconditions.checkNotNull; import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.StandaloneComputeServiceContextSpec; import org.jclouds.compute.StandaloneComputeServiceContextSpec;
@ -28,7 +27,6 @@ import org.jclouds.servermanager.Hardware;
import org.jclouds.servermanager.Image; import org.jclouds.servermanager.Image;
import org.jclouds.servermanager.Server; import org.jclouds.servermanager.Server;
import org.jclouds.servermanager.ServerManager; import org.jclouds.servermanager.ServerManager;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -38,29 +36,19 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live") @Test(groups = "live", singleThreaded = true, testName = "ServerManagerExperimentLiveTest")
public class ServerManagerExperimentLiveTest { public class ServerManagerExperimentLiveTest extends BaseVersionedServiceLiveTest {
protected String provider = "servermanager"; public ServerManagerExperimentLiveTest() {
protected String identity; provider = "servermanager";
protected String credential;
protected String endpoint;
protected String apiVersion;
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiVersion = System.getProperty("test." + provider + ".api-version");
} }
@Test @Test
public void testAndExperiment() { public void testAndExperiment() {
ComputeServiceContext context = null; ComputeServiceContext context = null;
try { try {
context = new ComputeServiceContextFactory() context = new ComputeServiceContextFactory()
.createContext(new StandaloneComputeServiceContextSpec<ServerManager, Server, Hardware, Image, Datacenter>( .createContext(new StandaloneComputeServiceContextSpec<ServerManager, Server, Hardware, Image, Datacenter>(
"servermanager", endpoint, apiVersion, "", identity, credential, ServerManager.class, "servermanager", endpoint, apiVersion, buildVersion, "", identity, credential, ServerManager.class,
ServerManagerComputeServiceContextBuilder.class, ImmutableSet.<Module> of())); ServerManagerComputeServiceContextBuilder.class, ImmutableSet.<Module> of()));
context.getComputeService().listNodes(); context.getComputeService().listNodes();