aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2021-10-19 15:54:25 +0200
committerJon Bratseth <bratseth@gmail.com>2021-10-19 15:54:25 +0200
commit8ae224deaa6c98c3cd5a212a526241e99689d4e2 (patch)
treef9f386d7ed169749d83b72f4680c9b05d1f21b61
parent5cb59ac0fee4d641b655f3aa789632e2cfea81ad (diff)
Test 2 levels
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java51
1 files changed, 32 insertions, 19 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 f185867a2df..1813ee1f636 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java
@@ -110,34 +110,47 @@ public class SchemaTestCase {
" }" +
" }" +
"}");
+ String grandchildLines = joinLines(
+ "schema grandchild inherits child {" +
+ " document grandchild inherits child {" +
+ " field gf1 type string {" +
+ " indexing: summary" +
+ " }" +
+ " }" +
+ "}");
SearchBuilder builder = new SearchBuilder(new DeployLoggerStub());
builder.processorsToSkip().add(OnnxModelTypeResolver.class); // Avoid discovering the Onnx model referenced does not exist
builder.processorsToSkip().add(ImportedFieldsResolver.class); // Avoid discovering the document reference leads nowhere
builder.importString(parentLines);
builder.importString(childLines);
+ builder.importString(grandchildLines);
builder.build(true);
var application = builder.application();
- var child = application.schemas().get("child");
- assertEquals("pf1", child.fieldSets().userFieldSets().get("parent_set").getFieldNames().stream().findFirst().get());
- assertEquals(Stemming.NONE, child.getStemming());
- assertEquals(Stemming.BEST, child.getIndex("parent_index").getStemming());
- assertNotNull(child.getField("parent_field"));
- assertNotNull(child.getExtraField("parent_field"));
- assertNotNull(application.rankProfileRegistry().get(child, "parent_profile"));
- assertNotNull(child.rankingConstants().get("parent_constant"));
- assertTrue(child.rankingConstants().asMap().containsKey("parent_constant"));
- assertNotNull(child.onnxModels().get("parent_model"));
- assertTrue(child.onnxModels().asMap().containsKey("parent_model"));
- assertNotNull(child.getSummary("parent_summary"));
- assertTrue(child.getSummaries().containsKey("parent_summary"));
- assertNotNull(child.getSummaryField("pf1"));
- assertNotNull(child.getExplicitSummaryField("pf1"));
- assertNotNull(child.getUniqueNamedSummaryFields().get("pf1"));
- assertTrue(child.temporaryImportedFields().isPresent());
- assertNotNull(child.temporaryImportedFields().get().fields().get("parent_imported"));
- assertTrue(child.isRawAsBase64());
+ assertInheritedFromParent(application.schemas().get("child"), application);
+ assertInheritedFromParent(application.schemas().get("grandchild"), application);
+ }
+
+ private void assertInheritedFromParent(Schema schema, Application application) {
+ 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(schema.rankingConstants().get("parent_constant"));
+ assertTrue(schema.rankingConstants().asMap().containsKey("parent_constant"));
+ assertNotNull(schema.onnxModels().get("parent_model"));
+ assertTrue(schema.onnxModels().asMap().containsKey("parent_model"));
+ assertNotNull(schema.getSummary("parent_summary"));
+ assertTrue(schema.getSummaries().containsKey("parent_summary"));
+ assertNotNull(schema.getSummaryField("pf1"));
+ assertNotNull(schema.getExplicitSummaryField("pf1"));
+ assertNotNull(schema.getUniqueNamedSummaryFields().get("pf1"));
+ assertTrue(schema.temporaryImportedFields().isPresent());
+ assertNotNull(schema.temporaryImportedFields().get().fields().get("parent_imported"));
+ assertTrue(schema.isRawAsBase64());
}
}