From ccb9709d0556eecd4f65bb152bdb4d1983574bfb Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Wed, 1 Jun 2011 20:26:10 -0700 Subject: [PATCH] Issue 550: metadata for slicehost --- providers/slicehost/pom.xml | 2 + .../slicehost/SlicehostProviderMetadata.java | 116 ++++++++++++++++++ .../org.jclouds.providers.ProviderMetadata | 1 + ...esTest.java => SlicehostProviderTest.java} | 25 ++-- 4 files changed, 126 insertions(+), 18 deletions(-) create mode 100644 providers/slicehost/src/main/java/org/jclouds/slicehost/SlicehostProviderMetadata.java create mode 100644 providers/slicehost/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata rename providers/slicehost/src/test/java/org/jclouds/slicehost/{ProvidersInPropertiesTest.java => SlicehostProviderTest.java} (59%) diff --git a/providers/slicehost/pom.xml b/providers/slicehost/pom.xml index eb2b07edb7..4965c905ad 100644 --- a/providers/slicehost/pom.xml +++ b/providers/slicehost/pom.xml @@ -102,6 +102,8 @@ test + + 1 test.slicehost.endpoint diff --git a/providers/slicehost/src/main/java/org/jclouds/slicehost/SlicehostProviderMetadata.java b/providers/slicehost/src/main/java/org/jclouds/slicehost/SlicehostProviderMetadata.java new file mode 100644 index 0000000000..e83853ca37 --- /dev/null +++ b/providers/slicehost/src/main/java/org/jclouds/slicehost/SlicehostProviderMetadata.java @@ -0,0 +1,116 @@ +/** + * + * Copyright (C) 2011 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.slicehost; + +import java.net.URI; +import java.util.Set; + +import org.jclouds.providers.BaseProviderMetadata; +import org.jclouds.providers.ProviderMetadata; + +import com.google.common.collect.ImmutableSet; + +/** + * Implementation of {@link org.jclouds.types.ProviderMetadata} for Slicehost + * + * @author Adrian Cole + */ +public class SlicehostProviderMetadata extends BaseProviderMetadata { + + /** + * {@inheritDoc} + */ + @Override + public String getId() { + return "slicehost"; + } + + /** + * {@inheritDoc} + */ + @Override + public String getType() { + return ProviderMetadata.COMPUTE_TYPE; + } + + /** + * {@inheritDoc} + */ + @Override + public String getName() { + return "Slicehost"; + } + + /** + * {@inheritDoc} + */ + @Override + public String getIdentityName() { + return "API password"; + } + + /** + * {@inheritDoc} + */ + @Override + public String getCredentialName() { + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public URI getHomepage() { + return URI.create("http://www.slicehost.com"); + } + + /** + * {@inheritDoc} + */ + @Override + public URI getConsole() { + return URI.create("https://manage.slicehost.com/"); + } + + /** + * {@inheritDoc} + */ + @Override + public URI getApiDocumentation() { + return URI.create("http://articles.slicehost.com/api"); + } + + /** + * {@inheritDoc} + */ + @Override + public Set getLinkedServices() { + return ImmutableSet.of("slicehost"); + } + + /** + * {@inheritDoc} + */ + @Override + public Set getIso3166Codes() { + return ImmutableSet.of("US-IL", "US-TX", "US-MO"); + } + +} \ No newline at end of file diff --git a/providers/slicehost/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/providers/slicehost/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata new file mode 100644 index 0000000000..78e0e800bc --- /dev/null +++ b/providers/slicehost/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata @@ -0,0 +1 @@ +org.jclouds.slicehost.SlicehostProviderMetadata diff --git a/providers/slicehost/src/test/java/org/jclouds/slicehost/ProvidersInPropertiesTest.java b/providers/slicehost/src/test/java/org/jclouds/slicehost/SlicehostProviderTest.java similarity index 59% rename from providers/slicehost/src/test/java/org/jclouds/slicehost/ProvidersInPropertiesTest.java rename to providers/slicehost/src/test/java/org/jclouds/slicehost/SlicehostProviderTest.java index a308276784..e564fc333f 100644 --- a/providers/slicehost/src/test/java/org/jclouds/slicehost/ProvidersInPropertiesTest.java +++ b/providers/slicehost/src/test/java/org/jclouds/slicehost/SlicehostProviderTest.java @@ -18,29 +18,18 @@ */ package org.jclouds.slicehost; -import org.jclouds.compute.util.ComputeServiceUtils; -import org.jclouds.rest.Providers; +import org.jclouds.providers.BaseProviderMetadataTest; +import org.jclouds.providers.ProviderMetadata; import org.testng.annotations.Test; -import com.google.common.collect.Iterables; - /** * * @author Adrian Cole - * */ -@Test(groups = "unit") -public class ProvidersInPropertiesTest { +@Test(groups = "unit", testName = "SlicehostProviderTest") +public class SlicehostProviderTest extends BaseProviderMetadataTest { - @Test - public void testSupportedComputeServiceProviders() { - Iterable providers = ComputeServiceUtils.getSupportedProviders(); - assert Iterables.contains(providers, "slicehost") : providers; + public SlicehostProviderTest() { + super(new SlicehostProviderMetadata(), ProviderMetadata.COMPUTE_TYPE); } - - @Test - public void testSupportedProviders() { - Iterable providers = Providers.getSupportedProviders(); - assert Iterables.contains(providers, "slicehost") : providers; - } -} +} \ No newline at end of file