diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-03-09 19:50:35 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-03-09 19:50:35 +0000 |
commit | 248b51e9257e024dea82a22a5e09ff16bfdb585a (patch) | |
tree | 07273826dc20037d2efde81386e188a56492e339 /config-model | |
parent | 3ca903a8e464d74216bb08490af0bb5a1ff633a0 (diff) |
keep inheritance order
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java | 5 | ||||
-rw-r--r-- | config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java | 12 |
2 files changed, 9 insertions, 8 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java index e627f06ad42..a037d5046a7 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDDocumentType.java @@ -18,7 +18,6 @@ import com.yahoo.searchdefinition.Schema; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -37,8 +36,8 @@ import java.util.Set; public class SDDocumentType implements Cloneable, Serializable { public static final SDDocumentType VESPA_DOCUMENT; - private final Map<DataTypeName, SDDocumentType> inheritedTypes = new HashMap<>(); - private final Map<NewDocumentType.Name, SDDocumentType> ownedTypes = new HashMap<>(); + private final Map<DataTypeName, SDDocumentType> inheritedTypes = new LinkedHashMap<>(); + private final Map<NewDocumentType.Name, SDDocumentType> ownedTypes = new LinkedHashMap<>(); private final AnnotationTypeRegistry annotationTypes = new AnnotationTypeRegistry(); private DocumentType docType; private DataType structType; 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 3bd1e568400..9e40c4ba0c3 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 @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchdefinition.derived; +import com.yahoo.config.model.deploy.TestProperties; import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.document.DataType; import com.yahoo.document.config.DocumentmanagerConfig; @@ -64,7 +65,8 @@ public class InheritanceTestCase extends AbstractExportingTestCase { 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) { - ApplicationBuilder builder = new ApplicationBuilder(); + var builder = new ApplicationBuilder + (new TestProperties().setExperimentalSdParsing(false)); for (int fileIdx = startIdx; fileIdx < startIdx + files.size(); ++fileIdx) { String fileName = files.get(fileIdx % files.size()); builder.addSchemaFile(dir + fileName); @@ -82,11 +84,11 @@ public class InheritanceTestCase extends AbstractExportingTestCase { assertEquals(childHeader.field(3).name(), "cox"); DocumentmanagerConfig.Datatype.Documenttype child = documentType("child", dc); assertEquals(child.inherits(0).name(), "document"); - assertEquals(child.inherits(1).name(), "father"); - assertEquals(child.inherits(2).name(), "mother"); + assertEquals(child.inherits(1).name(), "mother"); + assertEquals(child.inherits(2).name(), "father"); DocumentmanagerConfig.Datatype.Documenttype mother = documentType("mother", dc); - assertEquals(mother.inherits(0).name(), "grandparent"); - assertEquals(mother.inherits(1).name(), "document"); + assertEquals(mother.inherits(0).name(), "document"); + assertEquals(mother.inherits(1).name(), "grandparent"); } } |