|
16 | 16 | import java.util.Map; |
17 | 17 |
|
18 | 18 | import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope; |
19 | | -import com.fasterxml.jackson.databind.ObjectMapper; |
20 | | -import com.fasterxml.jackson.databind.node.ArrayNode; |
21 | | -import com.fasterxml.jackson.databind.node.ObjectNode; |
22 | 19 | import org.apache.http.HttpStatus; |
23 | 20 | import org.awaitility.Awaitility; |
24 | 21 | import org.junit.After; |
|
36 | 33 | import org.opensearch.test.framework.cluster.TestRestClient; |
37 | 34 | import org.opensearch.test.framework.matcher.RestMatchers; |
38 | 35 |
|
| 36 | +import tools.jackson.databind.ObjectMapper; |
| 37 | +import tools.jackson.databind.node.ArrayNode; |
| 38 | +import tools.jackson.databind.node.ObjectNode; |
| 39 | + |
39 | 40 | import static org.hamcrest.MatcherAssert.assertThat; |
40 | 41 | import static org.hamcrest.Matchers.containsInAnyOrder; |
41 | 42 | import static org.hamcrest.Matchers.equalTo; |
@@ -653,10 +654,10 @@ public void testMigrateAPI_withGarbageParentId() { |
653 | 654 | ArrayNode hitsNode = (ArrayNode) sharingResponse.bodyAsJsonNode().get("hits").get("hits"); |
654 | 655 | assertThat(hitsNode.size(), equalTo(1)); |
655 | 656 |
|
656 | | - com.fasterxml.jackson.databind.JsonNode source = hitsNode.get(0).get("_source"); |
657 | | - assertThat(source.get("resource_id").asText(), equalTo(resourceId)); |
658 | | - assertThat(source.get("parent_id").asText(), equalTo(garbageGroupId)); |
659 | | - assertThat(source.get("parent_type").asText(), equalTo(RESOURCE_GROUP_TYPE)); |
| 657 | + tools.jackson.databind.JsonNode source = hitsNode.get(0).get("_source"); |
| 658 | + assertThat(source.get("resource_id").asString(), equalTo(resourceId)); |
| 659 | + assertThat(source.get("parent_id").asString(), equalTo(garbageGroupId)); |
| 660 | + assertThat(source.get("parent_type").asString(), equalTo(RESOURCE_GROUP_TYPE)); |
660 | 661 |
|
661 | 662 | // Access check for the owner should still work gracefully — the nonexistent parent |
662 | 663 | // simply contributes no additional resource IDs, so the resource remains owner-accessible |
@@ -690,18 +691,18 @@ public void testMigrateAPI_withParentHierarchy() { |
690 | 691 | assertThat(hitsNode.size(), equalTo(2)); |
691 | 692 |
|
692 | 693 | // Find the resource hit (not the group) and verify parent fields |
693 | | - com.fasterxml.jackson.databind.JsonNode resourceSource = null; |
694 | | - for (com.fasterxml.jackson.databind.JsonNode hit : hitsNode) { |
695 | | - com.fasterxml.jackson.databind.JsonNode src = hit.get("_source"); |
696 | | - if (RESOURCE_TYPE.equals(src.get("resource_type").asText())) { |
| 694 | + tools.jackson.databind.JsonNode resourceSource = null; |
| 695 | + for (tools.jackson.databind.JsonNode hit : hitsNode) { |
| 696 | + tools.jackson.databind.JsonNode src = hit.get("_source"); |
| 697 | + if (RESOURCE_TYPE.equals(src.get("resource_type").asString())) { |
697 | 698 | resourceSource = src; |
698 | 699 | break; |
699 | 700 | } |
700 | 701 | } |
701 | 702 | assertThat("Expected a sharing record for resource type " + RESOURCE_TYPE, resourceSource != null); |
702 | | - assertThat(resourceSource.get("resource_id").asText(), equalTo(resourceId)); |
703 | | - assertThat(resourceSource.get("parent_type").asText(), equalTo(RESOURCE_GROUP_TYPE)); |
704 | | - assertThat(resourceSource.get("parent_id").asText(), equalTo(groupId)); |
| 703 | + assertThat(resourceSource.get("resource_id").asString(), equalTo(resourceId)); |
| 704 | + assertThat(resourceSource.get("parent_type").asString(), equalTo(RESOURCE_GROUP_TYPE)); |
| 705 | + assertThat(resourceSource.get("parent_id").asString(), equalTo(groupId)); |
705 | 706 | } |
706 | 707 | } |
707 | 708 |
|
|
0 commit comments