|
13 | 13 | import java.util.UUID; |
14 | 14 | import org.junit.jupiter.api.Test; |
15 | 15 | import org.mockito.MockedStatic; |
16 | | -import org.openmetadata.schema.entity.data.Page; |
17 | 16 | import org.openmetadata.schema.entity.data.Table; |
18 | 17 | import org.openmetadata.schema.entity.data.Topic; |
19 | 18 | import org.openmetadata.schema.tests.DataQualityReport; |
|
26 | 25 | import org.openmetadata.schema.type.TagLabel; |
27 | 26 | import org.openmetadata.schema.type.change.ChangeSource; |
28 | 27 | import org.openmetadata.schema.type.change.ChangeSummary; |
29 | | -import org.openmetadata.schema.utils.JsonUtils; |
30 | | -import org.openmetadata.service.Entity; |
31 | 28 | import org.openmetadata.service.TypeRegistry; |
32 | 29 |
|
33 | 30 | class SearchIndexUtilsTest { |
@@ -66,41 +63,6 @@ void testParseHelpersAndRemoveFieldByPathSupportsNestedLists() { |
66 | 63 | assertFalse(doc.containsKey("simple")); |
67 | 64 | } |
68 | 65 |
|
69 | | - @Test |
70 | | - void testNormalizeFollowersExpandsIdStringsIntoEntityReferences() { |
71 | | - UUID followerId = UUID.randomUUID(); |
72 | | - Map<String, Object> source = new HashMap<>(); |
73 | | - source.put("id", UUID.randomUUID().toString()); |
74 | | - source.put("name", "test-page"); |
75 | | - source.put("pageType", "Article"); |
76 | | - source.put("followers", new ArrayList<>(List.of(followerId.toString()))); |
77 | | - |
78 | | - assertThrows( |
79 | | - IllegalArgumentException.class, |
80 | | - () -> JsonUtils.readOrConvertValueLenient(source, Page.class)); |
81 | | - |
82 | | - SearchIndexUtils.normalizeFollowers(source); |
83 | | - Page page = JsonUtils.readOrConvertValueLenient(source, Page.class); |
84 | | - |
85 | | - assertEquals(1, page.getFollowers().size()); |
86 | | - EntityReference follower = page.getFollowers().getFirst(); |
87 | | - assertEquals(followerId, follower.getId()); |
88 | | - assertEquals(Entity.USER, follower.getType()); |
89 | | - } |
90 | | - |
91 | | - @Test |
92 | | - void testNormalizeFollowersLeavesEmptyOrMissingFollowersUntouched() { |
93 | | - Map<String, Object> missing = new HashMap<>(); |
94 | | - missing.put("name", "no-followers"); |
95 | | - SearchIndexUtils.normalizeFollowers(missing); |
96 | | - assertFalse(missing.containsKey("followers")); |
97 | | - |
98 | | - Map<String, Object> empty = new HashMap<>(); |
99 | | - empty.put("followers", new ArrayList<>()); |
100 | | - SearchIndexUtils.normalizeFollowers(empty); |
101 | | - assertEquals(List.of(), empty.get("followers")); |
102 | | - } |
103 | | - |
104 | 66 | @Test |
105 | 67 | void testBuildAggregationTreeAndParseMetricAggregationReport() { |
106 | 68 | SearchAggregation aggregation = |
|
0 commit comments