com.cloudinary.Url.suffix()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(74)

本文整理了Java中com.cloudinary.Url.suffix()方法的一些代码示例,展示了Url.suffix()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Url.suffix()方法的具体详情如下:
包路径:com.cloudinary.Url
类名称:Url
方法名:suffix

Url.suffix介绍

暂无

代码示例

代码示例来源:origin: cloudinary/cloudinary_java

@Test(expected = IllegalArgumentException.class)
public void testDisallowUrlSuffixWithDot() {
  cloudinary.url().suffix("hello.world").privateCdn(true).generate("test");
}

代码示例来源:origin: cloudinary/cloudinary_java

if (signed != null) url.signed(signed.booleanValue());
if (useRootPath != null) url.useRootPath(useRootPath);
if (urlSuffix != null) url.suffix(urlSuffix);
if (secureCdnSubdomain != null) url.secureCdnSubdomain(secureCdnSubdomain);
return url;

代码示例来源:origin: cloudinary/cloudinary_java

@Test(expected = IllegalArgumentException.class)
public void testDisallowUrlSuffixWithSlash() {
  cloudinary.url().suffix("hello/world").privateCdn(true).generate("test");
}

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testNotSignTheUrlSuffix() {
  Pattern pattern = Pattern.compile("s--[0-9A-Za-z_-]{8}--");
  String url = cloudinary.url().format("jpg").signed(true).generate("test");
  Matcher matcher = pattern.matcher(url);
  matcher.find();
  String expectedSignature = url.substring(matcher.start(), matcher.end());
  String actual = cloudinary.url().format("jpg").privateCdn(true).signed(true).suffix("hello").generate("test");
  assertEquals("http://test123-res.cloudinary.com/images/" + expectedSignature + "/test/hello.jpg", actual);
  url = cloudinary.url().format("jpg").signed(true).transformation(new Transformation().angle(0)).generate("test");
  matcher = pattern.matcher(url);
  matcher.find();
  expectedSignature = url.substring(matcher.start(), matcher.end());
  actual = cloudinary.url().format("jpg").privateCdn(true).signed(true).suffix("hello").transformation(new Transformation().angle(0)).generate("test");
  assertEquals("http://test123-res.cloudinary.com/images/" + expectedSignature + "/a_0/test/hello.jpg", actual);
}

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testUrlSuffixWithDotOrSlash(){
  Boolean[] errors = new Boolean[4];
  try {
    cloudinary.url().suffix("dsfdfd.adsfad").generate("publicId");
  } catch (IllegalArgumentException e){
    errors[0] = true;
  }
  try {
    cloudinary.url().suffix("dsfdfd/adsfad").generate("publicId");
  } catch (IllegalArgumentException e){
    errors[1] = true;
  }
  try {
    cloudinary.url().suffix("dsfd.fd/adsfad").generate("publicId");
  } catch (IllegalArgumentException e){
    errors[2] = true;
  }
  try {
    cloudinary.url().suffix("dsfdfdaddsfad").generate("publicId");
  } catch (IllegalArgumentException e){
    errors[3] = true;
  }
  assertTrue(errors[0]);
  assertTrue(errors[1]);
  assertTrue(errors[2]);
  assertNull(errors[3]);
}
@Test

代码示例来源:origin: cloudinary/cloudinary_java

@Test(expected = IllegalArgumentException.class)
public void testDisallowUrlSuffixInNonUploadTypes() {
  cloudinary.url().suffix("hello").privateCdn(true).type("facebook").generate("test");
}

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testSupportUrlSuffixForRawUploads() {
  String actual = cloudinary.url().suffix("hello").privateCdn(true).resourceType("raw").generate("test");
  assertEquals("http://test123-res.cloudinary.com/files/test/hello", actual);
}

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testSupportUrlSuffixForPrivateCdn() {
  String actual = cloudinary.url().suffix("hello").privateCdn(true).generate("test");
  assertEquals("http://test123-res.cloudinary.com/images/test/hello", actual);
  actual = cloudinary.url().suffix("hello").privateCdn(true).transformation(new Transformation().angle(0)).generate("test");
  assertEquals("http://test123-res.cloudinary.com/images/a_0/test/hello", actual);
}

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testSupportUrlSuffixForVideoUploads() {
  String actual = cloudinary.url().suffix("hello").privateCdn(true).resourceType("video").generate("test");
  assertEquals("http://test123-res.cloudinary.com/videos/test/hello", actual);
}

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testSupportUseRootPathTogetherWithUrlSuffixForPrivateCdn() {
  String actual = cloudinary.url().privateCdn(true).suffix("hello").useRootPath(true).generate("test");
  assertEquals("http://test123-res.cloudinary.com/test/hello", actual);
}

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testPutFormatAfterUrlSuffix() {
  String actual = cloudinary.url().suffix("hello").privateCdn(true).format("jpg").generate("test");
  assertEquals("http://test123-res.cloudinary.com/images/test/hello.jpg", actual);
}

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testSupportUrlSuffixForAuthenticatedImages() {
  String actual = cloudinary.url().suffix("hello").privateCdn(true).resourceType("image").type("authenticated").generate("test");
  assertEquals("http://test123-res.cloudinary.com/authenticated_images/test/hello", actual);
}

代码示例来源:origin: cloudinary/cloudinary_java

@Test
public void testSupportUrlSuffixForPrivateImages() {
  String actual = cloudinary.url().suffix("hello").privateCdn(true).resourceType("image").type("private").generate("test");
  assertEquals("http://test123-res.cloudinary.com/private_images/test/hello", actual);
}

相关文章