diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-04-01 11:51:29 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-04-01 11:51:29 +0000 |
commit | 430155207f7de4ee54456901803ce8ab1e65209c (patch) | |
tree | 2aa2a614ae9527b782f348d310d23518e3814e92 /config-model/src/test/java/com | |
parent | 1bb3dd192f4bcb91e710fe19ca54b2b8935ffb83 (diff) |
remove old document manager config production
Diffstat (limited to 'config-model/src/test/java/com')
2 files changed, 32 insertions, 19 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java index e1cc42ba9c5..b8ad3c24ed7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/AbstractExportingTestCase.java @@ -66,7 +66,7 @@ public abstract class AbstractExportingTestCase extends AbstractSchemaTestCase { private DerivedConfiguration export(String name, ApplicationBuilder builder, DerivedConfiguration config) throws IOException { String path = exportConfig(name, config); - DerivedConfiguration.exportDocuments(new DocumentManager().useV8DocManagerCfg(useV8DocManagerCfg()) + DerivedConfiguration.exportDocuments(new DocumentManager() .produce(builder.getModel(), new DocumentmanagerConfig.Builder()), path); DerivedConfiguration.exportDocuments(new DocumentTypes().produce(builder.getModel(), new DocumenttypesConfig.Builder()), path); DerivedConfiguration.exportQueryProfiles(builder.getQueryProfileRegistry(), path); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java index 10616731499..d27c081ce30 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java @@ -62,6 +62,16 @@ public class InheritanceTestCase extends AbstractExportingTestCase { @Test public void requireThatStructTypesAreInheritedThroughDiamond() throws IOException, ParseException { String dir = "src/test/derived/inheritdiamond/"; + { + ApplicationBuilder builder = new ApplicationBuilder(); + builder.addSchemaFile(dir + "grandparent.sd"); + builder.addSchemaFile(dir + "mother.sd"); + builder.addSchemaFile(dir + "father.sd"); + builder.addSchemaFile(dir + "child.sd"); + builder.build(true); + derive("inheritdiamond", builder, builder.getSchema("child")); + assertCorrectConfigFiles("inheritdiamond"); + } List<String> files = Arrays.asList("grandparent.sd", "mother.sd", "father.sd", "child.sd"); File outDir = tmpDir.newFolder("out"); for (int startIdx = 0; startIdx < files.size(); ++startIdx) { @@ -74,40 +84,43 @@ public class InheritanceTestCase extends AbstractExportingTestCase { builder.build(true); DocumentmanagerConfig.Builder b = new DocumentmanagerConfig.Builder(); DerivedConfiguration.exportDocuments(new DocumentManager(). - useV8DocManagerCfg(false). produce(builder.getModel(), b), outDir.getPath()); DocumentmanagerConfig dc = b.build(); - assertEquals(13, dc.datatype().size()); + assertEquals(5, dc.doctype().size()); + assertNull(structType("child.body", dc)); - DocumentmanagerConfig.Datatype.Structtype childHeader = structType("child.header", dc); + var childHeader = structType("child.header", dc); assertEquals(childHeader.field(0).name(), "foo"); assertEquals(childHeader.field(1).name(), "bar"); assertEquals(childHeader.field(2).name(), "baz"); assertEquals(childHeader.field(3).name(), "cox"); - DocumentmanagerConfig.Datatype.Documenttype child = documentType("child", dc); - assertEquals(child.inherits(0).name(), "document"); - assertEquals(child.inherits(1).name(), "mother"); - assertEquals(child.inherits(2).name(), "father"); - DocumentmanagerConfig.Datatype.Documenttype mother = documentType("mother", dc); - assertEquals(mother.inherits(0).name(), "document"); - assertEquals(mother.inherits(1).name(), "grandparent"); + + var root = documentType("document", dc); + var child = documentType("child", dc); + var mother = documentType("mother", dc); + var father = documentType("father", dc); + var grandparent = documentType("grandparent", dc); + + assertEquals(child.inherits(0).idx(), root.idx()); + assertEquals(child.inherits(1).idx(), mother.idx()); + assertEquals(child.inherits(2).idx(), father.idx()); + assertEquals(mother.inherits(0).idx(), root.idx()); + assertEquals(mother.inherits(1).idx(), grandparent.idx()); } } - private DocumentmanagerConfig.Datatype.Structtype structType(String name, DocumentmanagerConfig dc) { - for (DocumentmanagerConfig.Datatype dt : dc.datatype()) { - for (DocumentmanagerConfig.Datatype.Structtype st : dt.structtype()) { + private DocumentmanagerConfig.Doctype.Structtype structType(String name, DocumentmanagerConfig dc) { + for (var dt : dc.doctype()) { + for (var st : dt.structtype()) { if (name.equals(st.name())) return st; } } return null; } - private DocumentmanagerConfig.Datatype.Documenttype documentType(String name, DocumentmanagerConfig dc) { - for (DocumentmanagerConfig.Datatype dt : dc.datatype()) { - for (DocumentmanagerConfig.Datatype.Documenttype dot : dt.documenttype()) { - if (name.equals(dot.name())) return dot; - } + private DocumentmanagerConfig.Doctype documentType(String name, DocumentmanagerConfig dc) { + for (var dot : dc.doctype()) { + if (name.equals(dot.name())) return dot; } return null; } |