added southeast asia to sqs and added better region tests

This commit is contained in:
Adrian Cole 2010-05-20 10:06:19 -07:00
parent 570e6366a6
commit d3690c44f2
14 changed files with 64 additions and 52 deletions

View File

@ -29,7 +29,7 @@ package org.jclouds.aws.domain;
*
*/
public class Region {
/**
* EU (Ireland)
* <p/>

View File

@ -23,6 +23,7 @@ import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AWS_ACCESSKEYID;
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AWS_EXPIREINTERVAL;
import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AWS_SECRETACCESSKEY;
import static org.jclouds.aws.sqs.reference.SQSConstants.PROPERTY_SQS_ENDPOINT;
import static org.jclouds.aws.sqs.reference.SQSConstants.PROPERTY_SQS_ENDPOINT_AP_SOUTHEAST_1;
import static org.jclouds.aws.sqs.reference.SQSConstants.PROPERTY_SQS_ENDPOINT_EU_WEST_1;
import static org.jclouds.aws.sqs.reference.SQSConstants.PROPERTY_SQS_ENDPOINT_US_EAST_1;
import static org.jclouds.aws.sqs.reference.SQSConstants.PROPERTY_SQS_ENDPOINT_US_WEST_1;
@ -41,12 +42,15 @@ public class SQSPropertiesBuilder extends PropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_SQS_ENDPOINT, "https://queue.amazonaws.com");
properties.setProperty(PROPERTY_SQS_ENDPOINT_US_EAST_1, "https://queue.amazonaws.com");
properties.setProperty(PROPERTY_SQS_ENDPOINT_US_WEST_1,
"https://us-west-1.queue.amazonaws.com");
properties.setProperty(PROPERTY_SQS_ENDPOINT_EU_WEST_1,
"https://eu-west-1.queue.amazonaws.com");
properties.setProperty(PROPERTY_SQS_ENDPOINT, "https://sqs.us-east-1.amazonaws.com");
properties
.setProperty(PROPERTY_SQS_ENDPOINT_US_EAST_1, "https://sqs.us-east-1.amazonaws.com");
properties
.setProperty(PROPERTY_SQS_ENDPOINT_US_WEST_1, "https://sqs.us-west-1.amazonaws.com");
properties
.setProperty(PROPERTY_SQS_ENDPOINT_EU_WEST_1, "https://sqs.eu-west-1.amazonaws.com");
properties.setProperty(PROPERTY_SQS_ENDPOINT_AP_SOUTHEAST_1,
"https://sqs.ap-southeast-1.amazonaws.com");
properties.setProperty(PROPERTY_AWS_EXPIREINTERVAL, "60");
return properties;
}

View File

@ -94,9 +94,11 @@ public class SQSRestClientModule extends AbstractModule {
Map<String, URI> provideRegions(
@Named(SQSConstants.PROPERTY_SQS_ENDPOINT_US_EAST_1) String useast,
@Named(SQSConstants.PROPERTY_SQS_ENDPOINT_US_WEST_1) String uswest,
@Named(SQSConstants.PROPERTY_SQS_ENDPOINT_EU_WEST_1) String euwest) {
@Named(SQSConstants.PROPERTY_SQS_ENDPOINT_EU_WEST_1) String euwest,
@Named(SQSConstants.PROPERTY_SQS_ENDPOINT_AP_SOUTHEAST_1) String apsoutheast) {
return ImmutableMap.<String, URI> of(Region.US_EAST_1, URI.create(useast), Region.US_WEST_1,
URI.create(uswest), Region.EU_WEST_1, URI.create(euwest));
URI.create(uswest), Region.EU_WEST_1, URI.create(euwest), Region.AP_SOUTHEAST_1, URI
.create(apsoutheast));
}
@Provides

View File

@ -31,4 +31,6 @@ public interface SQSConstants extends AWSConstants {
public static final String PROPERTY_SQS_ENDPOINT_EU_WEST_1 = "jclouds.sqs.endpoint.eu_west_1";
public static final String PROPERTY_SQS_ENDPOINT_US_EAST_1 = "jclouds.sqs.endpoint.us_east_1";
public static final String PROPERTY_SQS_ENDPOINT_US_WEST_1 = "jclouds.sqs.endpoint.us_west_1";
public static final String PROPERTY_SQS_ENDPOINT_AP_SOUTHEAST_1 = "jclouds.sqs.endpoint.ap_southeast_1";
}

View File

@ -43,10 +43,10 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.inject.internal.ImmutableMap;
import com.google.inject.internal.Lists;
/**
* Tests behavior of {@code AMIClient}
@ -85,9 +85,9 @@ public class AMIClientLiveTest {
client.describeImagesInRegion(null, imageIds("asdaasdsa"));
}
@Test(enabled = false)
public void testDescribeImages() {
for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
SortedSet<Image> allResults = Sets.newTreeSet(client.describeImagesInRegion(region));
assertNotNull(allResults);
assert allResults.size() >= 2 : allResults.size();

View File

@ -41,9 +41,9 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.inject.internal.Lists;
/**
* Tests behavior of {@code AvailabilityZoneAndRegionClient}
@ -67,8 +67,8 @@ public class AvailabilityZoneAndRegionClientLiveTest {
}
public void testDescribeAvailabilityZones() {
for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1)) {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
SortedSet<AvailabilityZoneInfo> allResults = Sets.newTreeSet(client
.describeAvailabilityZonesInRegion(region));
assertNotNull(allResults);

View File

@ -44,9 +44,9 @@ import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.inject.internal.Lists;
/**
* Tests behavior of {@code ElasticBlockStoreClient}
@ -72,8 +72,8 @@ public class ElasticBlockStoreClientLiveTest {
@Test
void testDescribeVolumes() {
for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1)) {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
SortedSet<Volume> allResults = Sets.newTreeSet(client.describeVolumesInRegion(region));
assertNotNull(allResults);
if (allResults.size() >= 1) {
@ -96,8 +96,8 @@ public class ElasticBlockStoreClientLiveTest {
this.volumeId = expected.getId();
SortedSet<Volume> result = Sets.newTreeSet(client.describeVolumesInRegion(null,
expected.getId()));
SortedSet<Volume> result = Sets.newTreeSet(client.describeVolumesInRegion(null, expected
.getId()));
assertNotNull(result);
assertEquals(result.size(), 1);
Volume volume = result.iterator().next();
@ -171,8 +171,8 @@ public class ElasticBlockStoreClientLiveTest {
@Test
void testDescribeSnapshots() {
for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1)) {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
SortedSet<Snapshot> allResults = Sets.newTreeSet(client.describeSnapshotsInRegion(region));
assertNotNull(allResults);
if (allResults.size() >= 1) {
@ -213,8 +213,7 @@ public class ElasticBlockStoreClientLiveTest {
@Test(dependsOnMethods = "testCreateSnapshotInRegion")
void testDeleteVolumeInRegion() {
client.deleteVolumeInRegion(null, volumeId);
SortedSet<Volume> result = Sets.newTreeSet(client.describeVolumesInRegion(null,
volumeId));
SortedSet<Volume> result = Sets.newTreeSet(client.describeVolumesInRegion(null, volumeId));
assertEquals(result.size(), 1);
Volume volume = result.iterator().next();
assertEquals(volume.getStatus(), Volume.Status.DELETING);

View File

@ -35,8 +35,8 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.inject.internal.Lists;
/**
* Tests behavior of {@code ElasticIPAddressClient}
@ -61,8 +61,8 @@ public class ElasticIPAddressClientLiveTest {
@Test
void testDescribeAddresses() {
for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1)) {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
SortedSet<PublicIpInstanceIdPair> allResults = Sets.newTreeSet(client
.describeAddressesInRegion(region));
assertNotNull(allResults);

View File

@ -37,7 +37,7 @@ import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.inject.internal.Lists;
/**
* Tests behavior of {@code ElasticIPAddressClient}
@ -77,8 +77,8 @@ public class ElasticLoadBalancerClientLiveTest {
@Test(dependsOnMethods = "testCreateLoadBalancer")
void testDescribeLoadBalancers() {
String name = "TestDescribeLoadBalancer";
for (String region : ImmutableSet.of(Region.US_EAST_1, Region.US_WEST_1, Region.EU_WEST_1,
Region.AP_SOUTHEAST_1)) {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
Set<ElasticLoadBalancer> allResults = client.describeLoadBalancers(region, name);
assertNotNull(allResults);
assert (allResults.size() >= 1);
@ -87,8 +87,8 @@ public class ElasticLoadBalancerClientLiveTest {
@Test
void testDeleteLoadBalancer() {
for (String region : ImmutableSet.of(Region.US_EAST_1, Region.US_WEST_1, Region.EU_WEST_1,
Region.AP_SOUTHEAST_1)) {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
client.deleteLoadBalancer(region, "TestLoadBalancer");
}
}

View File

@ -34,7 +34,7 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.inject.internal.Lists;
/**
* Tests behavior of {@code EC2Client}
@ -61,8 +61,8 @@ public class InstanceClientLiveTest {
@Test
void testDescribeInstances() {
for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1)) {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
Set<Reservation> allResults = client.describeInstancesInRegion(region);
assertNotNull(allResults);
assert allResults.size() >= 0 : allResults.size();

View File

@ -35,8 +35,8 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.inject.internal.Lists;
/**
* Tests behavior of {@code KeyPairClient}
@ -61,8 +61,8 @@ public class KeyPairClientLiveTest {
@Test
void testDescribeKeyPairs() {
for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1)) {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
SortedSet<KeyPair> allResults = Sets.newTreeSet(client.describeKeyPairsInRegion(region));
assertNotNull(allResults);
@ -95,8 +95,8 @@ public class KeyPairClientLiveTest {
assertNotNull(result.getKeyFingerprint());
assertEquals(result.getKeyName(), keyName);
SortedSet<KeyPair> twoResults = Sets.newTreeSet(client.describeKeyPairsInRegion(
null, keyName));
SortedSet<KeyPair> twoResults = Sets.newTreeSet(client
.describeKeyPairsInRegion(null, keyName));
assertNotNull(twoResults);
assertEquals(twoResults.size(), 1);
KeyPair listPair = twoResults.iterator().next();

View File

@ -42,9 +42,9 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Sets;
import com.google.inject.internal.Lists;
/**
* Tests behavior of {@code SecurityGroupClient}
@ -69,7 +69,8 @@ public class SecurityGroupClientLiveTest {
@Test
void testDescribe() {
for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
SortedSet<SecurityGroup> allResults = Sets.newTreeSet(client
.describeSecurityGroupsInRegion(region));
assertNotNull(allResults);

View File

@ -37,8 +37,8 @@ import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.inject.internal.Lists;
/**
* Tests behavior of {@code SQSClient}
@ -66,7 +66,8 @@ public class SQSClientLiveTest {
@Test
void testListQueuesInRegion() throws InterruptedException {
for (String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1, Region.US_WEST_1)) {
for (String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
SortedSet<Queue> allResults = Sets.newTreeSet(client.listQueuesInRegion(region));
assertNotNull(allResults);
if (allResults.size() >= 1) {
@ -82,8 +83,8 @@ public class SQSClientLiveTest {
void testCreateQueue() throws InterruptedException {
String queueName = PREFIX + "1";
for (final String region : ImmutableSet.of(Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1)) {
for (final String region : Lists.newArrayList(null, Region.EU_WEST_1, Region.US_EAST_1,
Region.US_WEST_1, Region.AP_SOUTHEAST_1)) {
try {
SortedSet<Queue> result = Sets.newTreeSet(client.listQueuesInRegion(region,
queuePrefix(queueName)));
@ -109,7 +110,8 @@ public class SQSClientLiveTest {
throw e;
}
}
assertEquals(queue.getRegion(), region);
if (region != null)
assertEquals(queue.getRegion(), region);
assertEquals(queue.getName(), queueName);
assertQueueInList(region, queue);
queues.add(queue);

View File

@ -75,12 +75,14 @@ public class SQSRestClientModuleTest {
@Test
void testRegions() {
Map<String, URI> regionMap = createInjector().getInstance(new Key<Map<String, URI>>(SQS.class) {
});
Map<String, URI> regionMap = createInjector().getInstance(
new Key<Map<String, URI>>(SQS.class) {
});
assertEquals(regionMap, ImmutableMap.<String, URI> of(Region.US_EAST_1, URI
.create("https://queue.amazonaws.com"), Region.US_WEST_1, URI
.create("https://us-west-1.queue.amazonaws.com"), Region.EU_WEST_1, URI
.create("https://eu-west-1.queue.amazonaws.com")));
.create("https://sqs.us-east-1.amazonaws.com"), Region.US_WEST_1, URI
.create("https://sqs.us-west-1.amazonaws.com"), Region.EU_WEST_1, URI
.create("https://sqs.eu-west-1.amazonaws.com"), Region.AP_SOUTHEAST_1, URI
.create("https://sqs.ap-southeast-1.amazonaws.com")));
}
@Test