diff --git a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandler.java b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandler.java index abe9b9aadf..afa572f873 100644 --- a/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandler.java +++ b/aws/core/src/main/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandler.java @@ -33,8 +33,7 @@ import com.google.common.collect.Maps; * * @author Adrian Cole */ -public class DescribeRegionsResponseHandler extends - ParseSax.HandlerWithResult> { +public class DescribeRegionsResponseHandler extends ParseSax.HandlerWithResult> { private StringBuilder currentText = new StringBuilder(); private Map regionEndpoints = Maps.newHashMap(); @@ -52,11 +51,11 @@ public class DescribeRegionsResponseHandler extends String pending = currentText.toString().trim(); if (pending.indexOf("Walrus") == -1) region = pending; - } else if (qName.equals("regionEndpoint")) { + // Eucalyptus uses regionUrl + } else if (qName.equals("regionEndpoint") || qName.equals("regionUrl")) { String pending = currentText.toString().trim(); if (pending.indexOf("Walrus") == -1) - regionEndpoint = URI.create(pending.startsWith("http") ? pending - : String.format("https://%s", pending)); + regionEndpoint = URI.create(pending.startsWith("http") ? pending : String.format("https://%s", pending)); } else if (qName.equals("item") && region != null) { regionEndpoints.put(region, regionEndpoint); this.region = null; diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeAvailabilityZonesResponseHandlerTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeAvailabilityZonesResponseHandlerTest.java index 5539e339bd..1e5153eacd 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeAvailabilityZonesResponseHandlerTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeAvailabilityZonesResponseHandlerTest.java @@ -66,16 +66,16 @@ public class DescribeAvailabilityZonesResponseHandlerTest extends BaseHandlerTes Set expected = ImmutableSet. of( new AvailabilityZoneInfo(AvailabilityZone.US_EAST_1A, "available", Region.US_EAST_1, ImmutableSet. of()), - new AvailabilityZoneInfo(AvailabilityZone.US_EAST_1B, "available", Region.US_EAST_1, ImmutableSet - . of()), + new AvailabilityZoneInfo(AvailabilityZone.US_EAST_1B, "available", Region.US_EAST_1, ImmutableSet + . of()), - new AvailabilityZoneInfo(AvailabilityZone.US_EAST_1C, "available", Region.US_EAST_1, ImmutableSet - . of("our service is awesome")), + new AvailabilityZoneInfo(AvailabilityZone.US_EAST_1C, "available", Region.US_EAST_1, ImmutableSet + . of("our service is awesome")), - new AvailabilityZoneInfo(AvailabilityZone.US_EAST_1D, "downlikeaclown", Region.US_EAST_1, ImmutableSet - . of())); + new AvailabilityZoneInfo(AvailabilityZone.US_EAST_1D, "downlikeaclown", Region.US_EAST_1, ImmutableSet + . of())); Set result = factory.create( - injector.getInstance(DescribeAvailabilityZonesResponseHandler.class)).parse(is); + injector.getInstance(DescribeAvailabilityZonesResponseHandler.class)).parse(is); assertEquals(result, expected); } diff --git a/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandlerTest.java b/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandlerTest.java index 0811221e91..ec6159ebaf 100644 --- a/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandlerTest.java +++ b/aws/core/src/test/java/org/jclouds/aws/ec2/xml/DescribeRegionsResponseHandlerTest.java @@ -95,6 +95,21 @@ public class DescribeRegionsResponseHandlerTest extends BaseHandlerTest { assertEquals(result, expected); } + + public void testEuc2() { + + InputStream is = Utils + .toInputStream("1LAQRTCLTLPS6CEIC627http://10.255.255.1:8773/services/Cloudnova"); + + Map expected = ImmutableMap. of("nova", + URI.create("http://10.255.255.1:8773/services/Cloud")); + + Map result = factory.create( + injector.getInstance(DescribeRegionsResponseHandler.class)).parse( + is); + + assertEquals(result, expected); + } public void testUnsupportedAdditionalRegionDoesntBreak() {