Handle core removing addField

It is addStoredField now.

Original commit: elastic/x-pack-elasticsearch@265d716b31
This commit is contained in:
Nik Everett 2016-06-22 12:45:25 -04:00
parent 5883efc976
commit 9aecf6330a
1 changed files with 24 additions and 24 deletions

View File

@ -709,9 +709,9 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase {
SearchResponse response = client() SearchResponse response = client()
.filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user1", USERS_PASSWD))) .filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user1", USERS_PASSWD)))
.prepareSearch("test") .prepareSearch("test")
.addField("field1") .addStoredField("field1")
.addField("field2") .addStoredField("field2")
.addField("field3") .addStoredField("field3")
.get(); .get();
assertThat(response.getHits().getAt(0).fields().size(), equalTo(1)); assertThat(response.getHits().getAt(0).fields().size(), equalTo(1));
assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1")); assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1"));
@ -719,9 +719,9 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase {
// user2 is granted access to field2 only: // user2 is granted access to field2 only:
response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user2", USERS_PASSWD))) response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user2", USERS_PASSWD)))
.prepareSearch("test") .prepareSearch("test")
.addField("field1") .addStoredField("field1")
.addField("field2") .addStoredField("field2")
.addField("field3") .addStoredField("field3")
.get(); .get();
assertThat(response.getHits().getAt(0).fields().size(), equalTo(1)); assertThat(response.getHits().getAt(0).fields().size(), equalTo(1));
assertThat(response.getHits().getAt(0).fields().get("field2").<String>getValue(), equalTo("value2")); assertThat(response.getHits().getAt(0).fields().get("field2").<String>getValue(), equalTo("value2"));
@ -729,9 +729,9 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase {
// user3 is granted access to field1 and field2: // user3 is granted access to field1 and field2:
response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user3", USERS_PASSWD))) response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user3", USERS_PASSWD)))
.prepareSearch("test") .prepareSearch("test")
.addField("field1") .addStoredField("field1")
.addField("field2") .addStoredField("field2")
.addField("field3") .addStoredField("field3")
.get(); .get();
assertThat(response.getHits().getAt(0).fields().size(), equalTo(2)); assertThat(response.getHits().getAt(0).fields().size(), equalTo(2));
assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1")); assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1"));
@ -740,18 +740,18 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase {
// user4 is granted access to no fields: // user4 is granted access to no fields:
response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user4", USERS_PASSWD))) response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user4", USERS_PASSWD)))
.prepareSearch("test") .prepareSearch("test")
.addField("field1") .addStoredField("field1")
.addField("field2") .addStoredField("field2")
.addField("field3") .addStoredField("field3")
.get(); .get();
assertThat(response.getHits().getAt(0).fields().size(), equalTo(0)); assertThat(response.getHits().getAt(0).fields().size(), equalTo(0));
// user5 has no field level security configured: // user5 has no field level security configured:
response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user5", USERS_PASSWD))) response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user5", USERS_PASSWD)))
.prepareSearch("test") .prepareSearch("test")
.addField("field1") .addStoredField("field1")
.addField("field2") .addStoredField("field2")
.addField("field3") .addStoredField("field3")
.get(); .get();
assertThat(response.getHits().getAt(0).fields().size(), equalTo(3)); assertThat(response.getHits().getAt(0).fields().size(), equalTo(3));
assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1")); assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1"));
@ -761,9 +761,9 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase {
// user6 has field level security configured with access to field*: // user6 has field level security configured with access to field*:
response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user6", USERS_PASSWD))) response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user6", USERS_PASSWD)))
.prepareSearch("test") .prepareSearch("test")
.addField("field1") .addStoredField("field1")
.addField("field2") .addStoredField("field2")
.addField("field3") .addStoredField("field3")
.get(); .get();
assertThat(response.getHits().getAt(0).fields().size(), equalTo(3)); assertThat(response.getHits().getAt(0).fields().size(), equalTo(3));
assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1")); assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1"));
@ -773,9 +773,9 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase {
// user7 has access to all fields due to a mix of roles without field level security and with: // user7 has access to all fields due to a mix of roles without field level security and with:
response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user7", USERS_PASSWD))) response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user7", USERS_PASSWD)))
.prepareSearch("test") .prepareSearch("test")
.addField("field1") .addStoredField("field1")
.addField("field2") .addStoredField("field2")
.addField("field3") .addStoredField("field3")
.get(); .get();
assertThat(response.getHits().getAt(0).fields().size(), equalTo(3)); assertThat(response.getHits().getAt(0).fields().size(), equalTo(3));
assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1")); assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1"));
@ -785,9 +785,9 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase {
// user8 has field level security configured with access to field1 and field2: // user8 has field level security configured with access to field1 and field2:
response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user8", USERS_PASSWD))) response = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user8", USERS_PASSWD)))
.prepareSearch("test") .prepareSearch("test")
.addField("field1") .addStoredField("field1")
.addField("field2") .addStoredField("field2")
.addField("field3") .addStoredField("field3")
.get(); .get();
assertThat(response.getHits().getAt(0).fields().size(), equalTo(2)); assertThat(response.getHits().getAt(0).fields().size(), equalTo(2));
assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1")); assertThat(response.getHits().getAt(0).fields().get("field1").<String>getValue(), equalTo("value1"));