From 4c0fc5d0e0c9bd1462efcfd7bcb379e90418ec1b Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Wed, 8 Sep 2010 18:53:38 -0700 Subject: [PATCH] Issue 176: remove interim vcloud express support --- core/src/main/resources/rest.properties | 3 - .../build.properties.bluelock-vcloudexpress | 5 - .../cargooverssh/build.properties.ibmdev | 5 - .../antcontrib/samples/cargooverssh/build.xml | 2 +- .../build.properties.bluelock-vcloudexpress | 5 - .../samples/compute/build.properties.ibmdev | 5 - tools/antcontrib/samples/compute/build.xml | 2 +- vcloud/bluelock/README.txt | 2 +- vcloud/bluelock/pom.xml | 20 ---- .../BlueLockVCloudExpressContextBuilder.java | 63 ---------- ...lueLockVCloudExpressPropertiesBuilder.java | 46 -------- .../BlueLockVCloudExpressComputeClient.java | 63 ---------- ...oudExpressComputeServiceContextModule.java | 57 --------- .../suppliers/ParseSizeFromImageSupplier.java | 111 ------------------ .../BlueLockVCloudImageForVAppTemplate.java | 47 -------- ...efaultLoginCredentialsFromBlueLockFAQ.java | 57 --------- ...BlueLockVCloudExpressRestClientModule.java | 60 ---------- .../BlueLockVCloudExpressClientLiveTest.java | 54 --------- .../bluelock/ProvidersInPropertiesTest.java | 2 - ...ckVCloudExpressComputeServiceLiveTest.java | 70 ----------- 20 files changed, 3 insertions(+), 676 deletions(-) delete mode 100644 tools/antcontrib/samples/cargooverssh/build.properties.bluelock-vcloudexpress delete mode 100644 tools/antcontrib/samples/cargooverssh/build.properties.ibmdev delete mode 100644 tools/antcontrib/samples/compute/build.properties.bluelock-vcloudexpress delete mode 100644 tools/antcontrib/samples/compute/build.properties.ibmdev delete mode 100644 vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressContextBuilder.java delete mode 100644 vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressPropertiesBuilder.java delete mode 100644 vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeClient.java delete mode 100644 vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/BlueLockVCloudExpressComputeServiceContextModule.java delete mode 100644 vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/suppliers/ParseSizeFromImageSupplier.java delete mode 100644 vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/functions/BlueLockVCloudImageForVAppTemplate.java delete mode 100644 vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/strategy/DefaultLoginCredentialsFromBlueLockFAQ.java delete mode 100644 vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudExpressRestClientModule.java delete mode 100644 vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressClientLiveTest.java delete mode 100644 vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeServiceLiveTest.java diff --git a/core/src/main/resources/rest.properties b/core/src/main/resources/rest.properties index 520c44adc7..c65c3b11bd 100644 --- a/core/src/main/resources/rest.properties +++ b/core/src/main/resources/rest.properties @@ -83,9 +83,6 @@ cloudservers.propertiesbuilder=org.jclouds.rackspace.RackspacePropertiesBuilder 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/tools/antcontrib/samples/cargooverssh/build.properties.bluelock-vcloudexpress b/tools/antcontrib/samples/cargooverssh/build.properties.bluelock-vcloudexpress deleted file mode 100644 index 3103999af4..0000000000 --- a/tools/antcontrib/samples/cargooverssh/build.properties.bluelock-vcloudexpress +++ /dev/null @@ -1,5 +0,0 @@ -provider=bluelock-vcloudexpress -driver=bluelock -identity=user@youregistered.com -credential=password -tag=name_of_your_vapp diff --git a/tools/antcontrib/samples/cargooverssh/build.properties.ibmdev b/tools/antcontrib/samples/cargooverssh/build.properties.ibmdev deleted file mode 100644 index 8e3e7b5b9d..0000000000 --- a/tools/antcontrib/samples/cargooverssh/build.properties.ibmdev +++ /dev/null @@ -1,5 +0,0 @@ -provider=ibmdev -driver=ibmdev -identity=user@youregistered.com -credential=password -tag=name_of_your_server diff --git a/tools/antcontrib/samples/cargooverssh/build.xml b/tools/antcontrib/samples/cargooverssh/build.xml index 042c67636c..05e0294846 100644 --- a/tools/antcontrib/samples/cargooverssh/build.xml +++ b/tools/antcontrib/samples/cargooverssh/build.xml @@ -38,7 +38,7 @@ diff --git a/tools/antcontrib/samples/compute/build.properties.bluelock-vcloudexpress b/tools/antcontrib/samples/compute/build.properties.bluelock-vcloudexpress deleted file mode 100644 index 3103999af4..0000000000 --- a/tools/antcontrib/samples/compute/build.properties.bluelock-vcloudexpress +++ /dev/null @@ -1,5 +0,0 @@ -provider=bluelock-vcloudexpress -driver=bluelock -identity=user@youregistered.com -credential=password -tag=name_of_your_vapp diff --git a/tools/antcontrib/samples/compute/build.properties.ibmdev b/tools/antcontrib/samples/compute/build.properties.ibmdev deleted file mode 100644 index 8e3e7b5b9d..0000000000 --- a/tools/antcontrib/samples/compute/build.properties.ibmdev +++ /dev/null @@ -1,5 +0,0 @@ -provider=ibmdev -driver=ibmdev -identity=user@youregistered.com -credential=password -tag=name_of_your_server diff --git a/tools/antcontrib/samples/compute/build.xml b/tools/antcontrib/samples/compute/build.xml index a188b60483..b914b1456d 100644 --- a/tools/antcontrib/samples/compute/build.xml +++ b/tools/antcontrib/samples/compute/build.xml @@ -31,7 +31,7 @@ diff --git a/vcloud/bluelock/README.txt b/vcloud/bluelock/README.txt index 4b8c0dfbcc..3eb7e8335e 100644 --- a/vcloud/bluelock/README.txt +++ b/vcloud/bluelock/README.txt @@ -18,7 +18,7 @@ ==== # -# The jclouds provider for Hosting.com's vCloud Express (http://www.bluelock/vcloudexpress/) platform. +# The jclouds provider for BlueLock's vCloud Director platform. # # TODO: Implementation status. # TODO: Supported features. diff --git a/vcloud/bluelock/pom.xml b/vcloud/bluelock/pom.xml index 4794df66f5..234dfe213f 100644 --- a/vcloud/bluelock/pom.xml +++ b/vcloud/bluelock/pom.xml @@ -35,10 +35,6 @@ - https://express.bluelock.com/api - 0.8 - FIXME - FIXME https://vcenterprise.bluelock.com/api 1.0 FIXME @@ -82,22 +78,6 @@ - - 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} diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressContextBuilder.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressContextBuilder.java deleted file mode 100644 index 7dd776267c..0000000000 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressContextBuilder.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * 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.VCloudExpressContextBuilder; -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 BlueLockVCloudExpressContextBuilder extends VCloudExpressContextBuilder { - - public BlueLockVCloudExpressContextBuilder(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/BlueLockVCloudExpressPropertiesBuilder.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressPropertiesBuilder.java deleted file mode 100644 index c8a5e99529..0000000000 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressPropertiesBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - * 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_ENDPOINT; -import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_NETWORK; - -import java.util.Properties; - -import org.jclouds.vcloud.VCloudExpressPropertiesBuilder; - -/** - * Builds properties used in bluelock VCloud Clients - * - * @author Adrian Cole - */ -public class BlueLockVCloudExpressPropertiesBuilder extends VCloudExpressPropertiesBuilder { - @Override - protected Properties defaultProperties() { - Properties properties = super.defaultProperties(); - properties.setProperty(PROPERTY_ENDPOINT, "https://express.bluelock.com/api"); - properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, "Internal In and Out"); - return properties; - } - - public BlueLockVCloudExpressPropertiesBuilder(Properties properties) { - super(properties); - } -} diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeClient.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeClient.java deleted file mode 100644 index c12cc1247b..0000000000 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeClient.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * - * 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.compute; - -import java.net.URI; -import java.util.Map; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.NodeState; -import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy; -import org.jclouds.domain.Credentials; -import org.jclouds.vcloud.VCloudExpressClient; -import org.jclouds.vcloud.compute.internal.VCloudExpressComputeClientImpl; -import org.jclouds.vcloud.domain.Status; -import org.jclouds.vcloud.domain.VCloudExpressVApp; -import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate; - -import com.google.common.base.Predicate; - -/** - * @author Adrian Cole - */ -@Singleton -public class BlueLockVCloudExpressComputeClient extends VCloudExpressComputeClientImpl { - private final PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider; - - @Inject - protected BlueLockVCloudExpressComputeClient(PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider, - VCloudExpressClient client, Predicate successTester, Map vAppStatusToNodeState) { - super(client, successTester, vAppStatusToNodeState); - this.credentialsProvider = credentialsProvider; - } - - @Override - protected Map parseAndValidateResponse(VCloudExpressVAppTemplate template, - VCloudExpressVApp vAppResponse) { - Credentials credentials = credentialsProvider.execute(template); - Map toReturn = super.parseResponse(template, vAppResponse); - toReturn.put("username", credentials.identity); - toReturn.put("password", credentials.credential); - return toReturn; - } - -} \ No newline at end of file diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/BlueLockVCloudExpressComputeServiceContextModule.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/BlueLockVCloudExpressComputeServiceContextModule.java deleted file mode 100644 index 702b52c8b3..0000000000 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/BlueLockVCloudExpressComputeServiceContextModule.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * - * 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.compute.config; - -import java.util.Set; - -import org.jclouds.compute.domain.Size; -import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy; -import org.jclouds.vcloud.bluelock.compute.BlueLockVCloudExpressComputeClient; -import org.jclouds.vcloud.bluelock.compute.config.suppliers.ParseSizeFromImageSupplier; -import org.jclouds.vcloud.bluelock.compute.functions.BlueLockVCloudImageForVAppTemplate; -import org.jclouds.vcloud.bluelock.compute.strategy.DefaultLoginCredentialsFromBlueLockFAQ; -import org.jclouds.vcloud.compute.VCloudExpressComputeClient; -import org.jclouds.vcloud.compute.config.VCloudExpressComputeServiceContextModule; -import org.jclouds.vcloud.compute.functions.ImageForVCloudExpressVAppTemplate; - -import com.google.common.base.Supplier; -import com.google.inject.Injector; - -/** - * Configures the {@link BlueLockVCloudComputeServiceContext}; requires - * {@link BlueLockVCloudExpressComputeClient} bound. - * - * @author Adrian Cole - */ -public class BlueLockVCloudExpressComputeServiceContextModule extends VCloudExpressComputeServiceContextModule { - - @Override - protected void configure() { - super.configure(); - bind(ImageForVCloudExpressVAppTemplate.class).to(BlueLockVCloudImageForVAppTemplate.class); - bind(VCloudExpressComputeClient.class).to(BlueLockVCloudExpressComputeClient.class); - bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(DefaultLoginCredentialsFromBlueLockFAQ.class); - } - - @Override - protected Supplier> getSourceSizeSupplier(Injector injector) { - return injector.getInstance(ParseSizeFromImageSupplier.class); - } -} diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/suppliers/ParseSizeFromImageSupplier.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/suppliers/ParseSizeFromImageSupplier.java deleted file mode 100644 index c144b5d31a..0000000000 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/config/suppliers/ParseSizeFromImageSupplier.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * - * 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.compute.config.suppliers; - -import static com.google.common.collect.Iterables.filter; -import static com.google.common.collect.Iterables.transform; -import static com.google.common.collect.Sets.newLinkedHashSet; - -import java.util.NoSuchElementException; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.annotation.Resource; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.Image; -import org.jclouds.compute.domain.Size; -import org.jclouds.compute.domain.internal.SizeImpl; -import org.jclouds.compute.predicates.ImagePredicates; -import org.jclouds.compute.reference.ComputeServiceConstants; -import org.jclouds.logging.Logger; -import org.jclouds.vcloud.compute.domain.VCloudExpressImage; -import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate; - -import com.google.common.base.Function; -import com.google.common.base.Predicates; -import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableMap; - -/** - * @author Adrian Cole - */ -@Singleton -public class ParseSizeFromImageSupplier implements Supplier> { - // ex Ubuntu904Serverx64 1CPUx16GBx20GB - public static final Pattern GBRAM_PATTERN = Pattern.compile("[^ ] ([0-9]+)CPUx([0-9]+)GBx([0-9]+)GB"); - - // ex Windows2008stdx64 1CPUx512MBx30GB - public static final Pattern MBRAM_PATTERN = Pattern.compile("[^ ] ([0-9]+)CPUx([0-9]+)MBx([0-9]+)GB"); - - @Resource - @Named(ComputeServiceConstants.COMPUTE_LOGGER) - public Logger logger = Logger.NULL; - - private final Supplier> images; - - @Inject - ParseSizeFromImageSupplier(Supplier> images) { - this.images = images; - } - - @Override - public Set get() { - - return newLinkedHashSet(filter(transform(images.get(), new Function() { - - @Override - public Size apply(Image from) { - try { - VCloudExpressVAppTemplate template = VCloudExpressImage.class.cast(from).getVAppTemplate(); - Matcher matcher = getMatcherAndFind(template.getName()); - double cores = Double.parseDouble(matcher.group(1)); - int ram = Integer.parseInt(matcher.group(2)); - if (matcher.pattern().equals(GBRAM_PATTERN)) - ram *= 1024; - int disk = Integer.parseInt(matcher.group(3)); - String name = template.getName().split(" ")[1]; - return new SizeImpl(from.getId(), name, from.getId(), from.getLocation(), null, ImmutableMap - . of(), cores, ram, disk, ImagePredicates.idEquals(from.getId())); - } catch (NoSuchElementException e) { - logger.debug("<< didn't match at all(%s)", from); - return null; - } - } - }), Predicates.notNull())); - } - - /** - * - * @throws NoSuchElementException - * if no configured matcher matches the name. - */ - private Matcher getMatcherAndFind(String name) { - for (Pattern pattern : new Pattern[] { GBRAM_PATTERN, MBRAM_PATTERN }) { - Matcher matcher = pattern.matcher(name); - if (matcher.find()) - return matcher; - } - throw new NoSuchElementException(name); - } -} \ No newline at end of file diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/functions/BlueLockVCloudImageForVAppTemplate.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/functions/BlueLockVCloudImageForVAppTemplate.java deleted file mode 100644 index f6bc9c1b87..0000000000 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/functions/BlueLockVCloudImageForVAppTemplate.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * - * 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.compute.functions; - -import javax.inject.Inject; -import javax.inject.Singleton; - -import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy; -import org.jclouds.vcloud.compute.functions.FindLocationForResource; -import org.jclouds.vcloud.compute.functions.ImageForVCloudExpressVAppTemplate; - -/** - * - * @author Adrian Cole - */ -@Singleton -public class BlueLockVCloudImageForVAppTemplate extends ImageForVCloudExpressVAppTemplate { - - @Inject - protected BlueLockVCloudImageForVAppTemplate(FindLocationForResource findLocationForResource, - PopulateDefaultLoginCredentialsForImageStrategy credentialsProvider) { - super(findLocationForResource, credentialsProvider); - } - - // Extremely important, as otherwise the size encoded into the name will throw off the - // template matching, accidentally choosing the largest size by default - protected String getName(String name) { - return name.split(" ")[0]; - } -} \ No newline at end of file diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/strategy/DefaultLoginCredentialsFromBlueLockFAQ.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/strategy/DefaultLoginCredentialsFromBlueLockFAQ.java deleted file mode 100644 index 4c60e0f867..0000000000 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/compute/strategy/DefaultLoginCredentialsFromBlueLockFAQ.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * - * 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.compute.strategy; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -import javax.inject.Singleton; - -import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy; -import org.jclouds.domain.Credentials; -import org.jclouds.vcloud.domain.VCloudExpressVAppTemplate; - -/** - * - * from https://forums.bluelock.com/faq.php?faq=vcloudexpressfaq - * - * @author Adrian Cole - * - */ -@Singleton -public class DefaultLoginCredentialsFromBlueLockFAQ implements PopulateDefaultLoginCredentialsForImageStrategy { - - @Override - public Credentials execute(Object resourceToAuthenticate) { - checkNotNull(resourceToAuthenticate); - checkArgument(resourceToAuthenticate instanceof VCloudExpressVAppTemplate, - "Resource must be an VCloudExpressVAppTemplate (for Bluelock vCloud Express)"); - VCloudExpressVAppTemplate template = (VCloudExpressVAppTemplate) resourceToAuthenticate; - if (template.getDescription().indexOf("Windows") >= 0) { - return new Credentials("expressuser", "ExpressPassword#1"); - } else { - if (template.getDescription().indexOf("buntu") != -1) { - return new Credentials("express", "ExpressPassword#1"); - } else { - return new Credentials("root", "ExpressPassword#1"); - } - } - } -} diff --git a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudExpressRestClientModule.java b/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudExpressRestClientModule.java deleted file mode 100644 index d5e09048cc..0000000000 --- a/vcloud/bluelock/src/main/java/org/jclouds/vcloud/bluelock/config/BlueLockVCloudExpressRestClientModule.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * - * 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.config; - -import static com.google.common.base.Preconditions.checkState; -import static org.jclouds.Constants.PROPERTY_IDENTITY; - -import java.net.URI; - -import javax.inject.Named; - -import org.jclouds.http.RequiresHttp; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.vcloud.config.VCloudExpressRestClientModule; -import org.jclouds.vcloud.domain.Org; -import org.jclouds.vcloud.domain.ReferenceType; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -/** - * Configures the VCloud authentication service connection, including logging and http transport. - * - * @author Adrian Cole - */ -@RequiresHttp -@ConfiguresRestClient -public class BlueLockVCloudExpressRestClientModule extends VCloudExpressRestClientModule { - - - @Override - protected URI provideCatalog(Org org, @Named(PROPERTY_IDENTITY) final String user) { - checkState(org.getCatalogs().size() > 0, "No catalogs present in org: " + org.getName()); - return Iterables.getOnlyElement(Iterables.filter(org.getCatalogs().values(), new Predicate() { - - @Override - public boolean apply(ReferenceType input) { - return input.getName().startsWith(user); - } - - })).getHref(); - } -} diff --git a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressClientLiveTest.java b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressClientLiveTest.java deleted file mode 100644 index 0b6412b02f..0000000000 --- a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/BlueLockVCloudExpressClientLiveTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - * 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 com.google.common.base.Preconditions.checkNotNull; - -import java.util.Properties; - -import org.jclouds.compute.ComputeServiceContextFactory; -import org.jclouds.logging.log4j.config.Log4JLoggingModule; -import org.jclouds.vcloud.VCloudExpressClientLiveTest; -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 = "vcloud.BlueLockVCloudClientLiveTest") -public class BlueLockVCloudExpressClientLiveTest extends VCloudExpressClientLiveTest { - - @BeforeGroups(groups = { "live" }) - @Override - public void setupClient() { - identity = checkNotNull(System.getProperty("bluelock-vcloudexpress.identity"), "bluelock-vcloudexpress.identity"); - String credential = checkNotNull(System.getProperty("bluelock-vcloudexpress.credential"), - "bluelock-vcloudexpress.credential"); - context = new ComputeServiceContextFactory().createContext("bluelock-vcloudexpress", identity, credential, - ImmutableSet. of(new Log4JLoggingModule()), new Properties()).getProviderSpecificContext(); - 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 67e6511e09..cf2f3367a1 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,7 +36,6 @@ public class ProvidersInPropertiesTest { @Test public void testSupportedProviders() { Iterable providers = Utils.getSupportedProviders(); - assert Iterables.contains(providers, "bluelock-vcloudexpress") : providers; assert Iterables.contains(providers, "bluelock-vclouddirector") : providers; } @@ -44,7 +43,6 @@ public class ProvidersInPropertiesTest { @Test public void testSupportedComputeServiceProviders() { Iterable providers = ComputeServiceUtils.getSupportedProviders(); - 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/compute/BlueLockVCloudExpressComputeServiceLiveTest.java b/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeServiceLiveTest.java deleted file mode 100644 index 4b0d1ef294..0000000000 --- a/vcloud/bluelock/src/test/java/org/jclouds/vcloud/bluelock/compute/BlueLockVCloudExpressComputeServiceLiveTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * - * 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.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.VCloudExpressComputeServiceLiveTest; -import org.testng.annotations.Test; - -/** - * - * - * @author Adrian Cole - */ -@Test(groups = "live", enabled = true, sequential = true, testName = "bluelock.BlueLockVCloudExpressComputeServiceLiveTest") -public class BlueLockVCloudExpressComputeServiceLiveTest extends VCloudExpressComputeServiceLiveTest { - @Override - public void setServiceDefaults() { - 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 - public void testTemplateBuilder() { - Template defaultTemplate = client.templateBuilder().build(); - assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); - assertEquals(defaultTemplate.getLocation().getId(), "https://express3.bluelock.com/api/v0.8/vdc/133"); - 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; - } - -}