Issue 750:property to set the image id for the default template

This commit is contained in:
Adrian Cole 2011-11-11 19:36:20 +02:00
parent f7c6683a42
commit c08a7884bd
51 changed files with 311 additions and 273 deletions

View File

@ -39,6 +39,7 @@
<test.cloudservers.apiversion>1.0</test.cloudservers.apiversion>
<test.cloudservers.identity>${test.rackspace.identity}</test.cloudservers.identity>
<test.cloudservers.credential>${test.rackspace.credential}</test.cloudservers.credential>
<test.cloudservers.image-id></test.cloudservers.image-id>
</properties>
<dependencies>
@ -121,8 +122,8 @@
<value>${test.cloudservers.credential}</value>
</property>
<property>
<name>test.initializer</name>
<value>${test.initializer}</value>
<name>test.cloudservers.image-id</name>
<value>${test.cloudservers.image-id}</value>
</property>
</systemProperties>
</configuration>

View File

@ -38,6 +38,7 @@
<test.cloudsigma.apiversion>1.0</test.cloudsigma.apiversion>
<test.cloudsigma.identity>FIXME</test.cloudsigma.identity>
<test.cloudsigma.credential>FIXME</test.cloudsigma.credential>
<test.cloudsigma.image-id></test.cloudsigma.image-id>
</properties>
<dependencies>
@ -107,8 +108,8 @@
<value>${test.cloudsigma.credential}</value>
</property>
<property>
<name>jclouds.compute.blacklist-nodes</name>
<value>${jclouds.compute.blacklist-nodes}</value>
<name>test.cloudsigma.image-id</name>
<value>${test.cloudsigma.image-id}</value>
</property>
</systemProperties>
</configuration>

View File

@ -52,6 +52,7 @@
<test.deltacloud.apiversion>0.3.0</test.deltacloud.apiversion>
<test.deltacloud.identity>mockuser</test.deltacloud.identity>
<test.deltacloud.credential>mockpassword</test.deltacloud.credential>
<test.deltacloud.image-id></test.deltacloud.image-id>
</properties>
<dependencies>
<dependency>
@ -119,6 +120,10 @@
<name>test.deltacloud.credential</name>
<value>${test.deltacloud.credential}</value>
</property>
<property>
<name>test.deltacloud.image-id</name>
<value>${test.deltacloud.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -34,12 +34,11 @@
<packaging>bundle</packaging>
<properties>
<!-- when instances are hung, open a ticket and add here -->
<jclouds.compute.blacklist-nodes>trmkrun-ccc,test.trmk-924</jclouds.compute.blacklist-nodes>
<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.ec2.image-id></test.ec2.image-id>
</properties>
<dependencies>
@ -117,8 +116,8 @@
<value>${test.ec2.credential}</value>
</property>
<property>
<name>jclouds.compute.blacklist-nodes</name>
<value>${jclouds.compute.blacklist-nodes}</value>
<name>test.ec2.image-id</name>
<value>${test.ec2.image-id}</value>
</property>
</systemProperties>
</configuration>

View File

@ -54,6 +54,7 @@
<test.elasticstack.apiversion>1.0</test.elasticstack.apiversion>
<test.elasticstack.identity>FIXME</test.elasticstack.identity>
<test.elasticstack.credential>FIXME</test.elasticstack.credential>
<test.elasticstack.image-id></test.elasticstack.image-id>
</properties>
<dependencies>
<dependency>
@ -122,8 +123,8 @@
<value>${test.elasticstack.credential}</value>
</property>
<property>
<name>jclouds.compute.blacklist-nodes</name>
<value>${jclouds.compute.blacklist-nodes}</value>
<name>test.elasticstack.image-id</name>
<value>${test.elasticstack.image-id}</value>
</property>
</systemProperties>
</configuration>

View File

@ -38,6 +38,7 @@
<test.eucalyptus.apiversion>2010-06-15</test.eucalyptus.apiversion>
<test.eucalyptus.identity>FIXME_IDENTITY</test.eucalyptus.identity>
<test.eucalyptus.credential>FIXME_CREDENTIAL</test.eucalyptus.credential>
<test.eucalyptus.image-id></test.eucalyptus.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.eucalyptus.credential</name>
<value>${test.eucalyptus.credential}</value>
</property>
<property>
<name>test.eucalyptus.image-id</name>
<value>${test.eucalyptus.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -34,7 +34,11 @@
<packaging>bundle</packaging>
<properties>
<test.nova.endpoint>http://localhost:8773/services/Cloud</test.nova.endpoint>
<test.nova.apiversion>1.1</test.nova.apiversion>
<test.nova.identity>${test.nova.identity}</test.nova.identity>
<test.nova.credential>${test.nova.credential}</test.nova.credential>
<test.nova.image-id></test.nova.image-id>
</properties>
<dependencies>
@ -136,6 +140,10 @@
<name>test.nova.credential</name>
<value>${test.nova.credential}</value>
</property>
<property>
<name>test.nova.image-id</name>
<value>${test.nova.image-id}</value>
</property>
<property>
<name>test.ssh.keyfile.public</name>
<value>${test.ssh.keyfile.public}</value>
@ -144,10 +152,6 @@
<name>test.ssh.keyfile.private</name>
<value>${test.ssh.keyfile.private}</value>
</property>
<property>
<name>test.initializer</name>
<value>${test.initializer}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -40,6 +40,7 @@
<test.vcloud.apiversion>1.0</test.vcloud.apiversion>
<test.vcloud.identity>FIXME</test.vcloud.identity>
<test.vcloud.credential>FIXME</test.vcloud.credential>
<test.vcloud.image-id></test.vcloud.image-id>
</properties>
<dependencies>
@ -120,8 +121,8 @@
<value>${test.vcloud.credential}</value>
</property>
<property>
<name>jclouds.compute.blacklist-nodes</name>
<value>${jclouds.compute.blacklist-nodes}</value>
<name>test.vcloud.image-id</name>
<value>${test.vcloud.image-id}</value>
</property>
</systemProperties>
</configuration>
@ -135,7 +136,7 @@
<build>
<plugins>
<plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>

View File

@ -18,7 +18,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;
@ -26,12 +25,11 @@ import java.util.Map;
import java.util.Properties;
import java.util.regex.Pattern;
import org.jclouds.Constants;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.vcloud.domain.Catalog;
import org.jclouds.vcloud.domain.CatalogItem;
import org.jclouds.vcloud.domain.Org;
@ -60,7 +58,7 @@ import com.google.inject.Module;
*/
@Deprecated
@Test(groups = "live", singleThreaded = true)
public class DeprecatedVCloudClientLiveTest {
public class DeprecatedVCloudClientLiveTest extends BaseVersionedServiceLiveTest {
protected VCloudClient connection;
protected RestContext<VCloudClient,VCloudAsyncClient> context;
@ -280,39 +278,8 @@ public class DeprecatedVCloudClientLiveTest {
}
}
}
protected String provider = "vcloud";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
protected Iterable<Org> orgs;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".identity");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiversion = System.getProperty("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);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiversion != null)
overrides.setProperty(provider + ".apiversion", apiversion);
return overrides;
}
protected Properties setupRestProperties() {
return RestContextFactory.getPropertiesFromResource("/rest.properties");
}
@BeforeGroups(groups = { "live" })
public void setupClient() {
setupCredentials();

View File

@ -18,7 +18,6 @@
*/
package org.jclouds.trmk.vcloud_0_8;
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;
@ -39,10 +38,10 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.cim.CIMPredicates;
import org.jclouds.cim.ResourceAllocationSettingData;
import org.jclouds.cim.ResourceAllocationSettingData.ResourceType;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.net.IPSocket;
@ -90,7 +89,7 @@ import com.google.inject.Injector;
import com.google.inject.Module;
@Test(groups = "live" , singleThreaded = true)
public abstract class TerremarkClientLiveTest {
public abstract class TerremarkClientLiveTest extends BaseVersionedServiceLiveTest {
protected String expectedOs = "Ubuntu Linux (64-bit)";
protected String itemName = "Ubuntu JeOS 9.10 (64-bit)";
@ -720,31 +719,6 @@ public abstract class TerremarkClientLiveTest {
protected Iterable<Org> orgs;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".identity");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiversion = System.getProperty("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);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiversion != null)
overrides.setProperty(provider + ".apiversion", apiversion);
return overrides;
}
protected Properties setupRestProperties() {
return RestContextFactory.getPropertiesFromResource("/rest.properties");
}
public RestContext<TerremarkVCloudClient, TerremarkVCloudAsyncClient> createContextWithProperties(
Properties overrides) {
return new ComputeServiceContextFactory(setupRestProperties()).createContext(provider,

View File

@ -49,7 +49,9 @@ import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.compute.strategy.CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap;
import org.jclouds.compute.strategy.InitializeRunScriptOnNodeOrPlaceInBadMap;
import org.jclouds.config.ValueOfConfigurationKeyOrNull;
import org.jclouds.json.Json;
import org.jclouds.location.Provider;
import org.jclouds.location.config.LocationModule;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
@ -83,21 +85,22 @@ public abstract class BaseComputeServiceContextModule extends AbstractModule {
bind(new TypeLiteral<Function<TemplateOptions, Statement>>() {
}).to(TemplateOptionsToStatement.class);
install(new FactoryModuleBuilder().implement(RunScriptOnNodeUsingSsh.class, Names.named("direct"),
RunScriptOnNodeUsingSsh.class).implement(RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete.class,
Names.named("blocking"), RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete.class).implement(
RunScriptOnNodeAsInitScriptUsingSsh.class, Names.named("nonblocking"),
RunScriptOnNodeAsInitScriptUsingSsh.class).build(RunScriptOnNodeFactoryImpl.Factory.class));
install(new FactoryModuleBuilder()
.implement(RunScriptOnNodeUsingSsh.class, Names.named("direct"), RunScriptOnNodeUsingSsh.class)
.implement(RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete.class, Names.named("blocking"),
RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete.class)
.implement(RunScriptOnNodeAsInitScriptUsingSsh.class, Names.named("nonblocking"),
RunScriptOnNodeAsInitScriptUsingSsh.class).build(RunScriptOnNodeFactoryImpl.Factory.class));
install(new PersistNodeCredentialsModule());
bind(RunScriptOnNode.Factory.class).to(RunScriptOnNodeFactoryImpl.class);
install(new FactoryModuleBuilder().implement(new TypeLiteral<Callable<Void>>() {
}, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.class).implement(
new TypeLiteral<Function<NodeMetadata, Void>>() {
}, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.class).build(
CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory.class));
}, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.class)
.implement(new TypeLiteral<Function<NodeMetadata, Void>>() {
}, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.class)
.build(CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory.class));
install(new FactoryModuleBuilder().implement(new TypeLiteral<Callable<RunScriptOnNode>>() {
}, InitializeRunScriptOnNodeOrPlaceInBadMap.class).build(InitializeRunScriptOnNodeOrPlaceInBadMap.Factory.class));
@ -115,7 +118,7 @@ public abstract class BaseComputeServiceContextModule extends AbstractModule {
@Named("blocking")
RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilComplete backgroundAndBlockOnComplete(NodeMetadata node,
Statement script, RunScriptOptions options);
Statement script, RunScriptOptions options);
@Named("nonblocking")
RunScriptOnNodeAsInitScriptUsingSsh background(NodeMetadata node, Statement script, RunScriptOptions options);
@ -134,13 +137,13 @@ public abstract class BaseComputeServiceContextModule extends AbstractModule {
checkNotNull(runScript, "runScript");
checkNotNull(options, "options");
return !options.shouldWrapInInitScript() ? factory.exec(node, runScript, options) : (options
.shouldBlockOnComplete() ? factory.backgroundAndBlockOnComplete(node, runScript, options) : factory
.background(node, runScript, options));
.shouldBlockOnComplete() ? factory.backgroundAndBlockOnComplete(node, runScript, options) : factory
.background(node, runScript, options));
}
@Override
public BlockUntilInitScriptStatusIsZeroThenReturnOutput submit(NodeMetadata node, Statement script,
RunScriptOptions options) {
RunScriptOptions options) {
checkNotNull(node, "node");
checkNotNull(script, "script");
checkNotNull(options, "options");
@ -161,6 +164,17 @@ public abstract class BaseComputeServiceContextModule extends AbstractModule {
*/
@Provides
@Named("DEFAULT")
protected TemplateBuilder provideTemplateOptionallyFromProperties(Injector injector, TemplateBuilder template,
@Provider String provider, ValueOfConfigurationKeyOrNull config) {
template = provideTemplate(injector, template);
String imageId = config.apply(provider + ".image-id");
if (imageId == null)
imageId = config.apply("jclouds.image-id");
if (imageId != null)
template.imageId(imageId);
return template;
}
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.osFamily(UBUNTU).osVersionMatches("1[012].[01][04]").os64Bit(true);
}
@ -175,8 +189,8 @@ public abstract class BaseComputeServiceContextModule extends AbstractModule {
}
/**
* supplies how the tag is encoded into the name. A string of hex characters is the last argument
* and tag is the first
* supplies how the tag is encoded into the name. A string of hex characters
* is the last argument and tag is the first
*/
@Provides
@Named("NAMING_CONVENTION")
@ -211,14 +225,14 @@ public abstract class BaseComputeServiceContextModule extends AbstractModule {
@Singleton
@Memoized
protected Supplier<Set<? extends Image>> supplyImageCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
final Supplier<Set<? extends Image>> imageSupplier) {
final Supplier<Set<? extends Image>> imageSupplier) {
return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Set<? extends Image>>(authException,
seconds, new Supplier<Set<? extends Image>>() {
@Override
public Set<? extends Image> get() {
return imageSupplier.get();
}
});
seconds, new Supplier<Set<? extends Image>>() {
@Override
public Set<? extends Image> get() {
return imageSupplier.get();
}
});
}
@Provides
@ -245,14 +259,14 @@ public abstract class BaseComputeServiceContextModule extends AbstractModule {
@Singleton
@Memoized
protected Supplier<Set<? extends Hardware>> supplySizeCache(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
final Supplier<Set<? extends Hardware>> hardwareSupplier) {
final Supplier<Set<? extends Hardware>> hardwareSupplier) {
return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Set<? extends Hardware>>(authException,
seconds, new Supplier<Set<? extends Hardware>>() {
@Override
public Set<? extends Hardware> get() {
return hardwareSupplier.get();
}
});
seconds, new Supplier<Set<? extends Hardware>>() {
@Override
public Set<? extends Hardware> get() {
return hardwareSupplier.get();
}
});
}
@Provides

View File

@ -70,7 +70,6 @@ import java.util.concurrent.TimeoutException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jclouds.Constants;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.ComputeType;
import org.jclouds.compute.domain.ExecResponse;
@ -91,7 +90,6 @@ import org.jclouds.net.IPSocket;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.predicates.SocketOpen;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.scriptbuilder.domain.SaveHttpResponseTo;
import org.jclouds.scriptbuilder.domain.Statements;
import org.jclouds.scriptbuilder.statements.login.AdminAccess;
@ -165,10 +163,6 @@ public abstract class BaseComputeServiceLiveTest extends BaseVersionedServiceLiv
client = context.getComputeService();
}
protected Properties setupRestProperties() {
return RestContextFactory.getPropertiesFromResource("/rest.properties");
}
protected void buildSocketTester() {
SocketOpen socketOpen = Guice.createInjector(getSshModule()).getInstance(SocketOpen.class);
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS);

View File

@ -18,20 +18,18 @@
*/
package org.jclouds.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.Set;
import java.util.Map.Entry;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.compute.config.BaseComputeServiceContextModule;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.OsFamily;
@ -44,7 +42,6 @@ import org.jclouds.domain.LocationScope;
import org.jclouds.json.Json;
import org.jclouds.json.config.GsonModule;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContextFactory;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@ -62,22 +59,10 @@ import com.google.inject.Module;
* @author Adrian Cole
*/
@Test(groups = "integration,live")
public abstract class BaseTemplateBuilderLiveTest {
public abstract class BaseTemplateBuilderLiveTest extends BaseVersionedServiceLiveTest {
protected String provider;
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
protected ComputeServiceContext context;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiversion = System.getProperty("test." + provider + ".apiversion");
}
public void testCompareSizes() throws Exception {
Hardware defaultSize = context.getComputeService().templateBuilder().build().getHardware();
@ -107,24 +92,6 @@ public abstract class BaseTemplateBuilderLiveTest {
defaultTemplate.toString());
}
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;
}
protected Properties setupRestProperties() {
return RestContextFactory.getPropertiesFromResource("/rest.properties");
}
@BeforeClass
public void setupClient() throws InterruptedException, ExecutionException, TimeoutException, IOException {
setupCredentials();
@ -252,6 +219,39 @@ public abstract class BaseTemplateBuilderLiveTest {
}
}
@Test
public void testTemplateBuilderWithImageIdsSpecified() throws IOException {
Template defaultTemplate = context.getComputeService().templateBuilder().build();
ComputeServiceContext context = null;
try {
Properties overrides = setupProperties();
overrides.setProperty("jclouds.image-id", defaultTemplate.getImage().getId());
context = new ComputeServiceContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides);
assertEquals(context.getComputeService().templateBuilder().build(), defaultTemplate);
} finally {
if (context != null)
context.close();
}
context = null;
try {
Properties overrides = setupProperties();
overrides.setProperty(provider + ".image-id", defaultTemplate.getImage().getId());
context = new ComputeServiceContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule()), overrides);
assertEquals(context.getComputeService().templateBuilder().build(), defaultTemplate);
} finally {
if (context != null)
context.close();
}
}
void assertProvider(Location provider) {
assertEquals(provider.getScope(), LocationScope.PROVIDER);
assertEquals(provider.getParent(), null);

View File

@ -19,6 +19,7 @@
package org.jclouds.compute;
import org.jclouds.Constants;
import org.jclouds.rest.RestContextFactory;
import org.testng.annotations.BeforeClass;
import java.util.Properties;
@ -37,7 +38,12 @@ public abstract class BaseVersionedServiceLiveTest {
protected String credential;
protected String endpoint;
protected String apiversion;
protected String imageId;
protected Properties setupRestProperties() {
return RestContextFactory.getPropertiesFromResource("/rest.properties");
}
protected Properties setupProperties() {
if (emptyToNull(provider) == null) throw new NullPointerException("provider must not be null or empty:"+provider);
@ -55,6 +61,8 @@ public abstract class BaseVersionedServiceLiveTest {
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiversion != null)
overrides.setProperty(provider + ".apiversion", apiversion);
if (imageId != null)
overrides.setProperty(provider + ".image-id", imageId);
return overrides;
}
@ -65,6 +73,7 @@ public abstract class BaseVersionedServiceLiveTest {
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiversion = System.getProperty("test." + provider + ".apiversion");
imageId = System.getProperty("test." + provider + ".image-id");
}

View File

@ -19,6 +19,8 @@
package org.jclouds.config;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.emptyToNull;
import static com.google.inject.name.Names.named;
import javax.inject.Inject;
import javax.inject.Singleton;
@ -27,7 +29,6 @@ import com.google.common.base.Function;
import com.google.inject.ConfigurationException;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.name.Names;
/**
*
@ -46,7 +47,7 @@ public class ValueOfConfigurationKeyOrNull implements Function<String, String> {
public String apply(String configurationKey) {
checkNotNull(configurationKey, "configurationKey");
try {
return injector.getInstance(Key.get(String.class, Names.named(configurationKey)));
return emptyToNull(injector.getInstance(Key.get(String.class, named(configurationKey))));
} catch (ConfigurationException e) {
return null;
}

View File

@ -61,6 +61,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>

View File

@ -30,6 +30,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.jclouds.Constants;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.RunNodesException;
@ -41,7 +42,6 @@ import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.net.IPSocket;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.predicates.SocketOpen;
import org.jclouds.rest.RestContextFactory;
import org.jclouds.ssh.SshClient;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
@ -56,7 +56,7 @@ import com.google.inject.Module;
* @author Adrian Cole
*/
@Test(groups = "live", sequential = true)
public abstract class BaseLoadBalancerServiceLiveTest {
public abstract class BaseLoadBalancerServiceLiveTest extends BaseVersionedServiceLiveTest {
protected SshClient.Factory sshFactory;
protected String group;
@ -67,11 +67,6 @@ public abstract class BaseLoadBalancerServiceLiveTest {
protected Map<String, String> keyPair;
protected LoadBalancerMetadata loadbalancer;
protected String provider;
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
protected LoadBalancerServiceContext context;
protected String computeProvider;
@ -81,33 +76,18 @@ public abstract class BaseLoadBalancerServiceLiveTest {
protected String computeApiversion;
protected ComputeServiceContext computeContext;
@Override
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiversion = System.getProperty("test." + provider + ".apiversion");
super.setupCredentials();
computeProvider = checkNotNull(System.getProperty("test." + provider + ".compute.provider"), "test." + provider
+ ".compute.provider");
computeIdentity = checkNotNull(System.getProperty("test." + provider + ".compute.identity"), "test." + provider + ".compute.identity");
computeIdentity = checkNotNull(System.getProperty("test." + provider + ".compute.identity"), "test." + provider
+ ".compute.identity");
computeCredential = System.getProperty("test." + provider + ".compute.credential");
computeEndpoint = System.getProperty("test." + provider + ".compute.endpoint");
computeApiversion = System.getProperty("test." + provider + ".compute.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;
}
protected Properties setupComputeProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
@ -140,21 +120,17 @@ public abstract class BaseLoadBalancerServiceLiveTest {
private void initializeContext() throws IOException {
if (context != null)
context.close();
context = new LoadBalancerServiceContextFactory(getRestProperties()).createContext(provider,
context = new LoadBalancerServiceContextFactory(setupRestProperties()).createContext(provider,
ImmutableSet.of(new Log4JLoggingModule()), setupProperties());
}
private void initializeComputeContext() throws IOException {
if (computeContext != null)
computeContext.close();
computeContext = new ComputeServiceContextFactory(getRestProperties()).createContext(computeProvider,
computeContext = new ComputeServiceContextFactory(setupRestProperties()).createContext(computeProvider,
ImmutableSet.of(new Log4JLoggingModule(), getSshModule()), setupComputeProperties());
}
protected Properties getRestProperties() {
return RestContextFactory.getPropertiesFromResource("/rest.properties");
}
protected void buildSocketTester() {
SocketOpen socketOpen = Guice.createInjector(getSshModule()).getInstance(SocketOpen.class);
socketTester = new RetryablePredicate<IPSocket>(socketOpen, 60, 1, TimeUnit.SECONDS);

View File

@ -38,6 +38,7 @@
<test.aws-ec2.apiversion>2011-05-15</test.aws-ec2.apiversion>
<test.aws-ec2.identity>${test.aws.identity}</test.aws-ec2.identity>
<test.aws-ec2.credential>${test.aws.credential}</test.aws-ec2.credential>
<test.aws-ec2.image-id></test.aws-ec2.image-id>
</properties>
<dependencies>
@ -125,6 +126,10 @@
<name>test.aws-ec2.credential</name>
<value>${test.aws-ec2.credential}</value>
</property>
<property>
<name>test.aws-ec2.image-id</name>
<value>${test.aws-ec2.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.bluelock-vcloud-zone01.apiversion>1.0</test.bluelock-vcloud-zone01.apiversion>
<test.bluelock-vcloud-zone01.identity>FIXME_IDENTITY</test.bluelock-vcloud-zone01.identity>
<test.bluelock-vcloud-zone01.credential>FIXME_CREDENTIAL</test.bluelock-vcloud-zone01.credential>
<test.bluelock-vcloud-zone01.image-id></test.bluelock-vcloud-zone01.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.bluelock-vcloud-zone01.credential</name>
<value>${test.bluelock-vcloud-zone01.credential}</value>
</property>
<property>
<name>test.bluelock-vcloud-zone01.image-id</name>
<value>${test.bluelock-vcloud-zone01.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.cloudservers-uk.apiversion>1.0</test.cloudservers-uk.apiversion>
<test.cloudservers-uk.identity>${test.rackspace-uk.identity}</test.cloudservers-uk.identity>
<test.cloudservers-uk.credential>${test.rackspace-uk.credential}</test.cloudservers-uk.credential>
<test.cloudservers-uk.image-id></test.cloudservers-uk.image-id>
</properties>
<dependencies>
@ -119,6 +120,10 @@
<name>test.cloudservers-uk.credential</name>
<value>${test.cloudservers-uk.credential}</value>
</property>
<property>
<name>test.cloudservers-uk.image-id</name>
<value>${test.cloudservers-uk.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.cloudservers-us.apiversion>1.0</test.cloudservers-us.apiversion>
<test.cloudservers-us.identity>${test.rackspace-us.identity}</test.cloudservers-us.identity>
<test.cloudservers-us.credential>${test.rackspace-us.credential}</test.cloudservers-us.credential>
<test.cloudservers-us.image-id></test.cloudservers-us.image-id>
</properties>
<dependencies>
@ -120,6 +121,10 @@
<name>test.cloudservers-us.credential</name>
<value>${test.cloudservers-us.credential}</value>
</property>
<property>
<name>test.cloudservers-us.image-id</name>
<value>${test.cloudservers-us.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.cloudsigma-lvs.apiversion>1.0</test.cloudsigma-lvs.apiversion>
<test.cloudsigma-lvs.identity>FIXME</test.cloudsigma-lvs.identity>
<test.cloudsigma-lvs.credential>FIXME</test.cloudsigma-lvs.credential>
<test.cloudsigma-lvs.image-id></test.cloudsigma-lvs.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.cloudsigma-lvs.credential</name>
<value>${test.cloudsigma-lvs.credential}</value>
</property>
<property>
<name>test.cloudsigma-lvs.image-id</name>
<value>${test.cloudsigma-lvs.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.cloudsigma-zrh.apiversion>1.0</test.cloudsigma-zrh.apiversion>
<test.cloudsigma-zrh.identity>FIXME</test.cloudsigma-zrh.identity>
<test.cloudsigma-zrh.credential>FIXME</test.cloudsigma-zrh.credential>
<test.cloudsigma-zrh.image-id></test.cloudsigma-zrh.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.cloudsigma-zrh.credential</name>
<value>${test.cloudsigma-zrh.credential}</value>
</property>
<property>
<name>test.cloudsigma-zrh.image-id</name>
<value>${test.cloudsigma-zrh.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.elastichosts-lon-b.apiversion>2.0</test.elastichosts-lon-b.apiversion>
<test.elastichosts-lon-b.identity>FIXME_IDENTITY</test.elastichosts-lon-b.identity>
<test.elastichosts-lon-b.credential>FIXME_CREDENTIAL</test.elastichosts-lon-b.credential>
<test.elastichosts-lon-b.image-id></test.elastichosts-lon-b.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.elastichosts-lon-b.credential</name>
<value>${test.elastichosts-lon-b.credential}</value>
</property>
<property>
<name>test.elastichosts-lon-b.image-id</name>
<value>${test.elastichosts-lon-b.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.elastichosts-lon-p.apiversion>2.0</test.elastichosts-lon-p.apiversion>
<test.elastichosts-lon-p.identity>FIXME_IDENTITY</test.elastichosts-lon-p.identity>
<test.elastichosts-lon-p.credential>FIXME_CREDENTIAL</test.elastichosts-lon-p.credential>
<test.elastichosts-lon-p.image-id></test.elastichosts-lon-p.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.elastichosts-lon-p.credential</name>
<value>${test.elastichosts-lon-p.credential}</value>
</property>
<property>
<name>test.elastichosts-lon-p.image-id</name>
<value>${test.elastichosts-lon-p.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.elastichosts-sat-p.apiversion>2.0</test.elastichosts-sat-p.apiversion>
<test.elastichosts-sat-p.identity>FIXME_IDENTITY</test.elastichosts-sat-p.identity>
<test.elastichosts-sat-p.credential>FIXME_CREDENTIAL</test.elastichosts-sat-p.credential>
<test.elastichosts-sat-p.image-id></test.elastichosts-sat-p.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.elastichosts-sat-p.credential</name>
<value>${test.elastichosts-sat-p.credential}</value>
</property>
<property>
<name>test.elastichosts-sat-p.image-id</name>
<value>${test.elastichosts-sat-p.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.eucalyptus-partnercloud-ec2.apiversion>2010-06-15</test.eucalyptus-partnercloud-ec2.apiversion>
<test.eucalyptus-partnercloud-ec2.identity>FIXME_IDENTITY</test.eucalyptus-partnercloud-ec2.identity>
<test.eucalyptus-partnercloud-ec2.credential>FIXME_CREDENTIAL</test.eucalyptus-partnercloud-ec2.credential>
<test.eucalyptus-partnercloud-ec2.image-id></test.eucalyptus-partnercloud-ec2.image-id>
<!-- corresponds to image manifest and also virt + "-cluster" zone -->
<test.eucalyptus-partnercloud-ec2.virtualization-type>kvm</test.eucalyptus-partnercloud-ec2.virtualization-type>
</properties>
@ -129,6 +130,10 @@
<name>test.eucalyptus-partnercloud-ec2.credential</name>
<value>${test.eucalyptus-partnercloud-ec2.credential}</value>
</property>
<property>
<name>test.eucalyptus-partnercloud-ec2.image-id</name>
<value>${test.eucalyptus-partnercloud-ec2.image-id}</value>
</property>
<property>
<name>test.eucalyptus-partnercloud-ec2.virtualization-type</name>
<value>${test.eucalyptus-partnercloud-ec2.virtualization-type}</value>

View File

@ -38,6 +38,7 @@
<test.go2cloud-jhb1.apiversion>2.0</test.go2cloud-jhb1.apiversion>
<test.go2cloud-jhb1.identity>FIXME_IDENTITY</test.go2cloud-jhb1.identity>
<test.go2cloud-jhb1.credential>FIXME_CREDENTIAL</test.go2cloud-jhb1.credential>
<test.go2cloud-jhb1.image-id></test.go2cloud-jhb1.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.go2cloud-jhb1.credential</name>
<value>${test.go2cloud-jhb1.credential}</value>
</property>
<property>
<name>test.go2cloud-jhb1.image-id</name>
<value>${test.go2cloud-jhb1.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -34,12 +34,11 @@
<packaging>bundle</packaging>
<properties>
<!-- 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>
<test.gogrid.image-id></test.gogrid.image-id>
</properties>
<dependencies>
<dependency>
@ -110,8 +109,8 @@
<value>${test.gogrid.credential}</value>
</property>
<property>
<name>jclouds.compute.blacklist-nodes</name>
<value>${jclouds.compute.blacklist-nodes}</value>
<name>test.gogrid.image-id</name>
<value>${test.gogrid.image-id}</value>
</property>
</systemProperties>
</configuration>

View File

@ -38,6 +38,7 @@
<test.greenhousedata-element-vcloud.apiversion>1.0</test.greenhousedata-element-vcloud.apiversion>
<test.greenhousedata-element-vcloud.identity>FIXME_IDENTITY</test.greenhousedata-element-vcloud.identity>
<test.greenhousedata-element-vcloud.credential>FIXME_CREDENTIAL</test.greenhousedata-element-vcloud.credential>
<test.greenhousedata-element-vcloud.image-id></test.greenhousedata-element-vcloud.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.greenhousedata-element-vcloud.credential</name>
<value>${test.greenhousedata-element-vcloud.credential}</value>
</property>
<property>
<name>test.greenhousedata-element-vcloud.image-id</name>
<value>${test.greenhousedata-element-vcloud.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.openhosting-east1.apiversion>2.0</test.openhosting-east1.apiversion>
<test.openhosting-east1.identity>FIXME_IDENTITY</test.openhosting-east1.identity>
<test.openhosting-east1.credential>FIXME_CREDENTIAL</test.openhosting-east1.credential>
<test.openhosting-east1.image-id></test.openhosting-east1.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.openhosting-east1.credential</name>
<value>${test.openhosting-east1.credential}</value>
</property>
<property>
<name>test.openhosting-east1.image-id</name>
<value>${test.openhosting-east1.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -34,11 +34,10 @@
<packaging>bundle</packaging>
<properties>
<!-- 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://api.rimuhosting.com/r</test.rimuhosting.endpoint>
<test.rimuhosting.apiversion>1.0</test.rimuhosting.apiversion>
<test.rimuhosting.identity>FIXME</test.rimuhosting.identity>
<test.rimuhosting.image-id></test.rimuhosting.image-id>
</properties>
<dependencies>
<dependency>
@ -114,8 +113,8 @@
<value>${test.rimuhosting.identity}</value>
</property>
<property>
<name>jclouds.compute.blacklist-nodes</name>
<value>${jclouds.compute.blacklist-nodes}</value>
<name>test.rimuhosting.image-id</name>
<value>${test.rimuhosting.image-id}</value>
</property>
</systemProperties>
</configuration>

View File

@ -48,12 +48,11 @@
</repositories>
<properties>
<!-- when instances are hung, open a ticket and add here -->
<jclouds.compute.blacklist-nodes>node-924</jclouds.compute.blacklist-nodes>
<test.savvis-symphonyvpdc.endpoint>https://api.symphonyvpdc.savvis.net/vpdc</test.savvis-symphonyvpdc.endpoint>
<test.savvis-symphonyvpdc.apiversion>1.0</test.savvis-symphonyvpdc.apiversion>
<test.savvis-symphonyvpdc.identity>FIXME</test.savvis-symphonyvpdc.identity>
<test.savvis-symphonyvpdc.credential>FIXME</test.savvis-symphonyvpdc.credential>
<test.savvis-symphonyvpdc.image-id></test.savvis-symphonyvpdc.image-id>
<test.savvis-symphonyvpdc.vdc-email>FIXME</test.savvis-symphonyvpdc.vdc-email>
<test.savvis-symphonyvpdc.loginUser>FIXME</test.savvis-symphonyvpdc.loginUser>
<test.savvis-symphonyvpdc.loginPassword>FIXME</test.savvis-symphonyvpdc.loginPassword>
@ -130,6 +129,10 @@
<name>test.savvis-symphonyvpdc.credential</name>
<value>${test.savvis-symphonyvpdc.credential}</value>
</property>
<property>
<name>test.savvis-symphonyvpdc.image-id</name>
<value>${test.savvis-symphonyvpdc.image-id}</value>
</property>
<property>
<name>test.savvis-symphonyvpdc.vdc-email</name>
<value>${test.savvis-symphonyvpdc.vdc-email}</value>
@ -142,10 +145,6 @@
<name>test.savvis-symphonyvpdc.loginPassword</name>
<value>${test.savvis-symphonyvpdc.loginPassword}</value>
</property>
<property>
<name>jclouds.compute.blacklist-nodes</name>
<value>${jclouds.compute.blacklist-nodes}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.serverlove-z1-man.apiversion>1.0</test.serverlove-z1-man.apiversion>
<test.serverlove-z1-man.identity>FIXME_IDENTITY</test.serverlove-z1-man.identity>
<test.serverlove-z1-man.credential>FIXME_CREDENTIAL</test.serverlove-z1-man.credential>
<test.serverlove-z1-man.image-id></test.serverlove-z1-man.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.serverlove-z1-man.credential</name>
<value>${test.serverlove-z1-man.credential}</value>
</property>
<property>
<name>test.serverlove-z1-man.image-id</name>
<value>${test.serverlove-z1-man.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.skalicloud-sdg-my.apiversion>1.0</test.skalicloud-sdg-my.apiversion>
<test.skalicloud-sdg-my.identity>FIXME_IDENTITY</test.skalicloud-sdg-my.identity>
<test.skalicloud-sdg-my.credential>FIXME_CREDENTIAL</test.skalicloud-sdg-my.credential>
<test.skalicloud-sdg-my.image-id></test.skalicloud-sdg-my.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.skalicloud-sdg-my.credential</name>
<value>${test.skalicloud-sdg-my.credential}</value>
</property>
<property>
<name>test.skalicloud-sdg-my.image-id</name>
<value>${test.skalicloud-sdg-my.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -34,11 +34,10 @@
<packaging>bundle</packaging>
<properties>
<!-- 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>
<test.slicehost.image-id></test.slicehost.image-id>
</properties>
<dependencies>
<dependency>
@ -106,8 +105,8 @@
<value>${test.slicehost.identity}</value>
</property>
<property>
<name>jclouds.compute.blacklist-nodes</name>
<value>${jclouds.compute.blacklist-nodes}</value>
<name>test.slicehost.image-id</name>
<value>${test.slicehost.image-id}</value>
</property>
</systemProperties>
</configuration>

View File

@ -52,6 +52,7 @@
<test.softlayer.apiversion>3</test.softlayer.apiversion>
<test.softlayer.identity>FIXME</test.softlayer.identity>
<test.softlayer.credential>FIXME</test.softlayer.credential>
<test.softlayer.image-id></test.softlayer.image-id>
</properties>
<dependencies>
<dependency>
@ -119,6 +120,10 @@
<name>test.softlayer.credential</name>
<value>${test.softlayer.credential}</value>
</property>
<property>
<name>test.softlayer.image-id</name>
<value>${test.softlayer.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.stratogen-vcloud-mycloud.apiversion>1.0</test.stratogen-vcloud-mycloud.apiversion>
<test.stratogen-vcloud-mycloud.identity>FIXME_IDENTITY</test.stratogen-vcloud-mycloud.identity>
<test.stratogen-vcloud-mycloud.credential>FIXME_CREDENTIAL</test.stratogen-vcloud-mycloud.credential>
<test.stratogen-vcloud-mycloud.image-id></test.stratogen-vcloud-mycloud.image-id>
</properties>
<dependencies>
@ -114,6 +115,10 @@
<name>test.stratogen-vcloud-mycloud.credential</name>
<value>${test.stratogen-vcloud-mycloud.credential}</value>
</property>
<property>
<name>test.stratogen-vcloud-mycloud.image-id</name>
<value>${test.stratogen-vcloud-mycloud.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -39,6 +39,7 @@
<test.trmk-ecloud.apiversion>0.8b-ext2.8</test.trmk-ecloud.apiversion>
<test.trmk-ecloud.identity>FIXME</test.trmk-ecloud.identity>
<test.trmk-ecloud.credential>FIXME</test.trmk-ecloud.credential>
<test.trmk-ecloud.image-id></test.trmk-ecloud.image-id>
</properties>
<dependencies>
@ -120,6 +121,10 @@
<name>test.trmk-ecloud.datacenter</name>
<value>${test.trmk-ecloud.datacenter}</value>
</property>
<property>
<name>test.trmk-ecloud.image-id</name>
<value>${test.trmk-ecloud.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -38,6 +38,7 @@
<test.trmk-vcloudexpress.apiversion>0.8a-ext1.6</test.trmk-vcloudexpress.apiversion>
<test.trmk-vcloudexpress.identity>FIXME</test.trmk-vcloudexpress.identity>
<test.trmk-vcloudexpress.credential>FIXME</test.trmk-vcloudexpress.credential>
<test.trmk-vcloudexpress.image-id></test.trmk-vcloudexpress.image-id>
</properties>
<dependencies>
@ -115,6 +116,10 @@
<name>test.trmk-vcloudexpress.credential</name>
<value>${test.trmk-vcloudexpress.credential}</value>
</property>
<property>
<name>test.trmk-vcloudexpress.image-id</name>
<value>${test.trmk-vcloudexpress.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -52,6 +52,7 @@
<test.cloudstack.apiversion>2.2.0</test.cloudstack.apiversion>
<test.cloudstack.identity>FIXME_apiKey</test.cloudstack.identity>
<test.cloudstack.credential>FIXME_secretKey</test.cloudstack.credential>
<test.cloudstack.image-id></test.cloudstack.image-id>
</properties>
<dependencies>
<dependency>
@ -126,6 +127,10 @@
<name>test.cloudstack.credential</name>
<value>${test.cloudstack.credential}</value>
</property>
<property>
<name>test.cloudstack.image-id</name>
<value>${test.cloudstack.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -18,16 +18,11 @@
*/
package org.jclouds.cloudstack.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Properties;
import org.jclouds.Constants;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.sshj.config.SshjSshClientModule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
@ -38,35 +33,11 @@ import com.google.inject.Module;
* @author Adrian Cole
*/
@Test(groups = "live", testName = "CloudStackExperimentLiveTest")
public class CloudStackExperimentLiveTest {
protected String provider = "cloudstack";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
@BeforeClass
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = System.getProperty("test." + provider + ".credential");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiversion = System.getProperty("test." + provider + ".apiversion");
public class CloudStackExperimentLiveTest extends BaseVersionedServiceLiveTest {
public CloudStackExperimentLiveTest(){
provider = "cloudstack";
}
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;
}
@Test
public void testAndExperiment() {
ComputeServiceContext context = null;

View File

@ -18,14 +18,12 @@
*/
package org.jclouds.cloudstack.features;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals;
import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import org.jclouds.Constants;
import org.jclouds.cloudstack.CloudStackAsyncClient;
import org.jclouds.cloudstack.CloudStackClient;
import org.jclouds.cloudstack.domain.Account;
@ -36,6 +34,7 @@ import org.jclouds.cloudstack.predicates.JobComplete;
import org.jclouds.cloudstack.predicates.UserPredicates;
import org.jclouds.cloudstack.predicates.VirtualMachineDestroyed;
import org.jclouds.cloudstack.predicates.VirtualMachineRunning;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ExecResponse;
@ -61,16 +60,15 @@ import com.google.inject.Module;
*
* @author Adrian Cole
*/
public class BaseCloudStackClientLiveTest {
public class BaseCloudStackClientLiveTest extends BaseVersionedServiceLiveTest {
public BaseCloudStackClientLiveTest() {
provider = "cloudstack";
}
protected String prefix = System.getProperty("user.name");
protected CloudStackClient client;
protected RestContext<CloudStackClient, CloudStackAsyncClient> context;
protected String provider = "cloudstack";
protected String identity;
protected String credential;
protected String endpoint;
protected String apiversion;
protected Predicate<IPSocket> socketTester;
protected RetryablePredicate<Long> jobComplete;
protected RetryablePredicate<VirtualMachine> virtualMachineRunning;
@ -84,16 +82,6 @@ public class BaseCloudStackClientLiveTest {
protected ComputeServiceContext computeContext;
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider
+ ".identity must be set. ex. apiKey");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential must be set. ex. secretKey");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider
+ ".endpoint must be set. ex. http://localhost:8080/client/api");
apiversion = System.getProperty("test." + provider + ".apiversion");
}
protected void checkSSH(IPSocket socket) {
socketTester.apply(socket);
SshClient client = sshFactory.create(socket, new Credentials("root", password));
@ -107,32 +95,20 @@ public class BaseCloudStackClientLiveTest {
client.disconnect();
}
}
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);
if (apiversion != null)
overrides.setProperty(provider + ".apiversion", apiversion);
return overrides;
}
@BeforeGroups(groups = "live")
public void setupClient() {
setupCredentials();
Properties overrides = setupProperties();
computeContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()),
overrides);
computeContext = new ComputeServiceContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides);
context = computeContext.getProviderSpecificContext();
client = context.getApi();
// check access
Iterable<User> users = Iterables.concat(client.getAccountClient().listAccounts());
User currentUser;
User currentUser;
Predicate<User> apiKeyMatches = UserPredicates.apiKeyEquals(identity);
try {
currentUser = Iterables.find(users, apiKeyMatches);

View File

@ -44,6 +44,7 @@
<test.elb.compute.apiversion>2010-06-15</test.elb.compute.apiversion>
<test.elb.compute.identity>${test.aws.identity}</test.elb.compute.identity>
<test.elb.compute.credential>${test.aws.credential}</test.elb.compute.credential>
<test.elb.compute.image-id></test.elb.compute.image-id>
</properties>
<dependencies>
@ -154,6 +155,10 @@
<name>test.elb.compute.credential</name>
<value>${test.elb.compute.credential}</value>
</property>
<property>
<name>test.elb.compute.image-id</name>
<value>${test.elb.compute.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -39,6 +39,7 @@
<test.libvirt.apiversion>1.0</test.libvirt.apiversion>
<test.libvirt.identity>FIXME</test.libvirt.identity>
<test.libvirt.credential>FIXME</test.libvirt.credential>
<test.libvirt.image-id></test.libvirt.image-id>
</properties>
<dependencies>
<dependency>
@ -141,8 +142,8 @@
<value>${test.libvirt.credential}</value>
</property>
<property>
<name>jclouds.compute.blacklist.nodes</name>
<value>${jclouds.compute.blacklist.nodes}</value>
<name>test.libvirt.image-id</name>
<value>${test.libvirt.image-id}</value>
</property>
</systemProperties>
</configuration>

View File

@ -38,6 +38,7 @@
<test.virtualbox.apiversion>4.1.4</test.virtualbox.apiversion>
<test.virtualbox.identity>administrator</test.virtualbox.identity>
<test.virtualbox.credential>12345</test.virtualbox.credential>
<test.virtualbox.image-id></test.virtualbox.image-id>
</properties>
<dependencies>
@ -155,6 +156,10 @@
<name>test.virtualbox.credential</name>
<value>${test.virtualbox.credential}</value>
</property>
<property>
<name>test.virtualbox.image-id</name>
<value>${test.virtualbox.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -43,6 +43,7 @@
<test.aws-elb.compute.apiversion>2010-06-15</test.aws-elb.compute.apiversion>
<test.aws-elb.compute.identity>${test.aws.identity}</test.aws-elb.compute.identity>
<test.aws-elb.compute.credential>${test.aws.credential}</test.aws-elb.compute.credential>
<test.aws-elb.compute.image-id></test.aws-elb.compute.image-id>
</properties>
<dependencies>
@ -157,6 +158,10 @@
<name>test.aws-elb.compute.credential</name>
<value>${test.aws-elb.compute.credential}</value>
</property>
<property>
<name>test.aws-elb.compute.image-id</name>
<value>${test.aws-elb.compute.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -37,6 +37,7 @@
<test.dunkel-vcd.apiversion>1.0</test.dunkel-vcd.apiversion>
<test.dunkel-vcd.identity>FIXME_IDENTITY</test.dunkel-vcd.identity>
<test.dunkel-vcd.credential>FIXME_CREDENTIAL</test.dunkel-vcd.credential>
<test.dunkel-vcd.image-id></test.dunkel-vcd.image-id>
</properties>
<dependencies>
@ -113,6 +114,10 @@
<name>test.dunkel-vcd.credential</name>
<value>${test.dunkel-vcd.credential}</value>
</property>
<property>
<name>test.dunkel-vcd.image-id</name>
<value>${test.dunkel-vcd.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -52,6 +52,7 @@
<test.ibm-smartcloud.apiversion>20100331</test.ibm-smartcloud.apiversion>
<test.ibm-smartcloud.identity>FIXME</test.ibm-smartcloud.identity>
<test.ibm-smartcloud.credential>FIXME</test.ibm-smartcloud.credential>
<test.ibm-smartcloud.image-id></test.ibm-smartcloud.image-id>
</properties>
<dependencies>
<dependency>
@ -124,6 +125,10 @@
<name>test.ibm-smartcloud.credential</name>
<value>${test.ibm-smartcloud.credential}</value>
</property>
<property>
<name>test.ibm-smartcloud.image-id</name>
<value>${test.ibm-smartcloud.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -52,6 +52,7 @@
<test.trmk-enterprisecloud.apiversion>2011-07-01</test.trmk-enterprisecloud.apiversion>
<test.trmk-enterprisecloud.identity>FIXME</test.trmk-enterprisecloud.identity>
<test.trmk-enterprisecloud.credential>FIXME</test.trmk-enterprisecloud.credential>
<test.trmk-enterprisecloud.image-id></test.trmk-enterprisecloud.image-id>
</properties>
<dependencies>
<dependency>
@ -119,6 +120,10 @@
<name>test.trmk-enterprisecloud.credential</name>
<value>${test.trmk-enterprisecloud.credential}</value>
</property>
<property>
<name>test.trmk-enterprisecloud.image-id</name>
<value>${test.trmk-enterprisecloud.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>

View File

@ -37,6 +37,7 @@
<test.virtacore-vcloudexpress.apiversion>1.0</test.virtacore-vcloudexpress.apiversion>
<test.virtacore-vcloudexpress.identity>FIXME_IDENTITY</test.virtacore-vcloudexpress.identity>
<test.virtacore-vcloudexpress.credential>FIXME_CREDENTIAL</test.virtacore-vcloudexpress.credential>
<test.virtacore-vcloudexpress.image-id></test.virtacore-vcloudexpress.image-id>
</properties>
<dependencies>
@ -113,6 +114,10 @@
<name>test.virtacore-vcloudexpress.credential</name>
<value>${test.virtacore-vcloudexpress.credential}</value>
</property>
<property>
<name>test.virtacore-vcloudexpress.image-id</name>
<value>${test.virtacore-vcloudexpress.image-id}</value>
</property>
</systemProperties>
</configuration>
</execution>