Skip to content

Commit 4da149a

Browse files
nitzanjAmir Tocker
authored andcommitted
Change public ids ion SearchTest resources (Some were already used by ApiTest).
1 parent 072be5e commit 4da149a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

cloudinary-test-common/src/main/java/com/cloudinary/test/AbstractSearchTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@
1616
abstract public class AbstractSearchTest extends MockableTest {
1717
@Rule
1818
public TestName currentTest = new TestName();
19-
private static final String SEARCH_TAG = "search_test" + SUFFIX;
19+
private static final String SEARCH_TAG = "search_test_tag_" + SUFFIX;
2020
public static final String[] UPLOAD_TAGS = {SDK_TEST_TAG, SEARCH_TAG};
21-
private static final String API_TEST = "api_test_" + SUFFIX;
22-
private static final String API_TEST_1 = API_TEST + "_1";
23-
private static final String API_TEST_2 = API_TEST + "_2";
21+
private static final String SEARCH_TEST = "search_test_" + SUFFIX;
22+
private static final String SEARCH_TEST_1 = SEARCH_TEST + "_1";
23+
private static final String SEARCH_TEST_2 = SEARCH_TEST + "_2";
2424

2525
@BeforeClass
2626
public static void setUpClass() throws Exception {
2727
Cloudinary cloudinary = new Cloudinary();
28-
Map options = ObjectUtils.asMap("public_id", API_TEST, "tags", UPLOAD_TAGS, "context", "stage=in_review");
28+
Map options = ObjectUtils.asMap("public_id", SEARCH_TEST, "tags", UPLOAD_TAGS, "context", "stage=in_review");
2929
cloudinary.api().deleteResourcesByTag(SEARCH_TAG, null);
3030
cloudinary.uploader().upload(SRC_TEST_IMAGE, options);
31-
options = ObjectUtils.asMap("public_id", API_TEST_1, "tags", UPLOAD_TAGS, "context", "stage=new");
31+
options = ObjectUtils.asMap("public_id", SEARCH_TEST_1, "tags", UPLOAD_TAGS, "context", "stage=new");
3232
cloudinary.uploader().upload(SRC_TEST_IMAGE, options);
33-
options = ObjectUtils.asMap("public_id", API_TEST_2, "tags", UPLOAD_TAGS, "context", "stage=validated");
33+
options = ObjectUtils.asMap("public_id", SEARCH_TEST_2, "tags", UPLOAD_TAGS, "context", "stage=validated");
3434
cloudinary.uploader().upload(SRC_TEST_IMAGE, options);
3535
try {
36-
Thread.sleep(5000); //wait for search indexing
36+
Thread.sleep(3000); //wait for search indexing
3737
} catch (InterruptedException e) {
3838
e.printStackTrace();
3939
}
@@ -61,7 +61,7 @@ public void shouldFindResourcesByTag() throws Exception {
6161

6262
@Test
6363
public void shouldFindResourceByPublicId() throws Exception {
64-
Map result = cloudinary.search().expression(String.format("public_id:%s", API_TEST_1)).execute();
64+
Map result = cloudinary.search().expression(String.format("public_id:%s", SEARCH_TEST_1)).execute();
6565
List<Map> resources = (List<Map>) result.get("resources");
6666
assertEquals(1, resources.size());
6767
}
@@ -74,7 +74,7 @@ public void shouldPaginateResourcesLimitedByTagAndOrderdByAscendingPublicId() th
7474

7575
assertEquals(1, resources.size());
7676
assertEquals(3, result.get("total_count"));
77-
assertEquals(API_TEST, resources.get(0).get("public_id"));
77+
assertEquals(SEARCH_TEST, resources.get(0).get("public_id"));
7878

7979

8080
result = cloudinary.search().maxResults(1).expression(String.format("tags:%s", SEARCH_TAG)).sortBy("public_id", "asc")
@@ -83,15 +83,15 @@ public void shouldPaginateResourcesLimitedByTagAndOrderdByAscendingPublicId() th
8383

8484
assertEquals(1, resources.size());
8585
assertEquals(3, result.get("total_count"));
86-
assertEquals(API_TEST_1, resources.get(0).get("public_id"));
86+
assertEquals(SEARCH_TEST_1, resources.get(0).get("public_id"));
8787

8888
result = cloudinary.search().maxResults(1).expression(String.format("tags:%s", SEARCH_TAG)).sortBy("public_id", "asc")
8989
.nextCursor(ObjectUtils.asString(result.get("next_cursor"))).execute();
9090
resources = (List<Map>) result.get("resources");
9191

9292
assertEquals(1, resources.size());
9393
assertEquals(3, result.get("total_count"));
94-
assertEquals(API_TEST_2, resources.get(0).get("public_id"));
94+
assertEquals(SEARCH_TEST_2, resources.get(0).get("public_id"));
9595
assertNull(result.get("next_cursor"));
9696

9797

0 commit comments

Comments
 (0)