summaryrefslogtreecommitdiffstats
path: root/config-model/src/test
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-11-03 12:45:08 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2021-11-03 12:45:08 +0100
commit01165b282415fa1de88f21762127886cb8bba8aa (patch)
tree68acedaf4c6a80787ffe69b43e2924c2d1aff308 /config-model/src/test
parente5bc78b971380cb1245e9c6a36c2b3ea0fe6eebf (diff)
Separate RankProfileRegistry from Application to reduce its lifetime to be only during model building.
Application is kept alive from Schema which is kept alive from NamedSchema and lives permanently in the model.
Diffstat (limited to 'config-model/src/test')
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java
index 3413fe3c373..860b741a1f2 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java
@@ -153,9 +153,9 @@ public class SchemaTestCase {
assertNotNull(child.getField("child_field"));
assertNotNull(child.getExtraField("parent_field"));
assertNotNull(child.getExtraField("child_field"));
- assertNotNull(application.rankProfileRegistry().get(child, "parent_profile"));
- assertNotNull(application.rankProfileRegistry().get(child, "child_profile"));
- assertEquals("parent_profile", application.rankProfileRegistry().get(child, "child_profile").getInheritedName());
+ assertNotNull(builder.getRankProfileRegistry().get(child, "parent_profile"));
+ assertNotNull(builder.getRankProfileRegistry().get(child, "child_profile"));
+ assertEquals("parent_profile", builder.getRankProfileRegistry().get(child, "child_profile").getInheritedName());
assertNotNull(child.rankingConstants().get("parent_constant"));
assertNotNull(child.rankingConstants().get("child_constant"));
assertTrue(child.rankingConstants().asMap().containsKey("parent_constant"));
@@ -239,17 +239,17 @@ public class SchemaTestCase {
builder.build(true);
var application = builder.application();
- assertInheritedFromParent(application.schemas().get("child"), application);
- assertInheritedFromParent(application.schemas().get("grandchild"), application);
+ assertInheritedFromParent(application.schemas().get("child"), application, builder.getRankProfileRegistry());
+ assertInheritedFromParent(application.schemas().get("grandchild"), application, builder.getRankProfileRegistry());
}
- private void assertInheritedFromParent(Schema schema, Application application) {
+ private void assertInheritedFromParent(Schema schema, Application application, RankProfileRegistry rankProfileRegistry) {
assertEquals("pf1", schema.fieldSets().userFieldSets().get("parent_set").getFieldNames().stream().findFirst().get());
assertEquals(Stemming.NONE, schema.getStemming());
assertEquals(Stemming.BEST, schema.getIndex("parent_index").getStemming());
assertNotNull(schema.getField("parent_field"));
assertNotNull(schema.getExtraField("parent_field"));
- assertNotNull(application.rankProfileRegistry().get(schema, "parent_profile"));
+ assertNotNull(rankProfileRegistry.get(schema, "parent_profile"));
assertNotNull(schema.rankingConstants().get("parent_constant"));
assertTrue(schema.rankingConstants().asMap().containsKey("parent_constant"));
assertNotNull(schema.onnxModels().get("parent_model"));