From f3185db181dffdced11f56a76f86f51373d4e045 Mon Sep 17 00:00:00 2001 From: Meenal Bhave Date: Tue, 24 Jul 2018 16:29:05 +0100 Subject: [PATCH] Search-874 Test Added to test that selected set of fields appear in select * queries --- .../rest/search/sql/SearchSQLAPITest.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/e2e-test/java/org/alfresco/rest/search/sql/SearchSQLAPITest.java b/e2e-test/java/org/alfresco/rest/search/sql/SearchSQLAPITest.java index c251a9892..6cdedf75e 100644 --- a/e2e-test/java/org/alfresco/rest/search/sql/SearchSQLAPITest.java +++ b/e2e-test/java/org/alfresco/rest/search/sql/SearchSQLAPITest.java @@ -21,6 +21,7 @@ import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.model.UserModel; import org.springframework.http.HttpStatus; +import org.testng.Assert; import org.testng.annotations.Test; import org.hamcrest.Matchers; @@ -624,7 +625,34 @@ public class SearchSQLAPITest extends AbstractSearchTest response = searchSql(sqlRequest); restClient.assertStatusCodeIs(HttpStatus.OK); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.cm_name", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.cm_created", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.cm_creator", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.cm_modified", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.cm_modifier", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.cm_owner", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.OWNER", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.TYPE", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.LID", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.DBID", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.cm_title", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.cm_description", Matchers.notNullValue()); + + // This type of assertion is required because of a '.' in the field name + Assert.assertTrue(response.getResponse().body().jsonPath().get("result-set.docs[0].aliases").toString().contains("cm_content.size=cm_content.size")); + Assert.assertTrue(response.getResponse().body().jsonPath().get("result-set.docs[0].aliases").toString().contains("cm_content.mimetype=cm_content.mimetype")); + Assert.assertTrue(response.getResponse().body().jsonPath().get("result-set.docs[0].aliases").toString().contains("cm_content.encoding=cm_content.encoding")); + Assert.assertTrue(response.getResponse().body().jsonPath().get("result-set.docs[0].aliases").toString().contains("cm_content.locale=cm_content.locale")); + + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.cm_lockOwner", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.SITE", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.PARENT", Matchers.notNullValue()); restClient.onResponse().assertThat().body("result-set.docs[0].aliases.PATH", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.PRIMARYPARENT", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.ASPECT", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.QNAME", Matchers.notNullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.cm_content", Matchers.nullValue()); + restClient.onResponse().assertThat().body("result-set.docs[0].aliases.RandomNonExistentField", Matchers.nullValue()); } @Test(groups = { TestGroup.SEARCH, TestGroup.REST_API, TestGroup.INSIGHT_10 }, priority = 15)