Skip to content

Commit

Permalink
Run spotlessApply
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Jun 22, 2023
1 parent 092f284 commit 0830bb4
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions src/test/java/org/opensearch/security/dlic/dlsfls/FlsFlatTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ protected void populateData(final Client tc) {
final BiFunction<XContentBuilder, String, XContentBuilder> addFlatField = (builder, fieldName) -> {
try {
return builder.startObject(fieldName)
.startObject("properties")
.startObject("field")
.field("type", "flat_object")
.endObject()
.endObject()
.endObject();
.startObject("properties")
.startObject("field")
.field("type", "flat_object")
.endObject()
.endObject()
.endObject();
} catch (final Exception e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -81,30 +81,30 @@ protected void populateData(final Client tc) {
// Filtering is only done on local number
createIndexWithMapping.accept("yellow-page");
tc.index(
new IndexRequest("yellow-pages").id("1")
.setRefreshPolicy(RefreshPolicy.IMMEDIATE)
.source(
"{\"phone-all\": {\"areaCode\": 1001, \"localNumber\": 1091 },\"phone-some\":{\"areaCode\": 1002, \"localNumber\": 1092 },\"phone-one\":{\"areaCode\": 1003, \"localNumber\": 1093 }}",
XContentType.JSON
)
new IndexRequest("yellow-pages").id("1")
.setRefreshPolicy(RefreshPolicy.IMMEDIATE)
.source(
"{\"phone-all\": {\"areaCode\": 1001, \"localNumber\": 1091 },\"phone-some\":{\"areaCode\": 1002, \"localNumber\": 1092 },\"phone-one\":{\"areaCode\": 1003, \"localNumber\": 1093 }}",
XContentType.JSON
)
).actionGet();
createIndexWithMapping.accept("green-page");
tc.index(
new IndexRequest("green-pages").id("2")
.setRefreshPolicy(RefreshPolicy.IMMEDIATE)
.source(
"{\"phone-all\": {\"areaCode\": 2001, \"localNumber\": 2091 },\"phone-some\":{\"areaCode\": 2002, \"localNumber\": 2092 },\"phone-one\":{\"areaCode\": 2003, \"localNumber\": 2093 }}",
XContentType.JSON
)
new IndexRequest("green-pages").id("2")
.setRefreshPolicy(RefreshPolicy.IMMEDIATE)
.source(
"{\"phone-all\": {\"areaCode\": 2001, \"localNumber\": 2091 },\"phone-some\":{\"areaCode\": 2002, \"localNumber\": 2092 },\"phone-one\":{\"areaCode\": 2003, \"localNumber\": 2093 }}",
XContentType.JSON
)
).actionGet();
createIndexWithMapping.accept("blue-book");
tc.index(
new IndexRequest("blue-book").id("3")
.setRefreshPolicy(RefreshPolicy.IMMEDIATE)
.source(
"{\"phone-all\": {\"areaCode\": 3001, \"localNumber\": 3091 },\"phone-some\":{\"areaCode\": 3002, \"localNumber\": 3092 },\"phone-one\":{\"areaCode\": 3003, \"localNumber\": 3093 }}",
XContentType.JSON
)
new IndexRequest("blue-book").id("3")
.setRefreshPolicy(RefreshPolicy.IMMEDIATE)
.source(
"{\"phone-all\": {\"areaCode\": 3001, \"localNumber\": 3091 },\"phone-some\":{\"areaCode\": 3002, \"localNumber\": 3092 },\"phone-one\":{\"areaCode\": 3003, \"localNumber\": 3093 }}",
XContentType.JSON
)
).actionGet();

// Seperate index used to test aliasing
Expand Down Expand Up @@ -153,8 +153,8 @@ public void testSingleFlatFieldFlsAppliedForLimitedResults() throws Exception {
setup(new DynamicSecurityConfig().setSecurityRoles(ROLES_FILE).setSecurityRolesMapping(ROLES_MAPPINGS_FILE));

final HttpResponse phoneOneFilteredResponse = rh.executeGetRequest(
"/yellow-pages/_search?filter_path=hits.hits&pretty",
asPhoneOneUser
"/yellow-pages/_search?filter_path=hits.hits&pretty",
asPhoneOneUser
);
assertThat(phoneOneFilteredResponse.getStatusCode(), equalTo(HttpStatus.SC_OK));
assertThat(phoneOneFilteredResponse.getBody(), containsString("1003"));
Expand Down

0 comments on commit 0830bb4

Please sign in to comment.