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>
<properties>
<jclouds.test.identity>${providerUser}</jclouds.test.identity>
<jclouds.test.credential>${providerPassword}</jclouds.test.credential>
<jclouds.test.endpoint>${providerEndpoint}</jclouds.test.endpoint>
<test.identity>${providerUser}</test.identity>
<test.credential>${providerPassword}</test.credential>
<test.endpoint>${providerEndpoint}</test.endpoint>
</properties>
<dependencies>
<dependency>

View File

@ -31,9 +31,15 @@
<artifactId>jclouds-atmos</artifactId>
<name>jclouds atmosonline components</name>
<properties>
<jclouds.test.initializer>org.jclouds.atmosonline.saas.blobstore.integration.AtmosStorageTestInitializer</jclouds.test.initializer>
<jclouds.test.identity>${jclouds.emcsaas.uid}</jclouds.test.identity>
<jclouds.test.credential>${jclouds.emcsaas.key}</jclouds.test.credential>
<test.initializer>org.jclouds.atmosonline.saas.blobstore.integration.AtmosStorageTestInitializer</test.initializer>
<test.atmosonline.endpoint>https://accesspoint.atmosonline.com</test.atmosonline.endpoint>
<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>
<dependencies>
<dependency>
@ -68,5 +74,63 @@
<scope>test</scope>
</dependency>
</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>

View File

@ -19,7 +19,6 @@
package org.jclouds.atmosonline.saas;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals;
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.SystemMetadata;
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.KeyNotFoundException;
import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
import org.jclouds.http.HttpResponseException;
import org.jclouds.io.Payloads;
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.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.base.Supplier;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.inject.Module;
/**
* Tests behavior of {@code AtmosStorageClient}
@ -62,7 +54,11 @@ import com.google.inject.Module;
* @author Adrian Cole
*/
@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 final AtmosStorageClient connection;
@ -112,22 +108,6 @@ public class AtmosStorageClientLiveTest {
URI container1;
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
public void testListDirectorys() throws Exception {

View File

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

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

View File

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

View File

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

View File

@ -21,10 +21,11 @@ package org.jclouds.aws.cloudwatch;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext;
@ -47,14 +48,38 @@ public class CloudWatchClientLiveTest {
private CloudWatchClient client;
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" })
public void setupClient() throws 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 RestContextFactory().createContext("cloudwatch", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
client = context.getApi();
}

View File

@ -28,11 +28,13 @@ import static org.testng.Assert.assertNotNull;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.ec2.domain.BlockDeviceMapping;
import org.jclouds.aws.ec2.domain.InstanceState;
@ -91,12 +93,38 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
private RetryablePredicate<RunningInstance> hasIpTester;
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" })
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");
Injector injector = new RestContextFactory().createContextBuilder("ec2", identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule())).buildInjector();
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).buildInjector();
client = injector.getInstance(EC2Client.class);
sshFactory = injector.getInstance(SshClient.Factory.class);
runningTester = new RetryablePredicate<RunningInstance>(new InstanceStateRunning(client), 180, 5,
@ -151,7 +179,8 @@ public class CloudApplicationArchitecturesEC2ClientLiveTest {
try {
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
// to
// 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.assertNotNull;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.ec2.domain.Attachment;
import org.jclouds.aws.ec2.domain.BlockDeviceMapping;
@ -122,12 +123,38 @@ public class EBSBootEC2ClientLiveTest {
private Attachment attachment;
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" })
public void setupClient() throws IOException {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
Injector injector = new RestContextFactory().createContextBuilder("ec2", identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule())).buildInjector();
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).buildInjector();
client = injector.getInstance(EC2Client.class);
sshFactory = injector.getInstance(SshClient.Factory.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.collect.Iterables.get;
import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.blobstore.domain.Blob;
@ -48,24 +51,35 @@ public class BlobStoreAndComputeServiceLiveTest {
protected ComputeServiceContext computeContext;
protected BlobStoreContext blobContext;
protected String tag = System.getProperty("user.name") + "happy";
protected String identity;
protected String credential;
protected String blobStoreProvider;
protected String computeServiceProvider;
protected void setupCredentials() {
tag = System.getProperty("user.name") + "happy";
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
protected Properties setupCredentials(String provider) {
String identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider
+ ".identity");
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" })
public void setupClient() {
setupCredentials();
computeContext = new ComputeServiceContextFactory().createContext(computeServiceProvider, identity, credential,
ImmutableSet.of(new Log4JLoggingModule(), new JschSshClientModule()));
blobContext = new BlobStoreContextFactory().createContext(blobStoreProvider, identity, credential, ImmutableSet
.of(new Log4JLoggingModule()));
computeContext = new ComputeServiceContextFactory().createContext(computeServiceProvider, ImmutableSet.of(
new Log4JLoggingModule(), new JschSshClientModule()), setupCredentials(computeServiceProvider));
blobContext = new BlobStoreContextFactory().createContext(blobStoreProvider, ImmutableSet
.of(new Log4JLoggingModule()), setupCredentials(blobStoreProvider));
blobContext.getAsyncBlobStore().createContainerInLocation(null, 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")
public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@BeforeClass
@Override
public void setServiceDefaults() {
public EC2ComputeServiceLiveTest() {
provider = "ec2";
}
@ -237,7 +236,7 @@ public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@Test(enabled = true, dependsOnMethods = "testCompareSizes")
public void testExtendedOptionsWithSubnetId() throws Exception {
String subnetId = System.getProperty("jclouds.test.subnetId");
String subnetId = System.getProperty("test.subnetId");
if (subnetId == null) {
// Skip test and return
return;

View File

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

View File

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

View File

@ -25,19 +25,18 @@ import static org.testng.Assert.assertEquals;
import java.io.IOException;
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.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
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")
public class NovaTemplateBuilderLiveTest {
private String password;
private String user;
protected String provider = "nova";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
@BeforeGroups(groups = { "live" })
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException, IOException {
user = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
password = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
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;
}
@Test
public void testDefaultTemplateBuilder() throws IOException {
ComputeServiceContext newContext = null;
try {
newContext = new ComputeServiceContextFactory().createContext("nova", user, password, ImmutableSet
.of(new Log4JLoggingModule()));
newContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
.<Module> of(new Log4JLoggingModule()), setupProperties());
Template defaultTemplate = newContext.getComputeService().templateBuilder().build();
assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
@ -80,12 +96,12 @@ public class NovaTemplateBuilderLiveTest {
public void testTemplateBuilderWithNoOwnersParsesImageOnDemand() throws IOException {
ComputeServiceContext newContext = null;
try {
Properties overrides = new Properties();
Properties overrides = setupProperties();
// set owners to nothing
overrides.setProperty(EC2Constants.PROPERTY_EC2_AMI_OWNERS, "");
newContext = new ComputeServiceContextFactory().createContext("nova", user, password, ImmutableSet
.of(new Log4JLoggingModule()), overrides);
newContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
.<Module> of(new Log4JLoggingModule()), overrides);
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.assertNotNull;
import java.io.IOException;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient;
@ -60,7 +61,6 @@ import com.google.inject.Module;
public class AMIClientLiveTest {
private AMIClient client;
private String identity;
private String imageId = "ami-cdf819a4";
private static final String DEFAULT_MANIFEST = "adrianimages/image.manifest.xml";
private static final String DEFAULT_SNAPSHOT = "TODO";
@ -68,13 +68,38 @@ public class AMIClientLiveTest {
private Set<String> imagesToDeregister = Sets.newHashSet();
@BeforeGroups(groups = { "live" })
public void setupClient() throws IOException {
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
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" })
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
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.assertNotNull;
import java.io.IOException;
import java.net.URI;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
import java.util.SortedMap;
import java.util.Map.Entry;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client;
@ -59,14 +60,38 @@ public class AvailabilityZoneAndRegionClientLiveTest {
private AvailabilityZoneAndRegionClient client;
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" })
public void setupClient() throws 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 RestContextFactory().createContext("ec2", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
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.assertNotNull;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;
import java.util.SortedSet;
import java.util.concurrent.TimeUnit;
import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient;
@ -64,14 +65,38 @@ public class ElasticBlockStoreClientLiveTest {
private RestContext<EC2Client, EC2AsyncClient> context;
private String volumeId;
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" })
public void setupClient() throws 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 RestContextFactory().createContext("ec2", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
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.assertNotNull;
import java.io.IOException;
import java.util.Properties;
import java.util.SortedSet;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client;
@ -53,13 +54,38 @@ public class ElasticIPAddressClientLiveTest {
private ElasticIPAddressClient client;
private RestContext<EC2Client, EC2AsyncClient> context;
@BeforeGroups(groups = { "live" })
public void setupClient() throws IOException {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
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" })
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
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 org.testng.Assert.assertNotNull;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client;
@ -51,15 +52,39 @@ public class InstanceClientLiveTest {
public static final String PREFIX = System.getProperty("user.name") + "-ec2";
private InstanceClient client;
private String identity;
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" })
public void setupClient() throws IOException {
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
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.assertNotNull;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;
import java.util.SortedSet;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client;
@ -54,12 +55,38 @@ public class KeyPairClientLiveTest {
private KeyPairClient client;
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" })
public void setupClient() throws 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 RestContextFactory().createContext("ec2", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
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 org.testng.Assert.assertEquals;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client;
import org.jclouds.aws.ec2.domain.MonitoringState;
@ -48,30 +49,52 @@ public class MonitoringClientLiveTest {
private MonitoringClient client;
private static final String DEFAULT_INSTANCE = "i-TODO";
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" })
public void setupClient() throws 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 RestContextFactory().createContext("ec2", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
client = context.getApi().getMonitoringServices();
}
@Test(enabled = false)
// TODO get instance
public void testMonitorInstances() {
Map<String, MonitoringState> monitoringState = client.monitorInstancesInRegion(null,
DEFAULT_INSTANCE);
Map<String, MonitoringState> monitoringState = client.monitorInstancesInRegion(null, DEFAULT_INSTANCE);
assertEquals(monitoringState.get(DEFAULT_INSTANCE), MonitoringState.PENDING);
}
@Test(enabled = false)
// TODO get instance
public void testUnmonitorInstances() {
Map<String, MonitoringState> monitoringState = client.unmonitorInstancesInRegion(null,
DEFAULT_INSTANCE);
Map<String, MonitoringState> monitoringState = client.unmonitorInstancesInRegion(null, DEFAULT_INSTANCE);
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.assertNotNull;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.SortedSet;
import java.util.concurrent.TimeUnit;
import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.domain.Region;
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.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
@ -76,14 +78,40 @@ public class PlacementGroupClientLiveTest {
private RetryablePredicate<PlacementGroup> deletedTester;
private PlacementGroup group;
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" })
public void setupClient() throws IOException {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
public void setupClient() throws FileNotFoundException, IOException {
setupCredentials();
Properties overrides = setupProperties();
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
keyPair = BaseComputeServiceLiveTest.setupKeyPair();
context = new ComputeServiceContextFactory().createContext("ec2", identity, credential, ImmutableSet.<Module> of(
new Log4JLoggingModule(), new JschSshClientModule()));
client = EC2Client.class.cast(context.getProviderSpecificContext().getApi());
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.assertNotNull;
import java.io.IOException;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
import java.util.SortedSet;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client;
@ -60,12 +61,38 @@ public class SecurityGroupClientLiveTest {
private SecurityGroupClient client;
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" })
public void setupClient() throws 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 RestContextFactory().createContext("ec2", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
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 java.io.IOException;
import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.aws.ec2.EC2AsyncClient;
import org.jclouds.aws.ec2.EC2Client;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
@ -48,13 +49,38 @@ public class WindowsClientLiveTest {
private RestContext<EC2Client, EC2AsyncClient> context;
@BeforeGroups(groups = { "live" })
public void setupClient() throws IOException {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
protected String provider = "ec2";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
context = new RestContextFactory().createContext("ec2", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
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" })
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
client = context.getApi().getWindowsServices();
}
@ -62,12 +88,12 @@ public class WindowsClientLiveTest {
// TODO get instance
public void testBundleInstanceInRegion() {
client
.bundleInstanceInRegion(
null,
DEFAULT_INSTANCE,
"prefix",
DEFAULT_BUCKET,
"{\"expiration\": \"2008-08-30T08:49:09Z\",\"conditions\": [{\"bucket\": \"my-bucket\"},[\"starts-with\", \"$key\", \"my-new-image\"]]}");
.bundleInstanceInRegion(
null,
DEFAULT_INSTANCE,
"prefix",
DEFAULT_BUCKET,
"{\"expiration\": \"2008-08-30T08:49:09Z\",\"conditions\": [{\"bucket\": \"my-bucket\"},[\"starts-with\", \"$key\", \"my-new-image\"]]}");
}
@Test(enabled = false)

View File

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

View File

@ -20,7 +20,6 @@
package org.jclouds.aws.s3.blobstore.integration;
import java.io.IOException;
import java.util.Properties;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory;
@ -37,12 +36,16 @@ import com.google.inject.Module;
*/
public class S3TestInitializer extends TransientBlobStoreTestInitializer {
@Override
protected BlobStoreContext createLiveContext(Module configurationModule, String url, String app,
String identity, String key) throws IOException {
public S3TestInitializer() {
provider = "s3";
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 java.io.IOException;
import java.util.Properties;
import java.util.Set;
import java.util.SortedSet;
import org.jclouds.Constants;
import org.jclouds.aws.AWSResponseException;
import org.jclouds.aws.domain.Region;
import org.jclouds.aws.sqs.domain.Queue;
@ -57,14 +59,38 @@ public class SQSClientLiveTest {
private RestContext<SQSClient, SQSAsyncClient> context;
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" })
public void setupClient() throws 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 RestContextFactory().createContext("sqs", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
this.client = context.getApi();
}

View File

@ -35,11 +35,43 @@
<module>core</module>
<module>demos</module>
</modules>
<properties>
<jclouds.test.user>${jclouds.aws.accesskeyid}</jclouds.test.user>
<jclouds.test.key>${jclouds.aws.secretaccesskey}</jclouds.test.key>
<jclouds.test.initializer>org.jclouds.aws.s3.blobstore.integration.S3TestInitializer</jclouds.test.initializer>
<test.initializer>org.jclouds.aws.s3.blobstore.integration.S3TestInitializer</test.initializer>
<test.aws.identity>FIXME</test.aws.identity>
<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>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
@ -102,4 +134,151 @@
<scope>test</scope>
</dependency>
</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>

View File

@ -33,12 +33,21 @@
<name>jclouds azure services core</name>
<description>jclouds core components to access azure services</description>
<properties>
<jclouds.test.identity>${jclouds.azure.storage.account}</jclouds.test.identity>
<jclouds.test.credential>${jclouds.azure.storage.key}</jclouds.test.credential>
<jclouds.test.initializer>org.jclouds.azure.storage.blob.blobstore.integration.AzureBlobTestInitializer</jclouds.test.initializer>
<properties>
<test.azure.endpoint>https://auth.api.azurecloud.com</test.azure.endpoint>
<test.azure.apiversion>2009-09-19</test.azure.apiversion>
<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>
<scm>
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/azure</connection>
<developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/azure</developerConnection>
@ -78,5 +87,67 @@
<scope>test</scope>
</dependency>
</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>

View File

@ -19,6 +19,7 @@
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.withPublicAcl;
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 java.io.ByteArrayInputStream;
import java.io.IOException;
import java.lang.reflect.UndeclaredThrowableException;
import java.net.URI;
import java.security.SecureRandom;
import java.util.Properties;
import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.azure.storage.AzureStorageResponseException;
import org.jclouds.azure.storage.blob.domain.AzureBlob;
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.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.util.Utils;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
@ -71,13 +73,38 @@ public class AzureBlobClientLiveTest {
private String containerPrefix = System.getProperty("user.name") + "-azureblob";
private BlobStoreContext context;
protected String provider = "azurequeue";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
@BeforeTest
public void setupClient() throws IOException {
identity = System.getProperty("jclouds.test.identity");
String credential = System.getProperty("jclouds.test.credential");
context = new BlobStoreContextFactory().createContext("azureblob", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
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" })
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
context = new BlobStoreContextFactory().createContext(provider, ImmutableSet
.<Module> of(new Log4JLoggingModule()), overrides);
client = (AzureBlobClient) context.getProviderSpecificContext().getApi();
}
@ -92,7 +119,6 @@ public class AzureBlobClientLiveTest {
String privateContainer;
String publicContainer;
String identity;
@Test(timeOut = 5 * 60 * 1000)
public void testCreateContainer() throws Exception {

View File

@ -20,7 +20,6 @@
package org.jclouds.azure.storage.blob.blobstore.integration;
import java.io.IOException;
import java.util.Properties;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory;
@ -36,16 +35,15 @@ import com.google.inject.Module;
*/
public class AzureBlobTestInitializer extends TransientBlobStoreTestInitializer {
public AzureBlobTestInitializer() {
provider = "azureblob";
}
@Override
protected BlobStoreContext createLiveContext(Module configurationModule, String url, String app,
String identity, String key) throws IOException {
Properties properties = new Properties();
// properties.setProperty(PROPERTY_MAX_CONNECTIONS_PER_CONTEXT, Integer.toString(0));
// 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);
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

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

View File

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

View File

@ -22,7 +22,6 @@ package org.jclouds.blobstore.integration;
import java.io.IOException;
import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.blobstore.integration.internal.BaseTestInitializer;
import com.google.inject.Module;
@ -34,14 +33,10 @@ import com.google.inject.Module;
public class TransientBlobStoreTestInitializer extends BaseTestInitializer {
@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 {
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")
private BlobStoreContext getCloudResources(ITestContext testContext) throws ClassNotFoundException,
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);
BaseTestInitializer initializer = clazz.newInstance();
return initializer.init(createHttpModule(), testContext);

View File

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

View File

@ -124,31 +124,20 @@ public abstract class BaseComputeServiceLiveTest {
.append("sudo zypper install java-1.6.0-openjdk-devl\n")//
.toString();
abstract public void setServiceDefaults();
public void setServiceDefaults() {
}
protected String provider;
protected String tag;
protected RetryablePredicate<IPSocket> socketTester;
protected SortedSet<NodeMetadata> nodes;
protected ComputeServiceContext context;
protected ComputeService client;
protected String identity;
protected String credential;
protected Template template;
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() {
SocketOpen socketOpen = Guice.createInjector(getSshModule()).getInstance(SocketOpen.class);
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 {
String secretKeyFile;
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) {
secretKeyFile = System.getProperty("user.home") + "/.ssh/id_rsa";
}
@ -172,24 +161,56 @@ public abstract class BaseComputeServiceLiveTest {
+ ".pub"), Charsets.UTF_8));
}
protected String provider;
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
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 {
if (context != null)
context.close();
Properties props = new Properties();
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
context = new ComputeServiceContextFactory().createContext(provider, identity, credential, ImmutableSet.of(
new Log4JLoggingModule(), getSshModule()), props);
Properties props = setupProperties();
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.of(new Log4JLoggingModule(),
getSshModule()), props);
client = context.getComputeService();
}
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()) {
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
@Test(enabled = true, expectedExceptions = AuthorizationException.class)
public void testCorrectAuthException() throws Exception {
synchronized (ComputeServiceContext.class) {
ComputeServiceContext context = null;
// system properties override crendentials passed
// if in the form provider.identity, provider.credential
// we want this to fail, so we save off old state and reset those
// properties to garbage.
String oldIdentity = System.getProperty(provider + ".identity");
String oldCredential = System.getProperty(provider + ".credential");
try {
System.setProperty(provider + ".identity", "MOMMA");
System.setProperty(provider + ".credential", "MIA");
context = new ComputeServiceContextFactory().createContext(provider, "MOMMA", "MIA", ImmutableSet
.<Module> of(new Log4JLoggingModule()));
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();
}
ComputeServiceContext context = null;
try {
context = new ComputeServiceContextFactory().createContext(provider, "MOMMA", "MIA", ImmutableSet
.<Module> of(new Log4JLoggingModule()));
context.getComputeService().listNodes();
} catch (AuthorizationException e) {
throw e;
} catch (RuntimeException e) {
e.printStackTrace();
throw e;
} finally {
if (context != null)
context.close();
}
}

View File

@ -81,8 +81,8 @@ public abstract class BaseLoadBalancerServiceLiveTest {
IOException, RunNodesException {
if (tag == null)
tag = checkNotNull(provider, "provider") + "lb";
identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
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");
initializeContextAndClient();

View File

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

View File

@ -51,15 +51,17 @@ import com.google.inject.Module;
@Test(groups = "unit", testName = "rest.RestContextFactoryTest")
public class RestContextFactoryTest {
private static final String provider = "test";
public void testBuilder() {
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test",
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec(provider,
"http://localhost", "1", "dummy", null, IntegrationTestClient.class, IntegrationTestAsyncClient.class);
createContextBuilder(contextSpec);
}
public void testBuilderProperties() {
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test",
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec(provider,
"http://localhost", "1", "dummy", null, IntegrationTestClient.class, IntegrationTestAsyncClient.class);
Properties props = RestContextFactory.toProperties(contextSpec);
@ -73,11 +75,11 @@ public class RestContextFactoryTest {
assertEquals(props.getProperty("test.contextbuilder"), null);
assertEquals(props.getProperty("test.modules"), null);
new RestContextFactory().createContext("test", props);
new RestContextFactory().createContext(provider, props);
}
public void testBuilderPropertiesWithCredential() {
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test",
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec(provider,
"http://localhost", "1", "dummy", "credential", IntegrationTestClient.class,
IntegrationTestAsyncClient.class);
@ -92,12 +94,12 @@ public class RestContextFactoryTest {
assertEquals(props.getProperty("test.contextbuilder"), null);
assertEquals(props.getProperty("test.modules"), null);
new RestContextFactory().createContext("test", props);
new RestContextFactory().createContext(provider, props);
}
@SuppressWarnings("unchecked")
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,
(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.modules"), null);
new RestContextFactory().createContext("test", props);
new RestContextFactory().createContext(provider, props);
}
@SuppressWarnings("unchecked")
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,
(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.modules"), "org.jclouds.rest.RestContextFactoryTest$A");
new RestContextFactory().createContext("test", props);
new RestContextFactory().createContext(provider, props);
}
@SuppressWarnings("unchecked")
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,
(Class) IntegrationTestContextBuilder.class, Arrays.<Module> asList(new A(), new B()));
@ -153,7 +155,7 @@ public class RestContextFactoryTest {
assertEquals(props.getProperty("test.modules"),
"org.jclouds.rest.RestContextFactoryTest$A,org.jclouds.rest.RestContextFactoryTest$B");
new RestContextFactory().createContext("test", props);
new RestContextFactory().createContext(provider, props);
}
public void testBuilderPropertiesJCloudsScope() {
@ -181,7 +183,7 @@ public class RestContextFactoryTest {
return spec;
}
}.createContext("test", props);
}.createContext(provider, props);
}
public void testBuilderPropertiesJCloudsScopeWithProviderIdentityAndFileCredential() throws IOException {
@ -213,7 +215,7 @@ public class RestContextFactoryTest {
return spec;
}
}.createContext("test", props);
}.createContext(provider, props);
}
public static class A extends AbstractModule {
@ -238,7 +240,7 @@ public class RestContextFactoryTest {
@Test(expectedExceptions = IllegalArgumentException.class)
public void testBuilderPropertiesWithWrongConfig() {
@SuppressWarnings("unused")
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec("test",
ContextSpec<IntegrationTestClient, IntegrationTestAsyncClient> contextSpec = contextSpec(provider,
"http://localhost", "1", "dummy", null, (Class) null, (Class) null,
(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")
public class JschSshClientLiveTest {
protected static final String sshHost = System.getProperty("jclouds.test.ssh.host");
protected static final String sshPort = System.getProperty("jclouds.test.ssh.port");
protected static final String sshUser = System.getProperty("jclouds.test.ssh.username");
protected static final String sshPass = System.getProperty("jclouds.test.ssh.password");
protected static final String sshKeyFile = System.getProperty("jclouds.test.ssh.keyfile");
protected static final String sshHost = System.getProperty("test.ssh.host");
protected static final String sshPort = System.getProperty("test.ssh.port");
protected static final String sshUser = System.getProperty("test.ssh.username");
protected static final String sshPass = System.getProperty("test.ssh.password");
protected static final String sshKeyFile = System.getProperty("test.ssh.keyfile");
private File temp;
@BeforeGroups(groups = { "live" })

View File

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

View File

@ -26,31 +26,36 @@ import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.blobstore.BlobStoreContextFactory;
import org.jclouds.blobstore.integration.TransientBlobStoreTestInitializer;
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 com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
import org.jclouds.filesystem.reference.FilesystemConstants;
import org.jclouds.filesystem.utils.TestUtils;
/**
*
* @author Adrian Cole
*/
public class FilesystemTestInitializer extends TransientBlobStoreTestInitializer {
@Override
protected BlobStoreContext createLiveContext(Module configurationModule, String url, String app,
String identity, String key) throws IOException {
public FilesystemTestInitializer() {
provider = "filesystem";
BaseBlobStoreIntegrationTest.SANITY_CHECK_RETURNED_BUCKET_NAME = true;
}
Properties prop = new Properties();
prop.setProperty(FilesystemConstants.PROPERTY_BASEDIR, TestUtils.TARGET_BASE_DIR);
return new BlobStoreContextFactory().createContext(
"filesystem",
ImmutableSet.of(configurationModule, new Log4JLoggingModule()),
prop);
@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));
}
@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"?>
<!--
$HeadURL$
$Revision$
$Date$
<!--
$HeadURL$ $Revision$ $Date$ Copyright (C) 2010 Cloud Conscious,
LLC <info@cloudconscious.com>
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
====================================================================
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 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">
http://www.apache.org/licenses/LICENSE-2.0.html Unless required
by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions
and limitations under the License.
====================================================================
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
@ -42,8 +39,12 @@
<url>http://jclouds.googlecode.com/svn/trunk/gogrid</url>
</scm>
<properties>
<jclouds.test.identity>${jclouds.gogrid.apikey}</jclouds.test.identity>
<jclouds.test.credential>${jclouds.gogrid.secret}</jclouds.test.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.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>
<dependencies>
<dependency>
@ -83,4 +84,51 @@
<scope>test</scope>
</dependency>
</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>

View File

@ -32,11 +32,13 @@ import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
import org.jclouds.Constants;
import org.jclouds.domain.Credentials;
import org.jclouds.gogrid.domain.Ip;
import org.jclouds.gogrid.domain.IpPortPair;
@ -92,14 +94,38 @@ public class GoGridLiveTest {
private List<String> loadBalancersToDeleteAfterTest = new ArrayList<String>();
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" })
public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
context = new RestContextFactory().createContext("gogrid", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
setupCredentials();
Properties overrides = setupProperties();
context = new RestContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule()),
overrides);
client = context.getApi();
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.rest.RestContext;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
@ -38,10 +37,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live", enabled = true, sequential = true, testName = "gogrid.GoGridComputeServiceLiveTest")
public class GoGridComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@BeforeClass
@Override
public void setServiceDefaults() {
public GoGridComputeServiceLiveTest() {
provider = "gogrid";
}
@ -61,7 +57,7 @@ public class GoGridComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public void testAssignability() throws Exception {
@SuppressWarnings("unused")
RestContext<GoGridClient, GoGridAsyncClient> goGridContext = new ComputeServiceContextFactory()
.createContext(provider, identity, credential).getProviderSpecificContext();
RestContext<GoGridClient, GoGridAsyncClient> goGridContext = new ComputeServiceContextFactory().createContext(
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.md5>e5de09672af9b386c30a311654d8541a</jclouds.wire.httpstream.md5>
<jclouds.test.listener>org.jclouds.test.testng.UnitTestStatusListener</jclouds.test.listener>
<jclouds.test.ssh.keyfile />
<test.ssh.keyfile />
</properties>
<dependencyManagement>
@ -352,8 +352,8 @@
</properties>
<systemProperties>
<property>
<name>jclouds.test.initializer</name>
<value>${jclouds.test.initializer}</value>
<name>test.initializer</name>
<value>${test.initializer}</value>
</property>
<property>
<name>jclouds.wire.httpstream.url</name>
@ -565,32 +565,12 @@ pageTracker._trackPageview();
<value>${project.build.sourceEncoding}</value>
</property>
<property>
<name>jclouds.test.initializer</name>
<value>${jclouds.test.initializer}</value>
<name>test.initializer</name>
<value>${test.initializer}</value>
</property>
<property>
<name>jclouds.test.identity</name>
<value>${jclouds.test.identity}</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>
<name>test.ssh.keyfile</name>
<value>${test.ssh.keyfile}</value>
</property>
<property>
<name>jclouds.blobstore.httpstream.url</name>

View File

@ -1,26 +1,26 @@
<?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");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
====================================================================
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
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
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">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
@ -30,17 +30,32 @@
</parent>
<artifactId>jclouds-rackspace</artifactId>
<name>jclouds rackspace components</name>
<properties>
<jclouds.test.identity>${jclouds.rackspace.user}</jclouds.test.identity>
<jclouds.test.credential>${jclouds.rackspace.key}</jclouds.test.credential>
<jclouds.test.initializer>org.jclouds.rackspace.cloudfiles.blobstore.integration.CloudFilesTestInitializer</jclouds.test.initializer>
<test.rackspace.endpoint>https://auth.api.rackspacecloud.com</test.rackspace.endpoint>
<test.rackspace.apiversion>1.0</test.rackspace.apiversion>
<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>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
@ -68,10 +83,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>test</scope>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@ -86,5 +101,71 @@
<scope>test</scope>
</dependency>
</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>

View File

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

View File

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

@ -35,6 +35,7 @@ import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.jclouds.Constants;
import org.jclouds.http.HttpResponseException;
import org.jclouds.io.Payload;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
@ -81,14 +82,39 @@ public class CloudServersClientLiveTest {
protected CloudServersClient client;
protected SshClient.Factory sshFactory;
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" })
public void setupClient() {
String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
setupCredentials();
Properties overrides = setupProperties();
Injector injector = new RestContextFactory().createContextBuilder("cloudservers", identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), new Properties())
Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides)
.buildInjector();
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")
public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@Override
public void setServiceDefaults() {
public CloudServersComputeServiceLiveTest() {
provider = "cloudservers";
}
@ -77,4 +75,5 @@ public class CloudServersComputeServiceLiveTest extends BaseComputeServiceLiveTe
assertEquals(node.getLocation().getScope(), LocationScope.HOST);
}
}
}

View File

@ -39,8 +39,11 @@
<url>http://jclouds.googlecode.com/svn/trunk/rimuhosting</url>
</scm>
<properties>
<jclouds.test.identity>${jclouds.rimuhosting.apikey}</jclouds.test.identity>
<jclouds.test.credential>${jclouds.rimuhosting.apikey}</jclouds.test.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.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>
<dependencies>
<dependency>
@ -81,5 +84,46 @@
<scope>test</scope>
</dependency>
</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>

View File

@ -24,8 +24,10 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import java.util.Properties;
import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextFactory;
@ -52,11 +54,36 @@ public class RimuHostingClientLiveTest {
private RimuHostingClient connection;
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" })
public void setupClient() {
String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
this.context = new RestContextFactory().createContext("rimuhosting", credential, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()));
setupCredentials();
Properties overrides = setupProperties();
this.context = new RestContextFactory().createContext("rimuhosting", ImmutableSet
.<Module> of(new Log4JLoggingModule()), overrides);
this.connection = context.getApi();
}

View File

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

View File

@ -1,26 +1,26 @@
<?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");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
====================================================================
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
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
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">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
@ -31,15 +31,18 @@
<artifactId>jclouds-slicehost</artifactId>
<name>jclouds slicehost components</name>
<properties>
<jclouds.test.identity>${jclouds.slicehost.apikey}</jclouds.test.identity>
<jclouds.test.credential>${jclouds.slicehost.apikey}</jclouds.test.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.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>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
@ -55,10 +58,10 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>test</scope>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@ -73,5 +76,48 @@
<scope>test</scope>
</dependency>
</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>

View File

@ -31,6 +31,7 @@ import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.jclouds.Constants;
import org.jclouds.http.HttpResponseException;
import org.jclouds.io.Payloads;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
@ -59,7 +60,6 @@ import com.google.inject.Module;
*
* @author Adrian Cole
*/
// disabled [Web Hosting #129069
@Test(groups = "live", sequential = true, testName = "slicehost.SlicehostClientLiveTest")
public class SlicehostClientLiveTest {
@ -67,12 +67,36 @@ public class SlicehostClientLiveTest {
protected SshClient.Factory sshFactory;
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" })
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,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), new Properties())
Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides)
.buildInjector();
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.SlicehostClient;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
@ -41,10 +40,7 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live", enabled = true, sequential = true, testName = "slicehost.SlicehostComputeServiceLiveTest")
public class SlicehostComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@BeforeClass
@Override
public void setServiceDefaults() {
public SlicehostComputeServiceLiveTest() {
provider = "slicehost";
}

View File

@ -38,7 +38,7 @@
<input
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"
/>

View File

@ -31,7 +31,7 @@
<input
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"
/>

View File

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

View File

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

View File

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

View File

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

View File

@ -19,19 +19,9 @@
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.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
/**
* Tests behavior of {@code BlueLockVCloudClient}
*
@ -39,17 +29,8 @@ import com.google.inject.Module;
*/
@Test(groups = "live", sequential = true, testName = "bluelock.BlueLockVCloudDirectorClientLiveTest")
public class BlueLockVCloudDirectorClientLiveTest extends VCloudClientLiveTest {
@BeforeGroups(groups = { "live" })
@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();
public BlueLockVCloudDirectorClientLiveTest() {
provider = "bluelock-vcdirector";
}
}

View File

@ -19,8 +19,6 @@
package org.jclouds.vcloud.bluelock;
import static com.google.common.base.Preconditions.checkNotNull;
import org.jclouds.vcloud.VCloudGuestCustomizationLiveTest;
import org.testng.annotations.Test;
@ -32,13 +30,8 @@ import org.testng.annotations.Test;
@Test(groups = "live", enabled = true, sequential = true, testName = "vcloud.BlueLockVCloudDirectorGuestCustomizationLiveTest")
public class BlueLockVCloudDirectorGuestCustomizationLiveTest extends VCloudGuestCustomizationLiveTest {
@Override
protected void setupCredentials() {
public BlueLockVCloudDirectorGuestCustomizationLiveTest() {
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 org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
@ -48,7 +48,6 @@ public class VCloudSessionRefreshLiveTest {
private final static int timeOut = 40;
protected VCloudClient connection;
protected String identity;
protected ComputeServiceContext context;
@Test
@ -58,17 +57,41 @@ public class VCloudSessionRefreshLiveTest {
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" })
public void setupClient() throws IOException {
identity = checkNotNull(System.getProperty("bluelock-vcdirector.identity"), "bluelock-vcdirector.identity");
String credential = checkNotNull(System.getProperty("bluelock-vcdirector.credential"),
"bluelock-vcdirector.credential");
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
Properties props = new Properties();
props.setProperty(PROPERTY_SESSION_INTERVAL, 40 + "");
overrides.setProperty(PROPERTY_SESSION_INTERVAL, 40 + "");
context = new ComputeServiceContextFactory().createContext("bluelock-vcdirector", identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule()), props);
context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
.<Module> of(new Log4JLoggingModule()), overrides);
connection = VCloudClient.class.cast(context.getProviderSpecificContext().getApi());
}

View File

@ -19,7 +19,6 @@
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.testng.Assert.assertEquals;
@ -38,18 +37,13 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live", enabled = true, sequential = true, testName = "bluelock.BlueLockVCloudComputeServiceLiveTest")
public class BlueLockVCloudDirectorComputeServiceLiveTest extends VCloudComputeServiceLiveTest {
@Override
public void setServiceDefaults() {
public BlueLockVCloudDirectorComputeServiceLiveTest() {
provider = "bluelock-vcdirector";
tag = "director";
}
@Override
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("bluelock-vcdirector.identity"),
"bluelock-vcdirector.identity");
credential = checkNotNull(System.getProperty("bluelock-vcdirector.credential"),
"bluelock-vcdirector.credential");
public void setServiceDefaults() {
tag = "director";
}
@Test

View File

@ -1,26 +1,26 @@
<?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");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
====================================================================
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
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
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">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
@ -31,17 +31,19 @@
<name>jclouds vcloud Components Core</name>
<description>jclouds Core components to access vcloud</description>
<properties>
<test.identity>${jclouds.vcloud.user}</test.identity>
<test.credential>${jclouds.vcloud.password}</test.credential>
<test.endpoint>${jclouds.vcloud.endpoint}</test.endpoint>
<!-- when instances are hung, open a ticket and add here -->
<jclouds.compute.blacklist.nodes>trmkrun-ccc,test.trmk-924</jclouds.compute.blacklist.nodes>
<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>
<scm>
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/vcloud/core</connection>
<developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/vcloud/core</developerConnection>
<url>http://jclouds.googlecode.com/svn/trunk/vcloud/core</url>
</scm>
<dependencies>
<dependency>
<groupId>com.jamesmurty.utils</groupId>
@ -55,4 +57,51 @@
</dependency>
</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>

View File

@ -69,8 +69,9 @@ public class Utils {
errorCode = 500;
vendorSpecificErrorCode = attributes.get("majorErrorCode");
}
MinorCode minorErrorCode = MinorCode.fromValue(attributes.get("minorErrorCode"));
if (minorErrorCode == MinorCode.UNRECOGNIZED) {
MinorCode minorErrorCode = attributes.containsKey("minorErrorCode") ? MinorCode.fromValue(attributes
.get("minorErrorCode")) : null;
if (minorErrorCode == null || minorErrorCode == MinorCode.UNRECOGNIZED) {
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")
public class CaptureVAppLiveTest {
protected String identity;
protected String provider;
protected String credential;
protected ComputeService client;
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() {
provider = "vcloud";
identity = checkNotNull(System.getProperty("vcloud.identity"), "vcloud.identity");
credential = checkNotNull(System.getProperty("vcloud.credential"), "vcloud.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");
}
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 props = new Properties();
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
client = new ComputeServiceContextFactory().createContext(provider, identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule()), props).getComputeService();
Properties overrides = setupProperties();
client = new ComputeServiceContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getComputeService();
}
@Test

View File

@ -19,6 +19,7 @@
package org.jclouds.vcloud;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals;
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> {
protected S connection;
protected String provider;
protected String identity;
protected RestContext<S, A> context;
protected String credential;
@Test
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" })
public void setupClient() {
setupCredentials();
Properties props = new Properties();
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
context = new ComputeServiceContextFactory().createContext(provider, identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule()), props).getProviderSpecificContext();
Properties overrides = setupProperties();
context = new ComputeServiceContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getProviderSpecificContext();
connection = context.getApi();
}

View File

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

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
@ -41,12 +40,6 @@ import org.testng.annotations.Test;
@Test(groups = "live", sequential = true, testName = "vcloud.VCloudClientLiveTest")
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
public void testListOrgs() throws Exception {
for (ReferenceType response : connection.listOrgs().values()) {

View File

@ -19,13 +19,12 @@
package org.jclouds.vcloud;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertNotNull;
import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.Org;
import org.jclouds.vcloud.domain.ReferenceType;
import org.jclouds.vcloud.domain.VCloudExpressVApp;
import org.jclouds.vcloud.domain.VDC;
import org.testng.annotations.Test;
@ -36,14 +35,9 @@ import org.testng.annotations.Test;
* @author Adrian Cole
*/
@Test(groups = "live", sequential = true, testName = "vcloud.VCloudClientLiveTest")
public class VCloudExpressClientLiveTest extends
public abstract class VCloudExpressClientLiveTest extends
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
public void testGetVAppTemplate() throws Exception {
Org org = connection.findOrgNamed(null);
@ -88,7 +82,7 @@ public class VCloudExpressClientLiveTest extends
CatalogItem item = connection.getCatalogItem(resource.getHref());
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
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";
protected String identity;
protected String provider;
protected String credential;
protected ComputeServiceContext context;
protected ComputeService client;
protected RetryablePredicate<IPSocket> socketTester;
protected Factory sshFactory;
protected String provider = "vcloud";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
protected void setupCredentials() {
provider = "vcloud";
identity = checkNotNull(System.getProperty("vcloud.identity"), "vcloud.identity");
credential = checkNotNull(System.getProperty("vcloud.credential"), "vcloud.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");
}
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 props = new Properties();
props.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
props.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
client = new ComputeServiceContextFactory().createContext(provider, identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule()), props).getComputeService();
Properties overrides = setupProperties();
client = new ComputeServiceContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides).getComputeService();
socketTester = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 60, 1, TimeUnit.SECONDS);
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.lang.reflect.Method;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import javax.ws.rs.core.HttpHeaders;
import org.jclouds.concurrent.Timeout;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.filters.BasicAuthentication;
import org.jclouds.rest.RestClientTest;
import org.jclouds.rest.RestContextFactory.ContextSpec;
import org.jclouds.rest.annotations.Provider;
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.functions.ParseLoginResponseFromHeaders;
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
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.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.functions.ParseSax;
import org.jclouds.rest.RestClientTest;
import org.jclouds.rest.RestContextFactory.ContextSpec;
import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.jclouds.vcloud.VCloudVersionsLiveTest.VCloudVersionsClient;
import org.jclouds.vcloud.xml.SupportedVersionsHandler;
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
public ContextSpec<VCloudVersionsClient, VCloudVersionsAsyncClient> createContextSpec() {
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;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals;
import org.jclouds.compute.BaseComputeServiceLiveTest;
@ -41,17 +40,10 @@ import org.testng.annotations.Test;
@Test(groups = "live", enabled = true, sequential = true, testName = "vcloud.VCloudComputeServiceLiveTest")
public class VCloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
@Override
public void setServiceDefaults() {
public VCloudComputeServiceLiveTest() {
provider = "vcloud";
}
@Override
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("vcloud.identity"), "vcloud.identity");
credential = checkNotNull(System.getProperty("vcloud.credential"), "vcloud.credential");
}
@Override
protected JschSshClientModule getSshModule() {
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 java.net.URI;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContext;
@ -77,7 +79,8 @@ public class InternetServiceLiveTest {
@Test
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());
}
}
@ -87,13 +90,40 @@ public class InternetServiceLiveTest {
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" })
public void setupClient() {
String identity = checkNotNull(System.getProperty("trmk-vcloudexpress.identity"), "trmk-vcloudexpress.identity");
String credential = checkNotNull(System.getProperty("trmk-vcloudexpress.credential"), "trmk-vcloudexpress.credential");
setupCredentials();
Properties overrides = setupProperties();
context = new ComputeServiceContextFactory().createContext("trmk-vcloudexpress", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule(), new JschSshClientModule())).getProviderSpecificContext();
context = new ComputeServiceContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()), overrides)
.getProviderSpecificContext();
tmClient = context.getApi();

View File

@ -19,6 +19,7 @@
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.find;
import static com.google.common.collect.Iterables.size;
@ -33,10 +34,12 @@ import java.io.IOException;
import java.net.URI;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.http.HttpResponseException;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.net.IPSocket;
@ -87,7 +90,6 @@ public abstract class TerremarkClientLiveTest extends VCloudExpressClientLiveTes
super.testCatalog();
}
protected String provider = "trmk-vcloudexpress";
protected String expectedOs = "Ubuntu Linux (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 VCloudExpressVApp clone;
private VDC vdc;
protected String credential;
public static final String PREFIX = System.getProperty("user.name") + "-terremark";
@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" })
@Override
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
Injector injector = new RestContextFactory().createContextBuilder(provider, identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule())).buildInjector();
Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()),overrides).buildInjector();
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);
}
protected abstract void setupCredentials();
}

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.terremark;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.terremark.options.TerremarkInstantiateVAppTemplateOptions.Builder.processorCount;
import org.jclouds.net.IPSocket;
@ -46,12 +45,6 @@ public class TerremarkECloudClientLiveTest extends TerremarkClientLiveTest {
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
protected SshClient getConnectionFor(IPSocket socket) {
return sshFactory.create(socket, "ecloud", "$Ep455l0ud!2");

View File

@ -19,7 +19,6 @@
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.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
@ -43,11 +42,6 @@ import org.testng.annotations.Test;
*/
@Test(groups = "live", sequential = true, testName = "vcloud.TerremarkVCloudClientLiveTest")
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;

View File

@ -19,11 +19,12 @@
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.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.Image;
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.TemplateBuilder;
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.TerremarkECloudClient;
import org.testng.annotations.Test;
@ -42,18 +43,14 @@ import org.testng.annotations.Test;
* @author Adrian Cole
*/
@Test(groups = "live", enabled = true, sequential = true, testName = "terremark.TerremarkVCloudComputeServiceLiveTest")
public class TerremarkECloudComputeServiceLiveTest extends VCloudExpressComputeServiceLiveTest {
@Override
public void setServiceDefaults() {
public class TerremarkECloudComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public TerremarkECloudComputeServiceLiveTest() {
provider = "trmk-ecloud";
tag = "trmke";
}
@Override
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("trmk-ecloud.identity"), "trmk-ecloud.identity");
credential = checkNotNull(System.getProperty("trmk-ecloud.credential"), "trmk-ecloud.credential");
public void setServiceDefaults() {
tag = "trmke";
}
@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;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
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.Image;
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.TemplateBuilder;
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.TerremarkVCloudExpressClient;
import org.testng.annotations.Test;
@ -42,18 +43,14 @@ import org.testng.annotations.Test;
* @author Adrian Cole
*/
@Test(groups = "live", enabled = true, sequential = true, testName = "terremark.TerremarkVCloudComputeServiceLiveTest")
public class TerremarkVCloudExpressComputeServiceLiveTest extends VCloudExpressComputeServiceLiveTest {
@Override
public void setServiceDefaults() {
public class TerremarkVCloudExpressComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public TerremarkVCloudExpressComputeServiceLiveTest() {
provider = "trmk-vcloudexpress";
tag = "vcx";
}
@Override
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("trmk-vcloudexpress.identity"), "trmk-vcloudexpress.identity");
credential = checkNotNull(System.getProperty("trmk-vcloudexpress.credential"), "trmk-vcloudexpress.credential");
public void setServiceDefaults() {
tag = "vcx";
}
@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 java.io.IOException;
import java.util.Properties;
import java.util.Set;
import org.jclouds.Constants;
import org.jclouds.compute.domain.Image;
import org.jclouds.lifecycle.Closer;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.functions.AllCatalogItemsInOrg;
import org.jclouds.vcloud.terremark.TerremarkVCloudClient;
@ -53,15 +56,39 @@ public class VAppTemplatesInOrgsLiveTest {
private VAppTemplatesInOrgs parser;
private Closer closer;
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" })
public void setupClient() {
String identity = checkNotNull(System.getProperty("trmk-vcloudexpress.identity"), "trmk-vcloudexpress.identity");
String credential = checkNotNull(System.getProperty("trmk-vcloudexpress.credential"),
"trmk-vcloudexpress.credential");
setupCredentials();
Properties overrides = setupProperties();
Injector injector = new RestContextFactory().createContextBuilder("trmk-vcloudexpress", identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule())).buildInjector();
Injector injector = new RestContextFactory().createContextBuilder(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new JschSshClientModule()),overrides).buildInjector();
tmClient = injector.getInstance(TerremarkVCloudClient.class);
allCatalogItemsInOrg = injector.getInstance(AllCatalogItemsInOrg.class);