diff --git a/providers/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java index ba8b9d48a2..b961ca8f63 100644 --- a/providers/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java +++ b/providers/profitbricks/src/main/java/org/jclouds/profitbricks/ProfitBricksProviderMetadata.java @@ -16,6 +16,7 @@ */ package org.jclouds.profitbricks; +import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; import static org.jclouds.Constants.PROPERTY_SO_TIMEOUT; import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_RUNNING; import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_SUSPENDED; @@ -64,6 +65,9 @@ public class ProfitBricksProviderMetadata extends BaseProviderMetadata { properties.setProperty(PROPERTY_REGION + ".de.zones", "de/fkb,de/fra"); properties.setProperty(PROPERTY_REGION + ".us.zones", "us/las,us/lasdev"); properties.setProperty(PROPERTY_ZONES, "de/fkb,de/fra,us/las,us/lasdev"); + properties.setProperty(PROPERTY_ISO3166_CODES, "DE-BW,DE-HE,US_NV"); + properties.setProperty(PROPERTY_REGION + ".de." + ISO3166_CODES, "DE-BW,DE-HE"); + properties.setProperty(PROPERTY_REGION + ".us." + ISO3166_CODES, "US-NV"); properties.setProperty(PROPERTY_ZONE + ".de/fkb." + ISO3166_CODES, "DE-BW"); properties.setProperty(PROPERTY_ZONE + ".de/fra." + ISO3166_CODES, "DE-HE"); properties.setProperty(PROPERTY_ZONE + ".us/las." + ISO3166_CODES, "US-NV"); diff --git a/providers/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksTemplateBuilderLiveTest.java b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksTemplateBuilderLiveTest.java index f81ca289de..ae498d8d43 100644 --- a/providers/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksTemplateBuilderLiveTest.java +++ b/providers/profitbricks/src/test/java/org/jclouds/profitbricks/compute/ProfitBricksTemplateBuilderLiveTest.java @@ -16,88 +16,23 @@ */ package org.jclouds.profitbricks.compute; -import static org.jclouds.profitbricks.BaseProfitBricksLiveTest.testLocation; -import static org.jclouds.profitbricks.config.ProfitBricksComputeProperties.POLL_PREDICATE_DATACENTER; - -import java.util.Objects; import java.util.Set; -import com.google.common.base.Predicate; -import com.google.common.base.Supplier; -import com.google.common.collect.FluentIterable; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Key; -import com.google.inject.TypeLiteral; -import com.google.inject.name.Names; - import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest; -import org.jclouds.profitbricks.ProfitBricksApi; -import org.jclouds.profitbricks.domain.DataCenter; -import org.jclouds.profitbricks.features.DataCenterApi; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import com.google.common.collect.ImmutableSet; + @Test(groups = "live", testName = "ProfitBricksTemplateBuilderLiveTest", singleThreaded = true) public class ProfitBricksTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { - private static final String TEST_DC_NAME = "templateBuilderLiveTest-" + System.currentTimeMillis(); - - private DataCenter dataCenter; - public ProfitBricksTemplateBuilderLiveTest() { this.provider = "profitbricks"; } - @BeforeClass - @Override - public void setupContext() { - super.setupContext(); - - final DataCenterApi api = getDataCenterApi(); - final Predicate predicate = getDataCenterPredicate(); - dataCenter = FluentIterable.from(api.getAllDataCenters()).firstMatch(new Predicate() { - - @Override - public boolean apply(DataCenter input) { - boolean match = Objects.equals(input.name(), TEST_DC_NAME); - if (match && input.location() == testLocation) - return predicate.apply(input.id()); - return match; - } - }).or(new Supplier() { - - @Override - public DataCenter get() { - DataCenter dataCenter = api.createDataCenter( - DataCenter.Request.creatingPayload(TEST_DC_NAME, testLocation)); - predicate.apply(dataCenter.id()); - - return api.getDataCenter(dataCenter.id()); - } - }); - } - - private Predicate getDataCenterPredicate() { - return view.utils().injector().getInstance(Key.get(new TypeLiteral>() { - }, Names.named(POLL_PREDICATE_DATACENTER))); - } - - private DataCenterApi getDataCenterApi() { - return view.unwrapApi(ProfitBricksApi.class).dataCenterApi(); - } - - @AfterClass(groups = {"integration", "live"}, alwaysRun = true) - @Override - protected void tearDownContext() { - super.tearDownContext(); - if (dataCenter != null) - getDataCenterApi().deleteDataCenter(dataCenter.id()); - } - @Override protected Set getIso3166Codes() { - return ImmutableSet.of(); + return ImmutableSet.of("DE-BW", "DE-HE", "US-NV"); } }