JCLOUDS-489 - Adds support to Cloud Files for the iOS Streaming URI

This commit is contained in:
Jeremy Daggett 2014-03-07 11:20:21 -08:00 committed by Everett Toews
parent a45a24d4a1
commit c3d341a680
7 changed files with 90 additions and 73 deletions

View File

@ -16,8 +16,15 @@
*/ */
package org.jclouds.cloudfiles.domain; package org.jclouds.cloudfiles.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import java.beans.ConstructorProperties;
import java.net.URI; import java.net.URI;
import javax.inject.Named;
import org.jclouds.javax.annotation.Nullable;
/** /**
* *
* @author James Murty * @author James Murty
@ -26,23 +33,32 @@ import java.net.URI;
public class ContainerCDNMetadata implements Comparable<ContainerCDNMetadata> { public class ContainerCDNMetadata implements Comparable<ContainerCDNMetadata> {
private String name; private String name;
private boolean cdn_enabled; @Named("cdn_enabled")
private boolean log_retention; private boolean cdnEnabled;
@Named("log_retention")
private boolean logRetention;
private long ttl; private long ttl;
private URI cdn_uri; @Named("cdn_uri")
private URI cdn_ssl_uri; private URI cdnUri;
private URI cdn_streaming_uri; @Named("cdn_ssl_uri")
private String referrer_acl; private URI cdnSslUri;
private String useragent_acl; @Named("cdn_streaming_uri")
private URI cdnStreamingUri;
@Named("cdn_ios_uri")
private URI cdnIosUri;
public ContainerCDNMetadata(String name, boolean cdnEnabled, boolean logRetention, long ttl, URI cdnUri, URI cdnSslUri, URI cdnStreamingUri) { @ConstructorProperties({ "name", "cdn_enabled", "log_retention", "ttl", "cdn_uri", "cdn_ssl_uri",
this.name = name; "cdn_streaming_uri", "cdn_ios_uri"})
this.cdn_enabled = cdnEnabled; public ContainerCDNMetadata(String name, boolean cdnEnabled, boolean logRetention, long ttl,
this.log_retention = logRetention; @Nullable URI cdnUri, @Nullable URI cdnSslUri, @Nullable URI cdnStreamingUri, @Nullable URI cdnIosUri) {
this.ttl = ttl; this.name = checkNotNull(name, "name");
this.cdn_uri = cdnUri; this.cdnEnabled = checkNotNull(cdnEnabled);
this.cdn_ssl_uri = cdnSslUri; this.logRetention = checkNotNull(logRetention);
this.cdn_streaming_uri = cdnStreamingUri; this.ttl = checkNotNull(ttl);
this.cdnUri = cdnUri;
this.cdnSslUri = cdnSslUri;
this.cdnStreamingUri = cdnStreamingUri;
this.cdnIosUri = cdnIosUri;
} }
public ContainerCDNMetadata() { public ContainerCDNMetadata() {
@ -57,11 +73,11 @@ public class ContainerCDNMetadata implements Comparable<ContainerCDNMetadata> {
} }
public boolean isCDNEnabled() { public boolean isCDNEnabled() {
return cdn_enabled; return cdnEnabled;
} }
public boolean isLogRetention() { public boolean isLogRetention() {
return log_retention; return logRetention;
} }
public long getTTL() { public long getTTL() {
@ -69,23 +85,19 @@ public class ContainerCDNMetadata implements Comparable<ContainerCDNMetadata> {
} }
public URI getCDNUri() { public URI getCDNUri() {
return cdn_uri; return cdnUri;
} }
public URI getCDNSslUri() { public URI getCDNSslUri() {
return cdn_ssl_uri; return cdnSslUri;
} }
public URI getCDNStreamingUri() { public URI getCDNStreamingUri() {
return cdn_streaming_uri; return cdnStreamingUri;
} }
public String getReferrerACL() { public URI getCDNIosUri() {
return referrer_acl; return cdnIosUri;
}
public String getUseragentACL() {
return useragent_acl;
} }
public int compareTo(ContainerCDNMetadata o) { public int compareTo(ContainerCDNMetadata o) {
@ -98,7 +110,7 @@ public class ContainerCDNMetadata implements Comparable<ContainerCDNMetadata> {
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((cdn_uri == null) ? 0 : cdn_uri.hashCode()); result = prime * result + ((cdnUri == null) ? 0 : cdnUri.hashCode());
return result; return result;
} }
@ -112,10 +124,10 @@ public class ContainerCDNMetadata implements Comparable<ContainerCDNMetadata> {
return false; return false;
ContainerCDNMetadata other = (ContainerCDNMetadata) obj; ContainerCDNMetadata other = (ContainerCDNMetadata) obj;
if (cdn_uri == null) { if (cdnUri == null) {
if (other.cdn_uri != null) if (other.cdnUri != null)
return false; return false;
} else if (!cdn_uri.equals(other.cdn_uri)) } else if (!cdnUri.equals(other.cdnUri))
return false; return false;
return true; return true;
@ -124,7 +136,7 @@ public class ContainerCDNMetadata implements Comparable<ContainerCDNMetadata> {
@Override @Override
public String toString() { public String toString() {
return String.format( return String.format(
"[name=%s, cdn_enabled=%s, log_retention=%s, ttl=%s, cdn_uri=%s, cdn_ssl_uri=%s, cdn_streaming_uri=%s, referrer_acl=%s, useragent_acl=%s]", "[name=%s, cdnEnabled=%s, logRetention=%s, ttl=%s, cdnUri=%s, cdnSslUri=%s, cdnStreamingUri=%s, cdnIosUri=%s]",
name, cdn_enabled, log_retention, ttl, cdn_uri, cdn_ssl_uri, cdn_streaming_uri, referrer_acl, useragent_acl); name, cdnEnabled, logRetention, ttl, cdnUri, cdnSslUri, cdnStreamingUri, cdnIosUri);
} }
} }

View File

@ -16,9 +16,12 @@
*/ */
package org.jclouds.cloudfiles.functions; package org.jclouds.cloudfiles.functions;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Lists.newArrayList;
import java.net.URI; import java.net.URI;
import java.util.List;
import org.jclouds.cloudfiles.domain.ContainerCDNMetadata; import org.jclouds.cloudfiles.domain.ContainerCDNMetadata;
import org.jclouds.cloudfiles.reference.CloudFilesHeaders; import org.jclouds.cloudfiles.reference.CloudFilesHeaders;
@ -27,11 +30,14 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.rest.InvocationContext; import org.jclouds.rest.InvocationContext;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
/** /**
* This parses {@link AccountMetadata} from HTTP headers. * This parses {@link AccountMetadata} from HTTP headers.
* *
* @author James Murty * @author James Murty
* @author Jeremy Daggett
*/ */
public class ParseContainerCDNMetadataFromHeaders implements public class ParseContainerCDNMetadataFromHeaders implements
Function<HttpResponse, ContainerCDNMetadata>, InvocationContext<ParseContainerCDNMetadataFromHeaders> { Function<HttpResponse, ContainerCDNMetadata>, InvocationContext<ParseContainerCDNMetadataFromHeaders> {
@ -48,21 +54,20 @@ public class ParseContainerCDNMetadataFromHeaders implements
String cdnUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_URI), CloudFilesHeaders.CDN_URI); String cdnUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_URI), CloudFilesHeaders.CDN_URI);
String cdnSslUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_SSL_URI), CloudFilesHeaders.CDN_SSL_URI); String cdnSslUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_SSL_URI), CloudFilesHeaders.CDN_SSL_URI);
String cdnStreamingUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_STREAMING_URI), CloudFilesHeaders.CDN_STREAMING_URI); String cdnStreamingUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_STREAMING_URI), CloudFilesHeaders.CDN_STREAMING_URI);
String cdnIosUri = checkNotNull(from.getFirstHeaderOrNull(CloudFilesHeaders.CDN_IOS_URI), CloudFilesHeaders.CDN_IOS_URI);
if (cdnUri == null) {
// CDN is not, and has never, been enabled for this container. List<String> parts = newArrayList(Splitter.on('/').split(request.getEndpoint().getPath()));
return null; checkArgument(!parts.isEmpty(), "incorrect path: " + request.getEndpoint().getPath());
}
else { return new ContainerCDNMetadata(
return new ContainerCDNMetadata( Iterables.getLast(parts),
request.getEndpoint().getPath(), Boolean.parseBoolean(cdnEnabled),
Boolean.parseBoolean(cdnEnabled), Boolean.parseBoolean(cdnLogRetention),
Boolean.parseBoolean(cdnLogRetention), Long.parseLong(cdnTTL),
Long.parseLong(cdnTTL), URI.create(cdnUri),
URI.create(cdnUri), URI.create(cdnSslUri),
URI.create(cdnSslUri), URI.create(cdnStreamingUri),
URI.create(cdnStreamingUri)); URI.create(cdnIosUri));
}
} }
@Override @Override

View File

@ -34,8 +34,7 @@ public interface CloudFilesHeaders extends SwiftHeaders {
public static final String CDN_URI = "X-CDN-URI"; public static final String CDN_URI = "X-CDN-URI";
public static final String CDN_SSL_URI = "X-Cdn-Ssl-Uri"; public static final String CDN_SSL_URI = "X-Cdn-Ssl-Uri";
public static final String CDN_STREAMING_URI = "X-Cdn-Streaming-Uri"; public static final String CDN_STREAMING_URI = "X-Cdn-Streaming-Uri";
public static final String CDN_REFERRER_ACL = "X-Referrer-ACL "; public static final String CDN_IOS_URI = "X-Cdn-Ios-Uri";
public static final String CDN_USER_AGENT_ACL = "X-User-Agent-ACL";
public static final String CDN_CONTAINER_PURGE_OBJECT_EMAIL = "X-Purge-Email"; public static final String CDN_CONTAINER_PURGE_OBJECT_EMAIL = "X-Purge-Email";
public static final String CDN_WEBSITE_INDEX = "X-Container-Meta-Web-Index"; public static final String CDN_WEBSITE_INDEX = "X-Container-Meta-Web-Index";

View File

@ -33,13 +33,13 @@ import org.testng.annotations.Test;
/** /**
* *
* @author Adrian Cole * @author Adrian Cole
* @author Jeremy Daggett
*/ */
@Test(groups = "unit", testName = "CloudFilesClientExpectTest") @Test(groups = "unit", testName = "CloudFilesClientExpectTest")
public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTest { public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTest {
@Test @Test
public void testDeleteContainerReturnsTrueOn200And404() { public void testDeleteContainerReturnsTrueOn200And404() {
HttpRequest deleteContainer = HttpRequest HttpRequest deleteContainer = HttpRequest
.builder() .builder()
.method("DELETE") .method("DELETE")
@ -62,7 +62,7 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
@Test @Test
public void testGetCDNMetadataWhenResponseIs2xxReturnsContainerCDNMetadata() { public void testGetCDNMetadataWhenResponseIs2xxReturnsContainerCDNMetadata() {
HttpRequest cdnContainerRequest = HttpRequest.builder() HttpRequest cdnContainerRequest = HttpRequest.builder()
.method("HEAD") .method("HEAD")
.endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container") .endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container")
.addHeader("X-Auth-Token", authToken) .addHeader("X-Auth-Token", authToken)
@ -75,6 +75,7 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
.addHeader(CloudFilesHeaders.CDN_URI, "http://546406d62bf471d7435d-36c33e76d676c80251b3c13ecb603b67.r19.cf1.rackcdn.com") .addHeader(CloudFilesHeaders.CDN_URI, "http://546406d62bf471d7435d-36c33e76d676c80251b3c13ecb603b67.r19.cf1.rackcdn.com")
.addHeader(CloudFilesHeaders.CDN_SSL_URI, "https://e9f6fe92d217dc013369-36c33e76d676c80251b3c13ecb603b67.ssl.cf1.rackcdn.com") .addHeader(CloudFilesHeaders.CDN_SSL_URI, "https://e9f6fe92d217dc013369-36c33e76d676c80251b3c13ecb603b67.ssl.cf1.rackcdn.com")
.addHeader(CloudFilesHeaders.CDN_STREAMING_URI, "http://0e79346bc0a2564dcc5e-36c33e76d676c80251b3c13ecb603b67.r19.stream.cf1.rackcdn.com") .addHeader(CloudFilesHeaders.CDN_STREAMING_URI, "http://0e79346bc0a2564dcc5e-36c33e76d676c80251b3c13ecb603b67.r19.stream.cf1.rackcdn.com")
.addHeader(CloudFilesHeaders.CDN_IOS_URI, "http://552e06d62bf471d7435d-36c33e76d676c80251b3c13ecb603b67.r11.iosr.cf1.rackcdn.com")
.statusCode(204) .statusCode(204)
.build(); .build();
@ -88,11 +89,12 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
assertEquals(containerCDNMetadata.getCDNUri().toString(), "http://546406d62bf471d7435d-36c33e76d676c80251b3c13ecb603b67.r19.cf1.rackcdn.com"); assertEquals(containerCDNMetadata.getCDNUri().toString(), "http://546406d62bf471d7435d-36c33e76d676c80251b3c13ecb603b67.r19.cf1.rackcdn.com");
assertEquals(containerCDNMetadata.getCDNSslUri().toString(), "https://e9f6fe92d217dc013369-36c33e76d676c80251b3c13ecb603b67.ssl.cf1.rackcdn.com"); assertEquals(containerCDNMetadata.getCDNSslUri().toString(), "https://e9f6fe92d217dc013369-36c33e76d676c80251b3c13ecb603b67.ssl.cf1.rackcdn.com");
assertEquals(containerCDNMetadata.getCDNStreamingUri().toString(), "http://0e79346bc0a2564dcc5e-36c33e76d676c80251b3c13ecb603b67.r19.stream.cf1.rackcdn.com"); assertEquals(containerCDNMetadata.getCDNStreamingUri().toString(), "http://0e79346bc0a2564dcc5e-36c33e76d676c80251b3c13ecb603b67.r19.stream.cf1.rackcdn.com");
assertEquals(containerCDNMetadata.getCDNIosUri().toString(), "http://552e06d62bf471d7435d-36c33e76d676c80251b3c13ecb603b67.r11.iosr.cf1.rackcdn.com");
} }
@Test @Test
public void testGetCDNMetadataWhenResponseIs404ReturnsNull() { public void testGetCDNMetadataWhenResponseIs404ReturnsNull() {
HttpRequest cdnContainerRequest = HttpRequest.builder() HttpRequest cdnContainerRequest = HttpRequest.builder()
.method("HEAD") .method("HEAD")
.endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container") .endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container")
.addHeader("X-Auth-Token", authToken) .addHeader("X-Auth-Token", authToken)
@ -110,7 +112,7 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
@Test @Test
public void testUpdateCDNMetadataWhenResponseIs2xxReturnsURI() { public void testUpdateCDNMetadataWhenResponseIs2xxReturnsURI() {
HttpRequest cdnContainerRequest = HttpRequest.builder() HttpRequest cdnContainerRequest = HttpRequest.builder()
.method("POST") .method("POST")
.endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container") .endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container")
.addHeader(CloudFilesHeaders.CDN_TTL, "259200") .addHeader(CloudFilesHeaders.CDN_TTL, "259200")
@ -125,6 +127,7 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
.addHeader(CloudFilesHeaders.CDN_URI, "http://546406d62bf471d7435d-36c33e76d676c80251b3c13ecb603b67.r19.cf1.rackcdn.com") .addHeader(CloudFilesHeaders.CDN_URI, "http://546406d62bf471d7435d-36c33e76d676c80251b3c13ecb603b67.r19.cf1.rackcdn.com")
.addHeader(CloudFilesHeaders.CDN_SSL_URI, "https://e9f6fe92d217dc013369-36c33e76d676c80251b3c13ecb603b67.ssl.cf1.rackcdn.com") .addHeader(CloudFilesHeaders.CDN_SSL_URI, "https://e9f6fe92d217dc013369-36c33e76d676c80251b3c13ecb603b67.ssl.cf1.rackcdn.com")
.addHeader(CloudFilesHeaders.CDN_STREAMING_URI, "http://0e79346bc0a2564dcc5e-36c33e76d676c80251b3c13ecb603b67.r19.stream.cf1.rackcdn.com") .addHeader(CloudFilesHeaders.CDN_STREAMING_URI, "http://0e79346bc0a2564dcc5e-36c33e76d676c80251b3c13ecb603b67.r19.stream.cf1.rackcdn.com")
.addHeader(CloudFilesHeaders.CDN_IOS_URI, "http://552e06d62bf471d7435d-36c33e76d676c80251b3c13ecb603b67.r11.iosr.cf1.rackcdn.com")
.statusCode(204) .statusCode(204)
.build(); .build();
@ -154,10 +157,10 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
cdnContainerClient.updateCDN("container", 259200, true); cdnContainerClient.updateCDN("container", 259200, true);
} }
@Test @Test
public void testPurgeCDNObjectWhenResponseIs2xxReturnsTrue() { public void testPurgeCDNObjectWhenResponseIs2xxReturnsTrue() {
HttpRequest cdnContainerRequest = HttpRequest.builder() HttpRequest cdnContainerRequest = HttpRequest.builder()
.method("DELETE") .method("DELETE")
.endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container/foo.txt") .endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container/foo.txt")
.addHeader("X-Auth-Token", authToken) .addHeader("X-Auth-Token", authToken)
@ -175,7 +178,7 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
@Test @Test
public void testSetCDNStaticWebsiteIndexWhenResponseIs2xxReturnsTrue() { public void testSetCDNStaticWebsiteIndexWhenResponseIs2xxReturnsTrue() {
HttpRequest cdnContainerRequest = HttpRequest.builder() HttpRequest cdnContainerRequest = HttpRequest.builder()
.method("POST") .method("POST")
.endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container") .endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container")
.addHeader(CloudFilesHeaders.CDN_WEBSITE_INDEX, "index.html") .addHeader(CloudFilesHeaders.CDN_WEBSITE_INDEX, "index.html")
@ -194,7 +197,7 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
@Test(expectedExceptions = ContainerNotFoundException.class) @Test(expectedExceptions = ContainerNotFoundException.class)
public void testSetCDNStaticWebsiteIndexWhenResponseIs404ThrowsException() { public void testSetCDNStaticWebsiteIndexWhenResponseIs404ThrowsException() {
HttpRequest cdnContainerRequest = HttpRequest.builder() HttpRequest cdnContainerRequest = HttpRequest.builder()
.method("POST") .method("POST")
.endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container") .endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container")
.addHeader(CloudFilesHeaders.CDN_WEBSITE_INDEX, "index.html") .addHeader(CloudFilesHeaders.CDN_WEBSITE_INDEX, "index.html")
@ -213,7 +216,7 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
@Test @Test
public void testSetCDNStaticWebsiteErrorWhenResponseIs2xxReturnsTrue() { public void testSetCDNStaticWebsiteErrorWhenResponseIs2xxReturnsTrue() {
HttpRequest cdnContainerRequest = HttpRequest.builder() HttpRequest cdnContainerRequest = HttpRequest.builder()
.method("POST") .method("POST")
.endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container") .endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container")
.addHeader(CloudFilesHeaders.CDN_WEBSITE_ERROR, "error.html") .addHeader(CloudFilesHeaders.CDN_WEBSITE_ERROR, "error.html")
@ -232,7 +235,7 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
@Test(expectedExceptions = ContainerNotFoundException.class) @Test(expectedExceptions = ContainerNotFoundException.class)
public void testSetCDNStaticWebsiteErrorWhenResponseIs404ThrowsException() { public void testSetCDNStaticWebsiteErrorWhenResponseIs404ThrowsException() {
HttpRequest cdnContainerRequest = HttpRequest.builder() HttpRequest cdnContainerRequest = HttpRequest.builder()
.method("POST") .method("POST")
.endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container") .endpoint("https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container")
.addHeader(CloudFilesHeaders.CDN_WEBSITE_ERROR, "error.html") .addHeader(CloudFilesHeaders.CDN_WEBSITE_ERROR, "error.html")

View File

@ -109,11 +109,10 @@ public class CloudFilesClientLiveTest extends CommonSwiftClientLiveTest<CloudFil
final long initialTTL = cdnMetadata.getTTL(); final long initialTTL = cdnMetadata.getTTL();
final URI cdnSslUri = cdnMetadata.getCDNSslUri(); final URI cdnSslUri = cdnMetadata.getCDNSslUri();
final URI cdnStreamingUri = cdnMetadata.getCDNStreamingUri(); final URI cdnStreamingUri = cdnMetadata.getCDNStreamingUri();
final URI cdnIosUri = cdnMetadata.getCDNIosUri();
assertTrue(cdnMetadataList.contains(new ContainerCDNMetadata( assertTrue(cdnMetadataList.contains(new ContainerCDNMetadata(
containerNameWithCDN, cdnEnabled, logRetention, initialTTL, cdnUri, cdnSslUri, cdnStreamingUri))); containerNameWithCDN, cdnEnabled, logRetention, initialTTL, cdnUri, cdnSslUri, cdnStreamingUri, cdnIosUri)));
// Test listing with options // Test listing with options
cdnMetadataList = getApi().listCDNContainers(ListCdnContainerOptions.Builder.enabledOnly()); cdnMetadataList = getApi().listCDNContainers(ListCdnContainerOptions.Builder.enabledOnly());
assertTrue(Iterables.all(cdnMetadataList, new Predicate<ContainerCDNMetadata>() { assertTrue(Iterables.all(cdnMetadataList, new Predicate<ContainerCDNMetadata>() {

View File

@ -56,7 +56,8 @@ public class ParseContainerCDNMetadataListFromJsonResponseTest {
3600, 3600,
URI.create("http://c0354712.cdn.cloudfiles.rackspacecloud.com"), URI.create("http://c0354712.cdn.cloudfiles.rackspacecloud.com"),
URI.create("https://c0354712.cdn.ssl.cloudfiles.rackspacecloud.com"), URI.create("https://c0354712.cdn.ssl.cloudfiles.rackspacecloud.com"),
URI.create("http://c0354712.cdn.stream.cloudfiles.rackspacecloud.com")), URI.create("http://c0354712.cdn.stream.cloudfiles.rackspacecloud.com"),
URI.create("http://c0354712.cdn.iosr.cloudfiles.rackspacecloud.com")),
new ContainerCDNMetadata( new ContainerCDNMetadata(
"adriancole-blobstore5", "adriancole-blobstore5",
true, true,
@ -64,7 +65,8 @@ public class ParseContainerCDNMetadataListFromJsonResponseTest {
28800, 28800,
URI.create("http://c0404671.cdn.cloudfiles.rackspacecloud.com"), URI.create("http://c0404671.cdn.cloudfiles.rackspacecloud.com"),
URI.create("https://c0404671.cdn.ssl.cloudfiles.rackspacecloud.com"), URI.create("https://c0404671.cdn.ssl.cloudfiles.rackspacecloud.com"),
URI.create("http://c0404671.cdn.stream.cloudfiles.rackspacecloud.com")), URI.create("http://c0404671.cdn.stream.cloudfiles.rackspacecloud.com"),
URI.create("http://c0404671.cdn.iosr.cloudfiles.rackspacecloud.com")),
new ContainerCDNMetadata( new ContainerCDNMetadata(
"adriancole-cfcdnint.testCDNOperationsContainerWithCDN", "adriancole-cfcdnint.testCDNOperationsContainerWithCDN",
false, false,
@ -72,8 +74,8 @@ public class ParseContainerCDNMetadataListFromJsonResponseTest {
3600, 3600,
URI.create("http://c0320431.cdn.cloudfiles.rackspacecloud.com"), URI.create("http://c0320431.cdn.cloudfiles.rackspacecloud.com"),
URI.create("https://c0320431.cdn.ssl.cloudfiles.rackspacecloud.com"), URI.create("https://c0320431.cdn.ssl.cloudfiles.rackspacecloud.com"),
URI.create("http://c0320431.cdn.stream.cloudfiles.rackspacecloud.com")) URI.create("http://c0320431.cdn.stream.cloudfiles.rackspacecloud.com"),
); URI.create("http://c0320431.cdn.iosr.cloudfiles.rackspacecloud.com")));
ParseJson<SortedSet<ContainerCDNMetadata>> parser = i.getInstance(Key ParseJson<SortedSet<ContainerCDNMetadata>> parser = i.getInstance(Key
.get(new TypeLiteral<ParseJson<SortedSet<ContainerCDNMetadata>>>() { .get(new TypeLiteral<ParseJson<SortedSet<ContainerCDNMetadata>>>() {

View File

@ -7,8 +7,7 @@
"cdn_uri":"http://c0354712.cdn.cloudfiles.rackspacecloud.com", "cdn_uri":"http://c0354712.cdn.cloudfiles.rackspacecloud.com",
"cdn_ssl_uri":"https://c0354712.cdn.ssl.cloudfiles.rackspacecloud.com", "cdn_ssl_uri":"https://c0354712.cdn.ssl.cloudfiles.rackspacecloud.com",
"cdn_streaming_uri":"http://c0354712.cdn.stream.cloudfiles.rackspacecloud.com", "cdn_streaming_uri":"http://c0354712.cdn.stream.cloudfiles.rackspacecloud.com",
"referrer_acl":"", "cdn_ios_uri":"http://c0354712.cdn.iosr.cloudfiles.rackspacecloud.com"
"useragent_acl":""
}, },
{ {
"name":"adriancole-blobstore5", "name":"adriancole-blobstore5",
@ -18,8 +17,7 @@
"cdn_uri":"http://c0404671.cdn.cloudfiles.rackspacecloud.com", "cdn_uri":"http://c0404671.cdn.cloudfiles.rackspacecloud.com",
"cdn_ssl_uri":"https://c0404671.cdn.ssl.cloudfiles.rackspacecloud.com", "cdn_ssl_uri":"https://c0404671.cdn.ssl.cloudfiles.rackspacecloud.com",
"cdn_streaming_uri":"http://c0404671.cdn.stream.cloudfiles.rackspacecloud.com", "cdn_streaming_uri":"http://c0404671.cdn.stream.cloudfiles.rackspacecloud.com",
"referrer_acl":"", "cdn_ios_uri":"http://c0404671.cdn.iosr.cloudfiles.rackspacecloud.com"
"useragent_acl":""
}, },
{ {
"name":"adriancole-cfcdnint.testCDNOperationsContainerWithCDN", "name":"adriancole-cfcdnint.testCDNOperationsContainerWithCDN",
@ -29,7 +27,6 @@
"cdn_uri":"http://c0320431.cdn.cloudfiles.rackspacecloud.com", "cdn_uri":"http://c0320431.cdn.cloudfiles.rackspacecloud.com",
"cdn_ssl_uri":"https://c0320431.cdn.ssl.cloudfiles.rackspacecloud.com", "cdn_ssl_uri":"https://c0320431.cdn.ssl.cloudfiles.rackspacecloud.com",
"cdn_streaming_uri":"http://c0320431.cdn.stream.cloudfiles.rackspacecloud.com", "cdn_streaming_uri":"http://c0320431.cdn.stream.cloudfiles.rackspacecloud.com",
"referrer_acl":"", "cdn_ios_uri":"http://c0320431.cdn.iosr.cloudfiles.rackspacecloud.com"
"useragent_acl":""
} }
] ]