mirror of https://github.com/apache/jclouds.git
Prefer Regions to Zones
This commit is contained in:
parent
4073f7fdc4
commit
aa04ef007f
|
@ -32,7 +32,7 @@ import com.google.common.annotations.Beta;
|
||||||
* <p/>
|
* <p/>
|
||||||
* Additionally, Cloud Files provides a simple yet powerful way to publish and distribute content
|
* Additionally, Cloud Files provides a simple yet powerful way to publish and distribute content
|
||||||
* behind a Content Distribution Network.
|
* behind a Content Distribution Network.
|
||||||
*
|
*
|
||||||
* @see CDNApi
|
* @see CDNApi
|
||||||
* @see SwiftApi
|
* @see SwiftApi
|
||||||
*/
|
*/
|
||||||
|
@ -41,21 +41,21 @@ public interface CloudFilesApi extends SwiftApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to Cloud Files CDN features.
|
* Provides access to Cloud Files CDN features.
|
||||||
*
|
*
|
||||||
* @param region the region to access the CDN API.
|
* @param region the region to access the CDN API.
|
||||||
*
|
*
|
||||||
* @return the {@link CDNApi} for the specified region.
|
* @return the {@link CDNApi} for the specified region.
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
CDNApi getCDNApiForRegion(@EndpointParam(parser = RegionToCDNEndpoint.class) @Nullable String region);
|
CDNApi getCDNApi(@EndpointParam(parser = RegionToCDNEndpoint.class) @Nullable String region);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to Cloud Files CDN features.
|
* Provides access to Cloud Files CDN features.
|
||||||
*
|
*
|
||||||
* @param region the region to access the CDN API.
|
* @param region the region to access the CDN API.
|
||||||
*
|
*
|
||||||
* @return the {@link CDNApi} for the specified region.
|
* @return the {@link CDNApi} for the specified region.
|
||||||
*
|
*
|
||||||
* @deprecated Please use {@link #getCDNApiForRegion(String)}. This method will be removed in jclouds 1.8.
|
* @deprecated Please use {@link #getCDNApiForRegion(String)}. This method will be removed in jclouds 1.8.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -36,8 +36,8 @@ public class CloudFilesAccountApiLiveTest extends AccountApiLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUrlKeyExists() throws Exception {
|
public void testUrlKeyExists() throws Exception {
|
||||||
for (String regionId : regions) {
|
for (String region : regions) {
|
||||||
Account account = api.getAccountApiForRegion(regionId).get();
|
Account account = api.getAccountApi(region).get();
|
||||||
assertTrue(account.getTemporaryUrlKey().isPresent());
|
assertTrue(account.getTemporaryUrlKey().isPresent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,20 +53,20 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEnable() throws Exception {
|
public void testEnable() throws Exception {
|
||||||
for (String regionId : regions) {
|
for (String region : regions) {
|
||||||
assertNotNull(api.getCDNApiForRegion(regionId).enable(name));
|
assertNotNull(api.getCDNApi(region).enable(name));
|
||||||
|
|
||||||
CDNContainer container = api.getCDNApiForRegion(regionId).get(name);
|
CDNContainer container = api.getCDNApi(region).get(name);
|
||||||
assertCDNContainerNotNull(container);
|
assertCDNContainerNotNull(container);
|
||||||
assertTrue(container.isEnabled());
|
assertTrue(container.isEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEnableWithTTL() throws Exception {
|
public void testEnableWithTTL() throws Exception {
|
||||||
for (String regionId : regions) {
|
for (String region : regions) {
|
||||||
assertNotNull(api.getCDNApiForRegion(regionId).enable(name, 777777));
|
assertNotNull(api.getCDNApi(region).enable(name, 777777));
|
||||||
|
|
||||||
CDNContainer container = api.getCDNApiForRegion(regionId).get(name);
|
CDNContainer container = api.getCDNApi(region).get(name);
|
||||||
assertCDNContainerNotNull(container);
|
assertCDNContainerNotNull(container);
|
||||||
assertTrue(container.isEnabled());
|
assertTrue(container.isEnabled());
|
||||||
assertTrue(container.getTtl() == 777777);
|
assertTrue(container.getTtl() == 777777);
|
||||||
|
@ -74,19 +74,19 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDisable() throws Exception {
|
public void testDisable() throws Exception {
|
||||||
for (String regionId : regions) {
|
for (String region : regions) {
|
||||||
assertTrue(api.getCDNApiForRegion(regionId).disable(name));
|
assertTrue(api.getCDNApi(region).disable(name));
|
||||||
|
|
||||||
CDNContainer container = api.getCDNApiForRegion(regionId).get(name);
|
CDNContainer container = api.getCDNApi(region).get(name);
|
||||||
assertFalse(container.isEnabled());
|
assertFalse(container.isEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testList() throws Exception {
|
public void testList() throws Exception {
|
||||||
for (String regionId : regions) {
|
for (String region : regions) {
|
||||||
List<CDNContainer> cdnResponse = api.getCDNApiForRegion(regionId).list().toList();
|
List<CDNContainer> cdnResponse = api.getCDNApi(region).list().toList();
|
||||||
assertNotNull(cdnResponse);
|
assertNotNull(cdnResponse);
|
||||||
|
|
||||||
for (CDNContainer cdnContainer : cdnResponse) {
|
for (CDNContainer cdnContainer : cdnResponse) {
|
||||||
assertCDNContainerNotNull(cdnContainer);
|
assertCDNContainerNotNull(cdnContainer);
|
||||||
assertTrue(cdnContainer.isEnabled());
|
assertTrue(cdnContainer.isEnabled());
|
||||||
|
@ -96,35 +96,35 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest {
|
||||||
|
|
||||||
public void testListWithOptions() throws Exception {
|
public void testListWithOptions() throws Exception {
|
||||||
String lexicographicallyBeforeName = name.substring(0, name.length() - 1);
|
String lexicographicallyBeforeName = name.substring(0, name.length() - 1);
|
||||||
for (String regionId : regions) {
|
for (String region : regions) {
|
||||||
ListCDNContainerOptions options = new ListCDNContainerOptions().marker(lexicographicallyBeforeName);
|
ListCDNContainerOptions options = new ListCDNContainerOptions().marker(lexicographicallyBeforeName);
|
||||||
|
|
||||||
CDNContainer cdnContainer = api.getCDNApiForRegion(regionId).list(options).get(0);
|
CDNContainer cdnContainer = api.getCDNApi(region).list(options).get(0);
|
||||||
assertCDNContainerNotNull(cdnContainer);
|
assertCDNContainerNotNull(cdnContainer);
|
||||||
assertTrue(cdnContainer.isEnabled());
|
assertTrue(cdnContainer.isEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGet() throws Exception {
|
public void testGet() throws Exception {
|
||||||
for (String regionId : regions) {
|
for (String region : regions) {
|
||||||
CDNContainer container = api.getCDNApiForRegion(regionId).get(name);
|
CDNContainer container = api.getCDNApi(region).get(name);
|
||||||
assertCDNContainerNotNull(container);
|
assertCDNContainerNotNull(container);
|
||||||
assertTrue(container.isEnabled());
|
assertTrue(container.isEnabled());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPurgeObject() throws Exception {
|
public void testPurgeObject() throws Exception {
|
||||||
for (String regionId : regions) {
|
for (String region : regions) {
|
||||||
String objectName = "testPurge";
|
String objectName = "testPurge";
|
||||||
Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[] {1, 2, 3}));
|
Payload payload = Payloads.newByteSourcePayload(ByteSource.wrap(new byte[] {1, 2, 3}));
|
||||||
ObjectApi objectApi = api.getObjectApiForRegionAndContainer(regionId, name);
|
ObjectApi objectApi = api.getObjectApiForContainer(region, name);
|
||||||
|
|
||||||
// create a new object
|
// create a new object
|
||||||
objectApi.put(objectName, payload);
|
objectApi.put(objectName, payload);
|
||||||
|
|
||||||
CDNApi cdnApi = api.getCDNApiForRegion(regionId);
|
CDNApi cdnApi = api.getCDNApi(region);
|
||||||
assertTrue(cdnApi.purgeObject(name, "testPurge", ImmutableList.<String>of()));
|
assertTrue(cdnApi.purgeObject(name, "testPurge", ImmutableList.<String>of()));
|
||||||
|
|
||||||
// delete the object
|
// delete the object
|
||||||
objectApi.delete(objectName);
|
objectApi.delete(objectName);
|
||||||
assertNull(objectApi.get(objectName, GetOptions.NONE));
|
assertNull(objectApi.get(objectName, GetOptions.NONE));
|
||||||
|
@ -132,12 +132,12 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUpdate() throws Exception {
|
public void testUpdate() throws Exception {
|
||||||
for (String regionId : regions) {
|
for (String region : regions) {
|
||||||
// enable with a ttl
|
// enable with a ttl
|
||||||
assertNotNull(api.getCDNApiForRegion(regionId).enable(name, 777777));
|
assertNotNull(api.getCDNApi(region).enable(name, 777777));
|
||||||
|
|
||||||
// now get the container
|
// now get the container
|
||||||
CDNContainer original = api.getCDNApiForRegion(regionId).get(name);
|
CDNContainer original = api.getCDNApi(region).get(name);
|
||||||
assertTrue(original.isEnabled());
|
assertTrue(original.isEnabled());
|
||||||
assertCDNContainerNotNull(original);
|
assertCDNContainerNotNull(original);
|
||||||
|
|
||||||
|
@ -147,13 +147,13 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest {
|
||||||
.logRetention(true)
|
.logRetention(true)
|
||||||
.enabled(false);
|
.enabled(false);
|
||||||
// update the container
|
// update the container
|
||||||
assertTrue(api.getCDNApiForRegion(regionId).update(name, opts));
|
assertTrue(api.getCDNApi(region).update(name, opts));
|
||||||
|
|
||||||
// now get the updated container
|
// now get the updated container
|
||||||
CDNContainer updated = api.getCDNApiForRegion(regionId).get(name);
|
CDNContainer updated = api.getCDNApi(region).get(name);
|
||||||
assertFalse(updated.isEnabled());
|
assertFalse(updated.isEnabled());
|
||||||
assertCDNContainerNotNull(updated);
|
assertCDNContainerNotNull(updated);
|
||||||
|
|
||||||
assertNotEquals(original.getTtl(), updated.getTtl());
|
assertNotEquals(original.getTtl(), updated.getTtl());
|
||||||
assertTrue(updated.isLogRetentionEnabled());
|
assertTrue(updated.isLogRetentionEnabled());
|
||||||
}
|
}
|
||||||
|
@ -173,17 +173,17 @@ public class CloudFilesCDNApiLiveTest extends BaseCloudFilesApiLiveTest {
|
||||||
@BeforeClass(groups = "live")
|
@BeforeClass(groups = "live")
|
||||||
public void setup() {
|
public void setup() {
|
||||||
super.setup();
|
super.setup();
|
||||||
for (String regionId : regions) {
|
for (String region : regions) {
|
||||||
api.getContainerApiForRegion(regionId).create(name);
|
api.getContainerApi(region).create(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@AfterClass(groups = "live")
|
@AfterClass(groups = "live")
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
for (String regionId : regions) {
|
for (String region : regions) {
|
||||||
api.getCDNApiForRegion(regionId).disable(name);
|
api.getCDNApi(region).disable(name);
|
||||||
api.getContainerApiForRegion(regionId).deleteIfEmpty(name);
|
api.getContainerApi(region).deleteIfEmpty(name);
|
||||||
}
|
}
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
CDNApi cdnApi = api.getCDNApiForRegion("DFW");
|
CDNApi cdnApi = api.getCDNApi("DFW");
|
||||||
|
|
||||||
ImmutableList<CDNContainer> cdnContainers = cdnApi.list().toList();
|
ImmutableList<CDNContainer> cdnContainers = cdnApi.list().toList();
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
CDNApi cdnApi = api.getCDNApiForRegion("DFW");
|
CDNApi cdnApi = api.getCDNApi("DFW");
|
||||||
|
|
||||||
List<CDNContainer> cdnContainers = cdnApi.list().toList();
|
List<CDNContainer> cdnContainers = cdnApi.list().toList();
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
try {
|
try {
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
ListCDNContainerOptions options = new ListCDNContainerOptions().marker("cdn-container-3");
|
ListCDNContainerOptions options = new ListCDNContainerOptions().marker("cdn-container-3");
|
||||||
ImmutableList<CDNContainer> containers = api.getCDNApiForRegion("DFW").list(options).toList();
|
ImmutableList<CDNContainer> containers = api.getCDNApi("DFW").list(options).toList();
|
||||||
|
|
||||||
for (CDNContainer container : containers) {
|
for (CDNContainer container : containers) {
|
||||||
assertCDNContainerNotNull(container);
|
assertCDNContainerNotNull(container);
|
||||||
|
@ -128,7 +128,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
try {
|
try {
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
ListCDNContainerOptions options = ListCDNContainerOptions.Builder.marker("cdn-container-3");
|
ListCDNContainerOptions options = ListCDNContainerOptions.Builder.marker("cdn-container-3");
|
||||||
FluentIterable<CDNContainer> containers = api.getCDNApiForRegion("DFW").list(options);
|
FluentIterable<CDNContainer> containers = api.getCDNApi("DFW").list(options);
|
||||||
|
|
||||||
assertEquals(server.getRequestCount(), 2);
|
assertEquals(server.getRequestCount(), 2);
|
||||||
assertAuthentication(server);
|
assertAuthentication(server);
|
||||||
|
@ -150,7 +150,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
// enable a CDN Container
|
// enable a CDN Container
|
||||||
URI enabledContainer = api.getCDNApiForRegion("DFW").enable("container-1");
|
URI enabledContainer = api.getCDNApi("DFW").enable("container-1");
|
||||||
assertNotNull(enabledContainer);
|
assertNotNull(enabledContainer);
|
||||||
|
|
||||||
assertEquals(server.getRequestCount(), 2);
|
assertEquals(server.getRequestCount(), 2);
|
||||||
|
@ -165,11 +165,11 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
MockWebServer server = mockOpenStackServer();
|
MockWebServer server = mockOpenStackServer();
|
||||||
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
server.enqueue(addCommonHeaders(enabledResponse().setResponseCode(404)));
|
server.enqueue(addCommonHeaders(enabledResponse().setResponseCode(404)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
// enable a CDN Container
|
// enable a CDN Container
|
||||||
assertNull(api.getCDNApiForRegion("DFW").enable("container-1"));
|
assertNull(api.getCDNApi("DFW").enable("container-1"));
|
||||||
|
|
||||||
assertEquals(server.getRequestCount(), 2);
|
assertEquals(server.getRequestCount(), 2);
|
||||||
assertAuthentication(server);
|
assertAuthentication(server);
|
||||||
|
@ -188,7 +188,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
// enable a CDN Container with a TTL
|
// enable a CDN Container with a TTL
|
||||||
URI enabledContainer = api.getCDNApiForRegion("DFW").enable("container-1", 777777);
|
URI enabledContainer = api.getCDNApi("DFW").enable("container-1", 777777);
|
||||||
assertNotNull(enabledContainer);
|
assertNotNull(enabledContainer);
|
||||||
|
|
||||||
assertEquals(server.getRequestCount(), 2);
|
assertEquals(server.getRequestCount(), 2);
|
||||||
|
@ -208,7 +208,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
// enable a CDN Container with a TTL
|
// enable a CDN Container with a TTL
|
||||||
URI enabledContainer = api.getCDNApiForRegion("DFW").enable("container-1", 777777);
|
URI enabledContainer = api.getCDNApi("DFW").enable("container-1", 777777);
|
||||||
assertNull(enabledContainer);
|
assertNull(enabledContainer);
|
||||||
|
|
||||||
assertEquals(server.getRequestCount(), 2);
|
assertEquals(server.getRequestCount(), 2);
|
||||||
|
@ -228,7 +228,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
// disable a CDN Container
|
// disable a CDN Container
|
||||||
assertTrue(api.getCDNApiForRegion("DFW").disable("container-1"));
|
assertTrue(api.getCDNApi("DFW").disable("container-1"));
|
||||||
|
|
||||||
assertEquals(server.getRequestCount(), 2);
|
assertEquals(server.getRequestCount(), 2);
|
||||||
assertAuthentication(server);
|
assertAuthentication(server);
|
||||||
|
@ -247,7 +247,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
// disable a CDN Container
|
// disable a CDN Container
|
||||||
boolean disbledContainer = api.getCDNApiForRegion("DFW").disable("container-1");
|
boolean disbledContainer = api.getCDNApi("DFW").disable("container-1");
|
||||||
assertFalse(disbledContainer);
|
assertFalse(disbledContainer);
|
||||||
|
|
||||||
assertEquals(server.getRequestCount(), 2);
|
assertEquals(server.getRequestCount(), 2);
|
||||||
|
@ -262,11 +262,11 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
MockWebServer server = mockOpenStackServer();
|
MockWebServer server = mockOpenStackServer();
|
||||||
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
|
||||||
server.enqueue(addCommonHeaders(enabledResponse().setResponseCode(201)));
|
server.enqueue(addCommonHeaders(enabledResponse().setResponseCode(201)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
CDNContainer cdnContainer = api.getCDNApiForRegion("DFW").get("container-1");
|
CDNContainer cdnContainer = api.getCDNApi("DFW").get("container-1");
|
||||||
assertCDNContainerNotNull(cdnContainer);
|
assertCDNContainerNotNull(cdnContainer);
|
||||||
assertEquals(mockCDNContainer, cdnContainer);
|
assertEquals(mockCDNContainer, cdnContainer);
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
try {
|
try {
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
CDNContainer cdnContainer = api.getCDNApiForRegion("DFW").get("cdn-container with spaces");
|
CDNContainer cdnContainer = api.getCDNApi("DFW").get("cdn-container with spaces");
|
||||||
assertCDNContainerNotNull(cdnContainer);
|
assertCDNContainerNotNull(cdnContainer);
|
||||||
assertEquals(mockCDNContainerWithSpaces, cdnContainer);
|
assertEquals(mockCDNContainerWithSpaces, cdnContainer);
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
try {
|
try {
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
CDNContainer cdnContainer = api.getCDNApiForRegion("DFW").get("container-1");
|
CDNContainer cdnContainer = api.getCDNApi("DFW").get("container-1");
|
||||||
|
|
||||||
assertAuthentication(server);
|
assertAuthentication(server);
|
||||||
assertRequest(server.takeRequest(), "HEAD", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/container-1");
|
assertRequest(server.takeRequest(), "HEAD", "/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/container-1");
|
||||||
|
@ -325,7 +325,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
// purge the object
|
// purge the object
|
||||||
assertTrue(api.getCDNApiForRegion("DFW").purgeObject("myContainer", "myObject", emails));
|
assertTrue(api.getCDNApi("DFW").purgeObject("myContainer", "myObject", emails));
|
||||||
|
|
||||||
assertEquals(server.getRequestCount(), 2);
|
assertEquals(server.getRequestCount(), 2);
|
||||||
assertAuthentication(server);
|
assertAuthentication(server);
|
||||||
|
@ -344,7 +344,7 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
// purge the object
|
// purge the object
|
||||||
assertFalse(api.getCDNApiForRegion("DFW").purgeObject("myContainer", "myObject", emails));
|
assertFalse(api.getCDNApi("DFW").purgeObject("myContainer", "myObject", emails));
|
||||||
|
|
||||||
assertEquals(server.getRequestCount(), 2);
|
assertEquals(server.getRequestCount(), 2);
|
||||||
assertAuthentication(server);
|
assertAuthentication(server);
|
||||||
|
@ -364,13 +364,13 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
try {
|
try {
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
CDNContainer cdnContainer = api.getCDNApiForRegion("DFW").get("container-1");
|
CDNContainer cdnContainer = api.getCDNApi("DFW").get("container-1");
|
||||||
assertCDNContainerNotNull(cdnContainer);
|
assertCDNContainerNotNull(cdnContainer);
|
||||||
|
|
||||||
// update the CDN Container
|
// update the CDN Container
|
||||||
assertTrue(api.getCDNApiForRegion("DFW").update("container-1", enabled(false).logRetention(true).ttl(7654321)));
|
assertTrue(api.getCDNApi("DFW").update("container-1", enabled(false).logRetention(true).ttl(7654321)));
|
||||||
|
|
||||||
cdnContainer = api.getCDNApiForRegion("DFW").get("container-1");
|
cdnContainer = api.getCDNApi("DFW").get("container-1");
|
||||||
assertCDNContainerNotNull(cdnContainer);
|
assertCDNContainerNotNull(cdnContainer);
|
||||||
|
|
||||||
CDNContainer updatedContainer = CDNContainer.builder()
|
CDNContainer updatedContainer = CDNContainer.builder()
|
||||||
|
@ -405,11 +405,11 @@ public class CloudFilesCDNApiMockTest extends BaseOpenStackMockTest<CloudFilesAp
|
||||||
try {
|
try {
|
||||||
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
CloudFilesApi api = api(server.getUrl("/").toString(), "rackspace-cloudfiles");
|
||||||
|
|
||||||
CDNContainer cdnContainer = api.getCDNApiForRegion("DFW").get("container-1");
|
CDNContainer cdnContainer = api.getCDNApi("DFW").get("container-1");
|
||||||
assertCDNContainerNotNull(cdnContainer);
|
assertCDNContainerNotNull(cdnContainer);
|
||||||
|
|
||||||
// update the CDN Container
|
// update the CDN Container
|
||||||
assertFalse(api.getCDNApiForRegion("DFW").update("container-1", enabled(false).logRetention(true).ttl(7654321)));
|
assertFalse(api.getCDNApi("DFW").update("container-1", enabled(false).logRetention(true).ttl(7654321)));
|
||||||
|
|
||||||
assertEquals(server.getRequestCount(), 3);
|
assertEquals(server.getRequestCount(), 3);
|
||||||
assertAuthentication(server);
|
assertAuthentication(server);
|
||||||
|
|
Loading…
Reference in New Issue