diff --git a/core/src/main/resources/rest.properties b/core/src/main/resources/rest.properties index 76cd22a9a7..c8442950b8 100644 --- a/core/src/main/resources/rest.properties +++ b/core/src/main/resources/rest.properties @@ -22,6 +22,9 @@ aws-simpledb.propertiesbuilder=org.jclouds.aws.simpledb.AWSSimpleDBPropertiesBui aws-sqs.contextbuilder=org.jclouds.sqs.SQSContextBuilder aws-sqs.propertiesbuilder=org.jclouds.aws.sqs.AWSSQSPropertiesBuilder +elb.contextbuilder=org.jclouds.elb.ELBContextBuilder +elb.propertiesbuilder=org.jclouds.elb.ELBPropertiesBuilder + aws-elb.contextbuilder=org.jclouds.elb.ELBContextBuilder aws-elb.propertiesbuilder=org.jclouds.aws.elb.AWSELBPropertiesBuilder diff --git a/sandbox-providers/aws-elb/README.txt b/labs/aws-elb/README.txt similarity index 100% rename from sandbox-providers/aws-elb/README.txt rename to labs/aws-elb/README.txt diff --git a/sandbox-providers/aws-elb/pom.xml b/labs/aws-elb/pom.xml similarity index 98% rename from sandbox-providers/aws-elb/pom.xml rename to labs/aws-elb/pom.xml index 0227cb482c..c4a43951db 100644 --- a/sandbox-providers/aws-elb/pom.xml +++ b/labs/aws-elb/pom.xml @@ -27,7 +27,7 @@ 1.5.0-SNAPSHOT ../../project/pom.xml - org.jclouds.provider + org.jclouds.labs aws-elb jclouds Amazon Elastic Load Balancer provider Elastic Load Balancer implementation targeted to Amazon Web Services @@ -50,13 +50,13 @@ - org.jclouds.api + org.jclouds.labs elb ${project.version} jar - org.jclouds.api + org.jclouds.labs elb ${project.version} test-jar diff --git a/sandbox-providers/aws-elb/src/main/java/org/jclouds/aws/elb/AWSELBPropertiesBuilder.java b/labs/aws-elb/src/main/java/org/jclouds/aws/elb/AWSELBPropertiesBuilder.java similarity index 98% rename from sandbox-providers/aws-elb/src/main/java/org/jclouds/aws/elb/AWSELBPropertiesBuilder.java rename to labs/aws-elb/src/main/java/org/jclouds/aws/elb/AWSELBPropertiesBuilder.java index 759565c7ff..f22894ab4e 100644 --- a/sandbox-providers/aws-elb/src/main/java/org/jclouds/aws/elb/AWSELBPropertiesBuilder.java +++ b/labs/aws-elb/src/main/java/org/jclouds/aws/elb/AWSELBPropertiesBuilder.java @@ -69,10 +69,6 @@ public class AWSELBPropertiesBuilder extends ELBPropertiesBuilder { return properties; } - public AWSELBPropertiesBuilder() { - super(); - } - public AWSELBPropertiesBuilder(Properties properties) { super(properties); } diff --git a/sandbox-providers/aws-elb/src/main/java/org/jclouds/aws/elb/AWSELBProviderMetadata.java b/labs/aws-elb/src/main/java/org/jclouds/aws/elb/AWSELBProviderMetadata.java similarity index 100% rename from sandbox-providers/aws-elb/src/main/java/org/jclouds/aws/elb/AWSELBProviderMetadata.java rename to labs/aws-elb/src/main/java/org/jclouds/aws/elb/AWSELBProviderMetadata.java diff --git a/sandbox-providers/aws-elb/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/labs/aws-elb/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata similarity index 100% rename from sandbox-providers/aws-elb/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata rename to labs/aws-elb/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata diff --git a/sandbox-providers/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBAsyncClientTest.java b/labs/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBAsyncClientTest.java similarity index 100% rename from sandbox-providers/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBAsyncClientTest.java rename to labs/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBAsyncClientTest.java diff --git a/sandbox-providers/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBClientLiveTest.java b/labs/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBClientLiveTest.java similarity index 92% rename from sandbox-providers/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBClientLiveTest.java rename to labs/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBClientLiveTest.java index d8aa824f68..25bc4e26af 100644 --- a/sandbox-providers/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBClientLiveTest.java +++ b/labs/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBClientLiveTest.java @@ -27,7 +27,7 @@ import org.testng.annotations.Test; * * @author Adrian Cole */ -@Test(groups = "live", sequential = true, testName = "AWSELBClientLiveTest") +@Test(groups = "live", singleThreaded = true, testName = "AWSELBClientLiveTest") public class AWSELBClientLiveTest extends ELBClientLiveTest { public AWSELBClientLiveTest() { provider = "aws-elb"; @@ -47,7 +47,7 @@ public class AWSELBClientLiveTest extends ELBClientLiveTest { } } - @Test + @Test(dependsOnMethods = "testDescribeLoadBalancers") public void testDeleteLoadBalancer() { for (String region : Region.DEFAULT_REGIONS) { deleteLoadBalancerInRegion(region); diff --git a/sandbox-providers/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBProviderTest.java b/labs/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBProviderTest.java similarity index 100% rename from sandbox-providers/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBProviderTest.java rename to labs/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBProviderTest.java diff --git a/sandbox-providers/aws-elb/src/test/java/org/jclouds/aws/elb/config/AWSELBLoadBalancerServiceLiveTest.java b/labs/aws-elb/src/test/java/org/jclouds/aws/elb/config/AWSELBLoadBalancerServiceLiveTest.java similarity index 100% rename from sandbox-providers/aws-elb/src/test/java/org/jclouds/aws/elb/config/AWSELBLoadBalancerServiceLiveTest.java rename to labs/aws-elb/src/test/java/org/jclouds/aws/elb/config/AWSELBLoadBalancerServiceLiveTest.java diff --git a/sandbox-apis/elb/README.txt b/labs/elb/README.txt similarity index 100% rename from sandbox-apis/elb/README.txt rename to labs/elb/README.txt diff --git a/sandbox-apis/elb/pom.xml b/labs/elb/pom.xml similarity index 95% rename from sandbox-apis/elb/pom.xml rename to labs/elb/pom.xml index 11362160b8..e1cd5f7fbe 100644 --- a/sandbox-apis/elb/pom.xml +++ b/labs/elb/pom.xml @@ -27,7 +27,7 @@ 1.5.0-SNAPSHOT ../../project/pom.xml - org.jclouds.api + org.jclouds.labs elb jcloud elb api jclouds components to access an implementation of Elastic Load Balancer @@ -40,7 +40,7 @@ ${test.aws.identity} ${test.aws.credential} - ec2 + aws-ec2 https://ec2.us-east-1.amazonaws.com 2010-06-15 @@ -75,6 +75,12 @@ test-jar test + + org.jclouds.provider + aws-ec2 + ${project.version} + test + org.jclouds.driver jclouds-sshj diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/ELBAsyncClient.java b/labs/elb/src/main/java/org/jclouds/elb/ELBAsyncClient.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/ELBAsyncClient.java rename to labs/elb/src/main/java/org/jclouds/elb/ELBAsyncClient.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/ELBClient.java b/labs/elb/src/main/java/org/jclouds/elb/ELBClient.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/ELBClient.java rename to labs/elb/src/main/java/org/jclouds/elb/ELBClient.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/ELBContextBuilder.java b/labs/elb/src/main/java/org/jclouds/elb/ELBContextBuilder.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/ELBContextBuilder.java rename to labs/elb/src/main/java/org/jclouds/elb/ELBContextBuilder.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/ELBPropertiesBuilder.java b/labs/elb/src/main/java/org/jclouds/elb/ELBPropertiesBuilder.java similarity index 97% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/ELBPropertiesBuilder.java rename to labs/elb/src/main/java/org/jclouds/elb/ELBPropertiesBuilder.java index c9be99e5b0..34766fe0a0 100644 --- a/sandbox-apis/elb/src/main/java/org/jclouds/elb/ELBPropertiesBuilder.java +++ b/labs/elb/src/main/java/org/jclouds/elb/ELBPropertiesBuilder.java @@ -43,9 +43,6 @@ public class ELBPropertiesBuilder extends PropertiesBuilder { return properties; } - public ELBPropertiesBuilder() { - super(); - } public ELBPropertiesBuilder(Properties properties) { super(properties); diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/binders/BindAvailabilityZonesToIndexedFormParams.java b/labs/elb/src/main/java/org/jclouds/elb/binders/BindAvailabilityZonesToIndexedFormParams.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/binders/BindAvailabilityZonesToIndexedFormParams.java rename to labs/elb/src/main/java/org/jclouds/elb/binders/BindAvailabilityZonesToIndexedFormParams.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/binders/BindInstanceIdsToIndexedFormParams.java b/labs/elb/src/main/java/org/jclouds/elb/binders/BindInstanceIdsToIndexedFormParams.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/binders/BindInstanceIdsToIndexedFormParams.java rename to labs/elb/src/main/java/org/jclouds/elb/binders/BindInstanceIdsToIndexedFormParams.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/binders/BindLoadBalancerNamesToIndexedFormParams.java b/labs/elb/src/main/java/org/jclouds/elb/binders/BindLoadBalancerNamesToIndexedFormParams.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/binders/BindLoadBalancerNamesToIndexedFormParams.java rename to labs/elb/src/main/java/org/jclouds/elb/binders/BindLoadBalancerNamesToIndexedFormParams.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/config/ELBRestClientModule.java b/labs/elb/src/main/java/org/jclouds/elb/config/ELBRestClientModule.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/config/ELBRestClientModule.java rename to labs/elb/src/main/java/org/jclouds/elb/config/ELBRestClientModule.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/domain/LoadBalancer.java b/labs/elb/src/main/java/org/jclouds/elb/domain/LoadBalancer.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/domain/LoadBalancer.java rename to labs/elb/src/main/java/org/jclouds/elb/domain/LoadBalancer.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBBindLoadBalancerStrategiesByClass.java b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBBindLoadBalancerStrategiesByClass.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBBindLoadBalancerStrategiesByClass.java rename to labs/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBBindLoadBalancerStrategiesByClass.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBLoadBalancerContextModule.java b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBLoadBalancerContextModule.java similarity index 95% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBLoadBalancerContextModule.java rename to labs/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBLoadBalancerContextModule.java index 4cd265320a..fb4b60df60 100644 --- a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBLoadBalancerContextModule.java +++ b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBLoadBalancerContextModule.java @@ -30,7 +30,6 @@ public class ELBLoadBalancerContextModule extends BaseLoadBalancerServiceContext @Override protected void configure() { - install(new ELBBindLoadBalancerSuppliersByClass()); install(new ELBBindLoadBalancerStrategiesByClass()); install(new ELBLoadBalancerServiceDependenciesModule()); super.configure(); diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBLoadBalancerServiceDependenciesModule.java b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBLoadBalancerServiceDependenciesModule.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBLoadBalancerServiceDependenciesModule.java rename to labs/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBLoadBalancerServiceDependenciesModule.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/functions/LoadBalancerToLoadBalancerMetadata.java b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/functions/LoadBalancerToLoadBalancerMetadata.java similarity index 61% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/functions/LoadBalancerToLoadBalancerMetadata.java rename to labs/elb/src/main/java/org/jclouds/elb/loadbalancer/functions/LoadBalancerToLoadBalancerMetadata.java index 5b5e8e7bd4..dcd09d0a21 100644 --- a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/functions/LoadBalancerToLoadBalancerMetadata.java +++ b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/functions/LoadBalancerToLoadBalancerMetadata.java @@ -18,21 +18,27 @@ */ package org.jclouds.elb.loadbalancer.functions; -import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; +import javax.annotation.Resource; import javax.inject.Inject; import javax.inject.Singleton; +import org.jclouds.collect.Memoized; import org.jclouds.domain.Location; import org.jclouds.elb.domain.LoadBalancer; import org.jclouds.loadbalancer.domain.LoadBalancerMetadata; import org.jclouds.loadbalancer.domain.LoadBalancerType; import org.jclouds.loadbalancer.domain.internal.LoadBalancerMetadataImpl; +import org.jclouds.logging.Logger; import com.google.common.base.Function; +import com.google.common.base.Predicate; import com.google.common.base.Supplier; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; /** * @@ -40,25 +46,49 @@ import com.google.common.collect.ImmutableSet; */ @Singleton public class LoadBalancerToLoadBalancerMetadata implements Function { - protected final Supplier> locationMap; + @Resource + protected static Logger logger = Logger.NULL; + + protected final Supplier> locations; protected final Supplier defaultLocationSupplier; @Inject public LoadBalancerToLoadBalancerMetadata(Supplier defaultLocationSupplier, - Supplier> locationMap) { - this.locationMap = locationMap; + @Memoized Supplier> locations) { + this.locations = locations; this.defaultLocationSupplier = defaultLocationSupplier; } @Override public LoadBalancerMetadata apply(LoadBalancer input) { - Location location = input.getRegion() != null ? locationMap.get().get(input.getRegion()) - : defaultLocationSupplier.get(); + Location location = input.getRegion() != null ? findLocationWithId(input.getRegion()) : defaultLocationSupplier + .get(); String id = input.getRegion() != null ? input.getRegion() + "/" + input.getName() : input.getName(); // TODO Builder return new LoadBalancerMetadataImpl(LoadBalancerType.LB, input.getName(), input.getName(), id, location, null, - ImmutableMap. of(), ImmutableSet.of(input.getDnsName())); + ImmutableMap. of(), ImmutableSet.of(input.getDnsName())); } + + private Location findLocationWithId(final String locationId) { + if (locationId == null) + return null; + try { + Location location = Iterables.find(locations.get(), new Predicate() { + + @Override + public boolean apply(Location input) { + return input.getId().equals(locationId); + } + + }); + return location; + + } catch (NoSuchElementException e) { + logger.debug("couldn't match instance location %s in: %s", locationId, locations.get()); + return null; + } + } + } \ No newline at end of file diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBDestroyLoadBalancerStrategy.java b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBDestroyLoadBalancerStrategy.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBDestroyLoadBalancerStrategy.java rename to labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBDestroyLoadBalancerStrategy.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBGetLoadBalancerMetadataStrategy.java b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBGetLoadBalancerMetadataStrategy.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBGetLoadBalancerMetadataStrategy.java rename to labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBGetLoadBalancerMetadataStrategy.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBListLoadBalancersStrategy.java b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBListLoadBalancersStrategy.java similarity index 90% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBListLoadBalancersStrategy.java rename to labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBListLoadBalancersStrategy.java index 421d31ded6..65dc2614cf 100644 --- a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBListLoadBalancersStrategy.java +++ b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBListLoadBalancersStrategy.java @@ -27,7 +27,6 @@ import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; -import javax.annotation.Nullable; import javax.annotation.Resource; import javax.inject.Inject; import javax.inject.Named; @@ -44,6 +43,7 @@ import org.jclouds.location.Region; import org.jclouds.logging.Logger; import com.google.common.base.Function; +import com.google.common.base.Supplier; import com.google.common.util.concurrent.ListenableFuture; /** @@ -60,12 +60,12 @@ public class ELBListLoadBalancersStrategy implements ListLoadBalancersStrategy { private final ELBAsyncClient aclient; private final Function converter; private final ExecutorService executor; - private final Set regions; + private final Supplier> regions; @Inject protected ELBListLoadBalancersStrategy(ELBClient client, ELBAsyncClient aclient, - Function converter, - @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, @Nullable @Region Set regions) { + Function converter, + @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, @Region Supplier> regions) { this.client = checkNotNull(client, "client"); this.aclient = checkNotNull(aclient, "aclient"); this.regions = checkNotNull(regions, "regions"); @@ -76,7 +76,8 @@ public class ELBListLoadBalancersStrategy implements ListLoadBalancersStrategy { @Override public Iterable listLoadBalancers() { Iterable loadBalancers; - if (regions != null) + Set regions = this.regions.get(); + if (regions.size() > 0) loadBalancers = concat(transformParallel(regions, new Function>>() { @Override diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBLoadBalanceNodesStrategy.java b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBLoadBalanceNodesStrategy.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBLoadBalanceNodesStrategy.java rename to labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBLoadBalanceNodesStrategy.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/xml/CreateLoadBalancerResponseHandler.java b/labs/elb/src/main/java/org/jclouds/elb/xml/CreateLoadBalancerResponseHandler.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/xml/CreateLoadBalancerResponseHandler.java rename to labs/elb/src/main/java/org/jclouds/elb/xml/CreateLoadBalancerResponseHandler.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/xml/DescribeLoadBalancersResponseHandler.java b/labs/elb/src/main/java/org/jclouds/elb/xml/DescribeLoadBalancersResponseHandler.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/xml/DescribeLoadBalancersResponseHandler.java rename to labs/elb/src/main/java/org/jclouds/elb/xml/DescribeLoadBalancersResponseHandler.java diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/xml/RegisterInstancesWithLoadBalancerResponseHandler.java b/labs/elb/src/main/java/org/jclouds/elb/xml/RegisterInstancesWithLoadBalancerResponseHandler.java similarity index 100% rename from sandbox-apis/elb/src/main/java/org/jclouds/elb/xml/RegisterInstancesWithLoadBalancerResponseHandler.java rename to labs/elb/src/main/java/org/jclouds/elb/xml/RegisterInstancesWithLoadBalancerResponseHandler.java diff --git a/sandbox-apis/elb/src/test/java/org/jclouds/elb/ELBAsyncClientTest.java b/labs/elb/src/test/java/org/jclouds/elb/ELBAsyncClientTest.java similarity index 94% rename from sandbox-apis/elb/src/test/java/org/jclouds/elb/ELBAsyncClientTest.java rename to labs/elb/src/test/java/org/jclouds/elb/ELBAsyncClientTest.java index 4f82c47869..08dc42a790 100644 --- a/sandbox-apis/elb/src/test/java/org/jclouds/elb/ELBAsyncClientTest.java +++ b/labs/elb/src/test/java/org/jclouds/elb/ELBAsyncClientTest.java @@ -179,18 +179,10 @@ public class ELBAsyncClientTest extends RestClientTest { protected String provider = "elb"; - @Override - protected Properties getProperties() { - Properties overrides = new Properties(); - overrides.setProperty(provider + ".endpoint", "https://elasticloadbalancing.us-east-1.amazonaws.com"); - overrides.setProperty(provider + ".propertiesbuilder", ELBPropertiesBuilder.class.getName()); - overrides.setProperty(provider + ".contextbuilder", ELBContextBuilder.class.getName()); - return overrides; - } @Override public RestContextSpec createContextSpec() { - return new RestContextFactory(getProperties()).createContextSpec(provider, "identity", "credential", + return new RestContextFactory(setupRestProperties()).createContextSpec(provider, "identity", "credential", new Properties()); } diff --git a/sandbox-apis/elb/src/test/java/org/jclouds/elb/ELBClientLiveTest.java b/labs/elb/src/test/java/org/jclouds/elb/ELBClientLiveTest.java similarity index 61% rename from sandbox-apis/elb/src/test/java/org/jclouds/elb/ELBClientLiveTest.java rename to labs/elb/src/test/java/org/jclouds/elb/ELBClientLiveTest.java index 78c5e8b53a..24b963ca62 100644 --- a/sandbox-apis/elb/src/test/java/org/jclouds/elb/ELBClientLiveTest.java +++ b/labs/elb/src/test/java/org/jclouds/elb/ELBClientLiveTest.java @@ -24,12 +24,12 @@ import static org.testng.Assert.assertNotNull; import java.util.Properties; import java.util.Set; -import org.jclouds.Constants; import org.jclouds.elb.domain.LoadBalancer; import org.jclouds.loadbalancer.LoadBalancerServiceContextFactory; import org.jclouds.logging.log4j.config.Log4JLoggingModule; +import org.jclouds.rest.BaseRestClientLiveTest; import org.jclouds.rest.RestContext; -import org.testng.annotations.AfterTest; +import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; @@ -41,53 +41,31 @@ import com.google.inject.Module; * * @author Lili Nader */ -@Test(groups = "live", sequential = true) -public class ELBClientLiveTest { +@Test(groups = "live", singleThreaded = true, testName = "ELBClientLiveTest") +public class ELBClientLiveTest extends BaseRestClientLiveTest { + + public ELBClientLiveTest() { + provider = "elb"; + } private ELBClient client; private RestContext context; - protected String provider = "elb"; - protected String identity; - protected String credential; - protected String endpoint; - protected String apiVersion; + protected String name = "TestLoadBalancer"; - protected void setupCredentials() { - identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity"); - credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider - + ".credential"); - endpoint = System.getProperty("test." + provider + ".endpoint"); - apiVersion = System.getProperty("test." + provider + ".api-version"); - } - - protected Properties setupProperties() { - Properties overrides = new Properties(); - overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true"); - overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true"); - overrides.setProperty(provider + ".identity", identity); - if (credential != null) - overrides.setProperty(provider + ".credential", credential); - if (endpoint != null) - overrides.setProperty(provider + ".endpoint", endpoint); - if (apiVersion != null) - overrides.setProperty(provider + ".api-version", apiVersion); - return overrides; - } - - @BeforeGroups(groups = { "live" }) + @BeforeGroups(groups = "live") public void setupClient() { setupCredentials(); Properties overrides = setupProperties(); context = new LoadBalancerServiceContextFactory().createContext(provider, - ImmutableSet. of(new Log4JLoggingModule()), overrides).getProviderSpecificContext(); + ImmutableSet. of(new Log4JLoggingModule()), overrides).getProviderSpecificContext(); client = context.getApi(); } @Test public void testCreateLoadBalancer() { - createLoadBalancerInRegionZone(null, - checkNotNull(System.getProperty("test." + provider + ".zone"), "test." + provider + ".zone"), name); + createLoadBalancerInRegionZone(null, checkNotNull(System.getProperty("test." + provider + ".zone"), "test." + + provider + ".zone"), name); } protected void createLoadBalancerInRegionZone(String region, String zone, String name) { @@ -107,7 +85,7 @@ public class ELBClientLiveTest { assert (allResults.size() >= 1) : region; } - @Test + @Test(dependsOnMethods = "testDescribeLoadBalancers") public void testDeleteLoadBalancer() { deleteLoadBalancerInRegion(null); } @@ -116,8 +94,12 @@ public class ELBClientLiveTest { client.deleteLoadBalancerInRegion(region, name); } - @AfterTest + @AfterGroups(groups = "live") public void shutdown() { - context.close(); + try { + testDeleteLoadBalancer(); + } finally { + context.close(); + } } } diff --git a/sandbox-apis/elb/src/test/java/org/jclouds/elb/loadbalancer/ELBLoadBalancerServiceLiveTest.java b/labs/elb/src/test/java/org/jclouds/elb/loadbalancer/ELBLoadBalancerServiceLiveTest.java similarity index 96% rename from sandbox-apis/elb/src/test/java/org/jclouds/elb/loadbalancer/ELBLoadBalancerServiceLiveTest.java rename to labs/elb/src/test/java/org/jclouds/elb/loadbalancer/ELBLoadBalancerServiceLiveTest.java index 7c67633484..f218ca619f 100644 --- a/sandbox-apis/elb/src/test/java/org/jclouds/elb/loadbalancer/ELBLoadBalancerServiceLiveTest.java +++ b/labs/elb/src/test/java/org/jclouds/elb/loadbalancer/ELBLoadBalancerServiceLiveTest.java @@ -37,7 +37,7 @@ import org.testng.annotations.Test; * * @author Lili Nadar */ -@Test(groups = "live", sequential = true) +@Test(groups = "live", singleThreaded = true, testName = "ELBLoadBalancerServiceLiveTest") public class ELBLoadBalancerServiceLiveTest extends BaseLoadBalancerServiceLiveTest { public ELBLoadBalancerServiceLiveTest() { diff --git a/sandbox-apis/elb/src/test/java/org/jclouds/elb/xml/DescribeLoadBalancerResponseHandlerTest.java b/labs/elb/src/test/java/org/jclouds/elb/xml/DescribeLoadBalancerResponseHandlerTest.java similarity index 100% rename from sandbox-apis/elb/src/test/java/org/jclouds/elb/xml/DescribeLoadBalancerResponseHandlerTest.java rename to labs/elb/src/test/java/org/jclouds/elb/xml/DescribeLoadBalancerResponseHandlerTest.java diff --git a/sandbox-apis/elb/src/test/java/org/jclouds/elb/xml/RegisterInstancesWithLoadBalancerResponseHandlerTest.java b/labs/elb/src/test/java/org/jclouds/elb/xml/RegisterInstancesWithLoadBalancerResponseHandlerTest.java similarity index 100% rename from sandbox-apis/elb/src/test/java/org/jclouds/elb/xml/RegisterInstancesWithLoadBalancerResponseHandlerTest.java rename to labs/elb/src/test/java/org/jclouds/elb/xml/RegisterInstancesWithLoadBalancerResponseHandlerTest.java diff --git a/sandbox-apis/elb/src/test/resources/describe_loadbalancers.xml b/labs/elb/src/test/resources/describe_loadbalancers.xml similarity index 100% rename from sandbox-apis/elb/src/test/resources/describe_loadbalancers.xml rename to labs/elb/src/test/resources/describe_loadbalancers.xml diff --git a/sandbox-apis/elb/src/test/resources/log4j.xml b/labs/elb/src/test/resources/log4j.xml similarity index 100% rename from sandbox-apis/elb/src/test/resources/log4j.xml rename to labs/elb/src/test/resources/log4j.xml diff --git a/sandbox-apis/elb/src/test/resources/register_instances_with_loadbalancer.xml b/labs/elb/src/test/resources/register_instances_with_loadbalancer.xml similarity index 100% rename from sandbox-apis/elb/src/test/resources/register_instances_with_loadbalancer.xml rename to labs/elb/src/test/resources/register_instances_with_loadbalancer.xml diff --git a/labs/pom.xml b/labs/pom.xml index ad0519c072..cc9ecba707 100644 --- a/labs/pom.xml +++ b/labs/pom.xml @@ -37,5 +37,7 @@ vcloud-director glesys opsource-servers + elb + aws-elb diff --git a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBBindLoadBalancerSuppliersByClass.java b/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBBindLoadBalancerSuppliersByClass.java deleted file mode 100644 index 51cb313a75..0000000000 --- a/sandbox-apis/elb/src/main/java/org/jclouds/elb/loadbalancer/config/ELBBindLoadBalancerSuppliersByClass.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you 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.elb.loadbalancer.config; - -import java.util.Set; - -import org.jclouds.domain.Location; -import org.jclouds.loadbalancer.config.BindLoadBalancerSuppliersByClass; -import org.jclouds.location.suppliers.RegionToProviderOrJustProvider; - -import com.google.common.base.Supplier; - -/** - * @author Adrian Cole - */ -public class ELBBindLoadBalancerSuppliersByClass extends BindLoadBalancerSuppliersByClass { - - @Override - protected Class>> defineLocationSupplier() { - return RegionToProviderOrJustProvider.class; - } -} \ No newline at end of file