@@ -36,7 +36,7 @@ public void testCloudNameOptions() {
3636 public void testSecureDistribution () {
3737 // should use default secure distribution if secure=TRUE
3838 String result = cloudinary .url ().secure (true ).generate ("test" );
39- assertEquals ("https://d3jpl91pxevbkh.cloudfront .net/test123/image/upload/test" , result );
39+ assertEquals ("https://cloudinary-a.akamaihd .net/test123/image/upload/test" , result );
4040 }
4141
4242 @ Test
@@ -54,12 +54,31 @@ public void testSecureDistibution() {
5454 assertEquals ("https://config.secure.distribution.com/test123/image/upload/test" , result );
5555 }
5656
57- @ Test (expected = IllegalArgumentException .class )
58- public void testMissingSecureDistribution () {
59- // should raise exception if secure is given with private_cdn and no
60- // secure_distribution
57+ @ Test
58+ public void testSecureAkamai () {
59+ // should default to akamai if secure is given with private_cdn and no secure_distribution
60+ cloudinary .setConfig ("secure" , true );
61+ cloudinary .setConfig ("private_cdn" , true );
62+ String result = cloudinary .url ().generate ("test" );
63+ assertEquals ("https://cloudinary-a.akamaihd.net/test123/image/upload/test" , result );
64+ }
65+
66+ @ Test
67+ public void testSecureNonAkamai () {
68+ // should not add cloud_name if private_cdn and secure non akamai secure_distribution
69+ cloudinary .setConfig ("secure" , true );
6170 cloudinary .setConfig ("private_cdn" , true );
62- cloudinary .url ().secure (true ).generate ("test" );
71+ cloudinary .setConfig ("secure_distribution" , "something.cloudfront.net" );
72+ String result = cloudinary .url ().generate ("test" );
73+ assertEquals ("https://something.cloudfront.net/image/upload/test" , result );
74+ }
75+
76+ @ Test
77+ public void testHttpPrivateCdn () {
78+ // should not add cloud_name if private_cdn and not secure
79+ cloudinary .setConfig ("private_cdn" , true );
80+ String result = cloudinary .url ().generate ("test" );
81+ assertEquals ("http://test123-res.cloudinary.com/image/upload/test" , result );
6382 }
6483
6584 @ Test
0 commit comments