From 9c7844447dfb87bda6018f5e963d4031737d6811 Mon Sep 17 00:00:00 2001 From: Claudia Agache Date: Fri, 10 Apr 2020 14:53:45 +0300 Subject: [PATCH] wait for solr indexing --- .../rm/community/search/SearchDocumentsV1Test.java | 2 +- .../community/search/SearchRecordsV1CmisTests.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchDocumentsV1Test.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchDocumentsV1Test.java index 0ddafe66ad..df28b05ac4 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchDocumentsV1Test.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchDocumentsV1Test.java @@ -86,7 +86,7 @@ public class SearchDocumentsV1Test extends BaseRMRestTest * Create a collaboration site and some documents. */ @BeforeClass (alwaysRun = true) - public void beforeClass() throws Exception + public void setupSearchDocumentsV1Test() throws Exception { STEP("Create a collaboration site"); collaborationSite = dataSite.usingAdmin().createPrivateRandomSite(); diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchRecordsV1CmisTests.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchRecordsV1CmisTests.java index d49a4039ca..11296ff8dc 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchRecordsV1CmisTests.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/search/SearchRecordsV1CmisTests.java @@ -43,6 +43,7 @@ import org.alfresco.rest.search.RestRequestQueryModel; import org.alfresco.rest.search.SearchResponse; import org.alfresco.rest.v0.UserTrashcanAPI; import org.alfresco.rest.v0.service.RoleService; +import org.alfresco.utility.Utility; import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.model.FileModel; import org.alfresco.utility.model.FileType; @@ -105,6 +106,17 @@ public class SearchRecordsV1CmisTests extends BaseRMRestTest queryModel = new RestRequestQueryModel(); queryModel.setQuery("select * from cmis:document WHERE cmis:name LIKE 'Record" + SEARCH_TERM + "%'"); queryModel.setLanguage("cmis"); + + //wait for solr indexing + Utility.sleep(1000, 80000, () -> + { + SearchRequestBuilder sqlRequest = new SearchRequestBuilder().setQueryBuilder(queryModel) + .setPagingBuilder(new SearchRequestBuilder().setPagination(100, 0)) + .setFieldsBuilder(asList("id", "name")); + SearchResponse searchResponse = getRestAPIFactory().getSearchAPI(null).search(sqlRequest); + assertEquals(searchResponse.getPagination().getTotalItems().intValue(), 20, + "Total number of items is not retrieved yet"); + }); } /**