From 89fefe174713f282647c69d044dcffbd6c0cf5b1 Mon Sep 17 00:00:00 2001 From: jcule Date: Mon, 21 May 2018 13:38:21 +0100 Subject: [PATCH 1/2] RM-6318: Search for "derived by" and classification reasons: Automate AC --- .../main/java/org/alfresco/rest/v0/SearchAPI.java | 15 +++++++-------- .../rest/rm/community/base/BaseRMRestTest.java | 10 ++++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java index f462f06cdf..aec0b129ba 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java @@ -65,8 +65,7 @@ public class SearchAPI extends BaseAPI /** RM document search filters */ private static final String RM_DEFAULT_RECORD_FILTERS = - "records/true,undeclared/true,vital/false,folders/false,categories/false,frozen/false,cutoff/false"; - + "records/true,undeclared/true,vital/false,folders/{0},categories/{1},frozen/false,cutoff/false"; /** * Perform search request on search endpoint as a user. *

@@ -120,7 +119,7 @@ public class SearchAPI extends BaseAPI } /** - * Search as a user for records on site "rm" matching query, using SearchAPI.RM_DEFAULT_RECORD_FILTERS and sorted + * Search as a user for nodes on site "rm" matching query, using SearchAPI.RM_DEFAULT_RECORD_FILTERS and sorted * by sortby *
* If more fine-grained control of search parameters is required, use rmSearch() directly. @@ -131,12 +130,12 @@ public class SearchAPI extends BaseAPI * @return list of record names */ public List searchForRecordsAsUser( - String username, - String password, - String query, - String sortby) + String username, String password, + String query, String sortby, + Boolean includeCategories, Boolean includeFolders) { - return getItemNames(rmSearch(username, password, "rm", query, RM_DEFAULT_RECORD_FILTERS, sortby)); + String searchFilterParamaters = MessageFormat.format(RM_DEFAULT_RECORD_FILTERS, Boolean.toString(includeFolders), Boolean.toString(includeCategories)); + return getItemNames(rmSearch(username, password, "rm", query, searchFilterParamaters, sortby)); } /** diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java index 5de8128200..ee4ae09a62 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java @@ -678,7 +678,8 @@ public class BaseRMRestTest extends RestTest * @param expectedResults * @return */ - public List searchForRMContentAsUser(UserModel user, String term, String sortby, List expectedResults) + public List searchForRMContentAsUser(UserModel user, String term, String sortby, Boolean includeFolders, + Boolean includeCategories, List expectedResults) { List results = new ArrayList<>(); // wait for solr indexing @@ -691,12 +692,13 @@ public class BaseRMRestTest extends RestTest try { this.wait(waitInMilliSeconds); - } catch (InterruptedException e) + } + catch (InterruptedException e) { } } - - results = searchApi.searchForRecordsAsUser(user.getUsername(), user.getPassword(), term, sortby); + results = searchApi.searchForRecordsAsUser(user.getUsername(), user.getPassword(), term, sortby, + includeFolders, includeCategories); if (!results.isEmpty() && results.containsAll(expectedResults)) { break; From b075bf9e621fd287c8ae4b47766b77f29a2e0bce Mon Sep 17 00:00:00 2001 From: jcule Date: Tue, 22 May 2018 20:13:42 +0100 Subject: [PATCH 2/2] RM-6318: Search for "derived by" and classification reasons: Automate AC --- .../org/alfresco/rest/rm/community/base/BaseRMRestTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java index ee4ae09a62..3523521852 100644 --- a/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java +++ b/rm-automation/rm-automation-community-rest-api/src/test/java/org/alfresco/rest/rm/community/base/BaseRMRestTest.java @@ -678,8 +678,8 @@ public class BaseRMRestTest extends RestTest * @param expectedResults * @return */ - public List searchForRMContentAsUser(UserModel user, String term, String sortby, Boolean includeFolders, - Boolean includeCategories, List expectedResults) + public List searchForRMContentAsUser(UserModel user, String term, String sortby, boolean includeFolders, + boolean includeCategories, List expectedResults) { List results = new ArrayList<>(); // wait for solr indexing