Merge branch 'tas-rest-api-search' into 'master'

Tas rest api search

See merge request tas/alfresco-tas-restapi-test!95
This commit is contained in:
Meenal Bhave
2018-11-13 16:23:57 +00:00
@@ -20,6 +20,8 @@ package org.alfresco.rest.search;
import junit.framework.Assert;
import org.alfresco.rest.model.body.RestNodeLockBodyModel;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.FileType;
import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
@@ -180,4 +182,25 @@ public class SearchTest extends AbstractSearchTest
restClient.onResponse().assertThat().body("list.entries.entry[0].name", Matchers.nullValue());
restClient.onResponse().assertThat().body("list.entries.entry[0].id", Matchers.nullValue());
}
@Test(groups = { TestGroup.SEARCH, TestGroup.REST_API })
public void searchSpecialCharacters() throws Exception
{
// Create a file with Special Characters
String specialCharfileName = "è¥äæ§ç§-åæ.pdf";
FileModel file = new FileModel(specialCharfileName, "è¥äæ§ç§-忬¯¸" + "è¥äæ§ç§-忬¯¸", "è¥äæ§ç§-忬¯¸", FileType.TEXT_PLAIN,
"Text file with Special Characters: " + specialCharfileName);
dataContent.usingUser(userModel).usingSite(siteModel).createContent(file);
waitForIndexing(file.getName(), true);
// Search
SearchRequest searchReq = createQuery("name:'" + specialCharfileName + "'");
SearchResponse nodes = query(searchReq);
restClient.assertStatusCodeIs(HttpStatus.OK);
nodes.assertThat().entriesListIsNotEmpty();
restClient.onResponse().assertThat().body("list.entries.entry[0].name", Matchers.equalToIgnoringCase(specialCharfileName));
}
}