mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
Search-646: Implemented support to fields required for Search-646 + test
This commit is contained in:
@@ -18,9 +18,13 @@
|
||||
*/
|
||||
package org.alfresco.rest.search;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@@ -70,5 +74,30 @@ public class SearchTest extends AbstractSearchTest
|
||||
|
||||
response.getContext().assertThat().field("request").isNotEmpty();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SEARCH, TestGroup.ASS_1 })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.SEARCH,
|
||||
TestGroup.ASS_1 }, executionType = ExecutionType.REGRESSION, description = "Checks that only restricted fields appear in the response")
|
||||
public void searchWithFields() throws Exception
|
||||
{
|
||||
SearchRequest query = new SearchRequest();
|
||||
RestRequestQueryModel queryReq = new RestRequestQueryModel();
|
||||
queryReq.setQuery("alfresco");
|
||||
query.setQuery(queryReq);
|
||||
|
||||
// Restrict to fields
|
||||
List<String> fields = new ArrayList<String>();
|
||||
fields.add("parentId");
|
||||
query.setFields(fields);
|
||||
|
||||
query(query);
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
// Only Field parentId is included in the response
|
||||
restClient.onResponse().assertThat().body("list.entries.entry[0].parentId", Matchers.notNullValue());
|
||||
// Usual Fields such as 'name, id' aren't included in the response
|
||||
restClient.onResponse().assertThat().body("list.entries.entry[0].name", Matchers.nullValue());
|
||||
restClient.onResponse().assertThat().body("list.entries.entry[0].id", Matchers.nullValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user