Exemplo n.º 1
0
 @BeforeClass
 public static void setUpClass() throws IOException {
   Cloudinary cloudinary = new Cloudinary();
   if (cloudinary.getStringConfig("api_secret") == null) {
     System.err.println("Please setup environment for Upload test to run");
     return;
   }
   Api api = cloudinary.api();
   try {
     api.deleteResources(
         Arrays.asList("api_test", "api_test1", "api_test2", "api_test3", "api_test5"),
         Cloudinary.emptyMap());
   } catch (Exception e) {
   }
   try {
     api.deleteTransformation("api_test_transformation", Cloudinary.emptyMap());
   } catch (Exception e) {
   }
   try {
     api.deleteTransformation("api_test_transformation2", Cloudinary.emptyMap());
   } catch (Exception e) {
   }
   try {
     api.deleteTransformation("api_test_transformation3", Cloudinary.emptyMap());
   } catch (Exception e) {
   }
   try {
     api.deleteUploadPreset("api_test_upload_preset", Cloudinary.emptyMap());
   } catch (Exception e) {
   }
   try {
     api.deleteUploadPreset("api_test_upload_preset2", Cloudinary.emptyMap());
   } catch (Exception e) {
   }
   try {
     api.deleteUploadPreset("api_test_upload_preset3", Cloudinary.emptyMap());
   } catch (Exception e) {
   }
   try {
     api.deleteUploadPreset("api_test_upload_preset4", Cloudinary.emptyMap());
   } catch (Exception e) {
   }
   Map options =
       Cloudinary.asMap(
           "public_id",
           "api_test",
           "tags",
           new String[] {"api_test_tag", uniqueTag},
           "context",
           "key=value",
           "eager",
           Collections.singletonList(new Transformation().width(100).crop("scale")));
   cloudinary.uploader().upload("src/test/resources/logo.png", options);
   options.put("public_id", "api_test1");
   cloudinary.uploader().upload("src/test/resources/logo.png", options);
 }
Exemplo n.º 2
0
 @Before
 public void setUp() {
   this.cloudinary = new Cloudinary();
   assumeNotNull(cloudinary.getStringConfig("api_secret"));
   this.api = cloudinary.api();
 }