From 592e0cf48d3ff42c6d2809b2e5c17026f36a341a Mon Sep 17 00:00:00 2001 From: Tom Page Date: Thu, 1 Aug 2019 12:43:19 +0100 Subject: [PATCH 1/5] Refactor abstract test classes using changes to TAS. --- e2e-test/pom.xml | 6 +- .../functional/AbstractE2EFunctionalTest.java | 170 ++++++------------ .../cmis/AbstractCmisE2ETest.java | 3 +- .../cmis/SolrSearchScoreQueryTests.java | 2 +- .../search/AbstractSearchServicesE2ETest.java | 2 +- .../upgrade/AbstractUpgradeE2ETest.java | 2 +- 6 files changed, 66 insertions(+), 119 deletions(-) diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index 619a7f611..483f670a7 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -11,9 +11,9 @@ Search Analytics E2E Tests Test Project to test Search Service and Analytics Features on a complete setup of Alfresco, Share - 6.0.0.3 - 6.0.0.1 - 2.0.12 + 6.0.1.2 + 6.0.0.4 + 2.0.31 2.6.0 src/test/resources/SearchSuite.xml diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java index d85398287..06ba1f92d 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java @@ -47,9 +47,10 @@ import static lombok.AccessLevel.PROTECTED; @ContextConfiguration("classpath:alfresco-search-e2e-context.xml") public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringContextTests { - public static final int SEARCH_MAX_ATTEMPS = 6; + /** The number of retries that a query will be tried before giving up. */ + private static final int SEARCH_MAX_ATTEMPTS = 6; - private static Logger LOG = LogFactory.getLogger(); + private static final Logger LOGGER = LogFactory.getLogger(); @Autowired protected RestProperties restProperties; @@ -85,8 +86,6 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont protected static String unique_searchString; - public static final String NODE_PREFIX = "workspace/SpacesStore/"; - @BeforeSuite(alwaysRun = true) public void beforeSuite() throws Exception { @@ -97,7 +96,7 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont } @BeforeClass(alwaysRun = true) - public void setup() throws Exception + public void setup() { serverHealth.assertServerIsOnline(); @@ -120,68 +119,44 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont if ((path != null) && (path.endsWith("-model.xml"))) { - try - { - dataContent.usingAdmin().deployContentModel(path); - modelDeployed = true; - } - catch (Exception e) - { - LOG.warn("Error Loading Custom Model", e); - } + dataContent.usingAdmin().deployContentModel(path); + modelDeployed = true; } return modelDeployed; } public boolean deactivateCustomModel(String fileName) { - Boolean modelDeactivated = false; + FileModel customModel = getCustomModel(fileName); - try + // Deactivate the model if found + if (customModel != null) { - FileModel customModel = getCustomModel(fileName); + cmisApi.authenticateUser(dataUser.getAdminUser()).usingResource(customModel).updateProperty("cm:modelActive", false); - // Deactivate the model if found - if (customModel != null) - { - - cmisApi.authenticateUser(dataUser.getAdminUser()).usingResource(customModel).updateProperty("cm:modelActive", false); - - modelDeactivated = true; - } + return true; } - catch (Exception e) - { - LOG.warn("Error Deactivating Custom Model", e); - } - return modelDeactivated; + return false; } public boolean deleteCustomModel(String fileName) { Boolean modelDeleted = false; - try + FileModel customModel = getCustomModel(fileName); + + // Delete the model if found + if (customModel != null) { - FileModel customModel = getCustomModel(fileName); + // cmisApi.authenticateUser(dataUser.getAdminUser()).usingResource(customModel).deleteContent(); + dataContent.usingAdmin().usingResource(customModel).deleteContent(); + restClient.authenticateUser(dataContent.getAdminUser()).withCoreAPI().usingTrashcan().deleteNodeFromTrashcan(customModel); - // Delete the model if found - if (customModel != null) - { - // cmisApi.authenticateUser(dataUser.getAdminUser()).usingResource(customModel).deleteContent(); - dataContent.usingAdmin().usingResource(customModel).deleteContent(); - restClient.authenticateUser(dataContent.getAdminUser()).withCoreAPI().usingTrashcan().deleteNodeFromTrashcan(customModel); - - modelDeleted = true; - } - else - { - LOG.error("Custom Content Model [{}] is not available under [/Data Dictionary/Models/] location", fileName); - } + modelDeleted = true; } - catch (Exception e) + else { - LOG.error("Custom Content Model [{}] is not available under [/Data Dictionary/Models/] location", fileName); + LOGGER.error("Custom Content Model [{}] is not available under [/Data Dictionary/Models/] location", fileName); } return modelDeleted; @@ -191,32 +166,25 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont { FileModel customModel = null; - try - { - if ((fileName != null) && (fileName.endsWith("-model.xml"))) + if ((fileName != null) && (fileName.endsWith("-model.xml"))) + { + Session session = contentService.getCMISSession(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword()); + + CmisObject modelInRepo = session.getObjectByPath(String.format("/Data Dictionary/Models/%s", fileName)); + + if (modelInRepo != null) { - Session session = contentService.getCMISSession(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword()); - - CmisObject modelInRepo = session.getObjectByPath(String.format("/Data Dictionary/Models/%s", fileName)); - - if (modelInRepo != null) - { - customModel = new FileModel(modelInRepo.getName()); - customModel.setNodeRef(modelInRepo.getId()); - customModel.setNodeRef(customModel.getNodeRefWithoutVersion()); - customModel.setCmisLocation(String.format("/Data Dictionary/Models/%s", fileName)); - LOG.info("Custom Model file: " + customModel.getCmisLocation()); - } - else - { - LOG.info("Custom Content Model [{}] is not available under [/Data Dictionary/Models/] location", fileName); - } + customModel = new FileModel(modelInRepo.getName()); + customModel.setNodeRef(modelInRepo.getId()); + customModel.setNodeRef(customModel.getNodeRefWithoutVersion()); + customModel.setCmisLocation(String.format("/Data Dictionary/Models/%s", fileName)); + LOGGER.info("Custom Model file: " + customModel.getCmisLocation()); + } + else + { + LOGGER.info("Custom Content Model [{}] is not available under [/Data Dictionary/Models/] location", fileName); } - } - catch (Exception e) - { - LOG.warn("Error Getting Custom Model: " + fileName, e); } return customModel; @@ -224,29 +192,22 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont /** * Helper method which create an http post request to Search API end point. - * Executes the given search request without throwing checked exceptions (a {@link RuntimeException} will be thrown in case). + * Executes the given search request. * * @param query the search request. * @return the query execution response. */ protected SearchResponse query(SearchRequest query) { - try - { - return restClient.authenticateUser(testUser).withSearchAPI().search(query); - } - catch (final Exception exception) - { - throw new RuntimeException(exception); - } + return restClient.authenticateUser(testUser).withSearchAPI().search(query); } /** * Wait for Solr to finish indexing and search to return appropriate results * - * @param userQuery: Search Query + * @param userQuery Search Query * @param contentToFind that's expected to be included / excluded from the results - * @param expectedInResults + * @param expectedInResults Whether we expect the content in the results or not. * @return true if search returns expected results, i.e. is given content is found or excluded from the results */ public boolean isContentInSearchResults(String userQuery, String contentToFind, boolean expectedInResults) { @@ -254,30 +215,27 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont String expectedStatusCode = HttpStatus.OK.toString(); String contentName = (contentToFind == null) ? "" : contentToFind; + SearchRequest searchRequest = createQuery(userQuery); + // Repeat search until the query results are as expected or Search Retry count is hit - for (int searchCount = 0; searchCount < SEARCH_MAX_ATTEMPS; searchCount++) + for (int searchCount = 0; searchCount < SEARCH_MAX_ATTEMPTS; searchCount++) { - SearchRequest searchRequest = createQuery(userQuery); SearchResponse response = query(searchRequest); if (restClient.getStatusCode().matches(expectedStatusCode)) { - boolean found = response.getEntries().stream() .map(entry -> entry.getModel().getName()) .filter(name -> name.equalsIgnoreCase(contentName) || contentName.isBlank()) .count() > 0; - // Loop again if result is not as expected: To cater for solr lag: eventual consistency + // Exit loop if result is as expected. if (expectedInResults == found) { return true; } - else - { - // Wait for the solr indexing. - Utility.waitToLoopTime(properties.getSolrWaitTimeInSeconds(), "Wait For Indexing. Retry Attempt: " + searchCount); - } + // Wait for the solr indexing (eventual consistency). + Utility.waitToLoopTime(properties.getSolrWaitTimeInSeconds(), "Wait For Indexing. Retry Attempt: " + (searchCount + 1)); } else { @@ -294,9 +252,8 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont * @param userQuery: search query, this can include the fieldname, unique search string will guarantee accurate results * @param expectedInResults, true if entry is expected in the results set * @return true (indexing is finished) if search returns appropriate results - * @throws Exception */ - public boolean waitForIndexing(String userQuery, boolean expectedInResults) throws Exception + public boolean waitForIndexing(String userQuery, boolean expectedInResults) { // Use the search query as is: fieldname(s) may or may not be specified within the userQuery return waitForIndexing(null, userQuery, expectedInResults); @@ -308,9 +265,8 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont * @param userQuery * @param expectedInResults * @return - * @throws Exception */ - public boolean waitForMetadataIndexing(String userQuery, boolean expectedInResults) throws Exception + public boolean waitForMetadataIndexing(String userQuery, boolean expectedInResults) { return waitForIndexing("name", userQuery, expectedInResults); } @@ -322,9 +278,8 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont * @param userQuery * @param expectedInResults * @return - * @throws Exception */ - public boolean waitForContentIndexing(String userQuery, boolean expectedInResults) throws Exception + public boolean waitForContentIndexing(String userQuery, boolean expectedInResults) { return waitForIndexing("cm:content", userQuery, expectedInResults); } @@ -336,9 +291,8 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont * @param userQuery: search string, unique search string will guarantee accurate results * @param expectedInResults, true if entry is expected in the results set * @return true (indexing is finished) if search returns appropriate results - * @throws Exception */ - private boolean waitForIndexing(String fieldName, String userQuery, boolean expectedInResults) throws Exception + private boolean waitForIndexing(String fieldName, String userQuery, boolean expectedInResults) { String query = (fieldName == null) ? userQuery : String.format("%s:'%s'", fieldName, userQuery); @@ -365,16 +319,11 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont */ protected SearchResponse queryAsUser(UserModel user, String queryString) { - try { - SearchRequest searchRequest = new SearchRequest(); - RestRequestQueryModel queryModel = new RestRequestQueryModel(); - queryModel.setQuery(queryString); - searchRequest.setQuery(queryModel); - return restClient.authenticateUser(user).withSearchAPI().search(searchRequest); - } catch (final Exception exception) - { - throw new RuntimeException(exception); - } + SearchRequest searchRequest = new SearchRequest(); + RestRequestQueryModel queryModel = new RestRequestQueryModel(); + queryModel.setQuery(queryString); + searchRequest.setQuery(queryModel); + return restClient.authenticateUser(user).withSearchAPI().search(searchRequest); } /** @@ -384,7 +333,7 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont * @param queryModel: The queryModel to search for, containing the query * @return the search response from the API */ - protected SearchResponse queryAsUser(UserModel user, RestRequestQueryModel queryModel) throws Exception + protected SearchResponse queryAsUser(UserModel user, RestRequestQueryModel queryModel) { SearchRequest searchRequest = new SearchRequest(); searchRequest.setQuery(queryModel); @@ -396,9 +345,8 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont * Helper method which create an http post request to Search API end point. * * @return {@link SearchResponse} response. - * @throws Exception if error */ - protected SearchResponse query(RestRequestQueryModel queryReq, RestRequestHighlightModel highlight) throws Exception + protected SearchResponse query(RestRequestQueryModel queryReq, RestRequestHighlightModel highlight) { SearchRequest query = new SearchRequest(queryReq); query.setHighlight(highlight); diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/AbstractCmisE2ETest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/AbstractCmisE2ETest.java index 6f31ec0ac..3dc7ed8c3 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/AbstractCmisE2ETest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/AbstractCmisE2ETest.java @@ -57,9 +57,8 @@ public abstract class AbstractCmisE2ETest extends AbstractE2EFunctionalTest * @param query CMIS Query to be executed * @param expectedCountResults Number of results expected * @return true when results count is equals to expectedCountResults - * @throws Exception */ - protected boolean waitForIndexing(String query, long expectedCountResults) throws Exception + protected boolean waitForIndexing(String query, long expectedCountResults) { for (int searchCount = 1; searchCount <= 3; searchCount++) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/SolrSearchScoreQueryTests.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/SolrSearchScoreQueryTests.java index 36ad1eabe..85b597fea 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/SolrSearchScoreQueryTests.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/SolrSearchScoreQueryTests.java @@ -43,7 +43,7 @@ public class SolrSearchScoreQueryTests extends AbstractCmisE2ETest * @see org.alfresco.test.search.functional.AbstractE2EFunctionalTest#dataPreparation() */ @Override - public void setup() throws Exception + public void setup() { } diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java index edd3c230a..2beaa33f4 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/AbstractSearchServicesE2ETest.java @@ -35,7 +35,7 @@ public abstract class AbstractSearchServicesE2ETest extends AbstractE2EFunctiona protected FileModel file, file2, file3, file4; - public void searchServicesDataPreparation() throws Exception + public void searchServicesDataPreparation() { /* * Create the following file structure for preconditions : diff --git a/e2e-test/src/test/java/org/alfresco/test/search/nonFunctional/upgrade/AbstractUpgradeE2ETest.java b/e2e-test/src/test/java/org/alfresco/test/search/nonFunctional/upgrade/AbstractUpgradeE2ETest.java index f3959727e..59f618e9f 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/nonFunctional/upgrade/AbstractUpgradeE2ETest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/nonFunctional/upgrade/AbstractUpgradeE2ETest.java @@ -37,7 +37,7 @@ public abstract class AbstractUpgradeE2ETest extends AbstractTestNGSpringContext protected XMLTestData testData; @BeforeClass(alwaysRun = true) - public void checkServerHealth() throws Exception + public void checkServerHealth() { serverHealth.assertServerIsOnline(); } From 5e58da0afb42de8114d679c103ae332d6de66d32 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Thu, 1 Aug 2019 15:03:34 +0100 Subject: [PATCH 2/5] SEARCH-1742 Bump TAS utility version. --- e2e-test/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index 483f670a7..b264bff23 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -13,7 +13,7 @@ 6.0.1.2 6.0.0.4 - 2.0.31 + 2.0.32 2.6.0 src/test/resources/SearchSuite.xml From 17201507a37600143570e0796238bd3b04781ffd Mon Sep 17 00:00:00 2001 From: Tom Page Date: Fri, 2 Aug 2019 08:22:51 +0100 Subject: [PATCH 3/5] SEARCH-1742 Update TAS Utility to 3.0.x. Also fix some issues in previous commit around exception handling. --- e2e-test/pom.xml | 3 +- .../functional/AbstractE2EFunctionalTest.java | 92 ++++++++++++------- .../cmis/SolrSearchByPathTests.java | 4 +- 3 files changed, 64 insertions(+), 35 deletions(-) diff --git a/e2e-test/pom.xml b/e2e-test/pom.xml index b264bff23..f388149d1 100644 --- a/e2e-test/pom.xml +++ b/e2e-test/pom.xml @@ -13,7 +13,7 @@ 6.0.1.2 6.0.0.4 - 2.0.32 + 3.0.9 2.6.0 src/test/resources/SearchSuite.xml @@ -45,6 +45,7 @@ ${test.exclude} ${test.include} + true diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java index 06ba1f92d..2f259adb0 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/AbstractE2EFunctionalTest.java @@ -119,22 +119,36 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont if ((path != null) && (path.endsWith("-model.xml"))) { - dataContent.usingAdmin().deployContentModel(path); - modelDeployed = true; + try + { + dataContent.usingAdmin().deployContentModel(path); + modelDeployed = true; + } + catch (Exception e) + { + LOGGER.warn("Error Loading Custom Model", e); + } } return modelDeployed; } public boolean deactivateCustomModel(String fileName) { - FileModel customModel = getCustomModel(fileName); - - // Deactivate the model if found - if (customModel != null) + try { - cmisApi.authenticateUser(dataUser.getAdminUser()).usingResource(customModel).updateProperty("cm:modelActive", false); + FileModel customModel = getCustomModel(fileName); - return true; + // Deactivate the model if found + if (customModel != null) + { + cmisApi.authenticateUser(dataUser.getAdminUser()).usingResource(customModel).updateProperty("cm:modelActive", false); + + return true; + } + } + catch (Exception e) + { + LOGGER.warn("Error Deactivating Custom Model", e); } return false; } @@ -143,18 +157,25 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont { Boolean modelDeleted = false; - FileModel customModel = getCustomModel(fileName); - - // Delete the model if found - if (customModel != null) + try { - // cmisApi.authenticateUser(dataUser.getAdminUser()).usingResource(customModel).deleteContent(); - dataContent.usingAdmin().usingResource(customModel).deleteContent(); - restClient.authenticateUser(dataContent.getAdminUser()).withCoreAPI().usingTrashcan().deleteNodeFromTrashcan(customModel); + FileModel customModel = getCustomModel(fileName); - modelDeleted = true; + // Delete the model if found + if (customModel != null) + { + // cmisApi.authenticateUser(dataUser.getAdminUser()).usingResource(customModel).deleteContent(); + dataContent.usingAdmin().usingResource(customModel).deleteContent(); + restClient.authenticateUser(dataContent.getAdminUser()).withCoreAPI().usingTrashcan().deleteNodeFromTrashcan(customModel); + + modelDeleted = true; + } + else + { + LOGGER.error("Custom Content Model [{}] is not available under [/Data Dictionary/Models/] location", fileName); + } } - else + catch (Exception e) { LOGGER.error("Custom Content Model [{}] is not available under [/Data Dictionary/Models/] location", fileName); } @@ -166,25 +187,32 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont { FileModel customModel = null; - if ((fileName != null) && (fileName.endsWith("-model.xml"))) - + try { - Session session = contentService.getCMISSession(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword()); + if ((fileName != null) && (fileName.endsWith("-model.xml"))) - CmisObject modelInRepo = session.getObjectByPath(String.format("/Data Dictionary/Models/%s", fileName)); - - if (modelInRepo != null) { - customModel = new FileModel(modelInRepo.getName()); - customModel.setNodeRef(modelInRepo.getId()); - customModel.setNodeRef(customModel.getNodeRefWithoutVersion()); - customModel.setCmisLocation(String.format("/Data Dictionary/Models/%s", fileName)); + Session session = contentService.getCMISSession(dataUser.getAdminUser().getUsername(), dataUser.getAdminUser().getPassword()); + + CmisObject modelInRepo = session.getObjectByPath(String.format("/Data Dictionary/Models/%s", fileName)); + + if (modelInRepo != null) + { + customModel = new FileModel(modelInRepo.getName()); + customModel.setNodeRef(modelInRepo.getId()); + customModel.setNodeRef(customModel.getNodeRefWithoutVersion()); + customModel.setCmisLocation(String.format("/Data Dictionary/Models/%s", fileName)); LOGGER.info("Custom Model file: " + customModel.getCmisLocation()); + } + else + { + LOGGER.info("Custom Content Model [{}] is not available under [/Data Dictionary/Models/] location", fileName); + } } - else - { - LOGGER.info("Custom Content Model [{}] is not available under [/Data Dictionary/Models/] location", fileName); - } + } + catch (Exception e) + { + LOGGER.warn("Error Getting Custom Model: " + fileName, e); } return customModel; @@ -192,7 +220,7 @@ public abstract class AbstractE2EFunctionalTest extends AbstractTestNGSpringCont /** * Helper method which create an http post request to Search API end point. - * Executes the given search request. + * Executes the given search request without throwing checked exceptions (a {@link RuntimeException} will be thrown in case). * * @param query the search request. * @return the query execution response. diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/SolrSearchByPathTests.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/SolrSearchByPathTests.java index dc284c037..c1e0ae1b9 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/SolrSearchByPathTests.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/cmis/SolrSearchByPathTests.java @@ -38,7 +38,7 @@ public class SolrSearchByPathTests extends AbstractCmisE2ETest @Test(dataProviderClass = XMLTestDataProvider.class, dataProvider = "getAllData") @XMLDataConfig(file = "src/test/resources/testdata/search-by-path.xml") - public void prepareDataForSearchByPath(XMLTestData testData) throws Exception + public void prepareDataForSearchByPath(XMLTestData testData) { this.testData = testData; testData.createUsers(dataUser); @@ -49,7 +49,7 @@ public class SolrSearchByPathTests extends AbstractCmisE2ETest @Test(dependsOnMethods = "prepareDataForSearchByPath", dataProviderClass = XMLTestDataProvider.class, dataProvider = "getQueriesData") @XMLDataConfig(file = "src/test/resources/testdata/search-by-path.xml") - public void executeSearchByPathQueries(QueryModel query) throws Exception + public void executeSearchByPathQueries(QueryModel query) { cmisApi.withQuery(query.getValue()).assertResultsCount().equals(query.getResults()); } From 6d69399d7c443c6106bbe6667cdb26c6f2d85ef4 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Fri, 2 Aug 2019 13:41:19 +0100 Subject: [PATCH 4/5] SEARCH-1742 Check for float != null rather than empty. It doesn't really make sense to check if a float is empty, although the TAS library seems to allow checking if integers and longs are empty for some reason. --- .../search/functional/searchServices/search/SearchTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchTest.java index b3771d4a8..aa49cf8e5 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/SearchTest.java @@ -72,7 +72,7 @@ public class SearchTest extends AbstractSearchServicesE2ETest SearchNodeModel entity = nodes.getEntryByIndex(0); entity.assertThat().field("search").contains("score"); - entity.getSearch().assertThat().field("score").isNotEmpty(); + entity.getSearch().assertThat().field("score").isNotNull(); Assert.assertEquals(entity.getName(),"pangram.txt"); } From abbef3ce1d5d7eccae1728f7e4f50a6c81ec4fad Mon Sep 17 00:00:00 2001 From: Tom Page Date: Fri, 2 Aug 2019 14:08:46 +0100 Subject: [PATCH 5/5] SEARCH-1742 Use txt extension so that document content is indexed correctly. --- .../functional/searchServices/search/FingerPrintTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java index 2f6f8b678..858e8b2f5 100644 --- a/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java +++ b/e2e-test/src/test/java/org/alfresco/test/search/functional/searchServices/search/FingerPrintTest.java @@ -79,7 +79,7 @@ public class FingerPrintTest extends AbstractE2EFunctionalTest public void makeSureFingerprintQueryWorksAfterMetadataUpdate() throws Exception { // Index a new file with content - FileModel file = new FileModel("Project_Contract.pdf", FileType.TEXT_PLAIN, "A content which is completely different from other indexed files."); + FileModel file = new FileModel("Project_Contract.txt", FileType.TEXT_PLAIN, "A content which is completely different from other indexed files."); dataContent.usingUser(testUser).usingSite(testSite).usingResource(folder).createContent(file); // make sure the content has been indexed (i.e. the ContentTracker fingerprint has been correctly computed