Issue 361: normalize test properties

This commit is contained in:
Adrian Cole 2010-09-19 13:30:11 -07:00
parent 9aced88ca1
commit 53f4bec356
93 changed files with 2038 additions and 1163 deletions

View File

@ -62,9 +62,9 @@
</repositories> </repositories>
<properties> <properties>
<jclouds.test.identity>${providerUser}</jclouds.test.identity> <test.identity>${providerUser}</test.identity>
<jclouds.test.credential>${providerPassword}</jclouds.test.credential> <test.credential>${providerPassword}</test.credential>
<jclouds.test.endpoint>${providerEndpoint}</jclouds.test.endpoint> <test.endpoint>${providerEndpoint}</test.endpoint>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@ -31,9 +31,15 @@
<artifactId>jclouds-atmos</artifactId> <artifactId>jclouds-atmos</artifactId>
<name>jclouds atmosonline components</name> <name>jclouds atmosonline components</name>
<properties> <properties>
<jclouds.test.initializer>org.jclouds.atmosonline.saas.blobstore.integration.AtmosStorageTestInitializer</jclouds.test.initializer> <test.initializer>org.jclouds.atmosonline.saas.blobstore.integration.AtmosStorageTestInitializer</test.initializer>
<jclouds.test.identity>${jclouds.emcsaas.uid}</jclouds.test.identity> <test.atmosonline.endpoint>https://accesspoint.atmosonline.com</test.atmosonline.endpoint>
<jclouds.test.credential>${jclouds.emcsaas.key}</jclouds.test.credential> <test.atmosonline.apiversion>1.3.0</test.atmosonline.apiversion>
<test.atmosonline.identity>FIXME</test.atmosonline.identity>
<test.atmosonline.credential>FIXME</test.atmosonline.credential>
<test.synaptic.endpoint>https://storage.synaptic.att.com</test.synaptic.endpoint>
<test.synaptic.apiversion>1.3.0</test.synaptic.apiversion>
<test.synaptic.identity>FIXME</test.synaptic.identity>
<test.synaptic.credential>FIXME</test.synaptic.credential>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
@ -68,5 +74,63 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>test.atmosonline.endpoint</name>
<value>${test.atmosonline.endpoint}</value>
</property>
<property>
<name>test.atmosonline.apiversion</name>
<value>${test.atmosonline.apiversion}</value>
</property>
<property>
<name>test.atmosonline.identity</name>
<value>${test.atmosonline.identity}</value>
</property>
<property>
<name>test.atmosonline.credential</name>
<value>${test.atmosonline.credential}</value>
</property>
<property>
<name>test.synaptic.endpoint</name>
<value>${test.synaptic.endpoint}</value>
</property>
<property>
<name>test.synaptic.apiversion</name>
<value>${test.synaptic.apiversion}</value>
</property>
<property>
<name>test.synaptic.identity</name>
<value>${test.synaptic.identity}</value>
</property>
<property>
<name>test.synaptic.credential</name>
<value>${test.synaptic.credential}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -19,7 +19,6 @@
package org.jclouds.atmosonline.saas; package org.jclouds.atmosonline.saas;
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;
@ -35,26 +34,19 @@ import org.jclouds.atmosonline.saas.domain.DirectoryEntry;
import org.jclouds.atmosonline.saas.domain.FileType; import org.jclouds.atmosonline.saas.domain.FileType;
import org.jclouds.atmosonline.saas.domain.SystemMetadata; import org.jclouds.atmosonline.saas.domain.SystemMetadata;
import org.jclouds.atmosonline.saas.options.ListOptions; import org.jclouds.atmosonline.saas.options.ListOptions;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.blobstore.KeyAlreadyExistsException; import org.jclouds.blobstore.KeyAlreadyExistsException;
import org.jclouds.blobstore.KeyNotFoundException; import org.jclouds.blobstore.KeyNotFoundException;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest; import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.jclouds.http.HttpResponseException; import org.jclouds.http.HttpResponseException;
import org.jclouds.io.Payloads; import org.jclouds.io.Payloads;
import org.jclouds.io.payloads.InputStreamPayload; import org.jclouds.io.payloads.InputStreamPayload;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext;
import org.jclouds.util.Utils; import org.jclouds.util.Utils;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.inject.Module;
/** /**
* Tests behavior of {@code AtmosStorageClient} * Tests behavior of {@code AtmosStorageClient}
@ -62,7 +54,11 @@ import com.google.inject.Module;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true, testName = "emcsaas.AtmosStorageClientLiveTest") @Test(groups = "live", sequential = true, testName = "emcsaas.AtmosStorageClientLiveTest")
public class AtmosStorageClientLiveTest { public class AtmosStorageClientLiveTest extends BaseBlobStoreIntegrationTest {
public AtmosStorageClient getApi() {
return (AtmosStorageClient) context.getProviderSpecificContext().getApi();
}
private static final class HeadMatches implements Runnable { private static final class HeadMatches implements Runnable {
private final AtmosStorageClient connection; private final AtmosStorageClient connection;
@ -112,22 +108,6 @@ public class AtmosStorageClientLiveTest {
URI container1; URI container1;
URI container2; URI container2;
private BlobStoreContext context;
@BeforeGroups(groups = { "live" })
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
context = new BlobStoreContextFactory().createContext("atmosonline", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
RestContext<AtmosStorageClient, AtmosStorageAsyncClient> restContext = context.getProviderSpecificContext();
connection = restContext.getApi();
for (DirectoryEntry entry : connection.listDirectories()) {
if (entry.getObjectName().startsWith(containerPrefix)) {
context.getBlobStore().deleteContainer(entry.getObjectName());
}
}
}
@Test @Test
public void testListDirectorys() throws Exception { public void testListDirectorys() throws Exception {

View File

@ -20,7 +20,6 @@
package org.jclouds.atmosonline.saas.blobstore.integration; package org.jclouds.atmosonline.saas.blobstore.integration;
import java.io.IOException; import java.io.IOException;
import java.util.Properties;
import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory; import org.jclouds.blobstore.BlobStoreContextFactory;
@ -35,12 +34,15 @@ import com.google.inject.Module;
* @author Adrian Cole * @author Adrian Cole
*/ */
public class AtmosStorageTestInitializer extends TransientBlobStoreTestInitializer { public class AtmosStorageTestInitializer extends TransientBlobStoreTestInitializer {
public AtmosStorageTestInitializer() {
provider = "synaptic";
}
@Override @Override
protected BlobStoreContext createLiveContext(Module configurationModule, String url, String app, protected BlobStoreContext createLiveContext(Module configurationModule, String endpoint, String apiversion,
String identity, String credential) throws IOException { String app, String identity, String credential) throws IOException {
return new BlobStoreContextFactory().createContext("synaptic", identity, credential, ImmutableSet return new BlobStoreContextFactory().createContext(provider, ImmutableSet.of(configurationModule,
.of(configurationModule, new Log4JLoggingModule()), new Properties()); new Log4JLoggingModule()), setupProperties(endpoint, apiversion, identity, credential));
} }
} }

View File

@ -37,6 +37,7 @@
<url>http://jclouds.googlecode.com/svn/trunk</url> <url>http://jclouds.googlecode.com/svn/trunk</url>
</scm> </scm>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.jamesmurty.utils</groupId> <groupId>com.jamesmurty.utils</groupId>

View File

@ -19,8 +19,6 @@
package org.jclouds.aws.xml; package org.jclouds.aws.xml;
import javax.inject.Singleton;
import org.jclouds.aws.domain.AWSError; import org.jclouds.aws.domain.AWSError;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
@ -32,7 +30,6 @@ import org.jclouds.http.functions.ParseSax;
* /> * />
* @author Adrian Cole * @author Adrian Cole
*/ */
@Singleton
public class ErrorHandler extends ParseSax.HandlerWithResult<AWSError> { public class ErrorHandler extends ParseSax.HandlerWithResult<AWSError> {
private AWSError error = new AWSError(); private AWSError error = new AWSError();

View File

@ -47,7 +47,6 @@ public class ComputeAndBlobStoreTogetherHappilyLiveTest extends BlobStoreAndComp
protected void setupCredentials() { protected void setupCredentials() {
blobStoreProvider = "s3"; blobStoreProvider = "s3";
computeServiceProvider = "ec2"; computeServiceProvider = "ec2";
super.setupCredentials();
} }
/** /**

View File

@ -21,10 +21,11 @@ package org.jclouds.aws.cloudwatch;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.io.IOException;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
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,14 +48,38 @@ public class CloudWatchClientLiveTest {
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 = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
context = new RestContextFactory().createContext("cloudwatch", identity, credential, ImmutableSet overrides);
.<Module> of(new Log4JLoggingModule()));
client = context.getApi(); client = context.getApi();
} }

View File

@ -28,11 +28,13 @@ import static org.testng.Assert.assertNotNull;
import java.io.IOException; import java.io.IOException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
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.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.aws.ec2.domain.BlockDeviceMapping; import org.jclouds.aws.ec2.domain.BlockDeviceMapping;
import org.jclouds.aws.ec2.domain.InstanceState; import org.jclouds.aws.ec2.domain.InstanceState;
@ -91,12 +93,38 @@ 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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException, IOException { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
Injector injector = new RestContextFactory().createContextBuilder("ec2", identity, credential, Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule())).buildInjector(); ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).buildInjector();
client = injector.getInstance(EC2Client.class); client = injector.getInstance(EC2Client.class);
sshFactory = injector.getInstance(SshClient.Factory.class); sshFactory = injector.getInstance(SshClient.Factory.class);
runningTester = new RetryablePredicate<RunningInstance>(new InstanceStateRunning(client), 180, 5, runningTester = new RetryablePredicate<RunningInstance>(new InstanceStateRunning(client), 180, 5,
@ -151,7 +179,8 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
try { try {
System.out.printf("%d: running instance%n", System.currentTimeMillis()); System.out.printf("%d: running instance%n", System.currentTimeMillis());
Reservation<? extends RunningInstance> reservation = client.getInstanceServices().runInstancesInRegion(null, null, // allow Reservation<? extends RunningInstance> reservation = client.getInstanceServices().runInstancesInRegion(
null, null, // allow
// ec2 // ec2
// to // to
// chose // chose

View File

@ -27,14 +27,15 @@ import static org.jclouds.aws.ec2.options.RunInstancesOptions.Builder.withKeyNam
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.io.IOException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.Map; import java.util.Map;
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.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.aws.ec2.domain.Attachment; import org.jclouds.aws.ec2.domain.Attachment;
import org.jclouds.aws.ec2.domain.BlockDeviceMapping; import org.jclouds.aws.ec2.domain.BlockDeviceMapping;
@ -122,12 +123,38 @@ 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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
Injector injector = new RestContextFactory().createContextBuilder("ec2", identity, credential, Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule())).buildInjector(); ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).buildInjector();
client = injector.getInstance(EC2Client.class); client = injector.getInstance(EC2Client.class);
sshFactory = injector.getInstance(SshClient.Factory.class); sshFactory = injector.getInstance(SshClient.Factory.class);
SocketOpen socketOpen = injector.getInstance(SocketOpen.class); SocketOpen socketOpen = injector.getInstance(SocketOpen.class);

View File

@ -22,6 +22,9 @@ package org.jclouds.aws.ec2.compute;
import static com.google.common.base.Preconditions.checkNotNull; 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 java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory; import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.Blob;
@ -48,24 +51,35 @@ public class BlobStoreAndComputeServiceLiveTest {
protected ComputeServiceContext computeContext; protected ComputeServiceContext computeContext;
protected BlobStoreContext blobContext; protected BlobStoreContext blobContext;
protected String tag = System.getProperty("user.name") + "happy"; protected String tag = System.getProperty("user.name") + "happy";
protected String identity;
protected String credential;
protected String blobStoreProvider; protected String blobStoreProvider;
protected String computeServiceProvider; protected String computeServiceProvider;
protected void setupCredentials() { protected Properties setupCredentials(String provider) {
tag = System.getProperty("user.name") + "happy"; String identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); + ".identity");
credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); String credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
String endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider
+ ".endpoint");
String apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
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 + ".apiversion", apiversion);
return overrides;
} }
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); computeContext = new ComputeServiceContextFactory().createContext(computeServiceProvider, ImmutableSet.of(
computeContext = new ComputeServiceContextFactory().createContext(computeServiceProvider, identity, credential, new Log4JLoggingModule(), new JschSshClientModule()), setupCredentials(computeServiceProvider));
ImmutableSet.of(new Log4JLoggingModule(), new JschSshClientModule())); blobContext = new BlobStoreContextFactory().createContext(blobStoreProvider, ImmutableSet
blobContext = new BlobStoreContextFactory().createContext(blobStoreProvider, identity, credential, ImmutableSet .of(new Log4JLoggingModule()), setupCredentials(blobStoreProvider));
.of(new Log4JLoggingModule()));
blobContext.getAsyncBlobStore().createContainerInLocation(null, tag); blobContext.getAsyncBlobStore().createContainerInLocation(null, tag);
computeContext.getComputeService().destroyNodesMatching(NodePredicates.withTag(tag)); computeContext.getComputeService().destroyNodesMatching(NodePredicates.withTag(tag));
} }

View File

@ -64,9 +64,8 @@ import com.google.inject.Module;
*/ */
@Test(groups = "live", sequential = true, testName = "ec2.EC2ComputeServiceLiveTest") @Test(groups = "live", sequential = true, testName = "ec2.EC2ComputeServiceLiveTest")
public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest { public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@BeforeClass
@Override public EC2ComputeServiceLiveTest() {
public void setServiceDefaults() {
provider = "ec2"; provider = "ec2";
} }
@ -237,7 +236,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@Test(enabled = true, dependsOnMethods = "testCompareSizes") @Test(enabled = true, dependsOnMethods = "testCompareSizes")
public void testExtendedOptionsWithSubnetId() throws Exception { public void testExtendedOptionsWithSubnetId() throws Exception {
String subnetId = System.getProperty("jclouds.test.subnetId"); String subnetId = System.getProperty("test.subnetId");
if (subnetId == null) { if (subnetId == null) {
// Skip test and return // Skip test and return
return; return;

View File

@ -25,9 +25,8 @@ 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.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.aws.ec2.domain.InstanceType; import org.jclouds.aws.ec2.domain.InstanceType;
import org.jclouds.aws.ec2.reference.EC2Constants; import org.jclouds.aws.ec2.reference.EC2Constants;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
@ -35,10 +34,10 @@ import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
/** /**
* *
@ -46,21 +45,38 @@ import com.google.common.collect.ImmutableSet;
*/ */
@Test(groups = "live", testName = "ec2.EC2TemplateBuilderLiveTest") @Test(groups = "live", testName = "ec2.EC2TemplateBuilderLiveTest")
public class EC2TemplateBuilderLiveTest { public class EC2TemplateBuilderLiveTest {
private String password; protected String provider = "ec2";
private String user; protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
@BeforeGroups(groups = { "live" }) protected void setupCredentials() {
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException, IOException { identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
user = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
password = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); + ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
} }
@Test @Test
public void testTemplateBuilderCanUseImageIdAndhardwareId() { public void testTemplateBuilderCanUseImageIdAndhardwareId() {
ComputeServiceContext newContext = null; ComputeServiceContext newContext = null;
try { try {
newContext = new ComputeServiceContextFactory().createContext("ec2", user, password, newContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
ImmutableSet.of(new Log4JLoggingModule())); .<Module> of(new Log4JLoggingModule()), setupProperties());
Template template = newContext.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5") Template template = newContext.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5")
.hardwareId(InstanceType.M2_2XLARGE).build(); .hardwareId(InstanceType.M2_2XLARGE).build();
@ -85,8 +101,8 @@ public class EC2TemplateBuilderLiveTest {
public void testDefaultTemplateBuilder() throws IOException { public void testDefaultTemplateBuilder() throws IOException {
ComputeServiceContext newContext = null; ComputeServiceContext newContext = null;
try { try {
newContext = new ComputeServiceContextFactory().createContext("ec2", user, password, newContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
ImmutableSet.of(new Log4JLoggingModule())); .<Module> of(new Log4JLoggingModule()), setupProperties());
Template defaultTemplate = newContext.getComputeService().templateBuilder().build(); Template defaultTemplate = newContext.getComputeService().templateBuilder().build();
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate; assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
@ -107,8 +123,8 @@ public class EC2TemplateBuilderLiveTest {
public void testTemplateBuilderMicro() throws IOException { public void testTemplateBuilderMicro() throws IOException {
ComputeServiceContext newContext = null; ComputeServiceContext newContext = null;
try { try {
newContext = new ComputeServiceContextFactory().createContext("ec2", user, password, newContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
ImmutableSet.of(new Log4JLoggingModule())); .<Module> of(new Log4JLoggingModule()), setupProperties());
Template microTemplate = newContext.getComputeService().templateBuilder().hardwareId(InstanceType.T1_MICRO) Template microTemplate = newContext.getComputeService().templateBuilder().hardwareId(InstanceType.T1_MICRO)
.build(); .build();
@ -131,12 +147,12 @@ public class EC2TemplateBuilderLiveTest {
public void testTemplateBuilderWithNoOwnersParsesImageOnDemand() throws IOException { public void testTemplateBuilderWithNoOwnersParsesImageOnDemand() throws IOException {
ComputeServiceContext newContext = null; ComputeServiceContext newContext = null;
try { try {
Properties overrides = new Properties(); Properties overrides = setupProperties();
// set owners to nothing // set owners to nothing
overrides.setProperty(EC2Constants.PROPERTY_EC2_AMI_OWNERS, ""); overrides.setProperty(EC2Constants.PROPERTY_EC2_AMI_OWNERS, "");
newContext = new ComputeServiceContextFactory().createContext("ec2", user, password, newContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
ImmutableSet.of(new Log4JLoggingModule()), overrides); .<Module> of(new Log4JLoggingModule()), overrides);
assertEquals(newContext.getComputeService().listImages().size(), 0); assertEquals(newContext.getComputeService().listImages().size(), 0);

View File

@ -33,10 +33,14 @@ import org.testng.annotations.Test;
*/ */
@Test(groups = "live", sequential = true, testName = "ec2.EucalyptusComputeServiceLiveTest") @Test(groups = "live", sequential = true, testName = "ec2.EucalyptusComputeServiceLiveTest")
public class EucalyptusComputeServiceLiveTest extends EC2ComputeServiceLiveTest { public class EucalyptusComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
public EucalyptusComputeServiceLiveTest() {
provider = "eucalyptus";
}
@BeforeClass @BeforeClass
@Override @Override
public void setServiceDefaults() { public void setServiceDefaults() {
provider = "eucalyptus";
// security groups must be <30 characters // security groups must be <30 characters
tag = "euc"; tag = "euc";
} }

View File

@ -24,18 +24,16 @@ import static org.testng.Assert.assertEquals;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true, testName = "ec2.NebulaComputeServiceLiveTest") @Test(enabled = false, groups = "live", sequential = true, testName = "ec2.NebulaComputeServiceLiveTest")
public class NovaComputeServiceLiveTest extends EC2ComputeServiceLiveTest { public class NovaComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
@BeforeClass
@Override public NovaComputeServiceLiveTest() {
public void setServiceDefaults() {
provider = "nova"; provider = "nova";
} }

View File

@ -25,19 +25,18 @@ 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.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.aws.ec2.reference.EC2Constants; import org.jclouds.aws.ec2.reference.EC2Constants;
import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
/** /**
* *
@ -45,21 +44,38 @@ import com.google.common.collect.ImmutableSet;
*/ */
@Test(groups = "live", testName = "ec2.NebulaTemplateBuilderLiveTest") @Test(groups = "live", testName = "ec2.NebulaTemplateBuilderLiveTest")
public class NovaTemplateBuilderLiveTest { public class NovaTemplateBuilderLiveTest {
private String password; protected String provider = "nova";
private String user; protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
@BeforeGroups(groups = { "live" }) protected void setupCredentials() {
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException, IOException { identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
user = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
password = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); + ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
} }
@Test @Test
public void testDefaultTemplateBuilder() throws IOException { public void testDefaultTemplateBuilder() throws IOException {
ComputeServiceContext newContext = null; ComputeServiceContext newContext = null;
try { try {
newContext = new ComputeServiceContextFactory().createContext("nova", user, password, ImmutableSet newContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
.of(new Log4JLoggingModule())); .<Module> of(new Log4JLoggingModule()), setupProperties());
Template defaultTemplate = newContext.getComputeService().templateBuilder().build(); Template defaultTemplate = newContext.getComputeService().templateBuilder().build();
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate; assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
@ -80,12 +96,12 @@ public class NovaTemplateBuilderLiveTest {
public void testTemplateBuilderWithNoOwnersParsesImageOnDemand() throws IOException { public void testTemplateBuilderWithNoOwnersParsesImageOnDemand() throws IOException {
ComputeServiceContext newContext = null; ComputeServiceContext newContext = null;
try { try {
Properties overrides = new Properties(); Properties overrides = setupProperties();
// set owners to nothing // set owners to nothing
overrides.setProperty(EC2Constants.PROPERTY_EC2_AMI_OWNERS, ""); overrides.setProperty(EC2Constants.PROPERTY_EC2_AMI_OWNERS, "");
newContext = new ComputeServiceContextFactory().createContext("nova", user, password, ImmutableSet newContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
.of(new Log4JLoggingModule()), overrides); .<Module> of(new Log4JLoggingModule()), overrides);
assertEquals(newContext.getComputeService().listImages().size(), 0); assertEquals(newContext.getComputeService().listImages().size(), 0);

View File

@ -26,10 +26,11 @@ import static org.jclouds.aws.ec2.options.RegisterImageOptions.Builder.withDescr
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.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException; import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient; import org.jclouds.aws.ec2.EC2AsyncClient;
@ -60,7 +61,6 @@ import com.google.inject.Module;
public class AMIClientLiveTest { public class AMIClientLiveTest {
private AMIClient client; private AMIClient client;
private String identity;
private String imageId = "ami-cdf819a4"; 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";
@ -68,13 +68,38 @@ public class AMIClientLiveTest {
private Set<String> imagesToDeregister = Sets.newHashSet(); private Set<String> imagesToDeregister = Sets.newHashSet();
@BeforeGroups(groups = { "live" }) protected String provider = "ec2";
public void setupClient() throws IOException { protected String identity;
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); protected String credential;
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); protected String endpoint;
protected String apiversion;
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet protected void setupCredentials() {
.<Module> of(new Log4JLoggingModule())); 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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" })
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
client = context.getApi().getAMIServices(); client = context.getApi().getAMIServices();
} }

View File

@ -25,13 +25,14 @@ import static org.jclouds.aws.ec2.options.DescribeRegionsOptions.Builder.regions
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.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.Iterator; import java.util.Iterator;
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 java.util.Map.Entry;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient; import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client; import org.jclouds.aws.ec2.EC2Client;
@ -59,14 +60,38 @@ public class AvailabilityZoneAndRegionClientLiveTest {
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;
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet overrides);
.<Module> of(new Log4JLoggingModule()));
client = context.getApi().getAvailabilityZoneAndRegionServices(); client = context.getApi().getAvailabilityZoneAndRegionServices();
} }

View File

@ -24,11 +24,12 @@ import static org.jclouds.aws.ec2.options.DescribeSnapshotsOptions.Builder.snaps
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.io.IOException; import java.util.Properties;
import java.util.Set; 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.AWSResponseException; import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient; import org.jclouds.aws.ec2.EC2AsyncClient;
@ -64,14 +65,38 @@ public class ElasticBlockStoreClientLiveTest {
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;
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet overrides);
.<Module> of(new Log4JLoggingModule()));
client = context.getApi().getElasticBlockStoreServices(); client = context.getApi().getElasticBlockStoreServices();
} }

View File

@ -23,9 +23,10 @@ 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.io.IOException; 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.aws.ec2.EC2AsyncClient; import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client; import org.jclouds.aws.ec2.EC2Client;
@ -53,13 +54,38 @@ public class ElasticIPAddressClientLiveTest {
private ElasticIPAddressClient client; private ElasticIPAddressClient client;
private RestContext<EC2Client, EC2AsyncClient> context; private RestContext<EC2Client, EC2AsyncClient> context;
@BeforeGroups(groups = { "live" }) protected String provider = "ec2";
public void setupClient() throws IOException { protected String identity;
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); protected String credential;
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); protected String endpoint;
protected String apiversion;
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet protected void setupCredentials() {
.<Module> of(new Log4JLoggingModule())); 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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" })
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
client = context.getApi().getElasticIPAddressServices(); client = context.getApi().getElasticIPAddressServices();
} }

View File

@ -22,9 +22,10 @@ package org.jclouds.aws.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import java.io.IOException; 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.aws.ec2.EC2AsyncClient; import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client; import org.jclouds.aws.ec2.EC2Client;
@ -51,15 +52,39 @@ public class InstanceClientLiveTest {
public static final String PREFIX = System.getProperty("user.name") + "-ec2"; public static final String PREFIX = System.getProperty("user.name") + "-ec2";
private InstanceClient client; private InstanceClient client;
private String identity;
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
.<Module> of(new Log4JLoggingModule())); overrides);
client = context.getApi().getInstanceServices(); client = context.getApi().getInstanceServices();
} }

View File

@ -23,10 +23,11 @@ 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.io.IOException; 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.EC2AsyncClient; import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client; import org.jclouds.aws.ec2.EC2Client;
@ -54,12 +55,38 @@ public class KeyPairClientLiveTest {
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
.<Module> of(new Log4JLoggingModule())); overrides);
client = context.getApi().getKeyPairServices(); client = context.getApi().getKeyPairServices();
} }

View File

@ -22,9 +22,10 @@ package org.jclouds.aws.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull; 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.util.Map; import java.util.Map;
import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.aws.ec2.EC2AsyncClient; import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client; import org.jclouds.aws.ec2.EC2Client;
import org.jclouds.aws.ec2.domain.MonitoringState; import org.jclouds.aws.ec2.domain.MonitoringState;
@ -48,30 +49,52 @@ public class MonitoringClientLiveTest {
private MonitoringClient client; private MonitoringClient client;
private static final String DEFAULT_INSTANCE = "i-TODO"; private static final String DEFAULT_INSTANCE = "i-TODO";
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet overrides);
.<Module> of(new Log4JLoggingModule()));
client = context.getApi().getMonitoringServices(); client = context.getApi().getMonitoringServices();
} }
@Test(enabled = false) @Test(enabled = false)
// TODO get instance // TODO get instance
public void testMonitorInstances() { public void testMonitorInstances() {
Map<String, MonitoringState> monitoringState = client.monitorInstancesInRegion(null, Map<String, MonitoringState> monitoringState = client.monitorInstancesInRegion(null, DEFAULT_INSTANCE);
DEFAULT_INSTANCE);
assertEquals(monitoringState.get(DEFAULT_INSTANCE), MonitoringState.PENDING); assertEquals(monitoringState.get(DEFAULT_INSTANCE), MonitoringState.PENDING);
} }
@Test(enabled = false) @Test(enabled = false)
// TODO get instance // TODO get instance
public void testUnmonitorInstances() { public void testUnmonitorInstances() {
Map<String, MonitoringState> monitoringState = client.unmonitorInstancesInRegion(null, Map<String, MonitoringState> monitoringState = client.unmonitorInstancesInRegion(null, DEFAULT_INSTANCE);
DEFAULT_INSTANCE);
assertEquals(monitoringState.get(DEFAULT_INSTANCE), MonitoringState.PENDING); assertEquals(monitoringState.get(DEFAULT_INSTANCE), MonitoringState.PENDING);
} }

View File

@ -24,12 +24,15 @@ import static org.jclouds.io.Payloads.newStringPayload;
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.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
import java.util.Properties;
import java.util.Set; 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.AWSResponseException; import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2Client; import org.jclouds.aws.ec2.EC2Client;
@ -49,7 +52,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.predicates.RetryablePredicate; import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.AfterTest; import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -76,14 +78,40 @@ public class PlacementGroupClientLiveTest {
private RetryablePredicate<PlacementGroup> deletedTester; private RetryablePredicate<PlacementGroup> deletedTester;
private PlacementGroup group; private PlacementGroup group;
private Map<String, String> keyPair; private Map<String, String> keyPair;
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() throws FileNotFoundException, IOException {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
keyPair = BaseComputeServiceLiveTest.setupKeyPair(); keyPair = BaseComputeServiceLiveTest.setupKeyPair();
context = new ComputeServiceContextFactory().createContext("ec2", identity, credential, ImmutableSet.<Module> of(
new Log4JLoggingModule(), new JschSshClientModule()));
client = EC2Client.class.cast(context.getProviderSpecificContext().getApi()); client = EC2Client.class.cast(context.getProviderSpecificContext().getApi());
availableTester = new RetryablePredicate<PlacementGroup>(new PlacementGroupAvailable(client), 60, 1, availableTester = new RetryablePredicate<PlacementGroup>(new PlacementGroupAvailable(client), 60, 1,

View File

@ -23,13 +23,14 @@ 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.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.SortedSet; import java.util.SortedSet;
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.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient; import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client; import org.jclouds.aws.ec2.EC2Client;
@ -60,12 +61,38 @@ public class SecurityGroupClientLiveTest {
private SecurityGroupClient client; private 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 = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
.<Module> of(new Log4JLoggingModule())); overrides);
client = context.getApi().getSecurityGroupServices(); client = context.getApi().getSecurityGroupServices();
} }

View File

@ -21,8 +21,9 @@ package org.jclouds.aws.ec2.services;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.io.IOException; import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.aws.ec2.EC2AsyncClient; import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client; import org.jclouds.aws.ec2.EC2Client;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
@ -48,13 +49,38 @@ public class WindowsClientLiveTest {
private RestContext<EC2Client, EC2AsyncClient> context; private RestContext<EC2Client, EC2AsyncClient> context;
@BeforeGroups(groups = { "live" }) protected String provider = "ec2";
public void setupClient() throws IOException { protected String identity;
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); protected String credential;
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); protected String endpoint;
protected String apiversion;
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet protected void setupCredentials() {
.<Module> of(new Log4JLoggingModule())); 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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" })
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
client = context.getApi().getWindowsServices(); client = context.getApi().getWindowsServices();
} }
@ -62,12 +88,12 @@ public class WindowsClientLiveTest {
// TODO get instance // TODO get instance
public void testBundleInstanceInRegion() { public void testBundleInstanceInRegion() {
client client
.bundleInstanceInRegion( .bundleInstanceInRegion(
null, null,
DEFAULT_INSTANCE, DEFAULT_INSTANCE,
"prefix", "prefix",
DEFAULT_BUCKET, DEFAULT_BUCKET,
"{\"expiration\": \"2008-08-30T08:49:09Z\",\"conditions\": [{\"bucket\": \"my-bucket\"},[\"starts-with\", \"$key\", \"my-new-image\"]]}"); "{\"expiration\": \"2008-08-30T08:49:09Z\",\"conditions\": [{\"bucket\": \"my-bucket\"},[\"starts-with\", \"$key\", \"my-new-image\"]]}");
} }
@Test(enabled = false) @Test(enabled = false)

View File

@ -22,10 +22,11 @@ package org.jclouds.aws.elb;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import java.io.IOException; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.domain.AvailabilityZone; import org.jclouds.aws.ec2.domain.AvailabilityZone;
import org.jclouds.aws.elb.domain.LoadBalancer; import org.jclouds.aws.elb.domain.LoadBalancer;
@ -51,14 +52,38 @@ public class ELBClientLiveTest {
private ELBClient client; private ELBClient client;
private RestContext<ELBClient, ELBAsyncClient> context; private RestContext<ELBClient, ELBAsyncClient> context;
protected String provider = "elb";
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
context = new RestContextFactory().createContext("elb", identity, credential, ImmutableSet overrides);
.<Module> of(new Log4JLoggingModule()));
client = context.getApi(); client = context.getApi();
} }
@ -66,11 +91,10 @@ public class ELBClientLiveTest {
void testCreateLoadBalancer() { void testCreateLoadBalancer() {
String name = "TestLoadBalancer"; String name = "TestLoadBalancer";
for (Entry<String, String> regionZone : ImmutableMap.<String, String> of(Region.US_EAST_1, for (Entry<String, String> regionZone : ImmutableMap.<String, String> of(Region.US_EAST_1,
AvailabilityZone.US_EAST_1A, Region.US_WEST_1, AvailabilityZone.US_WEST_1A, AvailabilityZone.US_EAST_1A, Region.US_WEST_1, AvailabilityZone.US_WEST_1A, Region.EU_WEST_1,
Region.EU_WEST_1, AvailabilityZone.EU_WEST_1A, Region.AP_SOUTHEAST_1, AvailabilityZone.EU_WEST_1A, Region.AP_SOUTHEAST_1, AvailabilityZone.AP_SOUTHEAST_1A).entrySet()) {
AvailabilityZone.AP_SOUTHEAST_1A).entrySet()) { String dnsName = client.createLoadBalancerInRegion(regionZone.getKey(), name, "http", 80, 80, regionZone
String dnsName = client.createLoadBalancerInRegion(regionZone.getKey(), name, "http", 80, .getValue());
80, regionZone.getValue());
assertNotNull(dnsName); assertNotNull(dnsName);
assert (dnsName.startsWith(name)); assert (dnsName.startsWith(name));
} }
@ -78,8 +102,8 @@ public class ELBClientLiveTest {
@Test(dependsOnMethods = "testCreateLoadBalancer") @Test(dependsOnMethods = "testCreateLoadBalancer")
void testDescribeLoadBalancers() { void testDescribeLoadBalancers() {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) { Region.AP_SOUTHEAST_1)) {
Set<LoadBalancer> allResults = client.describeLoadBalancersInRegion(region); Set<LoadBalancer> allResults = client.describeLoadBalancersInRegion(region);
assertNotNull(allResults); assertNotNull(allResults);
assert (allResults.size() >= 1); assert (allResults.size() >= 1);
@ -88,8 +112,8 @@ public class ELBClientLiveTest {
@Test @Test
void testDeleteLoadBalancer() { void testDeleteLoadBalancer() {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) { Region.AP_SOUTHEAST_1)) {
client.deleteLoadBalancerInRegion(region, "TestLoadBalancer"); client.deleteLoadBalancerInRegion(region, "TestLoadBalancer");
} }
} }

View File

@ -20,7 +20,6 @@
package org.jclouds.aws.s3.blobstore.integration; package org.jclouds.aws.s3.blobstore.integration;
import java.io.IOException; import java.io.IOException;
import java.util.Properties;
import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory; import org.jclouds.blobstore.BlobStoreContextFactory;
@ -37,12 +36,16 @@ import com.google.inject.Module;
*/ */
public class S3TestInitializer extends TransientBlobStoreTestInitializer { public class S3TestInitializer extends TransientBlobStoreTestInitializer {
@Override public S3TestInitializer() {
protected BlobStoreContext createLiveContext(Module configurationModule, String url, String app, provider = "s3";
String identity, String key) throws IOException {
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true; BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
return new BlobStoreContextFactory().createContext("s3", identity, key, ImmutableSet.of( }
configurationModule, new Log4JLoggingModule()), new Properties());
@Override
protected BlobStoreContext createLiveContext(Module configurationModule, String endpoint, String apiversion,
String app, String identity, String credential) throws IOException {
return new BlobStoreContextFactory().createContext(provider, ImmutableSet.of(configurationModule,
new Log4JLoggingModule()), setupProperties(endpoint, apiversion, identity, credential));
} }
} }

View File

@ -25,9 +25,11 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import java.io.IOException; import java.io.IOException;
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.AWSResponseException; import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.domain.Region; import org.jclouds.aws.domain.Region;
import org.jclouds.aws.sqs.domain.Queue; import org.jclouds.aws.sqs.domain.Queue;
@ -57,14 +59,38 @@ public class SQSClientLiveTest {
private RestContext<SQSClient, SQSAsyncClient> context; private RestContext<SQSClient, SQSAsyncClient> context;
private Set<Queue> queues = Sets.newHashSet(); private Set<Queue> queues = Sets.newHashSet();
protected String provider = "sqs";
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
context = new RestContextFactory().createContext("sqs", identity, credential, ImmutableSet overrides);
.<Module> of(new Log4JLoggingModule()));
this.client = context.getApi(); this.client = context.getApi();
} }

View File

@ -35,11 +35,43 @@
<module>core</module> <module>core</module>
<module>demos</module> <module>demos</module>
</modules> </modules>
<properties> <properties>
<jclouds.test.user>${jclouds.aws.accesskeyid}</jclouds.test.user> <test.initializer>org.jclouds.aws.s3.blobstore.integration.S3TestInitializer</test.initializer>
<jclouds.test.key>${jclouds.aws.secretaccesskey}</jclouds.test.key> <test.aws.identity>FIXME</test.aws.identity>
<jclouds.test.initializer>org.jclouds.aws.s3.blobstore.integration.S3TestInitializer</jclouds.test.initializer> <test.aws.credential>FIXME</test.aws.credential>
<!-- when instances are hung, open a ticket and add here -->
<jclouds.compute.blacklist.nodes>trmkrun-ccc,test.trmk-924</jclouds.compute.blacklist.nodes>
<test.s3.endpoint>https://s3.amazonaws.com</test.s3.endpoint>
<test.s3.apiversion>2006-03-01</test.s3.apiversion>
<test.s3.identity>${test.aws.identity}</test.s3.identity>
<test.s3.credential>${test.aws.credential}</test.s3.credential>
<test.ec2.endpoint>https://ec2.us-east-1.amazonaws.com</test.ec2.endpoint>
<test.ec2.apiversion>2010-06-15</test.ec2.apiversion>
<test.ec2.identity>${test.aws.identity}</test.ec2.identity>
<test.ec2.credential>${test.aws.credential}</test.ec2.credential>
<test.cloudwatch.endpoint>https://monitoring.us-east-1.amazonaws.com</test.cloudwatch.endpoint>
<test.cloudwatch.apiversion>2009-05-15</test.cloudwatch.apiversion>
<test.cloudwatch.identity>${test.aws.identity}</test.cloudwatch.identity>
<test.cloudwatch.credential>${test.aws.credential}</test.cloudwatch.credential>
<test.elb.endpoint>https://elasticloadbalancing.us-east-1.amazonaws.com</test.elb.endpoint>
<test.elb.apiversion>2009-11-25</test.elb.apiversion>
<test.elb.identity>${test.aws.identity}</test.elb.identity>
<test.elb.credential>${test.aws.credential}</test.elb.credential>
<test.sqs.endpoint>https://sqs.us-east-1.amazonaws.com</test.sqs.endpoint>
<test.sqs.apiversion>2009-02-01</test.sqs.apiversion>
<test.sqs.identity>${test.aws.identity}</test.sqs.identity>
<test.sqs.credential>${test.aws.credential}</test.sqs.credential>
<test.eucalyptus.endpoint>http://173.205.188.130:8773/services/Eucalyptus</test.eucalyptus.endpoint>
<test.eucalyptus.apiversion>2010-06-15</test.eucalyptus.apiversion>
<test.eucalyptus.identity>FIXME</test.eucalyptus.identity>
<test.eucalyptus.credential>FIXME</test.eucalyptus.credential>
<test.nova.endpoint>http://10.255.255.1:8773/services/Cloud</test.nova.endpoint>
<test.nova.apiversion>2010-06-15</test.nova.apiversion>
<test.nova.identity>FIXME</test.nova.identity>
<test.nova.credential>FIXME</test.nova.credential>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
@ -102,4 +134,151 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>test.s3.endpoint</name>
<value>${test.s3.endpoint}</value>
</property>
<property>
<name>test.s3.apiversion</name>
<value>${test.s3.apiversion}</value>
</property>
<property>
<name>test.s3.identity</name>
<value>${test.s3.identity}</value>
</property>
<property>
<name>test.s3.credential</name>
<value>${test.s3.credential}</value>
</property>
<property>
<name>test.ec2.endpoint</name>
<value>${test.ec2.endpoint}</value>
</property>
<property>
<name>test.ec2.apiversion</name>
<value>${test.ec2.apiversion}</value>
</property>
<property>
<name>test.ec2.identity</name>
<value>${test.ec2.identity}</value>
</property>
<property>
<name>test.ec2.credential</name>
<value>${test.ec2.credential}</value>
</property>
<property>
<name>jclouds.compute.blacklist.nodes</name>
<value>${jclouds.compute.blacklist.nodes}</value>
</property>
<property>
<name>test.sqs.endpoint</name>
<value>${test.sqs.endpoint}</value>
</property>
<property>
<name>test.sqs.apiversion</name>
<value>${test.sqs.apiversion}</value>
</property>
<property>
<name>test.sqs.identity</name>
<value>${test.sqs.identity}</value>
</property>
<property>
<name>test.sqs.credential</name>
<value>${test.sqs.credential}</value>
</property>
<property>
<name>test.elb.endpoint</name>
<value>${test.elb.endpoint}</value>
</property>
<property>
<name>test.elb.apiversion</name>
<value>${test.elb.apiversion}</value>
</property>
<property>
<name>test.elb.identity</name>
<value>${test.elb.identity}</value>
</property>
<property>
<name>test.elb.credential</name>
<value>${test.elb.credential}</value>
</property>
<property>
<name>test.cloudwatch.endpoint</name>
<value>${test.cloudwatch.endpoint}</value>
</property>
<property>
<name>test.cloudwatch.apiversion</name>
<value>${test.cloudwatch.apiversion}</value>
</property>
<property>
<name>test.cloudwatch.identity</name>
<value>${test.cloudwatch.identity}</value>
</property>
<property>
<name>test.cloudwatch.credential</name>
<value>${test.cloudwatch.credential}</value>
</property>
<property>
<name>test.eucalyptus.endpoint</name>
<value>${test.eucalyptus.endpoint}</value>
</property>
<property>
<name>test.eucalyptus.apiversion</name>
<value>${test.eucalyptus.apiversion}</value>
</property>
<property>
<name>test.eucalyptus.identity</name>
<value>${test.eucalyptus.identity}</value>
</property>
<property>
<name>test.eucalyptus.credential</name>
<value>${test.eucalyptus.credential}</value>
</property>
<property>
<name>test.nova.endpoint</name>
<value>${test.nova.endpoint}</value>
</property>
<property>
<name>test.nova.apiversion</name>
<value>${test.nova.apiversion}</value>
</property>
<property>
<name>test.nova.identity</name>
<value>${test.nova.identity}</value>
</property>
<property>
<name>test.nova.credential</name>
<value>${test.nova.credential}</value>
</property>
<property>
<name>test.initializer</name>
<value>${test.initializer}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -33,12 +33,21 @@
<name>jclouds azure services core</name> <name>jclouds azure services core</name>
<description>jclouds core components to access azure services</description> <description>jclouds core components to access azure services</description>
<properties> <properties>
<jclouds.test.identity>${jclouds.azure.storage.account}</jclouds.test.identity> <test.azure.endpoint>https://auth.api.azurecloud.com</test.azure.endpoint>
<jclouds.test.credential>${jclouds.azure.storage.key}</jclouds.test.credential> <test.azure.apiversion>2009-09-19</test.azure.apiversion>
<jclouds.test.initializer>org.jclouds.azure.storage.blob.blobstore.integration.AzureBlobTestInitializer</jclouds.test.initializer> <test.azure.identity>FIXME</test.azure.identity>
<test.azure.credential>FIXME</test.azure.credential>
<test.initializer>org.jclouds.azure.storage.blob.blobstore.integration.AzureBlobTestInitializer</test.initializer>
<test.azureblob.endpoint>https://${test.azure.identity}.blob.core.windows.net</test.azureblob.endpoint>
<test.azureblob.apiversion>${test.azure.apiversion}</test.azureblob.apiversion>
<test.azureblob.identity>${test.azure.identity}</test.azureblob.identity>
<test.azureblob.credential>${test.azure.credential}</test.azureblob.credential>
<test.azurequeue.endpoint>https://${test.azure.identity}.queue.core.windows.net</test.azurequeue.endpoint>
<test.azurequeue.apiversion>${test.azure.apiversion}</test.azurequeue.apiversion>
<test.azurequeue.identity>${test.azure.identity}</test.azurequeue.identity>
<test.azurequeue.credential>${test.azure.credential}</test.azurequeue.credential>
</properties> </properties>
<scm> <scm>
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/azure</connection> <connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/azure</connection>
<developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/azure</developerConnection> <developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/azure</developerConnection>
@ -78,5 +87,67 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>test.azureblob.endpoint</name>
<value>${test.azureblob.endpoint}</value>
</property>
<property>
<name>test.azureblob.apiversion</name>
<value>${test.azureblob.apiversion}</value>
</property>
<property>
<name>test.azureblob.identity</name>
<value>${test.azureblob.identity}</value>
</property>
<property>
<name>test.azureblob.credential</name>
<value>${test.azureblob.credential}</value>
</property>
<property>
<name>test.azurequeue.endpoint</name>
<value>${test.azurequeue.endpoint}</value>
</property>
<property>
<name>test.azurequeue.apiversion</name>
<value>${test.azurequeue.apiversion}</value>
</property>
<property>
<name>test.azurequeue.identity</name>
<value>${test.azurequeue.identity}</value>
</property>
<property>
<name>test.azurequeue.credential</name>
<value>${test.azurequeue.credential}</value>
</property>
<property>
<name>test.initializer</name>
<value>${test.initializer}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -19,6 +19,7 @@
package org.jclouds.azure.storage.blob; package org.jclouds.azure.storage.blob;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.azure.storage.blob.options.CreateContainerOptions.Builder.withMetadata; import static org.jclouds.azure.storage.blob.options.CreateContainerOptions.Builder.withMetadata;
import static org.jclouds.azure.storage.blob.options.CreateContainerOptions.Builder.withPublicAcl; import static org.jclouds.azure.storage.blob.options.CreateContainerOptions.Builder.withPublicAcl;
import static org.jclouds.azure.storage.options.ListOptions.Builder.includeMetadata; import static org.jclouds.azure.storage.options.ListOptions.Builder.includeMetadata;
@ -26,12 +27,13 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.lang.reflect.UndeclaredThrowableException; import java.lang.reflect.UndeclaredThrowableException;
import java.net.URI; import java.net.URI;
import java.security.SecureRandom; import java.security.SecureRandom;
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.blob.domain.AzureBlob; import org.jclouds.azure.storage.blob.domain.AzureBlob;
import org.jclouds.azure.storage.blob.domain.BlobProperties; import org.jclouds.azure.storage.blob.domain.BlobProperties;
@ -49,7 +51,7 @@ 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.util.Utils; import org.jclouds.util.Utils;
import org.testng.annotations.BeforeTest; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
@ -71,13 +73,38 @@ public class AzureBlobClientLiveTest {
private String containerPrefix = System.getProperty("user.name") + "-azureblob"; private String containerPrefix = System.getProperty("user.name") + "-azureblob";
private BlobStoreContext context; private BlobStoreContext context;
protected String provider = "azurequeue";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
@BeforeTest protected void setupCredentials() {
public void setupClient() throws IOException { identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
identity = System.getProperty("jclouds.test.identity"); credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
String credential = System.getProperty("jclouds.test.credential"); + ".credential");
context = new BlobStoreContextFactory().createContext("azureblob", identity, credential, ImmutableSet endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
.<Module> of(new Log4JLoggingModule())); apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" })
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new BlobStoreContextFactory().createContext(provider, ImmutableSet
.<Module> of(new Log4JLoggingModule()), overrides);
client = (AzureBlobClient) context.getProviderSpecificContext().getApi(); client = (AzureBlobClient) context.getProviderSpecificContext().getApi();
} }
@ -92,7 +119,6 @@ public class AzureBlobClientLiveTest {
String privateContainer; String privateContainer;
String publicContainer; String publicContainer;
String identity;
@Test(timeOut = 5 * 60 * 1000) @Test(timeOut = 5 * 60 * 1000)
public void testCreateContainer() throws Exception { public void testCreateContainer() throws Exception {

View File

@ -20,7 +20,6 @@
package org.jclouds.azure.storage.blob.blobstore.integration; package org.jclouds.azure.storage.blob.blobstore.integration;
import java.io.IOException; import java.io.IOException;
import java.util.Properties;
import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory; import org.jclouds.blobstore.BlobStoreContextFactory;
@ -36,16 +35,15 @@ import com.google.inject.Module;
*/ */
public class AzureBlobTestInitializer extends TransientBlobStoreTestInitializer { public class AzureBlobTestInitializer extends TransientBlobStoreTestInitializer {
public AzureBlobTestInitializer() {
provider = "azureblob";
}
@Override @Override
protected BlobStoreContext createLiveContext(Module configurationModule, String url, String app, protected BlobStoreContext createLiveContext(Module configurationModule, String endpoint, String apiversion,
String identity, String key) throws IOException { String app, String identity, String credential) throws IOException {
Properties properties = new Properties(); return new BlobStoreContextFactory().createContext(provider, ImmutableSet.of(configurationModule,
// properties.setProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT, Integer.toString(0)); new Log4JLoggingModule()), setupProperties(endpoint, apiversion, identity, credential));
// properties.setProperty(PROPERTY_MAX_CONNECTIONS_PER_HOST, Integer.toString(0));
// properties.setProperty(PROPERTY_USER_THREADS, Integer.toString(0));
// properties.setProperty(PROPERTY_IO_WORKER_THREADS, Integer.toString(20));
return (BlobStoreContext) new BlobStoreContextFactory().createContext("azureblob", identity,
key, ImmutableSet.of(configurationModule, new Log4JLoggingModule()), properties);
} }
} }

View File

@ -19,16 +19,18 @@
package org.jclouds.azure.storage.queue; package org.jclouds.azure.storage.queue;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.azure.storage.options.ListOptions.Builder.prefix; import static org.jclouds.azure.storage.options.ListOptions.Builder.prefix;
import static org.jclouds.azure.storage.queue.options.GetOptions.Builder.maxMessages; import static org.jclouds.azure.storage.queue.options.GetOptions.Builder.maxMessages;
import static org.jclouds.azure.storage.queue.options.PutMessageOptions.Builder.withTTL; import static org.jclouds.azure.storage.queue.options.PutMessageOptions.Builder.withTTL;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.azure.storage.domain.BoundedSet; import org.jclouds.azure.storage.domain.BoundedSet;
import org.jclouds.azure.storage.options.CreateOptions; import org.jclouds.azure.storage.options.CreateOptions;
import org.jclouds.azure.storage.queue.domain.QueueMessage; import org.jclouds.azure.storage.queue.domain.QueueMessage;
@ -51,18 +53,43 @@ import com.google.inject.Module;
*/ */
@Test(groups = "live", sequential = true, testName = "azurequeue.AzureQueueClientLiveTest") @Test(groups = "live", sequential = true, testName = "azurequeue.AzureQueueClientLiveTest")
public class AzureQueueClientLiveTest { public class AzureQueueClientLiveTest {
String identity;
protected AzureQueueClient connection; protected AzureQueueClient connection;
private String queuePrefix = System.getProperty("user.name") + "-azurequeue"; private String queuePrefix = System.getProperty("user.name") + "-azurequeue";
protected String provider = "azurequeue";
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
identity = System.getProperty("jclouds.test.identity"); setupCredentials();
String credential = System.getProperty("jclouds.test.credential"); Properties overrides = setupProperties();
connection = (AzureQueueClient) new RestContextFactory().createContext("azurequeue", identity,
credential, ImmutableSet.<Module> of(new Log4JLoggingModule())).getApi(); connection = (AzureQueueClient) new RestContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getApi();
} }
@Test @Test
@ -83,8 +110,8 @@ public class AzureQueueClientLiveTest {
while (!created) { while (!created) {
privateQueue = queuePrefix + new SecureRandom().nextInt(); privateQueue = queuePrefix + new SecureRandom().nextInt();
try { try {
created = connection.createQueue(privateQueue, CreateOptions.Builder created = connection.createQueue(privateQueue, CreateOptions.Builder.withMetadata(ImmutableMultimap.of(
.withMetadata(ImmutableMultimap.of("foo", "bar"))); "foo", "bar")));
} catch (HttpResponseException htpe) { } catch (HttpResponseException htpe) {
if (htpe.getResponse().getStatusCode() == 409) { if (htpe.getResponse().getStatusCode() == 409) {
continue; continue;
@ -102,8 +129,7 @@ public class AzureQueueClientLiveTest {
@Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testCreateQueue" }) @Test(timeOut = 5 * 60 * 1000, dependsOnMethods = { "testCreateQueue" })
public void testListQueuesWithOptions() throws Exception { public void testListQueuesWithOptions() throws Exception {
BoundedSet<QueueMetadata> response = connection BoundedSet<QueueMetadata> response = connection.listQueues(prefix(privateQueue).maxResults(1));
.listQueues(prefix(privateQueue).maxResults(1));
assert null != response; assert null != response;
long initialQueueCount = response.size(); long initialQueueCount = response.size();
assertTrue(initialQueueCount >= 0); assertTrue(initialQueueCount >= 0);

View File

@ -89,7 +89,7 @@
</includes> </includes>
<systemProperties> <systemProperties>
<property> <property>
<name>jclouds.test.initializer</name> <name>test.initializer</name>
<value>org.jclouds.blobstore.integration.TransientBlobStoreTestInitializer</value> <value>org.jclouds.blobstore.integration.TransientBlobStoreTestInitializer</value>
</property> </property>
<property> <property>

View File

@ -22,7 +22,6 @@ package org.jclouds.blobstore.integration;
import java.io.IOException; import java.io.IOException;
import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.blobstore.integration.internal.BaseTestInitializer; import org.jclouds.blobstore.integration.internal.BaseTestInitializer;
import com.google.inject.Module; import com.google.inject.Module;
@ -34,14 +33,10 @@ import com.google.inject.Module;
public class TransientBlobStoreTestInitializer extends BaseTestInitializer { public class TransientBlobStoreTestInitializer extends BaseTestInitializer {
@Override @Override
protected BlobStoreContext createLiveContext(Module configurationModule, String url, String app, protected BlobStoreContext createLiveContext(Module configurationModule, String url, String apiversion, String app,
String identity, String key) throws IOException { String identity, String key) throws IOException {
return createStubContext(); return createStubContext();
} }
@Override
protected BlobStoreContext createStubContext() throws IOException {
return new BlobStoreContextFactory().createContext("transient", "foo", "bar");
}
} }

View File

@ -91,7 +91,7 @@ public class BaseBlobStoreIntegrationTest {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private BlobStoreContext getCloudResources(ITestContext testContext) throws ClassNotFoundException, private BlobStoreContext getCloudResources(ITestContext testContext) throws ClassNotFoundException,
InstantiationException, IllegalAccessException, Exception { InstantiationException, IllegalAccessException, Exception {
String initializerClass = checkNotNull(System.getProperty("jclouds.test.initializer"), "jclouds.test.initializer"); String initializerClass = checkNotNull(System.getProperty("test.initializer"), "test.initializer");
Class<BaseTestInitializer> clazz = (Class<BaseTestInitializer>) Class.forName(initializerClass); Class<BaseTestInitializer> clazz = (Class<BaseTestInitializer>) Class.forName(initializerClass);
BaseTestInitializer initializer = clazz.newInstance(); BaseTestInitializer initializer = clazz.newInstance();
return initializer.init(createHttpModule(), testContext); return initializer.init(createHttpModule(), testContext);

View File

@ -20,37 +20,61 @@
package org.jclouds.blobstore.integration.internal; package org.jclouds.blobstore.integration.internal;
import java.io.IOException; import java.io.IOException;
import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory;
import org.testng.ITestContext; import org.testng.ITestContext;
import com.google.inject.Module; import com.google.inject.Module;
public abstract class BaseTestInitializer { public abstract class BaseTestInitializer {
public BlobStoreContext init(Module configurationModule, ITestContext testContext) protected String provider = "transient";
throws Exception {
String endpoint = System.getProperty("jclouds.test.endpoint"); public BlobStoreContext init(Module configurationModule, ITestContext testContext) throws Exception {
String app = System.getProperty("jclouds.test.app"); String endpoint = System.getProperty("test." + provider + ".endpoint");
String identity = System.getProperty("jclouds.test.identity"); String app = System.getProperty("test.app");
String credential = System.getProperty("jclouds.test.credential"); String identity = System.getProperty("test." + provider + ".identity");
String credential = System.getProperty("test." + provider + ".credential");
String apiversion = System.getProperty("test." + provider + ".apiversion");
if (endpoint != null) if (endpoint != null)
testContext.setAttribute("jclouds.test.endpoint", endpoint); testContext.setAttribute("test." + provider + ".endpoint", endpoint);
if (app != null) if (app != null)
testContext.setAttribute("jclouds.test.app", app); testContext.setAttribute("test.app", app);
if (identity != null) if (identity != null)
testContext.setAttribute("jclouds.test.identity", identity); testContext.setAttribute("test." + provider + ".identity", identity);
if (credential != null) if (credential != null)
testContext.setAttribute("jclouds.test.credential", credential); testContext.setAttribute("test." + provider + ".credential", credential);
if (credential != null)
testContext.setAttribute("test." + provider + ".apiversion", apiversion);
if (identity != null) { if (identity != null) {
return createLiveContext(configurationModule, endpoint, app, identity, credential); return createLiveContext(configurationModule, endpoint, apiversion, app, identity, credential);
} else { } else {
return createStubContext(); return createStubContext();
} }
} }
protected abstract BlobStoreContext createStubContext() throws IOException; protected Properties setupProperties(String endpoint, String apiversion, String identity, String credential) {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
if (identity != null)
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 + ".apiversion", apiversion);
return overrides;
}
protected abstract BlobStoreContext createLiveContext(Module configurationModule, String url, protected BlobStoreContext createStubContext() throws IOException {
return new BlobStoreContextFactory().createContext("transient", "foo", "bar");
}
protected abstract BlobStoreContext createLiveContext(Module configurationModule, String url, String apiversion,
String app, String identity, String key) throws IOException; String app, String identity, String key) throws IOException;
} }

View File

@ -124,31 +124,20 @@ public abstract class BaseComputeServiceLiveTest {
.append("sudo zypper install java-1.6.0-openjdk-devl\n")// .append("sudo zypper install java-1.6.0-openjdk-devl\n")//
.toString(); .toString();
abstract public void setServiceDefaults(); public void setServiceDefaults() {
}
protected String provider;
protected String tag; protected String tag;
protected RetryablePredicate<IPSocket> socketTester; protected RetryablePredicate<IPSocket> socketTester;
protected SortedSet<NodeMetadata> nodes; protected SortedSet<NodeMetadata> nodes;
protected ComputeServiceContext context; protected ComputeServiceContext context;
protected ComputeService client; protected ComputeService client;
protected String identity;
protected String credential;
protected Template template; protected Template template;
protected Map<String, String> keyPair; protected Map<String, String> keyPair;
@BeforeGroups(groups = { "integration", "live" })
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException, IOException {
setServiceDefaults();
if (tag == null)
tag = checkNotNull(provider, "provider");
setupCredentials();
setupKeyPairForTest();
initializeContextAndClient();
buildSocketTester();
}
protected void buildSocketTester() { protected void buildSocketTester() {
SocketOpen socketOpen = Guice.createInjector(getSshModule()).getInstance(SocketOpen.class); SocketOpen socketOpen = Guice.createInjector(getSshModule()).getInstance(SocketOpen.class);
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS); socketTester = new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS);
@ -161,7 +150,7 @@ public abstract class BaseComputeServiceLiveTest {
public static Map<String, String> setupKeyPair() throws FileNotFoundException, IOException { public static Map<String, String> setupKeyPair() throws FileNotFoundException, IOException {
String secretKeyFile; String secretKeyFile;
try { try {
secretKeyFile = checkNotNull(System.getProperty("jclouds.test.ssh.keyfile"), "jclouds.test.ssh.keyfile"); secretKeyFile = checkNotNull(System.getProperty("test.ssh.keyfile"), "test.ssh.keyfile");
} catch (NullPointerException e) { } catch (NullPointerException e) {
secretKeyFile = System.getProperty("user.home") + "/.ssh/id_rsa"; secretKeyFile = System.getProperty("user.home") + "/.ssh/id_rsa";
} }
@ -172,24 +161,56 @@ public abstract class BaseComputeServiceLiveTest {
+ ".pub"), Charsets.UTF_8)); + ".pub"), Charsets.UTF_8));
} }
protected String provider;
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
protected void setupCredentials() { protected void setupCredentials() {
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); credential = System.getProperty("test." + provider + ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "integration", "live" })
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException, IOException {
setServiceDefaults();
if (tag == null)
tag = checkNotNull(provider, "provider");
setupCredentials();
setupKeyPairForTest();
initializeContextAndClient();
buildSocketTester();
} }
private void initializeContextAndClient() throws IOException { private void initializeContextAndClient() throws IOException {
if (context != null) if (context != null)
context.close(); context.close();
Properties props = new Properties(); Properties props = setupProperties();
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.of(new Log4JLoggingModule(),
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); getSshModule()), props);
context = new ComputeServiceContextFactory().createContext(provider, identity, credential, ImmutableSet.of(
new Log4JLoggingModule(), getSshModule()), props);
client = context.getComputeService(); client = context.getComputeService();
} }
private static void checkSecretKeyFile(String secretKeyFile) throws FileNotFoundException { private static void checkSecretKeyFile(String secretKeyFile) throws FileNotFoundException {
Utils.checkNotEmpty(secretKeyFile, "System property: [jclouds.test.ssh.keyfile] set to an empty string"); Utils.checkNotEmpty(secretKeyFile, "System property: [test.ssh.keyfile] set to an empty string");
if (!new File(secretKeyFile).exists()) { if (!new File(secretKeyFile).exists()) {
throw new FileNotFoundException("secretKeyFile not found at: " + secretKeyFile); throw new FileNotFoundException("secretKeyFile not found at: " + secretKeyFile);
} }
@ -200,33 +221,19 @@ public abstract class BaseComputeServiceLiveTest {
// wait up to 5 seconds for an auth exception // wait up to 5 seconds for an auth exception
@Test(enabled = true, expectedExceptions = AuthorizationException.class) @Test(enabled = true, expectedExceptions = AuthorizationException.class)
public void testCorrectAuthException() throws Exception { public void testCorrectAuthException() throws Exception {
synchronized (ComputeServiceContext.class) { ComputeServiceContext context = null;
ComputeServiceContext context = null; try {
// system properties override crendentials passed context = new ComputeServiceContextFactory().createContext(provider, "MOMMA", "MIA", ImmutableSet
// if in the form provider.identity, provider.credential .<Module> of(new Log4JLoggingModule()));
// we want this to fail, so we save off old state and reset those context.getComputeService().listNodes();
// properties to garbage. } catch (AuthorizationException e) {
String oldIdentity = System.getProperty(provider + ".identity"); throw e;
String oldCredential = System.getProperty(provider + ".credential"); } catch (RuntimeException e) {
try { e.printStackTrace();
System.setProperty(provider + ".identity", "MOMMA"); throw e;
System.setProperty(provider + ".credential", "MIA"); } finally {
context = new ComputeServiceContextFactory().createContext(provider, "MOMMA", "MIA", ImmutableSet if (context != null)
.<Module> of(new Log4JLoggingModule())); context.close();
context.getComputeService().listNodes();
} catch (AuthorizationException e) {
throw e;
} catch (RuntimeException e) {
e.printStackTrace();
throw e;
} finally {
if (oldIdentity != null)
System.setProperty(provider + ".identity", oldIdentity);
if (oldCredential != null)
System.setProperty(provider + ".credential", oldCredential);
if (context != null)
context.close();
}
} }
} }

View File

@ -81,8 +81,8 @@ public abstract class BaseLoadBalancerServiceLiveTest {
IOException, RunNodesException { IOException, RunNodesException {
if (tag == null) if (tag == null)
tag = checkNotNull(provider, "provider") + "lb"; tag = checkNotNull(provider, "provider") + "lb";
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider + ".credential");
initializeContextAndClient(); initializeContextAndClient();

View File

@ -83,8 +83,8 @@ nova.propertiesbuilder=org.jclouds.aws.ec2.NovaPropertiesBuilder
cloudservers.contextbuilder=org.jclouds.rackspace.cloudservers.CloudServersContextBuilder cloudservers.contextbuilder=org.jclouds.rackspace.cloudservers.CloudServersContextBuilder
cloudservers.propertiesbuilder=org.jclouds.rackspace.RackspacePropertiesBuilder cloudservers.propertiesbuilder=org.jclouds.rackspace.RackspacePropertiesBuilder
bluelock-vclouddirector.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorContextBuilder bluelock-vcdirector.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorContextBuilder
bluelock-vclouddirector.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorPropertiesBuilder bluelock-vcdirector.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorPropertiesBuilder
gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder
gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder

View File

@ -83,8 +83,8 @@ nova.propertiesbuilder=org.jclouds.aws.ec2.NovaPropertiesBuilder
cloudservers.contextbuilder=org.jclouds.rackspace.cloudservers.CloudServersContextBuilder cloudservers.contextbuilder=org.jclouds.rackspace.cloudservers.CloudServersContextBuilder
cloudservers.propertiesbuilder=org.jclouds.rackspace.RackspacePropertiesBuilder cloudservers.propertiesbuilder=org.jclouds.rackspace.RackspacePropertiesBuilder
bluelock-vclouddirector.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorContextBuilder bluelock-vcdirector.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorContextBuilder
bluelock-vclouddirector.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorPropertiesBuilder bluelock-vcdirector.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorPropertiesBuilder
gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder
gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder

View File

@ -51,15 +51,17 @@ import com.google.inject.Module;
@Test(groups = "unit", testName = "rest.RestContextFactoryTest") @Test(groups = "unit", testName = "rest.RestContextFactoryTest")
public class RestContextFactoryTest { public class RestContextFactoryTest {
private static final String provider = "test";
public void testBuilder() { public void testBuilder() {
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test", ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec(provider,
"http://localhost", "1", "dummy", null, IntegrationTestClient.class, IntegrationTestAsyncClient.class); "http://localhost", "1", "dummy", null, IntegrationTestClient.class, IntegrationTestAsyncClient.class);
createContextBuilder(contextSpec); createContextBuilder(contextSpec);
} }
public void testBuilderProperties() { public void testBuilderProperties() {
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test", ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec(provider,
"http://localhost", "1", "dummy", null, IntegrationTestClient.class, IntegrationTestAsyncClient.class); "http://localhost", "1", "dummy", null, IntegrationTestClient.class, IntegrationTestAsyncClient.class);
Properties props = RestContextFactory.toProperties(contextSpec); Properties props = RestContextFactory.toProperties(contextSpec);
@ -73,11 +75,11 @@ public class RestContextFactoryTest {
assertEquals(props.getProperty("test.contextbuilder"), null); assertEquals(props.getProperty("test.contextbuilder"), null);
assertEquals(props.getProperty("test.modules"), null); assertEquals(props.getProperty("test.modules"), null);
new RestContextFactory().createContext("test", props); new RestContextFactory().createContext(provider, props);
} }
public void testBuilderPropertiesWithCredential() { public void testBuilderPropertiesWithCredential() {
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test", ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec(provider,
"http://localhost", "1", "dummy", "credential", IntegrationTestClient.class, "http://localhost", "1", "dummy", "credential", IntegrationTestClient.class,
IntegrationTestAsyncClient.class); IntegrationTestAsyncClient.class);
@ -92,12 +94,12 @@ public class RestContextFactoryTest {
assertEquals(props.getProperty("test.contextbuilder"), null); assertEquals(props.getProperty("test.contextbuilder"), null);
assertEquals(props.getProperty("test.modules"), null); assertEquals(props.getProperty("test.modules"), null);
new RestContextFactory().createContext("test", props); new RestContextFactory().createContext(provider, props);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void testBuilderPropertiesWithContextBuilder() { public void testBuilderPropertiesWithContextBuilder() {
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test", ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec(provider,
"http://localhost", "1", "dummy", null, (Class) null, (Class) null, PropertiesBuilder.class, "http://localhost", "1", "dummy", null, (Class) null, (Class) null, PropertiesBuilder.class,
(Class) IntegrationTestContextBuilder.class, Collections.EMPTY_LIST); (Class) IntegrationTestContextBuilder.class, Collections.EMPTY_LIST);
@ -112,12 +114,12 @@ public class RestContextFactoryTest {
assertEquals(props.getProperty("test.contextbuilder"), IntegrationTestContextBuilder.class.getName()); assertEquals(props.getProperty("test.contextbuilder"), IntegrationTestContextBuilder.class.getName());
assertEquals(props.getProperty("test.modules"), null); assertEquals(props.getProperty("test.modules"), null);
new RestContextFactory().createContext("test", props); new RestContextFactory().createContext(provider, props);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void testBuilderPropertiesWithModule() { public void testBuilderPropertiesWithModule() {
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test", ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec(provider,
"http://localhost", "1", "dummy", null, (Class) null, (Class) null, PropertiesBuilder.class, "http://localhost", "1", "dummy", null, (Class) null, (Class) null, PropertiesBuilder.class,
(Class) IntegrationTestContextBuilder.class, Collections.<Module> singleton(new A())); (Class) IntegrationTestContextBuilder.class, Collections.<Module> singleton(new A()));
@ -132,12 +134,12 @@ public class RestContextFactoryTest {
assertEquals(props.getProperty("test.contextbuilder"), IntegrationTestContextBuilder.class.getName()); assertEquals(props.getProperty("test.contextbuilder"), IntegrationTestContextBuilder.class.getName());
assertEquals(props.getProperty("test.modules"), "org.jclouds.rest.RestContextFactoryTest$A"); assertEquals(props.getProperty("test.modules"), "org.jclouds.rest.RestContextFactoryTest$A");
new RestContextFactory().createContext("test", props); new RestContextFactory().createContext(provider, props);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void testBuilderPropertiesWithModules() { public void testBuilderPropertiesWithModules() {
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test", ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec(provider,
"http://localhost", "1", "dummy", null, (Class) null, (Class) null, PropertiesBuilder.class, "http://localhost", "1", "dummy", null, (Class) null, (Class) null, PropertiesBuilder.class,
(Class) IntegrationTestContextBuilder.class, Arrays.<Module> asList(new A(), new B())); (Class) IntegrationTestContextBuilder.class, Arrays.<Module> asList(new A(), new B()));
@ -153,7 +155,7 @@ public class RestContextFactoryTest {
assertEquals(props.getProperty("test.modules"), assertEquals(props.getProperty("test.modules"),
"org.jclouds.rest.RestContextFactoryTest$A,org.jclouds.rest.RestContextFactoryTest$B"); "org.jclouds.rest.RestContextFactoryTest$A,org.jclouds.rest.RestContextFactoryTest$B");
new RestContextFactory().createContext("test", props); new RestContextFactory().createContext(provider, props);
} }
public void testBuilderPropertiesJCloudsScope() { public void testBuilderPropertiesJCloudsScope() {
@ -181,7 +183,7 @@ public class RestContextFactoryTest {
return spec; return spec;
} }
}.createContext("test", props); }.createContext(provider, props);
} }
public void testBuilderPropertiesJCloudsScopeWithProviderIdentityAndFileCredential() throws IOException { public void testBuilderPropertiesJCloudsScopeWithProviderIdentityAndFileCredential() throws IOException {
@ -213,7 +215,7 @@ public class RestContextFactoryTest {
return spec; return spec;
} }
}.createContext("test", props); }.createContext(provider, props);
} }
public static class A extends AbstractModule { public static class A extends AbstractModule {
@ -238,7 +240,7 @@ public class RestContextFactoryTest {
@Test(expectedExceptions = IllegalArgumentException.class) @Test(expectedExceptions = IllegalArgumentException.class)
public void testBuilderPropertiesWithWrongConfig() { public void testBuilderPropertiesWithWrongConfig() {
@SuppressWarnings("unused") @SuppressWarnings("unused")
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test", ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec(provider,
"http://localhost", "1", "dummy", null, (Class) null, (Class) null, "http://localhost", "1", "dummy", null, (Class) null, (Class) null,
(Class) IntegrationTestContextBuilder.class, (Class) PropertiesBuilder.class, Collections.EMPTY_LIST); (Class) IntegrationTestContextBuilder.class, (Class) PropertiesBuilder.class, Collections.EMPTY_LIST);
} }

View File

@ -46,11 +46,11 @@ import com.google.inject.Injector;
*/ */
@Test(groups = "live", testName = "ssh.JschSshClientLiveTest") @Test(groups = "live", testName = "ssh.JschSshClientLiveTest")
public class JschSshClientLiveTest { public class JschSshClientLiveTest {
protected static final String sshHost = System.getProperty("jclouds.test.ssh.host"); protected static final String sshHost = System.getProperty("test.ssh.host");
protected static final String sshPort = System.getProperty("jclouds.test.ssh.port"); protected static final String sshPort = System.getProperty("test.ssh.port");
protected static final String sshUser = System.getProperty("jclouds.test.ssh.username"); protected static final String sshUser = System.getProperty("test.ssh.username");
protected static final String sshPass = System.getProperty("jclouds.test.ssh.password"); protected static final String sshPass = System.getProperty("test.ssh.password");
protected static final String sshKeyFile = System.getProperty("jclouds.test.ssh.keyfile"); protected static final String sshKeyFile = System.getProperty("test.ssh.keyfile");
private File temp; private File temp;
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })

View File

@ -68,7 +68,7 @@
</dependencies> </dependencies>
<properties> <properties>
<jclouds.test.initializer>org.jclouds.filesystem.integration.FilesystemTestInitializer</jclouds.test.initializer> <test.initializer>org.jclouds.filesystem.integration.FilesystemTestInitializer</test.initializer>
</properties> </properties>
</project> </project>

View File

@ -26,31 +26,36 @@ import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory; import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.blobstore.integration.TransientBlobStoreTestInitializer; import org.jclouds.blobstore.integration.TransientBlobStoreTestInitializer;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest; import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.jclouds.filesystem.reference.FilesystemConstants;
import org.jclouds.filesystem.utils.TestUtils;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.inject.Module; import com.google.inject.Module;
import org.jclouds.filesystem.reference.FilesystemConstants;
import org.jclouds.filesystem.utils.TestUtils;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class FilesystemTestInitializer extends TransientBlobStoreTestInitializer { public class FilesystemTestInitializer extends TransientBlobStoreTestInitializer {
@Override public FilesystemTestInitializer() {
protected BlobStoreContext createLiveContext(Module configurationModule, String url, String app, provider = "filesystem";
String identity, String key) throws IOException {
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true; BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
}
Properties prop = new Properties(); @Override
prop.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR); protected BlobStoreContext createLiveContext(Module configurationModule, String endpoint, String apiversion,
return new BlobStoreContextFactory().createContext( String app, String identity, String credential) throws IOException {
"filesystem", return new BlobStoreContextFactory().createContext(provider, ImmutableSet.of(configurationModule,
ImmutableSet.of(configurationModule, new Log4JLoggingModule()), new Log4JLoggingModule()), setupProperties(endpoint, apiversion, identity, credential));
prop); }
@Override
protected Properties setupProperties(String endpoint, String apiversion, String identity, String credential) {
Properties props = super.setupProperties(endpoint, apiversion, identity, credential);
props.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR);
return props;
} }
} }

View File

@ -1,30 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
$HeadURL$ $HeadURL$ $Revision$ $Date$ Copyright (C) 2010 Cloud Conscious,
$Revision$ LLC <info@cloudconscious.com>
$Date$
Copyright (C) 2010 Cloud Conscious, LLC <info@cloudconscious.com> ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or
more contributor license agreements. See the NOTICE file
distributed with this work for additional information regarding
copyright ownership. The ASF 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.html Unless required
Licensed to the Apache Software Foundation (ASF) under one by applicable law or agreed to in writing, software distributed
or more contributor license agreements. See the NOTICE file under the License is distributed on an "AS IS" BASIS, WITHOUT
distributed with this work for additional information WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
regarding copyright ownership. The ASF licenses this file See the License for the specific language governing permissions
to you under the Apache License, Version 2.0 (the and limitations under the License.
"License"); you may not use this file except in compliance ====================================================================
with the License. You may obtain a copy of the License at -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
http://www.apache.org/licenses/LICENSE-2.0.html xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
====================================================================
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.jclouds</groupId> <groupId>org.jclouds</groupId>
@ -42,8 +39,12 @@
<url>http://jclouds.googlecode.com/svn/trunk/gogrid</url> <url>http://jclouds.googlecode.com/svn/trunk/gogrid</url>
</scm> </scm>
<properties> <properties>
<jclouds.test.identity>${jclouds.gogrid.apikey}</jclouds.test.identity> <!-- when instances are hung, open a ticket and add here -->
<jclouds.test.credential>${jclouds.gogrid.secret}</jclouds.test.credential> <jclouds.compute.blacklist.nodes>trmkrun-ccc,test.trmk-924</jclouds.compute.blacklist.nodes>
<test.gogrid.endpoint>https://api.gogrid.com/api</test.gogrid.endpoint>
<test.gogrid.apiversion>1.5</test.gogrid.apiversion>
<test.gogrid.identity>FIXME</test.gogrid.identity>
<test.gogrid.credential>FIXME</test.gogrid.credential>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
@ -83,4 +84,51 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>test.gogrid.endpoint</name>
<value>${test.gogrid.endpoint}</value>
</property>
<property>
<name>test.gogrid.apiversion</name>
<value>${test.gogrid.apiversion}</value>
</property>
<property>
<name>test.gogrid.identity</name>
<value>${test.gogrid.identity}</value>
</property>
<property>
<name>test.gogrid.credential</name>
<value>${test.gogrid.credential}</value>
</property>
<property>
<name>jclouds.compute.blacklist.nodes</name>
<value>${jclouds.compute.blacklist.nodes}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -32,11 +32,13 @@ import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.jclouds.Constants;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.gogrid.domain.Ip; import org.jclouds.gogrid.domain.Ip;
import org.jclouds.gogrid.domain.IpPortPair; import org.jclouds.gogrid.domain.IpPortPair;
@ -92,14 +94,38 @@ public class GoGridLiveTest {
private List<String> loadBalancersToDeleteAfterTest = new ArrayList<String>(); private List<String> loadBalancersToDeleteAfterTest = new ArrayList<String>();
private RestContext<GoGridClient, GoGridAsyncClient> context; private RestContext<GoGridClient, GoGridAsyncClient> context;
protected String provider = "gogrid";
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
context = new RestContextFactory().createContext("gogrid", identity, credential, ImmutableSet overrides);
.<Module> of(new Log4JLoggingModule()));
client = context.getApi(); client = context.getApi();
serverLatestJobCompleted = new RetryablePredicate<Server>(new ServerLatestJobCompleted(client.getJobServices()), serverLatestJobCompleted = new RetryablePredicate<Server>(new ServerLatestJobCompleted(client.getJobServices()),

View File

@ -30,7 +30,6 @@ import org.jclouds.gogrid.GoGridAsyncClient;
import org.jclouds.gogrid.GoGridClient; import org.jclouds.gogrid.GoGridClient;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.jclouds.ssh.jsch.config.JschSshClientModule; import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@ -38,10 +37,7 @@ import org.testng.annotations.Test;
*/ */
@Test(groups = "live", enabled = true, sequential = true, testName = "gogrid.GoGridComputeServiceLiveTest") @Test(groups = "live", enabled = true, sequential = true, testName = "gogrid.GoGridComputeServiceLiveTest")
public class GoGridComputeServiceLiveTest extends BaseComputeServiceLiveTest { public class GoGridComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public GoGridComputeServiceLiveTest() {
@BeforeClass
@Override
public void setServiceDefaults() {
provider = "gogrid"; provider = "gogrid";
} }
@ -61,7 +57,7 @@ public class GoGridComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public void testAssignability() throws Exception { public void testAssignability() throws Exception {
@SuppressWarnings("unused") @SuppressWarnings("unused")
RestContext<GoGridClient, GoGridAsyncClient> goGridContext = new ComputeServiceContextFactory() RestContext<GoGridClient, GoGridAsyncClient> goGridContext = new ComputeServiceContextFactory().createContext(
.createContext(provider, identity, credential).getProviderSpecificContext(); provider, identity, credential).getProviderSpecificContext();
} }
} }

View File

@ -216,7 +216,7 @@
<jclouds.wire.httpstream.url>http://apache.opensourceresources.org/commons/logging/binaries/commons-logging-1.1.1-bin.tar.gz</jclouds.wire.httpstream.url> <jclouds.wire.httpstream.url>http://apache.opensourceresources.org/commons/logging/binaries/commons-logging-1.1.1-bin.tar.gz</jclouds.wire.httpstream.url>
<jclouds.wire.httpstream.md5>e5de09672af9b386c30a311654d8541a</jclouds.wire.httpstream.md5> <jclouds.wire.httpstream.md5>e5de09672af9b386c30a311654d8541a</jclouds.wire.httpstream.md5>
<jclouds.test.listener>org.jclouds.test.testng.UnitTestStatusListener</jclouds.test.listener> <jclouds.test.listener>org.jclouds.test.testng.UnitTestStatusListener</jclouds.test.listener>
<jclouds.test.ssh.keyfile /> <test.ssh.keyfile />
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -352,8 +352,8 @@
</properties> </properties>
<systemProperties> <systemProperties>
<property> <property>
<name>jclouds.test.initializer</name> <name>test.initializer</name>
<value>${jclouds.test.initializer}</value> <value>${test.initializer}</value>
</property> </property>
<property> <property>
<name>jclouds.wire.httpstream.url</name> <name>jclouds.wire.httpstream.url</name>
@ -565,32 +565,12 @@ pageTracker._trackPageview();
<value>${project.build.sourceEncoding}</value> <value>${project.build.sourceEncoding}</value>
</property> </property>
<property> <property>
<name>jclouds.test.initializer</name> <name>test.initializer</name>
<value>${jclouds.test.initializer}</value> <value>${test.initializer}</value>
</property> </property>
<property> <property>
<name>jclouds.test.identity</name> <name>test.ssh.keyfile</name>
<value>${jclouds.test.identity}</value> <value>${test.ssh.keyfile}</value>
</property>
<property>
<name>jclouds.test.credential</name>
<value>${jclouds.test.credential}</value>
</property>
<property>
<name>jclouds.test.endpoint</name>
<value>${jclouds.test.endpoint}</value>
</property>
<property>
<name>jclouds.test.appname</name>
<value>${jclouds.test.appname}</value>
</property>
<property>
<name>jclouds.test.appid</name>
<value>${jclouds.test.appid}</value>
</property>
<property>
<name>jclouds.test.ssh.keyfile</name>
<value>${jclouds.test.ssh.keyfile}</value>
</property> </property>
<property> <property>
<name>jclouds.blobstore.httpstream.url</name> <name>jclouds.blobstore.httpstream.url</name>

View File

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> Copyright (C) 2010 Cloud Conscious, LLC.
<info@cloudconscious.com>
==================================================================== ====================================================================
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 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.
====================================================================
-->
Unless required by applicable law or agreed to in writing, software <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
distributed under the License is distributed on an "AS IS" BASIS, xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
====================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.jclouds</groupId> <groupId>org.jclouds</groupId>
@ -30,11 +30,26 @@
</parent> </parent>
<artifactId>jclouds-rackspace</artifactId> <artifactId>jclouds-rackspace</artifactId>
<name>jclouds rackspace components</name> <name>jclouds rackspace components</name>
<properties> <properties>
<jclouds.test.identity>${jclouds.rackspace.user}</jclouds.test.identity> <test.rackspace.endpoint>https://auth.api.rackspacecloud.com</test.rackspace.endpoint>
<jclouds.test.credential>${jclouds.rackspace.key}</jclouds.test.credential> <test.rackspace.apiversion>1.0</test.rackspace.apiversion>
<jclouds.test.initializer>org.jclouds.rackspace.cloudfiles.blobstore.integration.CloudFilesTestInitializer</jclouds.test.initializer> <test.rackspace.identity>FIXME</test.rackspace.identity>
<test.rackspace.credential>FIXME</test.rackspace.credential>
<test.initializer>org.jclouds.rackspace.cloudfiles.blobstore.integration.CloudFilesTestInitializer</test.initializer>
<!-- when instances are hung, open a ticket and add here -->
<jclouds.compute.blacklist.nodes>trmkrun-ccc,test.trmk-924</jclouds.compute.blacklist.nodes>
<test.cloudfiles.endpoint>${test.rackspace.endpoint}</test.cloudfiles.endpoint>
<test.cloudfiles.apiversion>${test.rackspace.apiversion}</test.cloudfiles.apiversion>
<test.cloudfiles.identity>${test.rackspace.identity}</test.cloudfiles.identity>
<test.cloudfiles.credential>${test.rackspace.credential}</test.cloudfiles.credential>
<test.cloudservers.endpoint>${test.rackspace.endpoint}</test.cloudservers.endpoint>
<test.cloudservers.apiversion>${test.rackspace.apiversion}</test.cloudservers.apiversion>
<test.cloudservers.identity>${test.rackspace.identity}</test.cloudservers.identity>
<test.cloudservers.credential>${test.rackspace.credential}</test.cloudservers.credential>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
@ -68,10 +83,10 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
<version>1.2.14</version> <version>1.2.14</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
@ -86,5 +101,71 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>test.cloudfiles.endpoint</name>
<value>${test.cloudfiles.endpoint}</value>
</property>
<property>
<name>test.cloudfiles.apiversion</name>
<value>${test.cloudfiles.apiversion}</value>
</property>
<property>
<name>test.cloudfiles.identity</name>
<value>${test.cloudfiles.identity}</value>
</property>
<property>
<name>test.cloudfiles.credential</name>
<value>${test.cloudfiles.credential}</value>
</property>
<property>
<name>test.cloudservers.endpoint</name>
<value>${test.cloudservers.endpoint}</value>
</property>
<property>
<name>test.cloudservers.apiversion</name>
<value>${test.cloudservers.apiversion}</value>
</property>
<property>
<name>test.cloudservers.identity</name>
<value>${test.cloudservers.identity}</value>
</property>
<property>
<name>test.cloudservers.credential</name>
<value>${test.cloudservers.credential}</value>
</property>
<property>
<name>jclouds.compute.blacklist.nodes</name>
<value>${jclouds.compute.blacklist.nodes}</value>
</property>
<property>
<name>test.initializer</name>
<value>${test.initializer}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -34,7 +34,7 @@ import org.jclouds.rackspace.RackspaceAuthAsyncClient.AuthenticationResponse;
import org.jclouds.rest.AuthorizationException; import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextFactory.ContextSpec; import org.jclouds.rest.RestContextFactory.ContextSpec;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -55,8 +55,6 @@ public class RackspaceAuthenticationLiveTest {
} }
private RestContext<RackspaceAuthClient, RackspaceAuthAsyncClient> context; private RestContext<RackspaceAuthClient, RackspaceAuthAsyncClient> context;
private String identity;
private String credential;
@Test @Test
public void testAuthentication() throws Exception { public void testAuthentication() throws Exception {
@ -75,14 +73,27 @@ public class RackspaceAuthenticationLiveTest {
authentication.authenticate("foo", "bar").get(10, TimeUnit.SECONDS); authentication.authenticate("foo", "bar").get(10, TimeUnit.SECONDS);
} }
@BeforeClass protected String provider = "rackspace";
void setupFactory() { protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); protected void setupCredentials() {
credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); 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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
ContextSpec<RackspaceAuthClient, RackspaceAuthAsyncClient> contextSpec = contextSpec("test", @BeforeGroups(groups = { "live" })
"https://api.mosso.com", "1", null, null, RackspaceAuthClient.class, RackspaceAuthAsyncClient.class); public void setupFactory() {
setupCredentials();
ContextSpec<RackspaceAuthClient, RackspaceAuthAsyncClient> contextSpec = contextSpec(endpoint, endpoint,
apiversion, null, null, RackspaceAuthClient.class, RackspaceAuthAsyncClient.class);
context = createContextBuilder( context = createContextBuilder(
contextSpec, contextSpec,

View File

@ -20,7 +20,6 @@
package org.jclouds.rackspace.cloudfiles.blobstore.integration; package org.jclouds.rackspace.cloudfiles.blobstore.integration;
import java.io.IOException; import java.io.IOException;
import java.util.Properties;
import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory; import org.jclouds.blobstore.BlobStoreContextFactory;
@ -36,12 +35,15 @@ import com.google.inject.Module;
*/ */
public class CloudFilesTestInitializer extends TransientBlobStoreTestInitializer { public class CloudFilesTestInitializer extends TransientBlobStoreTestInitializer {
public CloudFilesTestInitializer() {
provider = "cloudfiles";
}
@Override @Override
protected BlobStoreContext createLiveContext(Module configurationModule, String url, String app, protected BlobStoreContext createLiveContext(Module configurationModule, String endpoint, String apiversion,
String identity, String key) throws IOException { String app, String identity, String credential) throws IOException {
return (BlobStoreContext) new BlobStoreContextFactory().createContext("cloudfiles", identity, return new BlobStoreContextFactory().createContext(provider, ImmutableSet.of(configurationModule,
key, ImmutableSet.of(configurationModule, new Log4JLoggingModule()), new Log4JLoggingModule()), setupProperties(endpoint, apiversion, identity, credential));
new Properties());
} }
} }

View File

@ -35,6 +35,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.http.HttpResponseException; import org.jclouds.http.HttpResponseException;
import org.jclouds.io.Payload; import org.jclouds.io.Payload;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
@ -81,14 +82,39 @@ public class CloudServersClientLiveTest {
protected CloudServersClient client; protected CloudServersClient client;
protected SshClient.Factory sshFactory; protected SshClient.Factory sshFactory;
private Predicate<IPSocket> socketTester; private Predicate<IPSocket> socketTester;
protected String provider = "cloudservers";
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); Properties overrides = setupProperties();
Injector injector = new RestContextFactory().createContextBuilder("cloudservers", identity, credential, Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), new Properties()) ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides)
.buildInjector(); .buildInjector();
client = injector.getInstance(CloudServersClient.class); client = injector.getInstance(CloudServersClient.class);

View File

@ -44,9 +44,7 @@ import org.testng.annotations.Test;
*/ */
@Test(groups = "live", enabled = true, sequential = true, testName = "cloudservers.CloudServersComputeServiceLiveTest") @Test(groups = "live", enabled = true, sequential = true, testName = "cloudservers.CloudServersComputeServiceLiveTest")
public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTest { public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public CloudServersComputeServiceLiveTest() {
@Override
public void setServiceDefaults() {
provider = "cloudservers"; provider = "cloudservers";
} }
@ -77,4 +75,5 @@ public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTe
assertEquals(node.getLocation().getScope(), LocationScope.HOST); assertEquals(node.getLocation().getScope(), LocationScope.HOST);
} }
} }
} }

View File

@ -39,8 +39,11 @@
<url>http://jclouds.googlecode.com/svn/trunk/rimuhosting</url> <url>http://jclouds.googlecode.com/svn/trunk/rimuhosting</url>
</scm> </scm>
<properties> <properties>
<jclouds.test.identity>${jclouds.rimuhosting.apikey}</jclouds.test.identity> <!-- when instances are hung, open a ticket and add here -->
<jclouds.test.credential>${jclouds.rimuhosting.apikey}</jclouds.test.credential> <jclouds.compute.blacklist.nodes>trmkrun-ccc,test.trmk-924</jclouds.compute.blacklist.nodes>
<test.rimuhosting.endpoint>https://rimuhosting.com/r</test.rimuhosting.endpoint>
<test.rimuhosting.apiversion>1.0</test.rimuhosting.apiversion>
<test.rimuhosting.identity>FIXME</test.rimuhosting.identity>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
@ -81,5 +84,46 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>test.rimuhosting.endpoint</name>
<value>${test.rimuhosting.endpoint}</value>
</property>
<property>
<name>test.rimuhosting.apiversion</name>
<value>${test.rimuhosting.apiversion}</value>
</property>
<property>
<name>test.rimuhosting.identity</name>
<value>${test.rimuhosting.identity}</value>
</property>
<property>
<name>jclouds.compute.blacklist.nodes</name>
<value>${jclouds.compute.blacklist.nodes}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -24,8 +24,10 @@ 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;
import java.util.Properties;
import java.util.Set; import java.util.Set;
import org.jclouds.Constants;
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;
@ -52,11 +54,36 @@ public class RimuHostingClientLiveTest {
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 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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential"); setupCredentials();
this.context = new RestContextFactory().createContext("rimuhosting", credential, credential, ImmutableSet Properties overrides = setupProperties();
.<Module> of(new Log4JLoggingModule()));
this.context = new RestContextFactory().createContext("rimuhosting", ImmutableSet
.<Module> of(new Log4JLoggingModule()), overrides);
this.connection = context.getApi(); this.connection = context.getApi();
} }

View File

@ -34,10 +34,13 @@ import org.testng.annotations.Test;
*/ */
@Test(groups = "live", sequential = true, testName = "rimuhosting.RimuHostingNodeServiceLiveTest") @Test(groups = "live", sequential = true, testName = "rimuhosting.RimuHostingNodeServiceLiveTest")
public class RimuHostingComputeServiceLiveTest extends BaseComputeServiceLiveTest { public class RimuHostingComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public RimuHostingComputeServiceLiveTest() {
provider = "rimuhosting";
}
@BeforeClass @BeforeClass
@Override @Override
public void setServiceDefaults() { public void setServiceDefaults() {
provider = "rimuhosting";
tag = "rimuhosting.jclouds"; tag = "rimuhosting.jclouds";
} }

View File

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> Copyright (C) 2010 Cloud Conscious, LLC.
<info@cloudconscious.com>
==================================================================== ====================================================================
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 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.
====================================================================
-->
Unless required by applicable law or agreed to in writing, software <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
distributed under the License is distributed on an "AS IS" BASIS, xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
====================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.jclouds</groupId> <groupId>org.jclouds</groupId>
@ -31,8 +31,11 @@
<artifactId>jclouds-slicehost</artifactId> <artifactId>jclouds-slicehost</artifactId>
<name>jclouds slicehost components</name> <name>jclouds slicehost components</name>
<properties> <properties>
<jclouds.test.identity>${jclouds.slicehost.apikey}</jclouds.test.identity> <!-- when instances are hung, open a ticket and add here -->
<jclouds.test.credential>${jclouds.slicehost.apikey}</jclouds.test.credential> <jclouds.compute.blacklist.nodes>trmkrun-ccc,test.trmk-924</jclouds.compute.blacklist.nodes>
<test.slicehost.endpoint>https://api.slicehost.com</test.slicehost.endpoint>
<test.slicehost.apiversion>1.4.1.1</test.slicehost.apiversion>
<test.slicehost.identity>FIXME</test.slicehost.identity>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
@ -55,10 +58,10 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
<version>1.2.14</version> <version>1.2.14</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
@ -74,4 +77,47 @@
</dependency> </dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>test.slicehost.endpoint</name>
<value>${test.slicehost.endpoint}</value>
</property>
<property>
<name>test.slicehost.apiversion</name>
<value>${test.slicehost.apiversion}</value>
</property>
<property>
<name>test.slicehost.identity</name>
<value>${test.slicehost.identity}</value>
</property>
<property>
<name>jclouds.compute.blacklist.nodes</name>
<value>${jclouds.compute.blacklist.nodes}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -31,6 +31,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.http.HttpResponseException; import org.jclouds.http.HttpResponseException;
import org.jclouds.io.Payloads; import org.jclouds.io.Payloads;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
@ -59,7 +60,6 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// disabled [Web Hosting #129069
@Test(groups = "live", sequential = true, testName = "slicehost.SlicehostClientLiveTest") @Test(groups = "live", sequential = true, testName = "slicehost.SlicehostClientLiveTest")
public class SlicehostClientLiveTest { public class SlicehostClientLiveTest {
@ -67,12 +67,36 @@ public class SlicehostClientLiveTest {
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity"); setupCredentials();
Properties overrides = setupProperties();
Injector injector = new RestContextFactory().createContextBuilder("slicehost", identity, null, Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), new Properties()) ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides)
.buildInjector(); .buildInjector();
client = injector.getInstance(SlicehostClient.class); client = injector.getInstance(SlicehostClient.class);

View File

@ -30,7 +30,6 @@ import org.jclouds.rest.RestContext;
import org.jclouds.slicehost.SlicehostAsyncClient; import org.jclouds.slicehost.SlicehostAsyncClient;
import org.jclouds.slicehost.SlicehostClient; import org.jclouds.slicehost.SlicehostClient;
import org.jclouds.ssh.jsch.config.JschSshClientModule; import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
@ -41,10 +40,7 @@ import org.testng.annotations.Test;
*/ */
@Test(groups = "live", enabled = true, sequential = true, testName = "slicehost.SlicehostComputeServiceLiveTest") @Test(groups = "live", enabled = true, sequential = true, testName = "slicehost.SlicehostComputeServiceLiveTest")
public class SlicehostComputeServiceLiveTest extends BaseComputeServiceLiveTest { public class SlicehostComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public SlicehostComputeServiceLiveTest() {
@BeforeClass
@Override
public void setServiceDefaults() {
provider = "slicehost"; provider = "slicehost";
} }

View File

@ -38,7 +38,7 @@
<input <input
message="Which provider would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?" message="Which provider would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?"
validargs="ec2,cloudservers,vcloud,trmk-ecloud,trmk-vcloudexpress,eucalyptus,bluelock-vclouddirector,gogrid,rimuhosting" validargs="ec2,cloudservers,vcloud,trmk-ecloud,trmk-vcloudexpress,eucalyptus,bluelock-vcdirector,gogrid,rimuhosting"
addproperty="provider" addproperty="provider"
/> />

View File

@ -31,7 +31,7 @@
<input <input
message="Which provider would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?" message="Which provider would you like to use (ec2, cloudservers, vcloud, terremark, rimuhosting)?"
validargs="ec2,cloudservers,vcloud,trmk-ecloud,trmk-vcloudexpress,eucalyptus,bluelock-vclouddirector,gogrid,rimuhosting" validargs="ec2,cloudservers,vcloud,trmk-ecloud,trmk-vcloudexpress,eucalyptus,bluelock-vcdirector,gogrid,rimuhosting"
addproperty="provider" addproperty="provider"
/> />

View File

@ -139,11 +139,11 @@ public class SSHJavaTest {
} }
private void addDestinationTo(SSHJava javaOverSsh) throws UnknownHostException { private void addDestinationTo(SSHJava javaOverSsh) throws UnknownHostException {
String sshHost = System.getProperty("jclouds.test.ssh.host"); String sshHost = System.getProperty("test.ssh.host");
String sshPort = System.getProperty("jclouds.test.ssh.port"); String sshPort = System.getProperty("test.ssh.port");
String sshUser = System.getProperty("jclouds.test.ssh.username"); String sshUser = System.getProperty("test.ssh.username");
String sshPass = System.getProperty("jclouds.test.ssh.password"); String sshPass = System.getProperty("test.ssh.password");
String sshKeyFile = System.getProperty("jclouds.test.ssh.keyfile"); String sshKeyFile = System.getProperty("test.ssh.keyfile");
int port = (sshPort != null) ? Integer.parseInt(sshPort) : 22; int port = (sshPort != null) ? Integer.parseInt(sshPort) : 22;
InetAddress host = (sshHost != null) ? InetAddress.getByName(sshHost) : InetAddress InetAddress host = (sshHost != null) ? InetAddress.getByName(sshHost) : InetAddress

View File

@ -127,27 +127,27 @@
<configuration> <configuration>
<systemProperties> <systemProperties>
<property> <property>
<name>jclouds.test.identity.azureblob</name> <name>test.identity.azureblob</name>
<value>${jclouds.azure.storage.account}</value> <value>${jclouds.azure.storage.account}</value>
</property> </property>
<property> <property>
<name>jclouds.test.credential.azureblob</name> <name>test.credential.azureblob</name>
<value>${jclouds.azure.storage.key}</value> <value>${jclouds.azure.storage.key}</value>
</property> </property>
<property> <property>
<name>jclouds.test.identity.cloudfiles</name> <name>test.identity.cloudfiles</name>
<value>${jclouds.rackspace.user}</value> <value>${jclouds.rackspace.user}</value>
</property> </property>
<property> <property>
<name>jclouds.test.credential.cloudfiles</name> <name>test.credential.cloudfiles</name>
<value>${jclouds.rackspace.key}</value> <value>${jclouds.rackspace.key}</value>
</property> </property>
<property> <property>
<name>jclouds.test.identity.s3</name> <name>test.identity.s3</name>
<value>${jclouds.aws.accesskeyid}</value> <value>${jclouds.aws.accesskeyid}</value>
</property> </property>
<property> <property>
<name>jclouds.test.credential.s3</name> <name>test.credential.s3</name>
<value>${jclouds.aws.secretaccesskey}</value> <value>${jclouds.aws.secretaccesskey}</value>
</property> </property>
<property> <property>

View File

@ -81,11 +81,11 @@ public class GetPathLiveTest {
contexts = Sets.newLinkedHashSet(); contexts = Sets.newLinkedHashSet();
BlobStoreContextFactory factory = new BlobStoreContextFactory(); BlobStoreContextFactory factory = new BlobStoreContextFactory();
for (String provider : new String[] { "s3", "cloudfiles", "azureblob" }) { for (String provider : new String[] { "s3", "cloudfiles", "azureblob" }) {
String identity = checkNotNull(System.getProperty("jclouds.test.identity." + provider), String identity = checkNotNull(System.getProperty("test.identity." + provider),
"jclouds.test.identity." + provider); "test.identity." + provider);
String credential = checkNotNull( String credential = checkNotNull(
System.getProperty("jclouds.test.credential." + provider), System.getProperty("test.credential." + provider),
"jclouds.test.credential." + provider); "test.credential." + provider);
contexts.add(factory.createContext(provider, identity, credential, ImmutableSet contexts.add(factory.createContext(provider, identity, credential, ImmutableSet
.of(new Log4JLoggingModule()))); .of(new Log4JLoggingModule())));

View File

@ -35,10 +35,10 @@
<properties> <properties>
<!-- when instances are hung, open a ticket and add their names here --> <!-- when instances are hung, open a ticket and add their names here -->
<jclouds.compute.blacklist.nodes></jclouds.compute.blacklist.nodes> <jclouds.compute.blacklist.nodes></jclouds.compute.blacklist.nodes>
<bluelock-vcdirector.endpoint>https://vcenterprise.bluelock.com/api</bluelock-vcdirector.endpoint> <test.bluelock-vcdirector.endpoint>https://vcenterprise.bluelock.com/api</test.bluelock-vcdirector.endpoint>
<bluelock-vcdirector.apiversion>1.0</bluelock-vcdirector.apiversion> <test.bluelock-vcdirector.apiversion>1.0</test.bluelock-vcdirector.apiversion>
<bluelock-vcdirector.identity>FIXME</bluelock-vcdirector.identity> <test.bluelock-vcdirector.identity>FIXME</test.bluelock-vcdirector.identity>
<bluelock-vcdirector.credential>FIXME</bluelock-vcdirector.credential> <test.bluelock-vcdirector.credential>FIXME</test.bluelock-vcdirector.credential>
</properties> </properties>
<scm> <scm>
@ -79,20 +79,20 @@
<configuration> <configuration>
<systemProperties> <systemProperties>
<property> <property>
<name>bluelock-vcdirector.endpoint</name> <name>test.bluelock-vcdirector.endpoint</name>
<value>${bluelock-vcdirector.endpoint}</value> <value>${test.bluelock-vcdirector.endpoint}</value>
</property> </property>
<property> <property>
<name>bluelock-vcdirector.apiversion</name> <name>test.bluelock-vcdirector.apiversion</name>
<value>${bluelock-vcdirector.apiversion}</value> <value>${test.bluelock-vcdirector.apiversion}</value>
</property> </property>
<property> <property>
<name>bluelock-vcdirector.identity</name> <name>test.bluelock-vcdirector.identity</name>
<value>${bluelock-vcdirector.identity}</value> <value>${test.bluelock-vcdirector.identity}</value>
</property> </property>
<property> <property>
<name>bluelock-vcdirector.credential</name> <name>test.bluelock-vcdirector.credential</name>
<value>${bluelock-vcdirector.credential}</value> <value>${test.bluelock-vcdirector.credential}</value>
</property> </property>
<property> <property>
<name>jclouds.compute.blacklist.nodes</name> <name>jclouds.compute.blacklist.nodes</name>

View File

@ -19,19 +19,9 @@
package org.jclouds.vcloud.bluelock; package org.jclouds.vcloud.bluelock;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Properties;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.vcloud.VCloudClientLiveTest; import org.jclouds.vcloud.VCloudClientLiveTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
/** /**
* Tests behavior of {@code BlueLockVCloudClient} * Tests behavior of {@code BlueLockVCloudClient}
* *
@ -39,17 +29,8 @@ import com.google.inject.Module;
*/ */
@Test(groups = "live", sequential = true, testName = "bluelock.BlueLockVCloudDirectorClientLiveTest") @Test(groups = "live", sequential = true, testName = "bluelock.BlueLockVCloudDirectorClientLiveTest")
public class BlueLockVCloudDirectorClientLiveTest extends VCloudClientLiveTest { public class BlueLockVCloudDirectorClientLiveTest extends VCloudClientLiveTest {
public BlueLockVCloudDirectorClientLiveTest() {
@BeforeGroups(groups = { "live" }) provider = "bluelock-vcdirector";
@Override
public void setupClient() {
identity = checkNotNull(System.getProperty("bluelock-vcdirector.identity"),
"bluelock-vcdirector.identity");
String credential = checkNotNull(System.getProperty("bluelock-vcdirector.credential"),
"bluelock-vcdirector.credential");
context = new ComputeServiceContextFactory().createContext("bluelock-vcdirector", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()), new Properties()).getProviderSpecificContext();
connection = context.getApi();
} }
} }

View File

@ -19,8 +19,6 @@
package org.jclouds.vcloud.bluelock; package org.jclouds.vcloud.bluelock;
import static com.google.common.base.Preconditions.checkNotNull;
import org.jclouds.vcloud.VCloudGuestCustomizationLiveTest; import org.jclouds.vcloud.VCloudGuestCustomizationLiveTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -32,13 +30,8 @@ import org.testng.annotations.Test;
@Test(groups = "live", enabled = true, sequential = true, testName = "vcloud.BlueLockVCloudDirectorGuestCustomizationLiveTest") @Test(groups = "live", enabled = true, sequential = true, testName = "vcloud.BlueLockVCloudDirectorGuestCustomizationLiveTest")
public class BlueLockVCloudDirectorGuestCustomizationLiveTest extends VCloudGuestCustomizationLiveTest { public class BlueLockVCloudDirectorGuestCustomizationLiveTest extends VCloudGuestCustomizationLiveTest {
@Override public BlueLockVCloudDirectorGuestCustomizationLiveTest() {
protected void setupCredentials() {
provider = "bluelock-vcdirector"; provider = "bluelock-vcdirector";
identity = checkNotNull(System.getProperty("bluelock-vcdirector.identity"),
"bluelock-vcdirector.identity");
credential = checkNotNull(System.getProperty("bluelock-vcdirector.credential"),
"bluelock-vcdirector.credential");
} }
} }

View File

@ -22,11 +22,11 @@ package org.jclouds.vcloud.bluelock;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL; import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
import java.io.IOException;
import java.util.Properties; import java.util.Properties;
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.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;
@ -48,7 +48,6 @@ public class VCloudSessionRefreshLiveTest {
private final static int timeOut = 40; private final static int timeOut = 40;
protected VCloudClient connection; protected VCloudClient connection;
protected String identity;
protected ComputeServiceContext context; protected ComputeServiceContext context;
@Test @Test
@ -58,17 +57,41 @@ public class VCloudSessionRefreshLiveTest {
connection.findOrgNamed(null); connection.findOrgNamed(null);
} }
protected String provider = "bluelock-vcdirector";
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() throws IOException { public void setupClient() {
identity = checkNotNull(System.getProperty("bluelock-vcdirector.identity"), "bluelock-vcdirector.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("bluelock-vcdirector.credential"), Properties overrides = setupProperties();
"bluelock-vcdirector.credential");
Properties props = new Properties(); overrides.setProperty(PROPERTY_SESSION_INTERVAL, 40 + "");
props.setProperty(PROPERTY_SESSION_INTERVAL, 40 + "");
context = new ComputeServiceContextFactory().createContext("bluelock-vcdirector", identity, credential, context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
ImmutableSet.<Module> of(new Log4JLoggingModule()), props); .<Module> of(new Log4JLoggingModule()), overrides);
connection = VCloudClient.class.cast(context.getProviderSpecificContext().getApi()); connection = VCloudClient.class.cast(context.getProviderSpecificContext().getApi());
} }

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.bluelock.compute; package org.jclouds.vcloud.bluelock.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores; import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
@ -38,18 +37,13 @@ import org.testng.annotations.Test;
*/ */
@Test(groups = "live", enabled = true, sequential = true, testName = "bluelock.BlueLockVCloudComputeServiceLiveTest") @Test(groups = "live", enabled = true, sequential = true, testName = "bluelock.BlueLockVCloudComputeServiceLiveTest")
public class BlueLockVCloudDirectorComputeServiceLiveTest extends VCloudComputeServiceLiveTest { public class BlueLockVCloudDirectorComputeServiceLiveTest extends VCloudComputeServiceLiveTest {
@Override public BlueLockVCloudDirectorComputeServiceLiveTest() {
public void setServiceDefaults() {
provider = "bluelock-vcdirector"; provider = "bluelock-vcdirector";
tag = "director";
} }
@Override @Override
protected void setupCredentials() { public void setServiceDefaults() {
identity = checkNotNull(System.getProperty("bluelock-vcdirector.identity"), tag = "director";
"bluelock-vcdirector.identity");
credential = checkNotNull(System.getProperty("bluelock-vcdirector.credential"),
"bluelock-vcdirector.credential");
} }
@Test @Test

View File

@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com> Copyright (C) 2010 Cloud Conscious, LLC.
<info@cloudconscious.com>
==================================================================== ====================================================================
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 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.
====================================================================
-->
Unless required by applicable law or agreed to in writing, software <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
distributed under the License is distributed on an "AS IS" BASIS, xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
====================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.jclouds</groupId> <groupId>org.jclouds</groupId>
@ -31,11 +31,13 @@
<name>jclouds vcloud Components Core</name> <name>jclouds vcloud Components Core</name>
<description>jclouds Core components to access vcloud</description> <description>jclouds Core components to access vcloud</description>
<properties> <properties>
<test.identity>${jclouds.vcloud.user}</test.identity> <!-- when instances are hung, open a ticket and add here -->
<test.credential>${jclouds.vcloud.password}</test.credential> <jclouds.compute.blacklist.nodes>trmkrun-ccc,test.trmk-924</jclouds.compute.blacklist.nodes>
<test.endpoint>${jclouds.vcloud.endpoint}</test.endpoint> <test.vcloud.endpoint>https://66.45.200.97/api</test.vcloud.endpoint>
<test.vcloud.apiversion>1.0</test.vcloud.apiversion>
<test.vcloud.identity>FIXME</test.vcloud.identity>
<test.vcloud.credential>FIXME</test.vcloud.credential>
</properties> </properties>
<scm> <scm>
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/vcloud/core</connection> <connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/vcloud/core</connection>
<developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/vcloud/core</developerConnection> <developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/vcloud/core</developerConnection>
@ -55,4 +57,51 @@
</dependency> </dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemProperties>
<property>
<name>test.vcloud.endpoint</name>
<value>${test.vcloud.endpoint}</value>
</property>
<property>
<name>test.vcloud.apiversion</name>
<value>${test.vcloud.apiversion}</value>
</property>
<property>
<name>test.vcloud.identity</name>
<value>${test.vcloud.identity}</value>
</property>
<property>
<name>test.vcloud.credential</name>
<value>${test.vcloud.credential}</value>
</property>
<property>
<name>jclouds.compute.blacklist.nodes</name>
<value>${jclouds.compute.blacklist.nodes}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -69,8 +69,9 @@ public class Utils {
errorCode = 500; errorCode = 500;
vendorSpecificErrorCode = attributes.get("majorErrorCode"); vendorSpecificErrorCode = attributes.get("majorErrorCode");
} }
MinorCode minorErrorCode = MinorCode.fromValue(attributes.get("minorErrorCode")); MinorCode minorErrorCode = attributes.containsKey("minorErrorCode") ? MinorCode.fromValue(attributes
if (minorErrorCode == MinorCode.UNRECOGNIZED) { .get("minorErrorCode")) : null;
if (minorErrorCode == null || minorErrorCode == MinorCode.UNRECOGNIZED) {
vendorSpecificErrorCode = attributes.get("minorErrorCode"); vendorSpecificErrorCode = attributes.get("minorErrorCode");
} }

View File

@ -49,26 +49,42 @@ import com.google.inject.Module;
@Test(groups = "live", enabled = true, sequential = true, testName = "vcloud.CaptureVAppLiveTest") @Test(groups = "live", enabled = true, sequential = true, testName = "vcloud.CaptureVAppLiveTest")
public class CaptureVAppLiveTest { public class CaptureVAppLiveTest {
protected String identity;
protected String provider;
protected String credential;
protected ComputeService client; protected ComputeService client;
protected String tag = System.getProperty("user.name") + "cap"; protected String tag = System.getProperty("user.name") + "cap";
protected String provider = "vcloud";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
protected void setupCredentials() { protected void setupCredentials() {
provider = "vcloud"; identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
identity = checkNotNull(System.getProperty("vcloud.identity"), "vcloud.identity"); credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
credential = checkNotNull(System.getProperty("vcloud.credential"), "vcloud.credential"); + ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
} }
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();
Properties props = new Properties(); Properties overrides = setupProperties();
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); client = new ComputeServiceContextFactory().createContext(provider,
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getComputeService();
client = new ComputeServiceContextFactory().createContext(provider, identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule()), props).getComputeService();
} }
@Test @Test

View File

@ -19,6 +19,7 @@
package org.jclouds.vcloud; package org.jclouds.vcloud;
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;
@ -50,10 +51,7 @@ import com.google.inject.Module;
public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A extends CommonVCloudAsyncClient> { public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A extends CommonVCloudAsyncClient> {
protected S connection; protected S connection;
protected String provider;
protected String identity;
protected RestContext<S, A> context; protected RestContext<S, A> context;
protected String credential;
@Test @Test
public void testOrg() throws Exception { public void testOrg() throws Exception {
@ -176,16 +174,38 @@ public abstract class CommonVCloudClientLiveTest<S extends CommonVCloudClient, A
} }
} }
protected abstract void setupCredentials(); protected String provider = "vcloud";
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();
Properties props = new Properties(); Properties overrides = setupProperties();
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); context = new ComputeServiceContextFactory().createContext(provider,
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getProviderSpecificContext();
context = new ComputeServiceContextFactory().createContext(provider, identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule()), props).getProviderSpecificContext();
connection = context.getApi(); connection = context.getApi();
} }

View File

@ -37,14 +37,12 @@ public class ProvidersInPropertiesTest {
public void testSupportedProviders() { public void testSupportedProviders() {
Iterable<String> providers = Utils.getSupportedProviders(); Iterable<String> providers = Utils.getSupportedProviders();
assert Iterables.contains(providers, "vcloud") : providers; assert Iterables.contains(providers, "vcloud") : providers;
assert Iterables.contains(providers, "vcloudexpress") : providers;
} }
@Test @Test
public void testSupportedComputeServiceProviders() { public void testSupportedComputeServiceProviders() {
Iterable<String> providers = ComputeServiceUtils.getSupportedProviders(); Iterable<String> providers = ComputeServiceUtils.getSupportedProviders();
assert Iterables.contains(providers, "vcloud") : providers; assert Iterables.contains(providers, "vcloud") : providers;
assert Iterables.contains(providers, "vcloudexpress") : providers;
} }
} }

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud; package org.jclouds.vcloud;
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;
@ -41,12 +40,6 @@ import org.testng.annotations.Test;
@Test(groups = "live", sequential = true, testName = "vcloud.VCloudClientLiveTest") @Test(groups = "live", sequential = true, testName = "vcloud.VCloudClientLiveTest")
public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClient, VCloudAsyncClient> { public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClient, VCloudAsyncClient> {
protected void setupCredentials() {
provider = "vcloud";
identity = checkNotNull(System.getProperty("vcloud.identity"), "vcloud.identity");
credential = checkNotNull(System.getProperty("vcloud.credential"), "vcloud.credential");
}
@Test @Test
public void testListOrgs() throws Exception { public void testListOrgs() throws Exception {
for (ReferenceType response : connection.listOrgs().values()) { for (ReferenceType response : connection.listOrgs().values()) {

View File

@ -19,13 +19,12 @@
package org.jclouds.vcloud; package org.jclouds.vcloud;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem; import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.Org;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.VCloudExpressVApp; import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VDC; import org.jclouds.vcloud.domain.VDC;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -36,14 +35,9 @@ import org.testng.annotations.Test;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", sequential = true, testName = "vcloud.VCloudClientLiveTest") @Test(groups = "live", sequential = true, testName = "vcloud.VCloudClientLiveTest")
public class VCloudExpressClientLiveTest extends public abstract class VCloudExpressClientLiveTest extends
CommonVCloudClientLiveTest<VCloudExpressClient, VCloudExpressAsyncClient> { CommonVCloudClientLiveTest<VCloudExpressClient, VCloudExpressAsyncClient> {
protected void setupCredentials() {
provider = "vcloudexpress";
identity = checkNotNull(System.getProperty("vcloudexpress.identity"), "vcloudexpress.identity");
credential = checkNotNull(System.getProperty("vcloudexpress.credential"), "vcloudexpress.credential");
}
@Test @Test
public void testGetVAppTemplate() throws Exception { public void testGetVAppTemplate() throws Exception {
Org org = connection.findOrgNamed(null); Org org = connection.findOrgNamed(null);
@ -88,7 +82,7 @@ public class VCloudExpressClientLiveTest extends
CatalogItem item = connection.getCatalogItem(resource.getHref()); CatalogItem item = connection.getCatalogItem(resource.getHref());
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) { if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
assertNotNull(connection.findVAppTemplateInOrgCatalogNamed(org.getName(), response.getName(), item assertNotNull(connection.findVAppTemplateInOrgCatalogNamed(org.getName(), response.getName(), item
.getEntity().getName())); .getEntity().getName()));
} }
} }
} }

View File

@ -60,28 +60,44 @@ public class VCloudGuestCustomizationLiveTest {
public static final String PARSE_VMTOOLSD = "vmtoolsd --cmd=\"info-get guestinfo.ovfenv\" |grep vCloud_CustomizationInfo|sed 's/.*value=\"\\(.*\\)\".*/\\1/g'|base64 -d"; public static final String PARSE_VMTOOLSD = "vmtoolsd --cmd=\"info-get guestinfo.ovfenv\" |grep vCloud_CustomizationInfo|sed 's/.*value=\"\\(.*\\)\".*/\\1/g'|base64 -d";
protected String identity;
protected String provider;
protected String credential;
protected ComputeServiceContext context; protected ComputeServiceContext context;
protected ComputeService client; protected ComputeService client;
protected RetryablePredicate<IPSocket> socketTester; protected RetryablePredicate<IPSocket> socketTester;
protected Factory sshFactory; protected Factory sshFactory;
protected String provider = "vcloud";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
protected void setupCredentials() { protected void setupCredentials() {
provider = "vcloud"; identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
identity = checkNotNull(System.getProperty("vcloud.identity"), "vcloud.identity"); credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
credential = checkNotNull(System.getProperty("vcloud.credential"), "vcloud.credential"); + ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
} }
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();
Properties props = new Properties(); Properties overrides = setupProperties();
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); client = new ComputeServiceContextFactory().createContext(provider,
client = new ComputeServiceContextFactory().createContext(provider, identity, credential, ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getComputeService();
ImmutableSet.<Module> of(new Log4JLoggingModule()), props).getComputeService();
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 60, 1, TimeUnit.SECONDS); socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 60, 1, TimeUnit.SECONDS);
sshFactory = Guice.createInjector(getSshModule()).getInstance(Factory.class); sshFactory = Guice.createInjector(getSshModule()).getInstance(Factory.class);
} }

View File

@ -25,16 +25,18 @@ import static org.testng.Assert.assertEquals;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URI; import java.net.URI;
import java.util.concurrent.TimeUnit;
import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.HttpHeaders;
import org.jclouds.concurrent.Timeout;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.filters.BasicAuthentication; import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.RestClientTest; import org.jclouds.rest.RestClientTest;
import org.jclouds.rest.RestContextFactory.ContextSpec; import org.jclouds.rest.RestContextFactory.ContextSpec;
import org.jclouds.rest.annotations.Provider; import org.jclouds.rest.annotations.Provider;
import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.jclouds.vcloud.VCloudLoginLiveTest.VCloudLoginClient; import org.jclouds.vcloud.domain.VCloudSession;
import org.jclouds.vcloud.endpoints.VCloudLogin; import org.jclouds.vcloud.endpoints.VCloudLogin;
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders; import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -99,6 +101,12 @@ public class VCloudLoginAsyncClientTest extends RestClientTest<VCloudExpressLogi
}; };
} }
@Timeout(duration = 10, timeUnit = TimeUnit.SECONDS)
public interface VCloudLoginClient {
VCloudSession login();
}
@Override @Override
public ContextSpec<VCloudLoginClient, VCloudExpressLoginAsyncClient> createContextSpec() { public ContextSpec<VCloudLoginClient, VCloudExpressLoginAsyncClient> createContextSpec() {

View File

@ -1,106 +0,0 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.rest.RestContextFactory.contextSpec;
import static org.jclouds.rest.RestContextFactory.createContextBuilder;
import static org.testng.Assert.assertNotNull;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.MoreExecutors;
import org.jclouds.concurrent.Timeout;
import org.jclouds.concurrent.config.ExecutorServiceModule;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextFactory.ContextSpec;
import org.jclouds.rest.annotations.Provider;
import org.jclouds.vcloud.domain.VCloudSession;
import org.jclouds.vcloud.endpoints.VCloudLogin;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.Provides;
import domain.VCloudExpressLoginAsyncClient;
/**
* Tests behavior of {@code VCloudLogin}
*
* @author Adrian Cole
*/
@Test(groups = "live", testName = "vcloud.VCloudLoginLiveTest")
public class VCloudLoginLiveTest {
private RestContext<VCloudLoginClient, VCloudExpressLoginAsyncClient> context;
@Test
public void testLogin() throws Exception {
VCloudExpressLoginAsyncClient authentication = context.getAsyncApi();
for (int i = 0; i < 5; i++) {
VCloudSession response = authentication.login().get(45, TimeUnit.SECONDS);
assertNotNull(response);
assertNotNull(response.getVCloudToken());
assertNotNull(response.getOrgs());
}
}
@Timeout(duration = 10, timeUnit = TimeUnit.SECONDS)
public interface VCloudLoginClient {
VCloudSession login();
}
@BeforeClass
void setupFactory() {
String endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint")
+ "/v0.8/login";
String identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
String credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider + ".credential");
ContextSpec<VCloudLoginClient, VCloudExpressLoginAsyncClient> contextSpec = contextSpec("test", endpoint, "1", identity,
credential, VCloudLoginClient.class, VCloudExpressLoginAsyncClient.class);
context = createContextBuilder(
contextSpec,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new ExecutorServiceModule(MoreExecutors
.sameThreadExecutor(), MoreExecutors.sameThreadExecutor()), new AbstractModule() {
@Override
protected void configure() {
}
@SuppressWarnings("unused")
@Provides
@VCloudLogin
URI provideURI(@Provider URI uri) {
return uri;
}
})).buildContext();
}
}

View File

@ -24,13 +24,16 @@ import static org.testng.Assert.assertEquals;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URI;
import java.util.SortedMap;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.jclouds.rest.RestClientTest; import org.jclouds.rest.RestClientTest;
import org.jclouds.rest.RestContextFactory.ContextSpec; import org.jclouds.rest.RestContextFactory.ContextSpec;
import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.jclouds.vcloud.VCloudVersionsLiveTest.VCloudVersionsClient;
import org.jclouds.vcloud.xml.SupportedVersionsHandler; import org.jclouds.vcloud.xml.SupportedVersionsHandler;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -72,10 +75,16 @@ public class VCloudVersionsAsyncClientTest extends RestClientTest<VCloudVersions
}; };
} }
@Timeout(duration = 10, timeUnit = TimeUnit.SECONDS)
public interface VCloudVersionsClient {
SortedMap<String, URI> getSupportedVersions();
}
@Override @Override
public ContextSpec<VCloudVersionsClient, VCloudVersionsAsyncClient> createContextSpec() { public ContextSpec<VCloudVersionsClient, VCloudVersionsAsyncClient> createContextSpec() {
return contextSpec("test", "http://localhost:8080", "1", "identity", "credential", VCloudVersionsClient.class, return contextSpec("test", "http://localhost:8080", "1", "identity", "credential", VCloudVersionsClient.class,
VCloudVersionsAsyncClient.class); VCloudVersionsAsyncClient.class);
} }
} }

View File

@ -1,84 +0,0 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.rest.RestContextFactory.contextSpec;
import static org.jclouds.rest.RestContextFactory.createContextBuilder;
import static org.testng.Assert.assertNotNull;
import java.net.URI;
import java.util.SortedMap;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.MoreExecutors;
import org.jclouds.concurrent.Timeout;
import org.jclouds.concurrent.config.ExecutorServiceModule;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextFactory.ContextSpec;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
import domain.VCloudVersionsAsyncClient;
/**
* Tests behavior of {@code VCloudVersions}
*
* @author Adrian Cole
*/
@Test(groups = "live", testName = "vcloud.VCloudVersionsLiveTest")
public class VCloudVersionsLiveTest {
@Timeout(duration = 10, timeUnit = TimeUnit.SECONDS)
public interface VCloudVersionsClient {
SortedMap<String, URI> getSupportedVersions();
}
private RestContext<VCloudVersionsClient, VCloudVersionsAsyncClient> context;
@Test
public void testGetSupportedVersions() throws Exception {
VCloudVersionsAsyncClient authentication = context.getAsyncApi();
for (int i = 0; i < 5; i++) {
SortedMap<String, URI> response = authentication.getSupportedVersions().get(45, TimeUnit.SECONDS);
assertNotNull(response);
assertNotNull(response.containsKey("0.8"));
}
}
@BeforeClass
void setupFactory() {
String endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
String identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
String credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider + ".credential");
ContextSpec<VCloudVersionsClient, VCloudVersionsAsyncClient> contextSpec = contextSpec("test", endpoint, "1",
identity, credential, VCloudVersionsClient.class, VCloudVersionsAsyncClient.class);
context = createContextBuilder(
contextSpec,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new ExecutorServiceModule(MoreExecutors
.sameThreadExecutor(), MoreExecutors.sameThreadExecutor()))).buildContext();
}
}

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.compute; package org.jclouds.vcloud.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.BaseComputeServiceLiveTest; import org.jclouds.compute.BaseComputeServiceLiveTest;
@ -41,17 +40,10 @@ import org.testng.annotations.Test;
@Test(groups = "live", enabled = true, sequential = true, testName = "vcloud.VCloudComputeServiceLiveTest") @Test(groups = "live", enabled = true, sequential = true, testName = "vcloud.VCloudComputeServiceLiveTest")
public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest { public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@Override public VCloudComputeServiceLiveTest() {
public void setServiceDefaults() {
provider = "vcloud"; provider = "vcloud";
} }
@Override
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("vcloud.identity"), "vcloud.identity");
credential = checkNotNull(System.getProperty("vcloud.credential"), "vcloud.credential");
}
@Override @Override
protected JschSshClientModule getSshModule() { protected JschSshClientModule getSshModule() {
return new JschSshClientModule(); return new JschSshClientModule();

View File

@ -1,163 +0,0 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.filter;
import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.processorCount;
import static org.jclouds.vcloud.predicates.VCloudPredicates.resourceType;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.net.URI;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.vcloud.VCloudExpressClient;
import org.jclouds.vcloud.domain.Status;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate;
import org.jclouds.vcloud.domain.ovf.ResourceType;
import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.base.CaseFormat;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
import com.google.inject.TypeLiteral;
/**
* Tests behavior of {@code VCloudClient}
*
* @author Adrian Cole
*/
@Test(groups = "live", enabled = true, sequential = true, testName = "vcloud.VCloudClientLiveTest")
public class VCloudExpressComputeClientLiveTest {
protected String provider;
protected VCloudExpressComputeClient computeClient;
protected VCloudExpressClient client;
protected URI id;
protected String publicAddress;
protected String templateName;
public static class Expectation {
final long hardDisk;
final String os;
public Expectation(long hardDisk, String os) {
this.hardDisk = hardDisk;
this.os = os;
}
}
protected Map<OsFamily, Expectation> expectationMap;
protected Predicate<String> addressTester;
private String identity;
private String credential;
@Test(enabled = true)
public void testPowerOn() throws InterruptedException, ExecutionException, TimeoutException, IOException {
OsFamily toTest = OsFamily.CENTOS;
String serverName = getCompatibleServerName(toTest);
int processorCount = 1;
int memory = 512;
VCloudExpressVAppTemplate template = client.findVAppTemplateInOrgCatalogNamed(null, null, templateName);
InstantiateVAppTemplateOptions options = processorCount(1).memory(512).disk(10 * 1025 * 1024);
id = URI.create(computeClient.start(null, template.getHref(), templateName, options).get("id"));
Expectation expectation = expectationMap.get(toTest);
VCloudExpressVApp vApp = client.getVApp(id);
verifyConfigurationOfVApp(vApp, serverName, expectation.os, processorCount, memory, expectation.hardDisk);
assertEquals(vApp.getStatus(), Status.ON);
}
private String getCompatibleServerName(OsFamily toTest) {
String serverName = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, toTest.toString()).substring(0,
toTest.toString().length() <= 15 ? toTest.toString().length() : 14);
return serverName;
}
@Test(dependsOnMethods = "testPowerOn", enabled = true)
public void testGetPublicAddresses() {
publicAddress = Iterables.getLast(computeClient.getPublicAddresses(id));
assert !addressTester.apply(publicAddress);
}
private void verifyConfigurationOfVApp(VCloudExpressVApp vApp, String serverName, String expectedOs,
int processorCount, int memory, long hardDisk) {
// assertEquals(vApp.getName(), serverName);
// assertEquals(vApp.getOperatingSystemDescription(), expectedOs);
assertEquals(Iterables
.getOnlyElement(filter(vApp.getResourceAllocations(), resourceType(ResourceType.PROCESSOR)))
.getVirtualQuantity(), processorCount);
assertEquals(Iterables.getOnlyElement(
filter(vApp.getResourceAllocations(), resourceType(ResourceType.SCSI_CONTROLLER))).getVirtualQuantity(),
1);
assertEquals(Iterables.getOnlyElement(filter(vApp.getResourceAllocations(), resourceType(ResourceType.MEMORY)))
.getVirtualQuantity(), memory);
assertEquals(Iterables.getOnlyElement(
filter(vApp.getResourceAllocations(), resourceType(ResourceType.DISK_DRIVE))).getVirtualQuantity(),
hardDisk);
}
@AfterTest
void cleanup() throws InterruptedException, ExecutionException, TimeoutException {
if (id != null)
computeClient.stop(id);
}
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("vcloudexpress.identity"), "vcloudexpress.identity");
credential = checkNotNull(System.getProperty("vcloudexpress.credential"), "vcloudexpress.credential");
}
@BeforeGroups(groups = { "live" })
public void setupClient() {
setupCredentials();
Injector injector = new RestContextFactory().createContextBuilder("vcloudexpress", identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule())).buildInjector();
computeClient = injector.getInstance(VCloudExpressComputeClient.class);
client = injector.getInstance(VCloudExpressClient.class);
addressTester = injector.getInstance(Key.get(new TypeLiteral<Predicate<String>>() {
}));
expectationMap = ImmutableMap.<OsFamily, Expectation> builder().put(OsFamily.CENTOS,
new Expectation(4194304 / 2 * 10, "Red Hat Enterprise Linux 5 (64-bit)")).build();
provider = "vcloudtest";
templateName = "Ubuntu JeOS 9.10 (32-bit)";
}
}

View File

@ -1,77 +0,0 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals;
import org.jclouds.compute.BaseComputeServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.ComputeType;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.rest.RestContext;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.jclouds.vcloud.VCloudExpressAsyncClient;
import org.jclouds.vcloud.VCloudExpressClient;
import org.testng.annotations.Test;
/**
*
*
* @author Adrian Cole
*/
@Test(groups = "live", enabled = true, sequential = true, testName = "vcloud.VCloudExpressComputeServiceLiveTest")
public class VCloudExpressComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@Override
public void setServiceDefaults() {
provider = "vcloudexpress";
}
@Override
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("vcloudexpress.identity"), "vcloudexpress.identity");
credential = checkNotNull(System.getProperty("vcloudexpress.credential"), "vcloudexpress.credential");
}
@Override
protected JschSshClientModule getSshModule() {
return new JschSshClientModule();
}
public void testAssignability() throws Exception {
@SuppressWarnings("unused")
RestContext<VCloudExpressClient, VCloudExpressAsyncClient> tmContext = new ComputeServiceContextFactory()
.createContext(provider, identity, credential).getProviderSpecificContext();
}
@Override
public void testListNodes() throws Exception {
for (ComputeMetadata node : client.listNodes()) {
assert node.getProviderId() != null;
assert node.getLocation() != null;
assertEquals(node.getType(), ComputeType.NODE);
NodeMetadata allData = client.getNodeMetadata(node.getId());
System.out.println(allData.getHardware());
}
}
}

View File

@ -22,10 +22,12 @@ package org.jclouds.vcloud.terremark;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
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.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;
@ -77,7 +79,8 @@ public class InternetServiceLiveTest {
@Test @Test
public void testGetAllPublicIps() throws Exception { public void testGetAllPublicIps() throws Exception {
for (PublicIpAddress ip : tmClient.getPublicIpsAssociatedWithVDC(tmClient.findVDCInOrgNamed(null, null).getHref())) { for (PublicIpAddress ip : tmClient
.getPublicIpsAssociatedWithVDC(tmClient.findVDCInOrgNamed(null, null).getHref())) {
tmClient.getInternetServicesOnPublicIp(ip.getId()); tmClient.getInternetServicesOnPublicIp(ip.getId());
} }
} }
@ -87,13 +90,40 @@ 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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
String identity = checkNotNull(System.getProperty("trmk-vcloudexpress.identity"), "trmk-vcloudexpress.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("trmk-vcloudexpress.credential"), "trmk-vcloudexpress.credential"); Properties overrides = setupProperties();
context = new ComputeServiceContextFactory().createContext("trmk-vcloudexpress", identity, credential, ImmutableSet context = new ComputeServiceContextFactory().createContext(provider,
.<Module> of(new Log4JLoggingModule(), new JschSshClientModule())).getProviderSpecificContext(); ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides)
.getProviderSpecificContext();
tmClient = context.getApi(); tmClient = context.getApi();

View File

@ -19,6 +19,7 @@
package org.jclouds.vcloud.terremark; package org.jclouds.vcloud.terremark;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.filter; import static com.google.common.collect.Iterables.filter;
import static com.google.common.collect.Iterables.find; import static com.google.common.collect.Iterables.find;
import static com.google.common.collect.Iterables.size; import static com.google.common.collect.Iterables.size;
@ -33,10 +34,12 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.concurrent.ExecutionException; 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.http.HttpResponseException; import org.jclouds.http.HttpResponseException;
import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.net.IPSocket; import org.jclouds.net.IPSocket;
@ -87,7 +90,6 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
super.testCatalog(); super.testCatalog();
} }
protected String provider = "trmk-vcloudexpress";
protected String expectedOs = "Ubuntu Linux (32-bit)"; protected String expectedOs = "Ubuntu Linux (32-bit)";
protected String itemName = "Ubuntu JeOS 9.10 (32-bit)"; protected String itemName = "Ubuntu JeOS 9.10 (32-bit)";
@ -101,7 +103,6 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
private RetryablePredicate<URI> successTester; private RetryablePredicate<URI> successTester;
private VCloudExpressVApp clone; private VCloudExpressVApp clone;
private VDC vdc; private VDC vdc;
protected String credential;
public static final String PREFIX = System.getProperty("user.name") + "-terremark"; public static final String PREFIX = System.getProperty("user.name") + "-terremark";
@Test @Test
@ -427,13 +428,39 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
} }
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
@Override
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();
Properties overrides = setupProperties();
Injector injector = new RestContextFactory().createContextBuilder(provider, identity, credential, Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule())).buildInjector(); ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()),overrides).buildInjector();
connection = tmClient = injector.getInstance(TerremarkVCloudClient.class); connection = tmClient = injector.getInstance(TerremarkVCloudClient.class);
@ -447,6 +474,4 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
successTester = new RetryablePredicate<URI>(injector.getInstance(TaskSuccess.class), 650, 10, TimeUnit.SECONDS); successTester = new RetryablePredicate<URI>(injector.getInstance(TaskSuccess.class), 650, 10, TimeUnit.SECONDS);
} }
protected abstract void setupCredentials();
} }

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.terremark; package org.jclouds.vcloud.terremark;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions.Builder.processorCount; import static org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions.Builder.processorCount;
import org.jclouds.net.IPSocket; import org.jclouds.net.IPSocket;
@ -46,12 +45,6 @@ public class TerremarkECloudClientLiveTest extends TerremarkClientLiveTest {
return processorCount(1).memory(512); return processorCount(1).memory(512);
} }
@Override
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("trmk-ecloud.identity"), "trmk-ecloud.identity");
credential = checkNotNull(System.getProperty("trmk-ecloud.credential"), "trmk-ecloud.credential");
}
@Override @Override
protected SshClient getConnectionFor(IPSocket socket) { protected SshClient getConnectionFor(IPSocket socket) {
return sshFactory.create(socket, "ecloud", "$Ep455l0ud!2"); return sshFactory.create(socket, "ecloud", "$Ep455l0ud!2");

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.terremark; package org.jclouds.vcloud.terremark;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions.Builder.processorCount; import static org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions.Builder.processorCount;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@ -43,11 +42,6 @@ import org.testng.annotations.Test;
*/ */
@Test(groups = "live", sequential = true, testName = "vcloud.TerremarkVCloudClientLiveTest") @Test(groups = "live", sequential = true, testName = "vcloud.TerremarkVCloudClientLiveTest")
public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTest { public class TerremarkVCloudExpressClientLiveTest extends TerremarkClientLiveTest {
@Override
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("trmk-vcloudexpress.identity"), "trmk-vcloudexpress.identity");
credential = checkNotNull(System.getProperty("trmk-vcloudexpress.credential"), "trmk-vcloudexpress.credential");
}
KeyPair key; KeyPair key;

View File

@ -19,11 +19,12 @@
package org.jclouds.vcloud.terremark.compute; package org.jclouds.vcloud.terremark.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores; import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import org.jclouds.compute.BaseComputeServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.ComputeType; import org.jclouds.compute.domain.ComputeType;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
@ -31,7 +32,7 @@ import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.jclouds.vcloud.compute.VCloudExpressComputeServiceLiveTest; import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.jclouds.vcloud.terremark.TerremarkECloudAsyncClient; import org.jclouds.vcloud.terremark.TerremarkECloudAsyncClient;
import org.jclouds.vcloud.terremark.TerremarkECloudClient; import org.jclouds.vcloud.terremark.TerremarkECloudClient;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -42,18 +43,14 @@ import org.testng.annotations.Test;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", enabled = true, sequential = true, testName = "terremark.TerremarkVCloudComputeServiceLiveTest") @Test(groups = "live", enabled = true, sequential = true, testName = "terremark.TerremarkVCloudComputeServiceLiveTest")
public class TerremarkECloudComputeServiceLiveTest extends VCloudExpressComputeServiceLiveTest { public class TerremarkECloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public TerremarkECloudComputeServiceLiveTest() {
@Override
public void setServiceDefaults() {
provider = "trmk-ecloud"; provider = "trmk-ecloud";
tag = "trmke";
} }
@Override @Override
protected void setupCredentials() { public void setServiceDefaults() {
identity = checkNotNull(System.getProperty("trmk-ecloud.identity"), "trmk-ecloud.identity"); tag = "trmke";
credential = checkNotNull(System.getProperty("trmk-ecloud.credential"), "trmk-ecloud.credential");
} }
@Test @Test
@ -100,4 +97,20 @@ public class TerremarkECloudComputeServiceLiveTest extends VCloudExpressComputeS
} }
} }
@Override
public void testListNodes() throws Exception {
for (ComputeMetadata node : client.listNodes()) {
assert node.getProviderId() != null;
assert node.getLocation() != null;
assertEquals(node.getType(), ComputeType.NODE);
NodeMetadata allData = client.getNodeMetadata(node.getId());
System.out.println(allData.getHardware());
}
}
@Override
protected JschSshClientModule getSshModule() {
return new JschSshClientModule();
}
} }

View File

@ -19,11 +19,12 @@
package org.jclouds.vcloud.terremark.compute; package org.jclouds.vcloud.terremark.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores; import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import org.jclouds.compute.BaseComputeServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.ComputeType; import org.jclouds.compute.domain.ComputeType;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
@ -31,7 +32,7 @@ import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.rest.RestContext; import org.jclouds.rest.RestContext;
import org.jclouds.vcloud.compute.VCloudExpressComputeServiceLiveTest; import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressAsyncClient; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressAsyncClient;
import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient; import org.jclouds.vcloud.terremark.TerremarkVCloudExpressClient;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -42,18 +43,14 @@ import org.testng.annotations.Test;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "live", enabled = true, sequential = true, testName = "terremark.TerremarkVCloudComputeServiceLiveTest") @Test(groups = "live", enabled = true, sequential = true, testName = "terremark.TerremarkVCloudComputeServiceLiveTest")
public class TerremarkVCloudExpressComputeServiceLiveTest extends VCloudExpressComputeServiceLiveTest { public class TerremarkVCloudExpressComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public TerremarkVCloudExpressComputeServiceLiveTest() {
@Override
public void setServiceDefaults() {
provider = "trmk-vcloudexpress"; provider = "trmk-vcloudexpress";
tag = "vcx";
} }
@Override @Override
protected void setupCredentials() { public void setServiceDefaults() {
identity = checkNotNull(System.getProperty("trmk-vcloudexpress.identity"), "trmk-vcloudexpress.identity"); tag = "vcx";
credential = checkNotNull(System.getProperty("trmk-vcloudexpress.credential"), "trmk-vcloudexpress.credential");
} }
@Test @Test
@ -99,4 +96,20 @@ public class TerremarkVCloudExpressComputeServiceLiveTest extends VCloudExpressC
} }
} }
@Override
public void testListNodes() throws Exception {
for (ComputeMetadata node : client.listNodes()) {
assert node.getProviderId() != null;
assert node.getLocation() != null;
assertEquals(node.getType(), ComputeType.NODE);
NodeMetadata allData = client.getNodeMetadata(node.getId());
System.out.println(allData.getHardware());
}
}
@Override
protected JschSshClientModule getSshModule() {
return new JschSshClientModule();
}
} }

View File

@ -23,12 +23,15 @@ 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.Set; import java.util.Set;
import org.jclouds.Constants;
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;
import org.jclouds.rest.RestContextFactory; import org.jclouds.rest.RestContextFactory;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.jclouds.vcloud.domain.CatalogItem; import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.functions.AllCatalogItemsInOrg; import org.jclouds.vcloud.functions.AllCatalogItemsInOrg;
import org.jclouds.vcloud.terremark.TerremarkVCloudClient; import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
@ -53,15 +56,39 @@ public class VAppTemplatesInOrgsLiveTest {
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 + ".apiversion"), "test." + provider
+ ".apiversion");
}
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 + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
String identity = checkNotNull(System.getProperty("trmk-vcloudexpress.identity"), "trmk-vcloudexpress.identity"); setupCredentials();
String credential = checkNotNull(System.getProperty("trmk-vcloudexpress.credential"), Properties overrides = setupProperties();
"trmk-vcloudexpress.credential");
Injector injector = new RestContextFactory().createContextBuilder("trmk-vcloudexpress", identity, credential, Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule())).buildInjector(); ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()),overrides).buildInjector();
tmClient = injector.getInstance(TerremarkVCloudClient.class); tmClient = injector.getInstance(TerremarkVCloudClient.class);
allCatalogItemsInOrg = injector.getInstance(AllCatalogItemsInOrg.class); allCatalogItemsInOrg = injector.getInstance(AllCatalogItemsInOrg.class);