Merge pull request #974 from jdaggett/feature/cdn-ssl-support

Added CDNSslUri to CDNContainer class, updated json and unit tests
This commit is contained in:
Adrian Cole 2012-11-10 08:26:05 -08:00
commit 96ab420bca
3 changed files with 47 additions and 23 deletions

View File

@ -41,11 +41,12 @@ public class CDNContainer implements Comparable<CDNContainer> {
protected String name;
protected boolean cdnEnabled;
protected boolean logRetention;
protected long ttl;
protected URI CDNUri;
protected URI cdnUri;
protected URI cdnSslUri;
protected String referrerAcl;
protected String useragentAcl;
protected boolean logRetention;
/**
* @see CDNContainer#getName()
@ -74,11 +75,19 @@ public class CDNContainer implements Comparable<CDNContainer> {
/**
* @see CDNContainer#getCDNUri()
*/
public Builder CDNUri(URI CDNUri) {
this.CDNUri = CDNUri;
public Builder CDNUri(URI cdnUri) {
this.cdnUri = cdnUri;
return this;
}
/**
* @see CDNContainer#getCDNSslUri()
*/
public Builder CDNSslUri(URI cdnSslUri) {
this.cdnSslUri = cdnSslUri;
return this;
}
/**
* @see CDNContainer#getReferrerAcl()
*/
@ -90,7 +99,7 @@ public class CDNContainer implements Comparable<CDNContainer> {
/**
* @see CDNContainer#getUseragentAcl()
*/
public Builder useragent_acl(String useragentAcl) {
public Builder useragentAcl(String useragentAcl) {
this.useragentAcl = useragentAcl;
return this;
}
@ -104,31 +113,35 @@ public class CDNContainer implements Comparable<CDNContainer> {
}
public CDNContainer build() {
return new CDNContainer(name, cdnEnabled, ttl, CDNUri, referrerAcl, useragentAcl, logRetention);
return new CDNContainer(name, cdnEnabled, ttl, cdnUri, cdnSslUri, referrerAcl, useragentAcl, logRetention);
}
public Builder fromCDNContainer(CDNContainer in) {
return this.name(in.getName()).CDNEnabled(in.isCDNEnabled()).ttl(in.getTTL()).CDNUri(in.getCDNUri())
.referrerAcl(in.getReferrerAcl()).useragent_acl(in.getUseragentAcl())
.logRetention(in.isLogRetention());
return this.name(in.getName()).CDNEnabled(in.isCDNEnabled()).ttl(in.getTTL())
.CDNUri(in.getCDNUri()).CDNSslUri(in.getCDNSslUri()).referrerAcl(in.getReferrerAcl())
.useragentAcl(in.getUseragentAcl()).logRetention(in.isLogRetention());
}
}
private final String name;
private final boolean cdnEnabled;
private final boolean logRetention;
private final long ttl;
private final URI CDNUri;
private final URI CDNSslUri;
private final String referrerAcl;
private final String useragentAcl;
private final boolean logRetention;
@ConstructorProperties({ "name", "cdn_enabled", "ttl", "cdn_uri", "referrer_acl", "useragent_acl", "log_retention" })
@ConstructorProperties({ "name", "cdnEnabled", "ttl", "cdnUri", "cdnSslUri", "referrerAcl", "useragentAcl",
"logRetention" })
protected CDNContainer(@Nullable String name, boolean cdnEnabled, long ttl, @Nullable URI CDNUri,
@Nullable String referrerAcl, @Nullable String useragentAcl, boolean logRetention) {
@Nullable URI CDNSslUri, @Nullable String referrerAcl, @Nullable String useragentAcl,
boolean logRetention) {
this.name = Strings.emptyToNull(name);
this.cdnEnabled = cdnEnabled;
this.ttl = ttl;
this.CDNUri = CDNUri;
this.CDNSslUri = CDNSslUri;
this.referrerAcl = Strings.emptyToNull(referrerAcl);
this.useragentAcl = Strings.emptyToNull(useragentAcl);
this.logRetention = logRetention;
@ -157,6 +170,11 @@ public class CDNContainer implements Comparable<CDNContainer> {
return this.CDNUri;
}
@Nullable
public URI getCDNSslUri() {
return this.CDNSslUri;
}
@Nullable
public String getReferrerAcl() {
return this.referrerAcl;
@ -188,8 +206,8 @@ public class CDNContainer implements Comparable<CDNContainer> {
protected ToStringHelper string() {
return Objects.toStringHelper(this).omitNullValues().add("name", name).add("cdnEnabled", cdnEnabled)
.add("ttl", ttl).add("CDNUri", CDNUri).add("referrerAcl", referrerAcl).add("useragentAcl", useragentAcl)
.add("logRetention", logRetention);
.add("ttl", ttl).add("CDNUri", CDNUri).add("CDNSslUri", CDNSslUri).add("referrerAcl", referrerAcl)
.add("useragentAcl", useragentAcl).add("logRetention", logRetention);
}
@Override

View File

@ -45,11 +45,17 @@ public class CDNContainersTest extends BaseItemParserTest<FluentIterable<CDNCont
@Consumes(MediaType.APPLICATION_JSON)
public FluentIterable<CDNContainer> expected() {
return FluentIterable.from(ImmutableSet.of(
CDNContainer.builder().name("hpcloud-blobstore.testCDNOperationsContainerWithCDN").CDNEnabled(false)
.ttl(3600).CDNUri(URI.create("https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/")).build(),
CDNContainer.builder().name("hpcloud-blobstore5").CDNEnabled(true).ttl(28800)
.CDNUri(URI.create("https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/")).build(),
CDNContainer.builder().name("hpcloud-cfcdnint.testCDNOperationsContainerWithCDN").CDNEnabled(false)
.ttl(3600).CDNUri(URI.create("https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/")).build()));
CDNContainer.builder().name("hpcloud-blobstore.testCDNOperationsContainerWithCDN").CDNEnabled(false).ttl(3600)
.CDNUri(URI.create("http://h10cdf69e2913a87afe9ce721ceb35ca5.cdn.hpcloudsvc.com"))
.CDNSslUri(URI.create("https://a248.e.akamai.net/cdn.hpcloudsvc.com/h10cdf69e2913a87afe9ce721ceb35ca5/aw2"))
.build(),
CDNContainer.builder().name("hpcloud-blobstore5").CDNEnabled(true).ttl(28800)
.CDNUri(URI.create("http://h0bc2984e4ad8f8bec0ebf5b147c9fe55.cdn.hpcloudsvc.com"))
.CDNSslUri(URI.create("https://a248.e.akamai.net/cdn.hpcloudsvc.com/h0bc2984e4ad8f8bec0ebf5b147c9fe55/aw2"))
.build(),
CDNContainer.builder().name("hpcloud-cfcdnint.testCDNOperationsContainerWithCDN").CDNEnabled(false).ttl(3600)
.CDNUri(URI.create("http://h82d1ae1ee2ada5151c60e33f097294c2.cdn.hpcloudsvc.com"))
.CDNSslUri(URI.create("https://a248.e.akamai.net/cdn.hpcloudsvc.com/h82d1ae1ee2ada5151c60e33f097294c2/aw2"))
.build()));
}
}

View File

@ -1,5 +1,5 @@
[
{"name":"hpcloud-blobstore.testCDNOperationsContainerWithCDN","cdn_enabled":"false","ttl":3600,"cdn_uri":"https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/","referrer_acl":"","useragent_acl":"", "log_retention":"false"},
{"name":"hpcloud-blobstore5","cdn_enabled":"true","ttl":28800,"cdn_uri":"https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/","referrer_acl":"","useragent_acl":"", "log_retention":"false"},
{"name":"hpcloud-cfcdnint.testCDNOperationsContainerWithCDN","cdn_enabled":"false","ttl":3600,"cdn_uri":"https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/","referrer_acl":"","useragent_acl":"", "log_retention":"false"}
{"name":"hpcloud-blobstore.testCDNOperationsContainerWithCDN","cdnEnabled":"false","ttl":3600,"cdnUri":"http://h10cdf69e2913a87afe9ce721ceb35ca5.cdn.hpcloudsvc.com","cdnSslUri":"https://a248.e.akamai.net/cdn.hpcloudsvc.com/h10cdf69e2913a87afe9ce721ceb35ca5/aw2","referrerAcl":"","useragentAcl":"", "logRetention":"false"},
{"name":"hpcloud-blobstore5","cdnEnabled":"true","ttl":28800,"cdnUri":"http://h0bc2984e4ad8f8bec0ebf5b147c9fe55.cdn.hpcloudsvc.com","cdnSslUri":"https://a248.e.akamai.net/cdn.hpcloudsvc.com/h0bc2984e4ad8f8bec0ebf5b147c9fe55/aw2","referrerAcl":"","useragentAcl":"", "logRetention":"false"},
{"name":"hpcloud-cfcdnint.testCDNOperationsContainerWithCDN","cdnEnabled":"false","ttl":3600,"cdnUri":"http://h82d1ae1ee2ada5151c60e33f097294c2.cdn.hpcloudsvc.com","cdnSslUri":"https://a248.e.akamai.net/cdn.hpcloudsvc.com/h82d1ae1ee2ada5151c60e33f097294c2/aw2","referrerAcl":"","useragentAcl":"", "logRetention":"false"}
]