Repo-1154: Using spaces for term-based queries - nodes retry mechanism of search

This commit is contained in:
Andreea Nechifor
2017-11-02 17:12:16 +02:00
parent 79a87a7886
commit 97fcc2f27e
@@ -5,6 +5,8 @@ import static org.testng.Assert.assertTrue;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.model.RestNodeModelsCollection;
import org.alfresco.utility.RetryOperation;
import org.alfresco.utility.Utility;
import org.alfresco.utility.model.ContentModel;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FileType;
@@ -58,7 +60,7 @@ public class QueriesTest extends RestTest
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.QUERIES }, executionType = ExecutionType.REGRESSION, description = "Verify GET queries on queries/nodes returnes success status code")
TestGroup.QUERIES }, executionType = ExecutionType.REGRESSION, description = "Verify GET queries on queries/nodes return success status code")
@Test(groups = { TestGroup.REST_API, TestGroup.RATINGS, TestGroup.CORE })
public void testSearchTermWhiteSpace() throws Exception
{
@@ -88,16 +90,21 @@ public class QueriesTest extends RestTest
cm.setName(folder.getName());
dataContent.usingUser(userModel).usingSite(siteModel).usingResource(cm).createContent(file1);
dataContent.usingUser(userModel).usingSite(siteModel).usingResource(cm).createContent(file2);
Thread.sleep(35000);// Allow indexing to complete.
RetryOperation op = new RetryOperation(){
public void execute() throws Exception{
RestNodeModelsCollection nodesChildTerm = restClient.withCoreAPI().usingQueries().usingParams("term=" + childTerm).findNodes();
// check if the search returns all nodes which contain that query term
assertEquals(2, nodesChildTerm.getEntries().size());
RestNodeModelsCollection nodesChildTermWS = restClient.withCoreAPI().usingQueries().usingParams("term=" + childTermWS).findNodes();
// check if search works for words with space and the space don't break
// the query
assertEquals(1, nodesChildTermWS.getEntries().size());
assertTrue(nodesChildTerm.getEntries().size() >= nodesChildTermWS.getEntries().size());
}
RestNodeModelsCollection nodesChildTerm = restClient.withCoreAPI().usingQueries().usingParams("term=" + childTerm).findNodes();
// check if the search returns all nodes which contain that query term
assertEquals(2, nodesChildTerm.getEntries().size());
RestNodeModelsCollection nodesChildTermWS = restClient.withCoreAPI().usingQueries().usingParams("term=" + childTermWS).findNodes();
// check if search works for words with space and the space don't break
// the query
assertEquals(1, nodesChildTermWS.getEntries().size());
assertTrue(nodesChildTerm.getEntries().size() >= nodesChildTermWS.getEntries().size());
};
Utility.sleep(10, 3500, op);// Allow indexing to complete.
}
}