Issue 341: bluelock-vcloudexpress, bluelock-vclouddirector

This commit is contained in:
Adrian Cole 2010-08-19 13:00:44 -07:00
parent 1b1c40c22f
commit 0d06623dcf
16 changed files with 361 additions and 39 deletions

View File

@ -80,8 +80,11 @@ eucalyptus.propertiesbuilder=org.jclouds.aws.ec2.EucalyptusPropertiesBuilder
cloudservers.contextbuilder=org.jclouds.rackspace.cloudservers.CloudServersContextBuilder
cloudservers.propertiesbuilder=org.jclouds.rackspace.RackspacePropertiesBuilder
bluelock.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudContextBuilder
bluelock.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudPropertiesBuilder
bluelock-vclouddirector.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorContextBuilder
bluelock-vclouddirector.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudDirectorPropertiesBuilder
bluelock-vcloudexpress.contextbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudExpressContextBuilder
bluelock-vcloudexpress.propertiesbuilder=org.jclouds.vcloud.bluelock.BlueLockVCloudExpressPropertiesBuilder
gogrid.propertiesbuilder=org.jclouds.gogrid.GoGridPropertiesBuilder
gogrid.contextbuilder=org.jclouds.gogrid.GoGridContextBuilder

View File

@ -31,9 +31,18 @@
<artifactId>jclouds-bluelock</artifactId>
<name>jclouds bluelock Components Core</name>
<description>jclouds core components to access bluelock</description>
<properties>
<jclouds.test.identity>${jclouds.bluelock.user}</jclouds.test.identity>
<jclouds.test.credential>${jclouds.bluelock.password}</jclouds.test.credential>
<!-- when instances are hung, open a ticket and add their names here -->
<jclouds.compute.blacklist.nodes></jclouds.compute.blacklist.nodes>
<bluelock-vcloudexpress.endpoint>https://express.bluelock.com/api</bluelock-vcloudexpress.endpoint>
<bluelock-vcloudexpress.apiversion>0.8</bluelock-vcloudexpress.apiversion>
<bluelock-vcloudexpress.identity>FIXME</bluelock-vcloudexpress.identity>
<bluelock-vcloudexpress.credential>FIXME</bluelock-vcloudexpress.credential>
<bluelock-vclouddirector.endpoint>https://vcenterprise.bluelock.com/api</bluelock-vclouddirector.endpoint>
<bluelock-vclouddirector.apiversion>1.0</bluelock-vclouddirector.apiversion>
<bluelock-vclouddirector.identity>FIXME</bluelock-vclouddirector.identity>
<bluelock-vclouddirector.credential>FIXME</bluelock-vclouddirector.credential>
</properties>
<scm>
@ -56,5 +65,66 @@
<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>bluelock-vcloudexpress.endpoint</name>
<value>${bluelock-vcloudexpress.endpoint}</value>
</property>
<property>
<name>bluelock-vcloudexpress.apiversion</name>
<value>${bluelock-vcloudexpress.apiversion}</value>
</property>
<property>
<name>bluelock-vcloudexpress.identity</name>
<value>${bluelock-vcloudexpress.identity}</value>
</property>
<property>
<name>bluelock-vcloudexpress.credential</name>
<value>${bluelock-vcloudexpress.credential}</value>
</property>
<property>
<name>bluelock-vclouddirector.endpoint</name>
<value>${bluelock-vclouddirector.endpoint}</value>
</property>
<property>
<name>bluelock-vclouddirector.apiversion</name>
<value>${bluelock-vclouddirector.apiversion}</value>
</property>
<property>
<name>bluelock-vclouddirector.identity</name>
<value>${bluelock-vclouddirector.identity}</value>
</property>
<property>
<name>bluelock-vclouddirector.credential</name>
<value>${bluelock-vclouddirector.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

@ -0,0 +1,63 @@
/**
*
* 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.bluelock;
import java.util.List;
import java.util.Properties;
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
import org.jclouds.logging.jdk.config.JDKLoggingModule;
import org.jclouds.vcloud.VCloudContextBuilder;
import org.jclouds.vcloud.bluelock.compute.config.BlueLockVCloudExpressComputeServiceContextModule;
import org.jclouds.vcloud.bluelock.config.BlueLockVCloudExpressRestClientModule;
import com.google.inject.Injector;
import com.google.inject.Module;
/**
* Creates {@link BlueLockVCloudComputeServiceContext} or {@link Injector} instances based on the
* most commonly requested arguments.
* <p/>
* Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
* <p/>
* <p/>
* If no <code>Module</code>s are specified, the default {@link JDKLoggingModule logging} and
* {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed.
*
* @author Adrian Cole
* @see BlueLockVCloudComputeServiceContext
*/
public class BlueLockVCloudDirectorContextBuilder extends VCloudContextBuilder {
public BlueLockVCloudDirectorContextBuilder(Properties props) {
super(props);
}
@Override
protected void addContextModule(List<Module> modules) {
modules.add(new BlueLockVCloudExpressComputeServiceContextModule());
}
@Override
protected void addClientModule(List<Module> modules) {
modules.add(new BlueLockVCloudExpressRestClientModule());
}
}

View File

@ -0,0 +1,48 @@
/**
*
* 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.bluelock;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_VERSION_SCHEMA;
import java.util.Properties;
import org.jclouds.vcloud.VCloudPropertiesBuilder;
/**
* Builds properties used in bluelock VCloud Clients
*
* @author Adrian Cole
*/
public class BlueLockVCloudDirectorPropertiesBuilder extends VCloudPropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_API_VERSION, "1.0");
properties.setProperty(PROPERTY_VCLOUD_VERSION_SCHEMA, "1.0");
properties.setProperty(PROPERTY_ENDPOINT, "https://vcenterprise.bluelock.com/api");
return properties;
}
public BlueLockVCloudDirectorPropertiesBuilder(Properties properties) {
super(properties);
}
}

View File

@ -25,8 +25,8 @@ import java.util.Properties;
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
import org.jclouds.logging.jdk.config.JDKLoggingModule;
import org.jclouds.vcloud.VCloudContextBuilder;
import org.jclouds.vcloud.bluelock.compute.config.BlueLockVCloudComputeServiceContextModule;
import org.jclouds.vcloud.bluelock.config.BlueLockVCloudRestClientModule;
import org.jclouds.vcloud.bluelock.compute.config.BlueLockVCloudExpressComputeServiceContextModule;
import org.jclouds.vcloud.bluelock.config.BlueLockVCloudExpressRestClientModule;
import com.google.inject.Injector;
import com.google.inject.Module;
@ -44,20 +44,20 @@ import com.google.inject.Module;
* @author Adrian Cole
* @see BlueLockVCloudComputeServiceContext
*/
public class BlueLockVCloudContextBuilder extends VCloudContextBuilder {
public class BlueLockVCloudExpressContextBuilder extends VCloudContextBuilder {
public BlueLockVCloudContextBuilder(Properties props) {
public BlueLockVCloudExpressContextBuilder(Properties props) {
super(props);
}
@Override
protected void addContextModule(List<Module> modules) {
modules.add(new BlueLockVCloudComputeServiceContextModule());
modules.add(new BlueLockVCloudExpressComputeServiceContextModule());
}
@Override
protected void addClientModule(List<Module> modules) {
modules.add(new BlueLockVCloudRestClientModule());
modules.add(new BlueLockVCloudExpressRestClientModule());
}
}

View File

@ -30,7 +30,7 @@ import org.jclouds.vcloud.VCloudPropertiesBuilder;
*
* @author Adrian Cole
*/
public class BlueLockVCloudPropertiesBuilder extends VCloudPropertiesBuilder {
public class BlueLockVCloudExpressPropertiesBuilder extends VCloudPropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();
@ -38,7 +38,7 @@ public class BlueLockVCloudPropertiesBuilder extends VCloudPropertiesBuilder {
return properties;
}
public BlueLockVCloudPropertiesBuilder(Properties properties) {
public BlueLockVCloudExpressPropertiesBuilder(Properties properties) {
super(properties);
}
}

View File

@ -40,11 +40,11 @@ import com.google.common.base.Predicate;
* @author Adrian Cole
*/
@Singleton
public class BlueLockVCloudComputeClient extends BaseVCloudComputeClient {
public class BlueLockVCloudExpressComputeClient extends BaseVCloudComputeClient {
private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider;
@Inject
protected BlueLockVCloudComputeClient(PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
protected BlueLockVCloudExpressComputeClient(PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider,
VCloudClient client, Predicate<URI> successTester, Map<VAppStatus, NodeState> vAppStatusToNodeState) {
super(client, successTester, vAppStatusToNodeState);
this.credentialsProvider = credentialsProvider;

View File

@ -23,9 +23,9 @@ import java.util.Set;
import org.jclouds.compute.domain.Size;
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
import org.jclouds.vcloud.bluelock.compute.BlueLockVCloudComputeClient;
import org.jclouds.vcloud.bluelock.compute.BlueLockVCloudExpressComputeClient;
import org.jclouds.vcloud.bluelock.compute.config.suppliers.ParseSizeFromImageSupplier;
import org.jclouds.vcloud.bluelock.compute.functions.BlueLockImageForVAppTemplate;
import org.jclouds.vcloud.bluelock.compute.functions.BlueLockVCloudExpressImageForVAppTemplate;
import org.jclouds.vcloud.bluelock.compute.strategy.DefaultLoginCredentialsFromBlueLockFAQ;
import org.jclouds.vcloud.compute.VCloudComputeClient;
import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
@ -36,17 +36,17 @@ import com.google.inject.Injector;
/**
* Configures the {@link BlueLockVCloudComputeServiceContext}; requires
* {@link BlueLockVCloudComputeClient} bound.
* {@link BlueLockVCloudExpressComputeClient} bound.
*
* @author Adrian Cole
*/
public class BlueLockVCloudComputeServiceContextModule extends VCloudComputeServiceContextModule {
public class BlueLockVCloudExpressComputeServiceContextModule extends VCloudComputeServiceContextModule {
@Override
protected void configure() {
super.configure();
bind(ImageForVAppTemplate.class).to(BlueLockImageForVAppTemplate.class);
bind(VCloudComputeClient.class).to(BlueLockVCloudComputeClient.class);
bind(ImageForVAppTemplate.class).to(BlueLockVCloudExpressImageForVAppTemplate.class);
bind(VCloudComputeClient.class).to(BlueLockVCloudExpressComputeClient.class);
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(DefaultLoginCredentialsFromBlueLockFAQ.class);
}

View File

@ -31,10 +31,10 @@ import org.jclouds.vcloud.compute.functions.ImageForVAppTemplate;
* @author Adrian Cole
*/
@Singleton
public class BlueLockImageForVAppTemplate extends ImageForVAppTemplate {
public class BlueLockVCloudExpressImageForVAppTemplate extends ImageForVAppTemplate {
@Inject
protected BlueLockImageForVAppTemplate(FindLocationForResource findLocationForResource,
protected BlueLockVCloudExpressImageForVAppTemplate(FindLocationForResource findLocationForResource,
PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider) {
super(findLocationForResource, credentialsProvider);
}

View File

@ -47,7 +47,7 @@ import com.google.common.collect.Iterables;
*/
@RequiresHttp
@ConfiguresRestClient
public class BlueLockVCloudRestClientModule extends VCloudRestClientModule {
public class BlueLockVCloudExpressRestClientModule extends VCloudRestClientModule {
@Override
protected URI provideDefaultNetwork(VCloudClient client) throws InterruptedException, ExecutionException,

View File

@ -0,0 +1,55 @@
/**
*
* 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 director or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud.bluelock;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Properties;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
import org.jclouds.rest.RestContextFactory;
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}
*
* @author Adrian Cole
*/
@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-vclouddirector.identity"),
"bluelock-vclouddirector.identity");
String credential = checkNotNull(System.getProperty("bluelock-vclouddirector.credential"),
"bluelock-vclouddirector.credential");
context = new RestContextFactory().createContext("bluelock-vclouddirector", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()), new Properties());
connection = context.getApi();
}
}

View File

@ -38,14 +38,15 @@ import com.google.inject.Module;
* @author Adrian Cole
*/
@Test(groups = "live", sequential = true, testName = "vcloud.BlueLockVCloudClientLiveTest")
public class BlueLockVCloudClientLiveTest extends VCloudClientLiveTest {
public class BlueLockVCloudExpressClientLiveTest extends VCloudClientLiveTest {
@BeforeGroups(groups = { "live" })
@Override
public void setupClient() {
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("bluelock", identity, credential, ImmutableSet
identity = checkNotNull(System.getProperty("bluelock-vcloudexpress.identity"), "bluelock-vcloudexpress.identity");
String credential = checkNotNull(System.getProperty("bluelock-vcloudexpress.credential"),
"bluelock-vcloudexpress.credential");
context = new RestContextFactory().createContext("bluelock-vcloudexpress", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()), new Properties());
connection = context.getApi();
}

View File

@ -36,13 +36,16 @@ public class ProvidersInPropertiesTest {
@Test
public void testSupportedProviders() {
Iterable<String> providers = Utils.getSupportedProviders();
assert Iterables.contains(providers, "bluelock") : providers;
assert Iterables.contains(providers, "bluelock-vcloudexpress") : providers;
assert Iterables.contains(providers, "bluelock-vclouddirector") : providers;
}
@Test
public void testSupportedComputeServiceProviders() {
Iterable<String> providers = ComputeServiceUtils.getSupportedProviders();
assert Iterables.contains(providers, "bluelock") : providers;
assert Iterables.contains(providers, "bluelock-vcloudexpress") : providers;
assert Iterables.contains(providers, "bluelock-vclouddirector") : providers;
}
}

View File

@ -60,14 +60,15 @@ public class VCloudSessionRefreshLiveTest {
@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");
identity = checkNotNull(System.getProperty("bluelock-vclouddirector.identity"), "bluelock-vclouddirector.identity");
String credential = checkNotNull(System.getProperty("bluelock-vclouddirector.credential"),
"bluelock-vclouddirector.credential");
Properties props = new Properties();
props.setProperty(PROPERTY_SESSION_INTERVAL, 40 + "");
context = new ComputeServiceContextFactory().createContext("bluelock", identity, credential, ImmutableSet
.<Module> of(new Log4JLoggingModule()), props);
context = new ComputeServiceContextFactory().createContext("bluelock-vclouddirector", identity, credential,
ImmutableSet.<Module> of(new Log4JLoggingModule()), props);
connection = VCloudClient.class.cast(context.getProviderSpecificContext().getApi());
}

View File

@ -0,0 +1,71 @@
/**
*
* 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 director or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
package org.jclouds.vcloud.bluelock.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
import org.testng.annotations.Test;
/**
*
*
* @author Adrian Cole
*/
@Test(groups = "live", enabled = true, sequential = true, testName = "bluelock.BlueLockVCloudExpressComputeServiceLiveTest")
public class BlueLockVCloudDirectorComputeServiceLiveTest extends VCloudComputeServiceLiveTest {
@Override
public void setServiceDefaults() {
provider = "bluelock-vclouddirector";
tag = "director";
}
@Override
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("bluelock-vclouddirector.identity"),
"bluelock-vclouddirector.identity");
credential = checkNotNull(System.getProperty("bluelock-vclouddirector.credential"),
"bluelock-vclouddirector.credential");
}
@Test
public void testTemplateBuilder() {
Template defaultTemplate = client.templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assert defaultTemplate.getLocation().getId() != null : defaultTemplate.getLocation();
assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
}
@Override
protected Template buildTemplate(TemplateBuilder templateBuilder) {
Template template = super.buildTemplate(templateBuilder);
Image image = template.getImage();
assert image.getDefaultCredentials().identity != null : image;
assert image.getDefaultCredentials().credential != null : image;
return template;
}
}

View File

@ -19,6 +19,7 @@
package org.jclouds.vcloud.bluelock.compute;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals;
import org.jclouds.compute.domain.Image;
@ -26,7 +27,6 @@ import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
@ -34,12 +34,19 @@ import org.testng.annotations.Test;
*
* @author Adrian Cole
*/
@Test(groups = "live", enabled = true, sequential = true, testName = "compute.BlueLockVCloudComputeServiceLiveTest")
public class BlueLockVCloudComputeServiceLiveTest extends VCloudComputeServiceLiveTest {
@BeforeClass
@Test(groups = "live", enabled = true, sequential = true, testName = "bluelock.BlueLockVCloudExpressComputeServiceLiveTest")
public class BlueLockVCloudExpressComputeServiceLiveTest extends VCloudComputeServiceLiveTest {
@Override
public void setServiceDefaults() {
provider = "bluelock";
provider = "bluelock-vcloudexpress";
tag = "vcx";
}
@Override
protected void setupCredentials() {
identity = checkNotNull(System.getProperty("bluelock-vcloudexpress.identity"), "bluelock-vcloudexpress.identity");
credential = checkNotNull(System.getProperty("bluelock-vcloudexpress.credential"),
"bluelock-vcloudexpress.credential");
}
@Test