diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-01-26 13:26:47 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-01-26 13:26:47 +0100 |
commit | 5869796c08003f41f0ac8e4738414d136b075b1d (patch) | |
tree | 8576de9cb78f6d55e9477e07bb55f2bf51caeab2 /config-model/src/test/java/com/yahoo/searchdefinition | |
parent | 67f133794502e7499f8f8e36821a04a46622fdb9 (diff) |
Modular rank profiles
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition')
30 files changed, 94 insertions, 89 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java index 819a6f54b23..7b2ed2d7a7f 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java @@ -98,15 +98,15 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase { assertTrue(attr.isFastAccess()); } - private Schema getSearch(String sd) throws ParseException { + private Schema getSchema(String sd) throws ParseException { ApplicationBuilder builder = new ApplicationBuilder(); builder.addSchema(sd); - builder.build(); + builder.build(true); return builder.getSchema(); } private Attribute getAttributeF(String sd) throws ParseException { - Schema schema = getSearch(sd); + Schema schema = getSchema(sd); SDField field = (SDField) schema.getDocument().getField("f"); return field.getAttributes().get(field.getName()); } @@ -153,14 +153,14 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase { @Test public void requireThatMutableCanNotbeSetInDocument() throws ParseException { try { - getSearch("search test {\n" + - " document test {\n" + - " field f type int {\n" + - " indexing: attribute\n" + - " attribute: mutable\n" + - " }\n" + - " }\n" + - "}\n"); + getSchema("search test {\n" + + " document test {\n" + + " field f type int {\n" + + " indexing: attribute\n" + + " attribute: mutable\n" + + " }\n" + + " }\n" + + "}\n"); fail(); } catch (IllegalArgumentException e) { assertEquals("Field 'f' in 'test' can not be marked mutable as it is inside the document clause.", e.getMessage()); @@ -185,7 +185,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase { } private Schema getSearchWithMutables() throws ParseException { - return getSearch( + return getSchema( "search test {\n" + " document test { \n" + " field a type int { \n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java index 6d39a64cb21..ca7313a5c3f 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java @@ -42,7 +42,7 @@ public class DiversityTestCase { " }\n" + " }\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile.MatchPhaseSettings matchPhase = rankProfileRegistry.get(s, "parent").getMatchPhaseSettings(); RankProfile.DiversitySettings diversity = matchPhase.getDiversity(); @@ -63,7 +63,7 @@ public class DiversityTestCase { ApplicationBuilder builder = getSearchBuilder("field b type predicate { indexing: attribute }"); try { - builder.build(); + builder.build(true); fail("Should throw."); } catch (IllegalArgumentException e) { assertEquals(getMessagePrefix() + "must be single value numeric, or enumerated attribute, but it is 'predicate'", e.getMessage()); @@ -75,7 +75,7 @@ public class DiversityTestCase { ApplicationBuilder builder = getSearchBuilder("field b type array<int> { indexing: attribute }"); try { - builder.build(); + builder.build(true); fail("Should throw."); } catch (IllegalArgumentException e) { assertEquals(getMessagePrefix() + "must be single value numeric, or enumerated attribute, but it is 'Array<int>'", e.getMessage()); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java index 4ebbf3f18cd..c88e8149e46 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java @@ -79,7 +79,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { builder.build(true); fail(); } catch (IllegalArgumentException e) { - assertEquals("rank-profile 'p1' inherits 'notexist', but it does not exist anywhere in the inheritance of search 'test'.", e.getMessage()); + assertEquals("rank-profile 'p1' inherits 'notexist', but this is not found in schema 'test'", e.getMessage()); } } @@ -166,7 +166,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { builder.build(true); fail("Sideways inheritance should have been enforced"); } catch (IllegalArgumentException e) { - assertEquals("rank-profile 'child' inherits 'parent', but it does not exist anywhere in the inheritance of search 'child1'.", e.getMessage()); + assertEquals("rank-profile 'child' inherits 'parent', but this is not found in schema 'child1'", e.getMessage()); } } @@ -249,7 +249,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry); builder.addSchema(sd); - builder.build(); + builder.build(true); Schema schema = builder.getSchema(); AttributeFields attributeFields = new AttributeFields(schema); verifyRankProfile(rankProfileRegistry.get(schema, "parent"), attributeFields, deployProperties, termwiseLimit); @@ -291,7 +291,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { " rank-profile p1 {}", " rank-profile p2 {}", "}")); - builder.build(); + builder.build(true); Schema schema = builder.getSchema(); assertEquals(4, registry.all().size()); @@ -311,7 +311,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { " field a type tensor(x[]) { indexing: attribute }", " }", "}")); - builder.build(); + builder.build(true); } catch (IllegalArgumentException e) { assertEquals("Illegal type in field a type tensor(x[]): Dense tensor dimensions must have a size", diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java index 963c91c8c23..6de890549c1 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java @@ -48,7 +48,7 @@ public class RankPropertiesTestCase extends AbstractSchemaTestCase { " }", " }", "}")); - builder.build(); + builder.build(true); Schema schema = builder.getSchema(); AttributeFields attributeFields = new AttributeFields(schema); @@ -128,7 +128,7 @@ public class RankPropertiesTestCase extends AbstractSchemaTestCase { " }", " }", "}")); - builder.build(); + builder.build(true); Schema schema = builder.getSchema(); RankProfile a = rankProfileRegistry.get(schema, "a"); List<RankProfile.MutateOperation> operations = a.getMutateOperations(); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java index 78897bd612f..6eb74dede62 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java @@ -43,7 +43,7 @@ public class RankingConstantTest { " }", "}" )); - schemaBuilder.build(); + schemaBuilder.build(true); Schema schema = schemaBuilder.getSchema(); Iterator<RankingConstant> constantIterator = schema.rankingConstants().asMap().values().iterator(); @@ -101,7 +101,7 @@ public class RankingConstantTest { " }", "}" )); - schemaBuilder.build(); + schemaBuilder.build(true); Schema schema = schemaBuilder.getSchema(); RankingConstant constant = schema.rankingConstants().asMap().values().iterator().next(); assertEquals("simplename", constant.getFileName()); @@ -120,7 +120,7 @@ public class RankingConstantTest { " }", "}" )); - schemaBuilder.build(); + schemaBuilder.build(true); Schema schema = schemaBuilder.getSchema(); RankingConstant constant = schema.rankingConstants().asMap().values().iterator().next(); assertEquals(RankingConstant.PathType.URI, constant.getPathType()); @@ -140,7 +140,7 @@ public class RankingConstantTest { " }", "}" )); - schemaBuilder.build(); + schemaBuilder.build(true); Schema schema = schemaBuilder.getSchema(); RankingConstant constant = schema.rankingConstants().asMap().values().iterator().next(); assertEquals(RankingConstant.PathType.URI, constant.getPathType()); @@ -160,7 +160,7 @@ public class RankingConstantTest { " }", "}" )); - schemaBuilder.build(); + schemaBuilder.build(true); Schema schema = schemaBuilder.getSchema(); RankingConstant constant = schema.rankingConstants().asMap().values().iterator().next(); assertEquals(RankingConstant.PathType.URI, constant.getPathType()); @@ -180,7 +180,7 @@ public class RankingConstantTest { " }", "}" )); - schemaBuilder.build(); + schemaBuilder.build(true); Schema schema = schemaBuilder.getSchema(); RankingConstant constant = schema.rankingConstants().asMap().values().iterator().next(); assertEquals(RankingConstant.PathType.URI, constant.getPathType()); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java index 19e471bacd3..4646ff2f394 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java @@ -66,7 +66,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile parent = rankProfileRegistry.get(s, "parent").compile(queryProfileRegistry, new ImportedMlModels()); assertEquals("0.0", parent.getFirstPhaseRanking().getRoot().toString()); @@ -110,7 +110,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); try { rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels()); @@ -141,7 +141,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile profile = rankProfileRegistry.get(s, "test"); assertEquals("safeLog(popShareSlowDecaySignal,-9.21034037)", profile.getFunctions().get("POP_SLOW_SCORE").function().getBody().getRoot().toString()); @@ -169,7 +169,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile profile = rankProfileRegistry.get(s, "test"); assertEquals("safeLog(popShareSlowDecaySignal,myValue)", profile.getFunctions().get("POP_SLOW_SCORE").function().getBody().getRoot().toString()); @@ -193,7 +193,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile profile = rankProfileRegistry.get(s, "test"); assertEquals("k1 + (k2 + k3) / 1.0E8", @@ -219,7 +219,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile profile = rankProfileRegistry.get(s, "test"); assertEquals("0.5 + 50 * (attribute(rating_yelp) - 3)", diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java index ab4cd3d2275..94d25deb16a 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java @@ -65,7 +65,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile parent = rankProfileRegistry.get(s, "parent").compile(new QueryProfileRegistry(), new ImportedMlModels()); @@ -125,7 +125,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile parent = rankProfileRegistry.get(s, "parent").compile(new QueryProfileRegistry(), new ImportedMlModels()); @@ -181,7 +181,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile test = rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels()); @@ -215,7 +215,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase { " }\n" + " }\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile test = rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels()); assertEquals("foo(2)", test.getFirstPhaseRanking().getRoot().toString()); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java index 1e108a51a07..ff8a9df4076 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java @@ -36,7 +36,7 @@ public class RankingExpressionLoopDetectionTestCase { "\n" + "}\n"); try { - builder.build(); + builder.build(true); fail("Excepted exception"); } catch (IllegalArgumentException e) { @@ -71,7 +71,7 @@ public class RankingExpressionLoopDetectionTestCase { "\n" + "}\n"); try { - builder.build(); + builder.build(true); fail("Excepted exception"); } catch (IllegalArgumentException e) { @@ -106,7 +106,7 @@ public class RankingExpressionLoopDetectionTestCase { "\n" + "}\n"); try { - builder.build(); + builder.build(true); fail("Excepted exception"); } catch (IllegalArgumentException e) { @@ -140,7 +140,7 @@ public class RankingExpressionLoopDetectionTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); } @Test @@ -168,7 +168,7 @@ public class RankingExpressionLoopDetectionTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); } @Test @@ -191,7 +191,7 @@ public class RankingExpressionLoopDetectionTestCase { " }\n" + " }\n" + "}\n"); - builder.build(); + builder.build(true); } @Test @@ -214,7 +214,7 @@ public class RankingExpressionLoopDetectionTestCase { " }\n" + " }\n" + "}\n"); - builder.build(); + builder.build(true); } @Test @@ -240,7 +240,7 @@ public class RankingExpressionLoopDetectionTestCase { " }\n" + " }\n" + "}\n"); - builder.build(); + builder.build(true); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java index 76fc7118d45..8354eb59416 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java @@ -45,7 +45,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile test = rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels()); List<Pair<String, String>> testRankProperties = createRawRankProfile(test, new QueryProfileRegistry(), s).configProperties(); @@ -86,7 +86,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile test = rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels()); List<Pair<String, String>> testRankProperties = createRawRankProfile(test, new QueryProfileRegistry(), s).configProperties(); @@ -132,7 +132,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase { " }\n" + "\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile test = rankProfileRegistry.get(s, "test").compile(new QueryProfileRegistry(), new ImportedMlModels()); List<Pair<String, String>> testRankProperties = createRawRankProfile(test, new QueryProfileRegistry(), s).configProperties(); @@ -193,7 +193,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase { " file: ignored.json\n" + " }\n" + "}\n"); - builder.build(); + builder.build(true); Schema s = builder.getSchema(); RankProfile test = rankProfileRegistry.get(s, "test").compile(queryProfiles, new ImportedMlModels()); List<Pair<String, String>> testRankProperties = createRawRankProfile(test, queryProfiles, s).configProperties(); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java index 48c3e8e74b7..ee3b4ab25e0 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java @@ -45,7 +45,7 @@ public class RankingExpressionValidationTestCase extends AbstractSchemaTestCase " }" + " }" + "}"); - builder.build(); + builder.build(true); return builder.getSchema(); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java index 1d01fd8cafa..8a9300a83eb 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java @@ -38,7 +38,7 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); ApplicationBuilder sb = new ApplicationBuilder(rankProfileRegistry, new QueryProfileRegistry()); sb.addSchemaFile("src/test/examples/simple.sd"); - sb.build(); + sb.build(true); Schema schema = sb.getSchema(); assertEquals("simple", schema.getName()); assertTrue(schema.hasDocument()); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java index c5ead2b4064..f2d78796553 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java @@ -22,7 +22,7 @@ public class UrlFieldValidationTestCase { " }" + "}"); try { - builder.build(); + builder.build(true); fail("Should have caused an exception"); // success } catch (IllegalArgumentException e) { 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 7f913ef5b5f..a88ad929e80 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 @@ -115,7 +115,7 @@ public abstract class AbstractExportingTestCase extends AbstractSchemaTestCase { * This will fail if the builder contains multiple search definitions. */ protected DerivedConfiguration assertCorrectDeriving(ApplicationBuilder builder, String dirName, DeployLogger logger) throws IOException { - builder.build(); + builder.build(true); DerivedConfiguration derived = derive(dirName, null, new TestProperties(), builder, logger); assertCorrectConfigFiles(dirName); return derived; diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java index 48f0c862468..ddb627216b7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java @@ -147,7 +147,7 @@ public class ExportingTestCase extends AbstractExportingTestCase { ApplicationBuilder builder = new ApplicationBuilder(); builder.addSchemaFile(dir + "first.sd"); builder.addSchemaFile(dir + "second.sd"); - builder.build(); + builder.build(true); derive("tensor2", builder, builder.getSchema("second")); assertCorrectConfigFiles("tensor2"); } 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 13de3f95fa5..bcf68387294 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 @@ -44,7 +44,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase { ApplicationBuilder builder = new ApplicationBuilder(); builder.addSchemaFile(dir + "parent.sd"); builder.addSchemaFile(dir + "child.sd"); - builder.build(); + builder.build(true); derive("inheritstruct", builder, builder.getSchema("child")); assertCorrectConfigFiles("inheritstruct"); } @@ -69,7 +69,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase { String fileName = files.get(fileIdx % files.size()); builder.addSchemaFile(dir + fileName); } - builder.build(); + builder.build(true); DocumentmanagerConfig.Builder b = new DocumentmanagerConfig.Builder(); DerivedConfiguration.exportDocuments(new DocumentManager().produce(builder.getModel(), b), outDir.getPath()); DocumentmanagerConfig dc = b.build(); @@ -114,7 +114,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase { ApplicationBuilder builder = new ApplicationBuilder(); builder.addSchemaFile(dir + "parent.sd"); builder.addSchemaFile(dir + "child.sd"); - builder.build(); + builder.build(true); derive("inheritfromparent", builder, builder.getSchema("child")); assertCorrectConfigFiles("inheritfromparent"); } @@ -126,7 +126,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase { builder.addSchemaFile(dir + "grandparent.sd"); builder.addSchemaFile(dir + "parent.sd"); builder.addSchemaFile(dir + "child.sd"); - builder.build(); + builder.build(true); derive("inheritfromgrandparent", builder, builder.getSchema("child")); assertCorrectConfigFiles("inheritfromgrandparent"); } @@ -139,7 +139,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase { builder.addSchemaFile(dir + "father.sd"); builder.addSchemaFile(dir + "mother.sd"); builder.addSchemaFile(dir + "child.sd"); - builder.build(); + builder.build(true); derive("inheritance", builder, builder.getSchema("child")); assertCorrectConfigFiles("inheritance"); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java index 8a4e403072b..d89e5f2c957 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java @@ -22,7 +22,7 @@ public class SimpleInheritTestCase extends AbstractExportingTestCase { ApplicationBuilder builder = new ApplicationBuilder(); builder.addSchemaFile(expectedResultsDirName + "parent.sd"); builder.addSchemaFile(expectedResultsDirName + "child.sd"); - builder.build(); + builder.build(true); Schema schema = builder.getSchema("child"); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/StructInheritanceTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/StructInheritanceTestCase.java index c684ec17e42..1f6c70c9383 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/StructInheritanceTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/StructInheritanceTestCase.java @@ -45,7 +45,7 @@ public class StructInheritanceTestCase extends AbstractExportingTestCase { String dir = "src/test/derived/structinheritance/"; ApplicationBuilder builder = new ApplicationBuilder(); builder.addSchemaFile(dir + "bad.sd"); - builder.build(); + builder.build(true); derive("structinheritance", builder, builder.getSchema("bad")); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryMapTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryMapTestCase.java index fa8a31befc4..c0fa3e8311f 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryMapTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryMapTestCase.java @@ -196,7 +196,7 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase { field, " }", "}")); - builder.build(); + builder.build(true); return builder.getSchema(); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java index b18b2120212..9a36ef90cd7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java @@ -149,7 +149,7 @@ public class SummaryTestCase extends AbstractSchemaTestCase { " summary other_campaign_ref type reference<campaign> {}", " }", "}")); - builder.build(); + builder.build(true); return builder.getSchema("ad"); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java index 53948e2d5c8..4e629fcb4d8 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java @@ -13,6 +13,7 @@ import java.io.IOException; * @author arnej27959 */ public class TwoStreamingStructsTestCase extends AbstractExportingTestCase { + @Test public void testTwoStreamingStructsExporting() throws ParseException, IOException { @@ -20,13 +21,14 @@ public class TwoStreamingStructsTestCase extends AbstractExportingTestCase { ApplicationBuilder builder = new ApplicationBuilder(); builder.addSchemaFile(root + "/streamingstruct.sd"); builder.addSchemaFile(root + "/whatever.sd"); - builder.build(); + builder.build(true); assertCorrectDeriving(builder, builder.getSchema("streamingstruct"), root); builder = new ApplicationBuilder(); builder.addSchemaFile(root + "/streamingstruct.sd"); builder.addSchemaFile(root + "/whatever.sd"); - builder.build(); + builder.build(true); assertCorrectDeriving(builder, builder.getSchema("streamingstruct"), root); } + } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java index 3bdda1ea0d8..b03aff455c5 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java @@ -51,7 +51,7 @@ public class DisallowComplexMapAndWsetKeyTypesTestCase { " field a type " + fieldType + " {}\n" + " }\n" + "}\n"); - builder.build(); + builder.build(true); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java index 6e01909ea44..0c25cef49a1 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java @@ -55,7 +55,7 @@ public class FastAccessValidatorTest { "For schema 'test': The following attributes have a type that is incompatible " + "with fast-access: predicate_attribute, tensor_attribute, reference_attribute. " + "Predicate, tensor and reference attributes are incompatible with fast-access."); - builder.build(); + builder.build(true); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java index cfc1779ded0..b0b9ce81cc7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java @@ -84,7 +84,7 @@ public class ImplicitSchemaFieldsTestCase extends AbstractSchemaTestCase { public void testRequireThatDerivedConfigurationWorks() throws IOException, ParseException { ApplicationBuilder sb = new ApplicationBuilder(); sb.addSchemaFile("src/test/examples/nextgen/simple.sd"); - sb.build(); + sb.build(true); assertNotNull(sb.getSchema()); new DerivedConfiguration(sb.getSchema(), sb.getRankProfileRegistry()); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java index e87ecd3294f..b15b81b717d 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java @@ -82,7 +82,7 @@ public class ImportedFieldsTestCase { " }", "}")); builder.addSchema(sdContent); - builder.build(); + builder.build(true); return builder.getSchema("ad"); } @@ -315,7 +315,7 @@ public class ImportedFieldsTestCase { ApplicationBuilder builder = new ApplicationBuilder(); builder.addSchema(parentSdContent); builder.addSchema(sdContent); - builder.build(); + builder.build(true); return builder.getSchema("child"); } @@ -324,7 +324,7 @@ public class ImportedFieldsTestCase { builder.addSchema(grandParentSdContent); builder.addSchema(parentSdContent); builder.addSchema(sdContent); - builder.build(); + builder.build(true); return builder.getSchema("child"); } @@ -522,7 +522,7 @@ public class ImportedFieldsTestCase { "import field ref_parent_b.entries as entries_from_b {}", "}")); - builder.build(); + builder.build(true); return builder; } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java index ea5102baf17..b48927d58a3 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java @@ -186,7 +186,7 @@ public class MatchedElementsOnlyResolverTestCase { " }", summary, "}")); - builder.build(); + builder.build(true); return builder.getSchema(); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java index dbf339dee4b..2d0bdb58122 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java @@ -78,7 +78,7 @@ class RankProfileSearchFixture { "\n" + "}"; builder.addSchema(sdContent); - builder.build(); + builder.build(true); schema = builder.getSchema(); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java index ec8d9bc4261..7f5e8f8753a 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java @@ -48,7 +48,7 @@ public class RankingExpressionTypeResolverTestCase { " }", "}" )); - builder.build(); + builder.build(true); fail("Expected exception"); } catch (IllegalArgumentException expected) { @@ -96,7 +96,7 @@ public class RankingExpressionTypeResolverTestCase { " }", "}" )); - builder.build(); + builder.build(true); fail("Expected exception"); } catch (IllegalArgumentException expected) { @@ -128,7 +128,7 @@ public class RankingExpressionTypeResolverTestCase { " }", "}" )); - builder.build(); + builder.build(true); fail("Expected exception"); } catch (IllegalArgumentException expected) { @@ -158,7 +158,7 @@ public class RankingExpressionTypeResolverTestCase { " }", "}" )); - schemaBuilder.build(); + schemaBuilder.build(true); fail("Expected exception"); } catch (IllegalArgumentException expected) { @@ -194,7 +194,7 @@ public class RankingExpressionTypeResolverTestCase { " }", "}" )); - builder.build(); + builder.build(true); RankProfile profile = builder.getRankProfileRegistry().get(builder.getSchema(), "my_rank_profile"); assertEquals(TensorType.fromSpec("tensor(x[10],y[3])"), @@ -236,7 +236,7 @@ public class RankingExpressionTypeResolverTestCase { " }", "}" )); - builder.build(); + builder.build(true); RankProfile profile = builder.getRankProfileRegistry().get(builder.getSchema(), "my_rank_profile"); assertEquals(TensorType.fromSpec("tensor(x[10],y[1])"), @@ -280,7 +280,7 @@ public class RankingExpressionTypeResolverTestCase { " first-phase { expression: commonfirstphase(eustaticrank) }", " }", "}")); - builder.build(); + builder.build(true); RankProfile profile = builder.getRankProfileRegistry().get(builder.getSchema(), "eurank"); } @@ -320,7 +320,7 @@ public class RankingExpressionTypeResolverTestCase { " }", "}" )); - builder.build(); + builder.build(true); RankProfile profile = builder.getRankProfileRegistry().get(builder.getSchema(), "my_rank_profile"); assertEquals(TensorType.fromSpec("tensor(x[10],y[1])"), @@ -345,7 +345,7 @@ public class RankingExpressionTypeResolverTestCase { " summary-features { test_func_via_func_with_expr }", " }", "}")); - builder.build(); + builder.build(true); RankProfile profile = builder.getRankProfileRegistry().get(builder.getSchema(), "test"); assertEquals(TensorType.fromSpec("tensor<float>(y{})"), summaryFeatures(profile).get("test_func_via_func_with_expr").type(profile.typeContext(builder.getQueryProfileRegistry()))); @@ -378,7 +378,7 @@ public class RankingExpressionTypeResolverTestCase { " }", "}" )); - builder.build(); + builder.build(true); } @Test diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java index 09aa09a626b..2a9d64767ba 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java @@ -399,8 +399,10 @@ public class RankingExpressionWithOnnxTestCase { @Override public List<NamedReader> getFiles(Path path, String suffix) { + File[] files = getFileReference(path).listFiles(); + if (files == null) return List.of(); List<NamedReader> readers = new ArrayList<>(); - for (File file : getFileReference(path).listFiles()) { + for (File file : files) { if ( ! file.getName().endsWith(suffix)) continue; try { readers.add(new NamedReader(file.getName(), new FileReader(file))); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java index 1cdc0aef1cc..ffc073ed434 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java @@ -89,7 +89,7 @@ public class RankingExpressionWithTransformerTokensTestCase { "}"; ApplicationBuilder schemaBuilder = new ApplicationBuilder(application, new MockFileRegistry(), new BaseDeployLogger(), new TestProperties(), rankProfileRegistry, queryProfileRegistry); schemaBuilder.addSchema(sdContent); - schemaBuilder.build(); + schemaBuilder.build(true); Schema schema = schemaBuilder.getSchema(); RankProfile rp = rankProfileRegistry.get(schema, "my_profile"); return new RankProfileTransformContext(rp, queryProfileRegistry, Collections.emptyMap(), null, Collections.emptyMap(), Collections.emptyMap()); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReferenceFieldTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReferenceFieldTestCase.java index a2da13b3749..d60cb9040d8 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReferenceFieldTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReferenceFieldTestCase.java @@ -49,7 +49,7 @@ public class ReferenceFieldTestCase { builder.addSchema(campaignSdContent); builder.addSchema(salespersonSdContent); builder.addSchema(adSdContent); - builder.build(); + builder.build(true); Schema schema = builder.getSchema("ad"); assertSearchContainsReferenceField("campaign_ref", "campaign", schema.getDocument()); assertSearchContainsReferenceField("salesperson_ref", "salesperson", schema.getDocument()); @@ -74,7 +74,7 @@ public class ReferenceFieldTestCase { builder.addSchema(adSdContent); exceptionRule.expect(DocumentGraphValidator.DocumentGraphException.class); exceptionRule.expectMessage("Document dependency cycle detected: campaign->ad->campaign."); - builder.build(); + builder.build(true); } private static void assertSearchContainsReferenceField(String expectedFieldname, @@ -87,4 +87,5 @@ public class ReferenceFieldTestCase { ReferenceDataType refField = (ReferenceDataType) dataType; assertEquals(referencedDocType, refField.getTargetType().getName()); } + } |