mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-6288: Record Search of classified files with marks return also the files classified only with classification levels: api test
This commit is contained in:
@@ -77,6 +77,7 @@ import org.alfresco.rest.search.RestRequestQueryModel;
|
|||||||
import org.alfresco.rest.search.SearchNodeModel;
|
import org.alfresco.rest.search.SearchNodeModel;
|
||||||
import org.alfresco.rest.search.SearchRequest;
|
import org.alfresco.rest.search.SearchRequest;
|
||||||
import org.alfresco.rest.v0.RMRolesAndActionsAPI;
|
import org.alfresco.rest.v0.RMRolesAndActionsAPI;
|
||||||
|
import org.alfresco.rest.v0.SearchAPI;
|
||||||
import org.alfresco.utility.data.DataUser;
|
import org.alfresco.utility.data.DataUser;
|
||||||
import org.alfresco.utility.model.ContentModel;
|
import org.alfresco.utility.model.ContentModel;
|
||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
@@ -114,6 +115,10 @@ public class BaseRMRestTest extends RestTest
|
|||||||
@Getter(value = PROTECTED)
|
@Getter(value = PROTECTED)
|
||||||
private RMRolesAndActionsAPI rmRolesAndActionsAPI;
|
private RMRolesAndActionsAPI rmRolesAndActionsAPI;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Getter(value = PROTECTED)
|
||||||
|
private SearchAPI searchApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts the given status code
|
* Asserts the given status code
|
||||||
*
|
*
|
||||||
@@ -663,6 +668,46 @@ public class BaseRMRestTest extends RestTest
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns records search results for the given search term
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* @param term
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public List<String> searchForRMContentAsUser(UserModel user, String term, String expectedResult) throws Exception
|
||||||
|
{
|
||||||
|
List<String> results = new ArrayList<>();
|
||||||
|
// wait for solr indexing
|
||||||
|
int counter = 0;
|
||||||
|
int waitInMilliSeconds = 6000;
|
||||||
|
while (counter < 3)
|
||||||
|
{
|
||||||
|
results = searchApi.searchForRecordsAsUser(user.getUsername(), user.getPassword(), term);
|
||||||
|
if ((results != null && !results.isEmpty() && results.contains(expectedResult)))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
// double wait time to not overdo solr search
|
||||||
|
waitInMilliSeconds = (waitInMilliSeconds * 2);
|
||||||
|
synchronized (this)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.wait(waitInMilliSeconds);
|
||||||
|
} catch (InterruptedException e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to return site document library content model
|
* Helper method to return site document library content model
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user