From 66627e94b80da2e988dfa488985a6c70493dd794 Mon Sep 17 00:00:00 2001 From: Jeremy Daggett Date: Tue, 12 Aug 2014 09:53:50 -0700 Subject: [PATCH] Swift API region cleanup Conflicts: openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/features/ObjectApiMockTest.java --- .../cloudfiles/v1/CloudFilesApi.java | 12 ---- .../CloudFilesAccountApiLiveTest.java | 4 +- .../v1/features/CloudFilesCDNApiLiveTest.java | 56 +++++++++---------- 3 files changed, 30 insertions(+), 42 deletions(-) diff --git a/apis/rackspace-cloudfiles/src/main/java/org/jclouds/rackspace/cloudfiles/v1/CloudFilesApi.java b/apis/rackspace-cloudfiles/src/main/java/org/jclouds/rackspace/cloudfiles/v1/CloudFilesApi.java index ff19eb897c..7c25ec2cb2 100644 --- a/apis/rackspace-cloudfiles/src/main/java/org/jclouds/rackspace/cloudfiles/v1/CloudFilesApi.java +++ b/apis/rackspace-cloudfiles/src/main/java/org/jclouds/rackspace/cloudfiles/v1/CloudFilesApi.java @@ -48,16 +48,4 @@ public interface CloudFilesApi extends SwiftApi { @Delegate CDNApi getCDNApi(@EndpointParam(parser = RegionToCDNEndpoint.class) String region); - /** - * Provides access to Cloud Files CDN features. - * - * @param region the region to access the CDN API. - * - * @return the {@link CDNApi} for the specified region. - * - * @deprecated Please use {@link #getCDNApiForRegion(String)}. This method will be removed in jclouds 1.8. - */ - @Deprecated - @Delegate - CDNApi cdnApiInRegion(@EndpointParam(parser = RegionToCDNEndpoint.class) String region); } diff --git a/apis/rackspace-cloudfiles/src/test/java/org/jclouds/rackspace/cloudfiles/v1/features/CloudFilesAccountApiLiveTest.java b/apis/rackspace-cloudfiles/src/test/java/org/jclouds/rackspace/cloudfiles/v1/features/CloudFilesAccountApiLiveTest.java index f91d2baa63..95de2b3ac4 100644 --- a/apis/rackspace-cloudfiles/src/test/java/org/jclouds/rackspace/cloudfiles/v1/features/CloudFilesAccountApiLiveTest.java +++ b/apis/rackspace-cloudfiles/src/test/java/org/jclouds/rackspace/cloudfiles/v1/features/CloudFilesAccountApiLiveTest.java @@ -36,8 +36,8 @@ public class CloudFilesAccountApiLiveTest extends AccountApiLiveTest { } public void testUrlKeyExists() throws Exception { - for (String region : regions) { - Account account = api.getAccountApi(region).get(); + for (String regionId : regions) { + Account account = api.getAccountApi(regionId).get(); assertTrue(account.getTemporaryUrlKey().isPresent()); } } diff --git a/apis/rackspace-cloudfiles/src/test/java/org/jclouds/rackspace/cloudfiles/v1/features/CloudFilesCDNApiLiveTest.java b/apis/rackspace-cloudfiles/src/test/java/org/jclouds/rackspace/cloudfiles/v1/features/CloudFilesCDNApiLiveTest.java index 887033d337..beeb15a037 100644 --- a/apis/rackspace-cloudfiles/src/test/java/org/jclouds/rackspace/cloudfiles/v1/features/CloudFilesCDNApiLiveTest.java +++ b/apis/rackspace-cloudfiles/src/test/java/org/jclouds/rackspace/cloudfiles/v1/features/CloudFilesCDNApiLiveTest.java @@ -53,20 +53,20 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest { } public void testEnable() throws Exception { - for (String region : regions) { - assertNotNull(api.getCDNApi(region).enable(name)); + for (String regionId : regions) { + assertNotNull(api.getCDNApi(regionId).enable(name)); - CDNContainer container = api.getCDNApi(region).get(name); + CDNContainer container = api.getCDNApi(regionId).get(name); assertCDNContainerNotNull(container); assertTrue(container.isEnabled()); } } public void testEnableWithTTL() throws Exception { - for (String region : regions) { - assertNotNull(api.getCDNApi(region).enable(name, 777777)); + for (String regionId : regions) { + assertNotNull(api.getCDNApi(regionId).enable(name, 777777)); - CDNContainer container = api.getCDNApi(region).get(name); + CDNContainer container = api.getCDNApi(regionId).get(name); assertCDNContainerNotNull(container); assertTrue(container.isEnabled()); assertTrue(container.getTtl() == 777777); @@ -74,17 +74,17 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest { } public void testDisable() throws Exception { - for (String region : regions) { - assertTrue(api.getCDNApi(region).disable(name)); + for (String regionId : regions) { + assertTrue(api.getCDNApi(regionId).disable(name)); - CDNContainer container = api.getCDNApi(region).get(name); + CDNContainer container = api.getCDNApi(regionId).get(name); assertFalse(container.isEnabled()); } } public void testList() throws Exception { - for (String region : regions) { - List cdnResponse = api.getCDNApi(region).list().toList(); + for (String regionId : regions) { + List cdnResponse = api.getCDNApi(regionId).list().toList(); assertNotNull(cdnResponse); for (CDNContainer cdnContainer : cdnResponse) { @@ -96,33 +96,33 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest { public void testListWithOptions() throws Exception { String lexicographicallyBeforeName = name.substring(0, name.length() - 1); - for (String region : regions) { + for (String regionId : regions) { ListCDNContainerOptions options = new ListCDNContainerOptions().marker(lexicographicallyBeforeName); - CDNContainer cdnContainer = api.getCDNApi(region).list(options).get(0); + CDNContainer cdnContainer = api.getCDNApi(regionId).list(options).get(0); assertCDNContainerNotNull(cdnContainer); assertTrue(cdnContainer.isEnabled()); } } public void testGet() throws Exception { - for (String region : regions) { - CDNContainer container = api.getCDNApi(region).get(name); + for (String regionId : regions) { + CDNContainer container = api.getCDNApi(regionId).get(name); assertCDNContainerNotNull(container); assertTrue(container.isEnabled()); } } public void testPurgeObject() throws Exception { - for (String region : regions) { + for (String regionId : regions) { String objectName = "testPurge"; Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[] {1, 2, 3})); - ObjectApi objectApi = api.getObjectApiForContainer(region, name); + ObjectApi objectApi = api.getObjectApi(regionId, name); // create a new object objectApi.put(objectName, payload); - CDNApi cdnApi = api.getCDNApi(region); + CDNApi cdnApi = api.getCDNApi(regionId); assertTrue(cdnApi.purgeObject(name, "testPurge", ImmutableList.of())); // delete the object @@ -132,12 +132,12 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest { } public void testUpdate() throws Exception { - for (String region : regions) { + for (String regionId : regions) { // enable with a ttl - assertNotNull(api.getCDNApi(region).enable(name, 777777)); + assertNotNull(api.getCDNApi(regionId).enable(name, 777777)); // now get the container - CDNContainer original = api.getCDNApi(region).get(name); + CDNContainer original = api.getCDNApi(regionId).get(name); assertTrue(original.isEnabled()); assertCDNContainerNotNull(original); @@ -147,10 +147,10 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest { .logRetention(true) .enabled(false); // update the container - assertTrue(api.getCDNApi(region).update(name, opts)); + assertTrue(api.getCDNApi(regionId).update(name, opts)); // now get the updated container - CDNContainer updated = api.getCDNApi(region).get(name); + CDNContainer updated = api.getCDNApi(regionId).get(name); assertFalse(updated.isEnabled()); assertCDNContainerNotNull(updated); @@ -173,17 +173,17 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest { @BeforeClass(groups = "live") public void setup() { super.setup(); - for (String region : regions) { - api.getContainerApi(region).create(name); + for (String regionId : regions) { + api.getContainerApi(regionId).create(name); } } @Override @AfterClass(groups = "live") public void tearDown() { - for (String region : regions) { - api.getCDNApi(region).disable(name); - api.getContainerApi(region).deleteIfEmpty(name); + for (String regionId : regions) { + api.getCDNApi(regionId).disable(name); + api.getContainerApi(regionId).deleteIfEmpty(name); } super.tearDown(); }