JCLOUDS-96: Handle us-standard in testAllLocations

This commit is contained in:
Andrew Gaul 2015-01-23 10:04:24 -08:00
parent b3691fed7c
commit af1a01a0af
2 changed files with 18 additions and 1 deletions

View File

@ -56,7 +56,7 @@ public class BaseServiceIntegrationTest extends BaseBlobStoreIntegrationTest {
PageSet<? extends StorageMetadata> list = view.getBlobStore().list();
assert Iterables.any(list, new Predicate<StorageMetadata>() {
public boolean apply(StorageMetadata md) {
return containerName.equals(md.getName()) && location.equals(md.getLocation());
return containerName.equals(md.getName()) && locationEquals(location, md.getLocation());
}
}) : String.format("container %s/%s not found in list %s", location, containerName, list);
assertTrue(view.getBlobStore().containerExists(containerName), containerName);
@ -119,4 +119,7 @@ public class BaseServiceIntegrationTest extends BaseBlobStoreIntegrationTest {
assertEquals(provider.getIso3166Codes(), getIso3166Codes());
}
protected boolean locationEquals(Location location1, Location location2) {
return location1.equals(location2);
}
}

View File

@ -18,6 +18,7 @@ package org.jclouds.aws.s3.blobstore.integration;
import java.util.Set;
import org.jclouds.domain.Location;
import org.jclouds.s3.blobstore.integration.S3ServiceIntegrationLiveTest;
import org.testng.annotations.Test;
@ -34,4 +35,17 @@ public class AWSS3ServiceIntegrationLiveTest extends S3ServiceIntegrationLiveTes
return ImmutableSet.<String> of("US", "US-CA", "US-OR", "BR-SP", "IE", "SG", "AU-NSW", "JP-13");
}
// Amazon returns null instead of us-standard in some situations
@Override
protected boolean locationEquals(Location location1, Location location2) {
Location usStandard = null;
for (Location location : view.getBlobStore().listAssignableLocations()) {
if (location.getId().equals("us-standard")) {
usStandard = location;
break;
}
}
return super.locationEquals(location1 == null ? usStandard : location1,
location2 == null ? usStandard : location2);
}
}