diff --git a/providers/aws-elb/pom.xml b/providers/aws-elb/pom.xml new file mode 100644 index 0000000000..65e3add7e2 --- /dev/null +++ b/providers/aws-elb/pom.xml @@ -0,0 +1,161 @@ + + + + + 4.0.0 + + org.jclouds.provider + jclouds-providers-project + 1.0-SNAPSHOT + ../pom.xml + + aws-elb + jclouds Amazon Elastic Load Balancer provider + Elastic Load Balancer implementation targeted to Amazon Web Services + + + https://elasticloadbalancing.us-east-1.amazonaws.com + 2010-07-01 + ${test.aws.identity} + ${test.aws.credential} + aws-ec2 + https://ec2.us-east-1.amazonaws.com + 2010-06-15 + ${test.aws.identity} + ${test.aws.credential} + + + + + org.jclouds.api + elb + ${project.version} + jar + + + org.jclouds.api + elb + ${project.version} + test-jar + test + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds + jclouds-loadbalancer + ${project.version} + test-jar + test + + + org.jclouds + jclouds-log4j + ${project.version} + test + + + org.jclouds + jclouds-jsch + ${project.version} + test + + + log4j + log4j + 1.2.16 + test + + + + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration + integration-test + + test + + + + + test.aws-elb.endpoint + ${test.aws-elb.endpoint} + + + test.aws-elb.apiversion + ${test.aws-elb.apiversion} + + + test.aws-elb.identity + ${test.aws-elb.identity} + + + test.aws-elb.credential + ${test.aws-elb.credential} + + + test.aws-elb.compute.provider + ${test.aws-elb.compute.provider} + + + test.aws-elb.compute.endpoint + ${test.aws-elb.compute.endpoint} + + + test.aws-elb.compute.apiversion + ${test.aws-elb.compute.apiversion} + + + test.aws-elb.compute.identity + ${test.aws-elb.compute.identity} + + + test.aws-elb.compute.credential + ${test.aws-elb.compute.credential} + + + + + + + + + + + + + + diff --git a/providers/aws-elb/src/main/java/org/jclouds/aws/elb/ELBPropertiesBuilder.java b/providers/aws-elb/src/main/java/org/jclouds/aws/elb/ELBPropertiesBuilder.java new file mode 100644 index 0000000000..47bf2c04af --- /dev/null +++ b/providers/aws-elb/src/main/java/org/jclouds/aws/elb/ELBPropertiesBuilder.java @@ -0,0 +1,77 @@ +/** + * + * 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.aws.elb; + +import static org.jclouds.Constants.PROPERTY_API_VERSION; +import static org.jclouds.Constants.PROPERTY_ENDPOINT; +import static org.jclouds.aws.domain.Region.AP_SOUTHEAST_1; +import static org.jclouds.aws.domain.Region.EU_WEST_1; +import static org.jclouds.aws.domain.Region.US_EAST_1; +import static org.jclouds.aws.domain.Region.US_WEST_1; +import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG; +import static org.jclouds.aws.reference.AWSConstants.PROPERTY_ZONECLIENT_ENDPOINT; +import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGION; +import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS; + +import java.util.Properties; +import java.util.Set; + +import org.jclouds.aws.domain.Region; +import org.jclouds.elb.ELBAsyncClient; + +import com.google.common.base.Joiner; +import com.google.common.collect.ImmutableSet; + +/** + * Builds properties used in ELB Clients + * + * @author Adrian Cole + */ +public class ELBPropertiesBuilder extends org.jclouds.elb.ELBPropertiesBuilder { + public static Set DEFAULT_REGIONS = ImmutableSet.of(EU_WEST_1, US_EAST_1, US_WEST_1, AP_SOUTHEAST_1); + + @Override + protected Properties defaultProperties() { + Properties properties = super.defaultProperties(); + properties.setProperty(PROPERTY_AUTH_TAG, "AWS"); + properties.setProperty(PROPERTY_REGIONS, Joiner.on(',').join(DEFAULT_REGIONS)); + properties.setProperty(PROPERTY_API_VERSION, ELBAsyncClient.VERSION); + properties.setProperty(PROPERTY_ENDPOINT, "https://elasticloadbalancing.us-east-1.amazonaws.com"); + properties.setProperty(PROPERTY_REGION + "." + Region.US_EAST_1 + ".endpoint", + "https://elasticloadbalancing.us-east-1.amazonaws.com"); + properties.setProperty(PROPERTY_REGION + "." + Region.US_WEST_1 + ".endpoint", + "https://elasticloadbalancing.us-west-1.amazonaws.com"); + properties.setProperty(PROPERTY_REGION + "." + Region.EU_WEST_1 + ".endpoint", + "https://elasticloadbalancing.eu-west-1.amazonaws.com"); + properties.setProperty(PROPERTY_REGION + "." + Region.AP_SOUTHEAST_1 + ".endpoint", + "https://elasticloadbalancing.ap-southeast-1.amazonaws.com"); + properties.setProperty(PROPERTY_ZONECLIENT_ENDPOINT, "https://ec2.us-east-1.amazonaws.com"); + return properties; + } + + public ELBPropertiesBuilder() { + super(); + } + + public ELBPropertiesBuilder(Properties properties) { + super(properties); + } + +} diff --git a/providers/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBClientLiveTest.java b/providers/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBClientLiveTest.java new file mode 100644 index 0000000000..db714aa936 --- /dev/null +++ b/providers/aws-elb/src/test/java/org/jclouds/aws/elb/AWSELBClientLiveTest.java @@ -0,0 +1,57 @@ +/** + * + * 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.aws.elb; + +import org.jclouds.elb.ELBClientLiveTest; +import org.testng.annotations.Test; + +/** + * Tests behavior of {@code ELBClient} + * + * @author Adrian Cole + */ +@Test(groups = "live", sequential = true, testName = "AWSELBClientLiveTest") +public class AWSELBClientLiveTest extends ELBClientLiveTest { + public AWSELBClientLiveTest() { + provider = "aws-elb"; + } + + @Test + public void testCreateLoadBalancer() { + for (String region : ELBPropertiesBuilder.DEFAULT_REGIONS) { + createLoadBalancerInRegionZone(region, region + "a", name); + } + } + + @Test(dependsOnMethods = "testCreateLoadBalancer") + public void testDescribeLoadBalancers() { + for (String region : ELBPropertiesBuilder.DEFAULT_REGIONS) { + describeLoadBalancerInRegion(region); + } + } + + @Test + public void testDeleteLoadBalancer() { + for (String region : ELBPropertiesBuilder.DEFAULT_REGIONS) { + deleteLoadBalancerInRegion(region); + } + } + +} diff --git a/providers/aws-elb/src/test/java/org/jclouds/aws/elb/ELBAsyncClientTest.java b/providers/aws-elb/src/test/java/org/jclouds/aws/elb/ELBAsyncClientTest.java new file mode 100644 index 0000000000..f015b30d35 --- /dev/null +++ b/providers/aws-elb/src/test/java/org/jclouds/aws/elb/ELBAsyncClientTest.java @@ -0,0 +1,50 @@ +/** + * + * 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.aws.elb; + +import static org.jclouds.aws.elb.ELBPropertiesBuilder.DEFAULT_REGIONS; + +import java.io.IOException; +import java.lang.reflect.Method; + +import org.jclouds.elb.ELBAsyncClient; +import org.testng.annotations.Test; + +/** + * Tests behavior of {@code ELBAsyncClient} + * + * @author Adrian Cole + */ +// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire +@Test(groups = "unit", testName = "aws.ELBAsyncClientTest") +public class ELBAsyncClientTest extends org.jclouds.elb.ELBAsyncClientTest { + + public ELBAsyncClientTest() { + this.provider = "aws-elb"; + } + + public void testAllRegions() throws SecurityException, NoSuchMethodException, IOException { + Method method = ELBAsyncClient.class.getMethod("describeLoadBalancersInRegion", String.class, String[].class); + for (String region : DEFAULT_REGIONS) { + processor.createRequest(method, region); + } + } + +} diff --git a/providers/aws-elb/src/test/java/org/jclouds/aws/elb/ProvidersInPropertiesTest.java b/providers/aws-elb/src/test/java/org/jclouds/aws/elb/ProvidersInPropertiesTest.java new file mode 100644 index 0000000000..fa59865b82 --- /dev/null +++ b/providers/aws-elb/src/test/java/org/jclouds/aws/elb/ProvidersInPropertiesTest.java @@ -0,0 +1,41 @@ +/** + * + * 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.aws.elb; + +import org.jclouds.rest.Providers; +import org.testng.annotations.Test; + +import com.google.common.collect.Iterables; + +/** + * + * @author Adrian Cole + * + */ +@Test(groups = "unit") +public class ProvidersInPropertiesTest { + + @Test + public void testSupportedProviders() { + Iterable providers = Providers.getSupportedProviders(); + assert Iterables.contains(providers, "aws-elb") : providers; + } + +} diff --git a/providers/aws-elb/src/test/java/org/jclouds/aws/elb/config/AWSELBLoadBalancerServiceLiveTest.java b/providers/aws-elb/src/test/java/org/jclouds/aws/elb/config/AWSELBLoadBalancerServiceLiveTest.java new file mode 100644 index 0000000000..3e73cda334 --- /dev/null +++ b/providers/aws-elb/src/test/java/org/jclouds/aws/elb/config/AWSELBLoadBalancerServiceLiveTest.java @@ -0,0 +1,38 @@ +/** + * + * 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.aws.elb.config; + +import org.jclouds.elb.loadbalancer.ELBLoadBalancerServiceLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", sequential = true, testName = "AWSELBLoadBalancerServiceLiveTest") +public class AWSELBLoadBalancerServiceLiveTest extends ELBLoadBalancerServiceLiveTest { + + public AWSELBLoadBalancerServiceLiveTest() { + provider = "aws-elb"; + computeProvider = "aws-ec2"; + tag = "elb"; + } + +}