From 0d06623dcfa88f46937fcaec56d8dd6bb7ddef1a Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Thu, 19 Aug 2010 13:00:44 -0700 Subject: [PATCH] Issue 341: bluelock-vcloudexpress, bluelock-vclouddirector --- core/src/main/resources/rest.properties | 7 +- vcloud/bluelock/pom.xml | 76 ++++++++++++++++++- .../BlueLockVCloudDirectorContextBuilder.java | 63 +++++++++++++++ ...ueLockVCloudDirectorPropertiesBuilder.java | 48 ++++++++++++ ... BlueLockVCloudExpressContextBuilder.java} | 12 +-- ...ueLockVCloudExpressPropertiesBuilder.java} | 4 +- ...> BlueLockVCloudExpressComputeClient.java} | 4 +- ...udExpressComputeServiceContextModule.java} | 12 +-- ...ockVCloudExpressImageForVAppTemplate.java} | 4 +- ...lueLockVCloudExpressRestClientModule.java} | 2 +- .../BlueLockVCloudDirectorClientLiveTest.java | 55 ++++++++++++++ ... BlueLockVCloudExpressClientLiveTest.java} | 9 ++- .../bluelock/ProvidersInPropertiesTest.java | 7 +- .../VCloudSessionRefreshLiveTest.java | 9 ++- ...kVCloudDirectorComputeServiceLiveTest.java | 71 +++++++++++++++++ ...kVCloudExpressComputeServiceLiveTest.java} | 17 +++-- 16 files changed, 361 insertions(+), 39 deletions(-) create mode 100644 vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorContextBuilder.java create mode 100644 vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorPropertiesBuilder.java rename vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/{BlueLockVCloudContextBuilder.java => BlueLockVCloudExpressContextBuilder.java} (82%) rename vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/{BlueLockVCloudPropertiesBuilder.java => BlueLockVCloudExpressPropertiesBuilder.java} (89%) rename vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/{BlueLockVCloudComputeClient.java => BlueLockVCloudExpressComputeClient.java} (89%) rename vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/{BlueLockVCloudComputeServiceContextModule.java => BlueLockVCloudExpressComputeServiceContextModule.java} (78%) rename vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/functions/{BlueLockImageForVAppTemplate.java => BlueLockVCloudExpressImageForVAppTemplate.java} (89%) rename vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/{BlueLockVCloudRestClientModule.java => BlueLockVCloudExpressRestClientModule.java} (97%) create mode 100644 vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorClientLiveTest.java rename vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/{BlueLockVCloudClientLiveTest.java => BlueLockVCloudExpressClientLiveTest.java} (80%) create mode 100644 vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudDirectorComputeServiceLiveTest.java rename vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/{BlueLockVCloudComputeServiceLiveTest.java => BlueLockVCloudExpressComputeServiceLiveTest.java} (78%) diff --git a/core/src/main/resources/rest.properties b/core/src/main/resources/rest.properties index fe611b190c..d1c008b552 100644 --- a/core/src/main/resources/rest.properties +++ b/core/src/main/resources/rest.properties @@ -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 diff --git a/vcloud/bluelock/pom.xml b/vcloud/bluelock/pom.xml index 83b6a1d20a..4794df66f5 100644 --- a/vcloud/bluelock/pom.xml +++ b/vcloud/bluelock/pom.xml @@ -31,9 +31,18 @@ jclouds-bluelock jclouds bluelock Components Core jclouds core components to access bluelock + - ${jclouds.bluelock.user} - ${jclouds.bluelock.password} + + + https://express.bluelock.com/api + 0.8 + FIXME + FIXME + https://vcenterprise.bluelock.com/api + 1.0 + FIXME + FIXME @@ -56,5 +65,66 @@ test - + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration + integration-test + + test + + + + + bluelock-vcloudexpress.endpoint + ${bluelock-vcloudexpress.endpoint} + + + bluelock-vcloudexpress.apiversion + ${bluelock-vcloudexpress.apiversion} + + + bluelock-vcloudexpress.identity + ${bluelock-vcloudexpress.identity} + + + bluelock-vcloudexpress.credential + ${bluelock-vcloudexpress.credential} + + + bluelock-vclouddirector.endpoint + ${bluelock-vclouddirector.endpoint} + + + bluelock-vclouddirector.apiversion + ${bluelock-vclouddirector.apiversion} + + + bluelock-vclouddirector.identity + ${bluelock-vclouddirector.identity} + + + bluelock-vclouddirector.credential + ${bluelock-vclouddirector.credential} + + + jclouds.compute.blacklist.nodes + ${jclouds.compute.blacklist.nodes} + + + + + + + + + + diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorContextBuilder.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorContextBuilder.java new file mode 100644 index 0000000000..22120c1566 --- /dev/null +++ b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorContextBuilder.java @@ -0,0 +1,63 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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. + *

+ * Note that Threadsafe objects will be bound as singletons to the Injector or Context provided. + *

+ *

+ * If no Modules 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 modules) { + modules.add(new BlueLockVCloudExpressComputeServiceContextModule()); + } + + @Override + protected void addClientModule(List modules) { + modules.add(new BlueLockVCloudExpressRestClientModule()); + } + +} diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorPropertiesBuilder.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorPropertiesBuilder.java new file mode 100644 index 0000000000..94816202ed --- /dev/null +++ b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorPropertiesBuilder.java @@ -0,0 +1,48 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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); + } +} diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudContextBuilder.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressContextBuilder.java similarity index 82% rename from vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudContextBuilder.java rename to vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressContextBuilder.java index 6c65ecd46d..f9187854b5 100644 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudContextBuilder.java +++ b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressContextBuilder.java @@ -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 modules) { - modules.add(new BlueLockVCloudComputeServiceContextModule()); + modules.add(new BlueLockVCloudExpressComputeServiceContextModule()); } @Override protected void addClientModule(List modules) { - modules.add(new BlueLockVCloudRestClientModule()); + modules.add(new BlueLockVCloudExpressRestClientModule()); } } diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudPropertiesBuilder.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressPropertiesBuilder.java similarity index 89% rename from vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudPropertiesBuilder.java rename to vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressPropertiesBuilder.java index d86391b17d..22b7455a56 100644 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudPropertiesBuilder.java +++ b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressPropertiesBuilder.java @@ -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); } } diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudComputeClient.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeClient.java similarity index 89% rename from vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudComputeClient.java rename to vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeClient.java index 74e627efe5..9c7e4369fc 100644 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudComputeClient.java +++ b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeClient.java @@ -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 successTester, Map vAppStatusToNodeState) { super(client, successTester, vAppStatusToNodeState); this.credentialsProvider = credentialsProvider; diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/BlueLockVCloudComputeServiceContextModule.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/BlueLockVCloudExpressComputeServiceContextModule.java similarity index 78% rename from vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/BlueLockVCloudComputeServiceContextModule.java rename to vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/BlueLockVCloudExpressComputeServiceContextModule.java index 1fdea89539..1390275b01 100644 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/BlueLockVCloudComputeServiceContextModule.java +++ b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/BlueLockVCloudExpressComputeServiceContextModule.java @@ -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); } diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/functions/BlueLockImageForVAppTemplate.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/functions/BlueLockVCloudExpressImageForVAppTemplate.java similarity index 89% rename from vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/functions/BlueLockImageForVAppTemplate.java rename to vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/functions/BlueLockVCloudExpressImageForVAppTemplate.java index cc0d620607..5214728345 100644 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/functions/BlueLockImageForVAppTemplate.java +++ b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/functions/BlueLockVCloudExpressImageForVAppTemplate.java @@ -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); } diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudRestClientModule.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudExpressRestClientModule.java similarity index 97% rename from vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudRestClientModule.java rename to vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudExpressRestClientModule.java index 3e56163d16..f8a3ea852d 100644 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudRestClientModule.java +++ b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudExpressRestClientModule.java @@ -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, diff --git a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorClientLiveTest.java b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorClientLiveTest.java new file mode 100644 index 0000000000..53dbbe5533 --- /dev/null +++ b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudDirectorClientLiveTest.java @@ -0,0 +1,55 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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 + . of(new Log4JLoggingModule()), new Properties()); + connection = context.getApi(); + } + +} diff --git a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudClientLiveTest.java b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressClientLiveTest.java similarity index 80% rename from vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudClientLiveTest.java rename to vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressClientLiveTest.java index 40cb827765..b4c5bdbb25 100644 --- a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudClientLiveTest.java +++ b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressClientLiveTest.java @@ -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 . of(new Log4JLoggingModule()), new Properties()); connection = context.getApi(); } diff --git a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/ProvidersInPropertiesTest.java b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/ProvidersInPropertiesTest.java index 58e3efac36..67e6511e09 100644 --- a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/ProvidersInPropertiesTest.java +++ b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/ProvidersInPropertiesTest.java @@ -36,13 +36,16 @@ public class ProvidersInPropertiesTest { @Test public void testSupportedProviders() { Iterable 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 providers = ComputeServiceUtils.getSupportedProviders(); - assert Iterables.contains(providers, "bluelock") : providers; + assert Iterables.contains(providers, "bluelock-vcloudexpress") : providers; + assert Iterables.contains(providers, "bluelock-vclouddirector") : providers; } } diff --git a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/VCloudSessionRefreshLiveTest.java b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/VCloudSessionRefreshLiveTest.java index d3bd466193..c17842e70e 100644 --- a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/VCloudSessionRefreshLiveTest.java +++ b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/VCloudSessionRefreshLiveTest.java @@ -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 - . of(new Log4JLoggingModule()), props); + context = new ComputeServiceContextFactory().createContext("bluelock-vclouddirector", identity, credential, + ImmutableSet. of(new Log4JLoggingModule()), props); connection = VCloudClient.class.cast(context.getProviderSpecificContext().getApi()); } diff --git a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudDirectorComputeServiceLiveTest.java b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudDirectorComputeServiceLiveTest.java new file mode 100644 index 0000000000..ce801b154b --- /dev/null +++ b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudDirectorComputeServiceLiveTest.java @@ -0,0 +1,71 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * 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; + } + +} diff --git a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudComputeServiceLiveTest.java b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeServiceLiveTest.java similarity index 78% rename from vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudComputeServiceLiveTest.java rename to vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeServiceLiveTest.java index e46a2cf410..cb66134353 100644 --- a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudComputeServiceLiveTest.java +++ b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeServiceLiveTest.java @@ -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