@@ -676,6 +676,47 @@ public void testUploadMapping() throws Exception {
676676 assertTrue (!found );
677677 }
678678
679+ @ Test
680+ public void testPublishByIds () throws Exception {
681+ Map response = cloudinary .uploader ().upload (SRC_TEST_IMAGE , ObjectUtils .asMap ("tags" , SDK_TEST_TAG , "type" , "authenticated" ));
682+ String publicId = (String ) response .get ("public_id" );
683+ response = cloudinary .api ().publishByIds (Arrays .asList (publicId ), null );
684+ List published = (List ) response .get ("published" );
685+ assertNotNull (published );
686+ assertEquals (published .size (), 1 );
687+ Map resource = (Map ) published .get (0 );
688+ assertEquals (resource .get ("public_id" ), publicId );
689+ assertNotNull (resource .get ("url" ));
690+ cloudinary .uploader ().destroy (publicId , null );
691+ }
692+
693+ @ Test
694+ public void testPublishByPrefix () throws Exception {
695+ Map response = cloudinary .uploader ().upload (SRC_TEST_IMAGE , ObjectUtils .asMap ("tags" , SDK_TEST_TAG , "type" , "authenticated" ));
696+ String publicId = (String ) response .get ("public_id" );
697+ response = cloudinary .api ().publishByPrefix (publicId .substring (0 , publicId .length () - 2 ), null );
698+ List published = (List ) response .get ("published" );
699+ assertNotNull (published );
700+ assertEquals (published .size (), 1 );
701+ Map resource = (Map ) published .get (0 );
702+ assertEquals (resource .get ("public_id" ), publicId );
703+ assertNotNull (resource .get ("url" ));
704+ cloudinary .uploader ().destroy (publicId , null );
705+ }
706+
707+ @ Test
708+ public void testPublishByTag () throws Exception {
709+ Map response = cloudinary .uploader ().upload (SRC_TEST_IMAGE , ObjectUtils .asMap ("tags" , Arrays .asList (SDK_TEST_TAG , SDK_TEST_TAG + "1" ), "type" , "authenticated" ));
710+ String publicId = (String ) response .get ("public_id" );
711+ response = cloudinary .api ().publishByTag (SDK_TEST_TAG + "1" , null );
712+ List published = (List ) response .get ("published" );
713+ assertNotNull (published );
714+ assertEquals (published .size (), 1 );
715+ Map resource = (Map ) published .get (0 );
716+ assertEquals (resource .get ("public_id" ), publicId );
717+ assertNotNull (resource .get ("url" ));
718+ cloudinary .uploader ().destroy (publicId , null );
719+ }
679720
680721 private void assertContains (Object object , Collection list ) {
681722 assertTrue (list .contains (object ));
0 commit comments