diff options
Diffstat (limited to 'config-model/src/test')
51 files changed, 261 insertions, 251 deletions
diff --git a/config-model/src/test/java/com/yahoo/document/test/SDDocumentTypeTestCase.java b/config-model/src/test/java/com/yahoo/document/test/SDDocumentTypeTestCase.java index f1bebdb0a29..c3b4f97dc6e 100644 --- a/config-model/src/test/java/com/yahoo/document/test/SDDocumentTypeTestCase.java +++ b/config-model/src/test/java/com/yahoo/document/test/SDDocumentTypeTestCase.java @@ -9,8 +9,6 @@ import com.yahoo.searchdefinition.SchemaBuilder; import com.yahoo.searchdefinition.document.SDDocumentType; import com.yahoo.searchdefinition.document.SDField; import com.yahoo.searchdefinition.parser.ParseException; -import com.yahoo.searchdefinition.processing.ImportedFieldsResolver; -import com.yahoo.searchdefinition.processing.OnnxModelTypeResolver; import com.yahoo.vespa.model.test.utils.DeployLoggerStub; import org.junit.Test; @@ -123,7 +121,7 @@ public class SDDocumentTypeTestCase extends AbstractSchemaTestCase { "}"); SchemaBuilder builder = new SchemaBuilder(new DeployLoggerStub()); - builder.importString(schemaLines); + builder.addSchema(schemaLines); builder.build(true); var application = builder.application(); 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 e4de0aef622..a0dc1a87c9f 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java @@ -100,7 +100,7 @@ public class AttributeSettingsTestCase extends AbstractSchemaTestCase { private Schema getSearch(String sd) throws ParseException { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(sd); + builder.addSchema(sd); builder.build(); return builder.getSchema(); } 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 7c5c5c6fccc..33d5f7c2c6d 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java @@ -16,7 +16,7 @@ public class DiversityTestCase { public void testDiversity() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type int { \n" + @@ -84,7 +84,7 @@ public class DiversityTestCase { private SchemaBuilder getSearchBuilder(String diversity) throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type int { \n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/DocumentGraphValidatorTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/DocumentGraphValidatorTest.java index fb552f5cfb0..81a44261daf 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/DocumentGraphValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/DocumentGraphValidatorTest.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; +import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.document.ReferenceDataType; import com.yahoo.document.TemporaryStructuredDataType; import com.yahoo.searchdefinition.document.SDDocumentType; @@ -143,7 +144,7 @@ public class DocumentGraphValidatorTest { } private static Schema createSearchWithName(String name, Schema... parents) { - Schema campaignSchema = new Schema(name); + Schema campaignSchema = new Schema(name, MockApplicationPackage.createEmpty()); SDDocumentType document = new SDDocumentType(name); campaignSchema.addDocument(document); document.setDocumentReferences(new DocumentReferences(Collections.emptyMap())); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.java index cc45a2aaec0..66f1850bd10 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.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; +import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.document.DataType; import com.yahoo.document.ReferenceDataType; import com.yahoo.document.TemporaryStructuredDataType; @@ -32,7 +33,7 @@ public class DocumentReferenceResolverTest { @Test public void reference_from_one_document_to_another_is_resolved() { // Create bar document with no fields - Schema barSchema = new Schema(BAR); + Schema barSchema = new Schema(BAR, MockApplicationPackage.createEmpty()); SDDocumentType barDocument = new SDDocumentType(BAR, barSchema); barSchema.addDocument(barDocument); @@ -41,7 +42,7 @@ public class DocumentReferenceResolverTest { ("bar_ref", ReferenceDataType.createWithInferredId(barDocument.getDocumentType())); AttributeUtils.addAttributeAspect(fooRefToBarField); SDField irrelevantField = new SDField("irrelevant_stuff", DataType.INT); - Schema fooSchema = new Schema(FOO); + Schema fooSchema = new Schema(FOO, MockApplicationPackage.createEmpty()); SDDocumentType fooDocument = new SDDocumentType("foo", fooSchema); fooDocument.addField(fooRefToBarField); fooDocument.addField(irrelevantField); @@ -64,7 +65,7 @@ public class DocumentReferenceResolverTest { SDField fooRefToBarField = new SDField( "bar_ref", ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create("bar"))); AttributeUtils.addAttributeAspect(fooRefToBarField); - Schema fooSchema = new Schema(FOO); + Schema fooSchema = new Schema(FOO, MockApplicationPackage.createEmpty()); SDDocumentType fooDocument = new SDDocumentType("foo", fooSchema); fooDocument.addField(fooRefToBarField); fooSchema.addDocument(fooDocument); @@ -80,14 +81,14 @@ public class DocumentReferenceResolverTest { @Test public void throws_exception_if_reference_is_not_an_attribute() { // Create bar document with no fields - Schema barSchema = new Schema(BAR); + Schema barSchema = new Schema(BAR, MockApplicationPackage.createEmpty()); SDDocumentType barDocument = new SDDocumentType("bar", barSchema); barSchema.addDocument(barDocument); // Create foo document with document reference to bar SDField fooRefToBarField = new SDField ("bar_ref", ReferenceDataType.createWithInferredId(barDocument.getDocumentType())); - Schema fooSchema = new Schema(FOO); + Schema fooSchema = new Schema(FOO, MockApplicationPackage.createEmpty()); SDDocumentType fooDocument = new SDDocumentType("foo", fooSchema); fooDocument.addField(fooRefToBarField); fooSchema.addDocument(fooDocument); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/ImportedFieldsEnumeratorTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/ImportedFieldsEnumeratorTest.java index 4057fc469bc..7d2386030da 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/ImportedFieldsEnumeratorTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/ImportedFieldsEnumeratorTest.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; +import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.document.DataType; import com.yahoo.document.ReferenceDataType; import com.yahoo.searchdefinition.document.SDDocumentType; @@ -19,7 +20,7 @@ public class ImportedFieldsEnumeratorTest { @Test public void imported_fields_are_enumerated_and_copied_from_correct_search_instance() { String PARENT = "parent"; - Schema parentSchema = new Schema(PARENT); + Schema parentSchema = new Schema(PARENT, MockApplicationPackage.createEmpty()); SDDocumentType parentDocument = new SDDocumentType(PARENT, parentSchema); var parentField = new SDField("their_field", DataType.INT); AttributeUtils.addAttributeAspect(parentField); @@ -27,7 +28,7 @@ public class ImportedFieldsEnumeratorTest { parentSchema.addDocument(parentDocument); String FOO = "foo"; - Schema fooSchema = new Schema(FOO); + Schema fooSchema = new Schema(FOO, MockApplicationPackage.createEmpty()); SDField fooRefToParent = new SDField( "foo_ref", ReferenceDataType.createWithInferredId(parentDocument.getDocumentType())); AttributeUtils.addAttributeAspect(fooRefToParent); @@ -38,7 +39,7 @@ public class ImportedFieldsEnumeratorTest { fooSchema.addDocument(fooDocument); String BAR = "bar"; - Schema barSchema = new Schema(BAR); + Schema barSchema = new Schema(BAR, MockApplicationPackage.createEmpty()); SDField barRefToParent = new SDField( "bar_ref", ReferenceDataType.createWithInferredId(parentDocument.getDocumentType())); AttributeUtils.addAttributeAspect(barRefToParent); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileRegistryTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileRegistryTest.java index d2486395340..d07f4513c3c 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileRegistryTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileRegistryTest.java @@ -2,6 +2,7 @@ package com.yahoo.searchdefinition; import com.yahoo.config.model.application.provider.FilesApplicationPackage; +import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.config.model.test.TestDriver; import com.yahoo.config.model.test.TestRoot; import com.yahoo.searchlib.rankingexpression.ExpressionFunction; @@ -33,7 +34,7 @@ public class RankProfileRegistryTest { @Test(expected = IllegalArgumentException.class) public void testRankProfileDuplicateNameIsIllegal() { - Schema schema = new Schema("foo"); + Schema schema = new Schema("foo", MockApplicationPackage.createEmpty()); RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); RankProfile barRankProfile = new RankProfile("bar", schema, rankProfileRegistry, schema.rankingConstants()); rankProfileRegistry.add(barRankProfile); @@ -42,7 +43,7 @@ public class RankProfileRegistryTest { @Test public void testRankProfileDuplicateNameLegalForOverridableRankProfiles() { - Schema schema = new Schema("foo"); + Schema schema = new Schema("foo", MockApplicationPackage.createEmpty()); RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); for (String rankProfileName : RankProfileRegistry.overridableRankProfileNames) { 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 3fa129eae39..3785ada8f63 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java @@ -6,6 +6,7 @@ import com.yahoo.component.ComponentId; import com.yahoo.config.model.api.ModelContext; import com.yahoo.config.model.application.provider.MockFileRegistry; import com.yahoo.config.model.deploy.TestProperties; +import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.document.DataType; import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.search.query.profile.types.FieldDescription; @@ -43,7 +44,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { @Test public void testRankProfileInheritance() { - Schema schema = new Schema("test"); + Schema schema = new Schema("test", MockApplicationPackage.createEmpty()); RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); SDDocumentType document = new SDDocumentType("test"); SDField a = document.addField("a", DataType.STRING); @@ -70,7 +71,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { try { RankProfileRegistry registry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(registry, setupQueryProfileTypes()); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { } ", " rank-profile p1 inherits notexist {}", @@ -87,7 +88,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { try { RankProfileRegistry registry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(registry, setupQueryProfileTypes()); - builder.importString(joinLines( + builder.addSchema(joinLines( "schema test {", " document test { } ", " rank-profile self inherits self {}", @@ -103,12 +104,12 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { public void requireThatSelfInheritanceIsLegalWhenOverloading() throws ParseException { RankProfileRegistry registry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(registry, setupQueryProfileTypes()); - builder.importString(joinLines( + builder.addSchema(joinLines( "schema base {", " document base { } ", " rank-profile self inherits default {}", "}")); - builder.importString(joinLines( + builder.addSchema(joinLines( "schema test {", " document test inherits base { } ", " rank-profile self inherits self {}", @@ -120,7 +121,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { public void requireThatSidewaysInheritanceIsImpossible() throws ParseException { RankProfileRegistry registry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(registry, setupQueryProfileTypes()); - builder.importString(joinLines( + builder.addSchema(joinLines( "schema child1 {", " document child1 {", " field field1 type int {", @@ -141,7 +142,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { " }", " }", "}\n")); - builder.importString(joinLines( + builder.addSchema(joinLines( "schema child2 {", " document child2 {", " field field1 type int {", @@ -173,7 +174,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { public void requireThatDefaultCanAlwaysBeInherited() throws ParseException { RankProfileRegistry registry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(registry, setupQueryProfileTypes()); - builder.importString(joinLines( + builder.addSchema(joinLines( "schema test {", " document test { } ", " rank-profile default inherits default {}", @@ -186,7 +187,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { try { RankProfileRegistry registry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(registry, setupQueryProfileTypes()); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { } ", " rank-profile a inherits b {}", @@ -205,7 +206,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { { RankProfileRegistry registry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(registry, setupQueryProfileTypes()); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { } ", " rank-profile p1 inherits not_yet_defined {}", @@ -247,7 +248,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { private void verifyTermwiseLimitAndSomeMoreIncludingInheritance(ModelContext.Properties deployProperties, String sd, Double termwiseLimit) throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString(sd); + builder.addSchema(sd); builder.build(); Schema schema = builder.getSchema(); AttributeFields attributeFields = new AttributeFields(schema); @@ -280,7 +281,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { public void requireThatConfigIsDerivedForAttributeTypeSettings() throws ParseException { RankProfileRegistry registry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(registry); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { ", " field a type tensor(x[10]) { indexing: attribute }", @@ -304,7 +305,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { public void requireThatDenseDimensionsMustBeBound() throws ParseException { try { SchemaBuilder builder = new SchemaBuilder(new RankProfileRegistry()); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { ", " field a type tensor(x[]) { indexing: attribute }", @@ -333,7 +334,7 @@ public class RankProfileTestCase extends AbstractSchemaTestCase { public void requireThatConfigIsDerivedForQueryFeatureTypeSettings() throws ParseException { RankProfileRegistry registry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(registry, setupQueryProfileTypes()); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { } ", " rank-profile p1 {}", 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 d6065e74af5..0f2fa2646ef 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java @@ -24,7 +24,7 @@ public class RankPropertiesTestCase extends AbstractSchemaTestCase { public void testRankPropertyInheritance() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test {", " field a type string { ", @@ -81,7 +81,7 @@ public class RankPropertiesTestCase extends AbstractSchemaTestCase { public void testRankProfileMutate() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test {", " field a type int { ", 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 1925b7e77b9..1d9d63c356d 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java @@ -29,7 +29,7 @@ public class RankingConstantTest { final String TENSOR_TYPE = "tensor(x{})"; RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder schemaBuilder = new SchemaBuilder(rankProfileRegistry); - schemaBuilder.importString(joinLines( + schemaBuilder.addSchema(joinLines( "search test {", " document test { }", " rank-profile my_rank_profile {", @@ -62,7 +62,7 @@ public class RankingConstantTest { SchemaBuilder schemaBuilder = new SchemaBuilder(rankProfileRegistry); thrown.expect(IllegalArgumentException.class); thrown.expectMessage("must have a type"); - schemaBuilder.importString(joinLines( + schemaBuilder.addSchema(joinLines( "search test {", " document test { }", " constant foo {", @@ -78,7 +78,7 @@ public class RankingConstantTest { SchemaBuilder schemaBuilder = new SchemaBuilder(rankProfileRegistry); thrown.expect(IllegalArgumentException.class); thrown.expectMessage("must have a file"); - schemaBuilder.importString(joinLines( + schemaBuilder.addSchema(joinLines( "search test {", " document test { }", " constant foo {", @@ -92,7 +92,7 @@ public class RankingConstantTest { public void constant_file_does_not_need_path_or_ending() throws Exception { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder schemaBuilder = new SchemaBuilder(rankProfileRegistry); - schemaBuilder.importString(joinLines( + schemaBuilder.addSchema(joinLines( "search test {", " document test { }", " constant foo {", @@ -111,7 +111,7 @@ public class RankingConstantTest { public void constant_uri_is_allowed() throws Exception { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder schemaBuilder = new SchemaBuilder(rankProfileRegistry); - schemaBuilder.importString(joinLines( + schemaBuilder.addSchema(joinLines( "search test {", " document test { }", " constant foo {", @@ -131,7 +131,7 @@ public class RankingConstantTest { public void constant_https_uri_is_allowed() throws Exception { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder schemaBuilder = new SchemaBuilder(rankProfileRegistry); - schemaBuilder.importString(joinLines( + schemaBuilder.addSchema(joinLines( "search test {", " document test { }", " constant foo {", @@ -151,7 +151,7 @@ public class RankingConstantTest { public void constant_uri_with_port_is_allowed() throws Exception { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder schemaBuilder = new SchemaBuilder(rankProfileRegistry); - schemaBuilder.importString(joinLines( + schemaBuilder.addSchema(joinLines( "search test {", " document test { }", " constant foo {", @@ -171,7 +171,7 @@ public class RankingConstantTest { public void constant_uri_no_dual_slashes_is_allowed() throws Exception { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder schemaBuilder = new SchemaBuilder(rankProfileRegistry); - schemaBuilder.importString(joinLines( + schemaBuilder.addSchema(joinLines( "search test {", " document test { }", " constant foo {", @@ -195,7 +195,7 @@ public class RankingConstantTest { "Was expecting:\n\n" + "<URI_PATH> ..."; try { - schemaBuilder.importString(joinLines( + schemaBuilder.addSchema(joinLines( "search test {", " document test { }", " constant foo {", 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 87b406c39fa..58985236c28 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java @@ -26,7 +26,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); QueryProfileRegistry queryProfileRegistry = new QueryProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -92,7 +92,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { public void testNameCollision() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -126,7 +126,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { public void testNegativeLiteralArgument() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -151,7 +151,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { public void testNegativeConstantArgument() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -181,7 +181,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { public void testConstantDivisorInFunction() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " }\n" + @@ -204,7 +204,7 @@ public class RankingExpressionConstantsTestCase extends AbstractSchemaTestCase { public void test3() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field rating_yelp type int {" + 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 0598fee538a..37f1f116ad7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java @@ -29,7 +29,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase { public void testFunctionInliningPreserveArithmeticOrdering() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type double { \n" + @@ -80,7 +80,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase { public void testConstants() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -151,7 +151,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase { public void testNonTopLevelInlining() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type double { \n" + @@ -200,7 +200,7 @@ public class RankingExpressionInliningTestCase extends AbstractSchemaTestCase { new TestProperties(), rankProfileRegistry, new QueryProfileRegistry()); - builder.importString( + builder.addSchema( "search test {\n" + " document test { }\n" + " rank-profile test {\n" + 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 689b75690ae..a56d3272d6c 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java @@ -17,7 +17,7 @@ public class RankingExpressionLoopDetectionTestCase { public void testSelfLoop() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -49,7 +49,7 @@ public class RankingExpressionLoopDetectionTestCase { public void testNestedLoop() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -84,7 +84,7 @@ public class RankingExpressionLoopDetectionTestCase { public void testSelfArgumentLoop() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -119,7 +119,7 @@ public class RankingExpressionLoopDetectionTestCase { public void testNoLoopWithSameLocalArgument() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -147,7 +147,7 @@ public class RankingExpressionLoopDetectionTestCase { public void testNoLoopWithMultipleInvocations() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -175,7 +175,7 @@ public class RankingExpressionLoopDetectionTestCase { public void testNoLoopWithBoundIdentifiers() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " }\n" + @@ -198,7 +198,7 @@ public class RankingExpressionLoopDetectionTestCase { public void testNoLoopWithTheSameNestedIdentifierWhichIsUnbound() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " }\n" + @@ -221,7 +221,7 @@ public class RankingExpressionLoopDetectionTestCase { public void testNoLoopWithTheSameAlternatingNestedIdentifierWhichIsUnbound() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " }\n" + 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 ff146fedd88..c7e233677bd 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java @@ -27,7 +27,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase { public void testBasicFunctionShadowing() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -62,7 +62,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase { public void testMultiLevelFunctionShadowing() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -114,7 +114,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase { public void testFunctionShadowingArguments() throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + @@ -154,7 +154,7 @@ public class RankingExpressionShadowingTestCase extends AbstractSchemaTestCase { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); QueryProfileRegistry queryProfiles = queryProfileWith("query(q)", "tensor(input[1])"); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry, queryProfiles); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + 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 299724ea39e..b1bc698763f 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java @@ -33,18 +33,18 @@ public class RankingExpressionValidationTestCase extends AbstractSchemaTestCase private Schema importWithExpression(String expression, RankProfileRegistry registry) throws ParseException { SchemaBuilder builder = new SchemaBuilder(registry); - builder.importString("search test {" + - " document test { " + - " field a type string { " + - " indexing: index " + - " }" + - " }" + - " rank-profile default {" + - " first-phase {" + - " expression: " + expression + - " }" + - " }" + - "}"); + builder.addSchema("search test {" + + " document test { " + + " field a type string { " + + " indexing: index " + + " }" + + " }" + + " rank-profile default {" + + " first-phase {" + + " expression: " + expression + + " }" + + " }" + + "}"); builder.build(); 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 c2816336076..3640750e544 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java @@ -37,7 +37,7 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase { public void testSimpleImporting() throws IOException, ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder sb = new SchemaBuilder(rankProfileRegistry, new QueryProfileRegistry()); - sb.importFile("src/test/examples/simple.sd"); + sb.addSchemaFile("src/test/examples/simple.sd"); sb.build(); Schema schema = sb.getSchema(); assertEquals("simple", schema.getName()); 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 d906685d502..d8c23d6ca04 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java @@ -169,9 +169,9 @@ public class SchemaTestCase { SchemaBuilder builder = new SchemaBuilder(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(child1Lines); - builder.importString(child2Lines); + builder.addSchema(parentLines); + builder.addSchema(child1Lines); + builder.addSchema(child2Lines); builder.build(true); var application = builder.application(); @@ -310,9 +310,9 @@ public class SchemaTestCase { SchemaBuilder builder = new SchemaBuilder(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.addSchema(parentLines); + builder.addSchema(childLines); + builder.addSchema(grandchildLines); builder.build(true); var application = builder.application(); 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 9fdeb9ece1d..962f572d35a 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java @@ -16,11 +16,11 @@ public class UrlFieldValidationTestCase { @Test public void requireThatInheritedRiseFieldsStillCanBeInConflictButDontThrowException() throws ParseException { SchemaBuilder builder = new SchemaBuilder(); - builder.importString("search test {" + - " document test { " + - " field a type uri { indexing: attribute | summary }" + - " }" + - "}"); + builder.addSchema("search test {" + + " document test { " + + " field a type uri { indexing: attribute | summary }" + + " }" + + "}"); try { builder.build(); fail("Should have caused an exception"); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/EmptyRankProfileTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/EmptyRankProfileTestCase.java index 604082fb52e..8d2c99140ac 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/EmptyRankProfileTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/EmptyRankProfileTestCase.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.test.MockApplicationPackage; import com.yahoo.document.DataType; import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.searchdefinition.RankProfileRegistry; @@ -20,7 +21,7 @@ public class EmptyRankProfileTestCase extends AbstractSchemaTestCase { @Test public void testDeriving() { - Schema schema = new Schema("test"); + Schema schema = new Schema("test", MockApplicationPackage.createEmpty()); RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); SDDocumentType doc = new SDDocumentType("test"); schema.addDocument(doc); 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 403b953cdb5..9eac73e5c53 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 @@ -1,7 +1,6 @@ // 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.searchdefinition.SchemaBuilder; import com.yahoo.searchdefinition.parser.ParseException; import org.junit.Test; @@ -146,8 +145,8 @@ public class ExportingTestCase extends AbstractExportingTestCase { public void testTensor2() throws IOException, ParseException { String dir = "src/test/derived/tensor2/"; SchemaBuilder builder = new SchemaBuilder(); - builder.importFile(dir + "first.sd"); - builder.importFile(dir + "second.sd"); + builder.addSchemaFile(dir + "first.sd"); + builder.addSchemaFile(dir + "second.sd"); builder.build(); derive("tensor2", builder, builder.getSchema("second")); assertCorrectConfigFiles("tensor2"); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/IdTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/IdTestCase.java index b262ef92e1a..440f067dd00 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/IdTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/IdTestCase.java @@ -2,6 +2,7 @@ package com.yahoo.searchdefinition.derived; import com.yahoo.config.model.application.provider.BaseDeployLogger; +import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.document.DataType; import com.yahoo.searchdefinition.RankProfileRegistry; import com.yahoo.searchdefinition.Schema; @@ -25,7 +26,7 @@ public class IdTestCase extends AbstractExportingTestCase { @Test public void testExplicitUpperCaseIdField() { - Schema schema = new Schema("test"); + Schema schema = new Schema("test", MockApplicationPackage.createEmpty()); SDDocumentType document = new SDDocumentType("test"); schema.addDocument(document); SDField uri = new SDField("URI", DataType.URI); 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 f9bd28037eb..259996135a2 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.test.MockApplicationPackage; import com.yahoo.document.DataType; import com.yahoo.document.config.DocumentmanagerConfig; import com.yahoo.searchdefinition.Index; @@ -41,8 +42,8 @@ public class InheritanceTestCase extends AbstractExportingTestCase { public void requireThatIndexedStructFieldCanBeInherited() throws IOException, ParseException { String dir = "src/test/derived/inheritstruct/"; SchemaBuilder builder = new SchemaBuilder(); - builder.importFile(dir + "parent.sd"); - builder.importFile(dir + "child.sd"); + builder.addSchemaFile(dir + "parent.sd"); + builder.addSchemaFile(dir + "child.sd"); builder.build(); derive("inheritstruct", builder, builder.getSchema("child")); assertCorrectConfigFiles("inheritstruct"); @@ -66,7 +67,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase { SchemaBuilder builder = new SchemaBuilder(); for (int fileIdx = startIdx; fileIdx < startIdx + files.size(); ++fileIdx) { String fileName = files.get(fileIdx % files.size()); - builder.importFile(dir + fileName); + builder.addSchemaFile(dir + fileName); } builder.build(); DocumentmanagerConfig.Builder b = new DocumentmanagerConfig.Builder(); @@ -111,8 +112,8 @@ public class InheritanceTestCase extends AbstractExportingTestCase { public void requireThatStructTypesAreInheritedFromParent() throws IOException, ParseException { String dir = "src/test/derived/inheritfromparent/"; SchemaBuilder builder = new SchemaBuilder(); - builder.importFile(dir + "parent.sd"); - builder.importFile(dir + "child.sd"); + builder.addSchemaFile(dir + "parent.sd"); + builder.addSchemaFile(dir + "child.sd"); builder.build(); derive("inheritfromparent", builder, builder.getSchema("child")); assertCorrectConfigFiles("inheritfromparent"); @@ -122,9 +123,9 @@ public class InheritanceTestCase extends AbstractExportingTestCase { public void requireThatStructTypesAreInheritedFromGrandParent() throws IOException, ParseException { String dir = "src/test/derived/inheritfromgrandparent/"; SchemaBuilder builder = new SchemaBuilder(); - builder.importFile(dir + "grandparent.sd"); - builder.importFile(dir + "parent.sd"); - builder.importFile(dir + "child.sd"); + builder.addSchemaFile(dir + "grandparent.sd"); + builder.addSchemaFile(dir + "parent.sd"); + builder.addSchemaFile(dir + "child.sd"); builder.build(); derive("inheritfromgrandparent", builder, builder.getSchema("child")); assertCorrectConfigFiles("inheritfromgrandparent"); @@ -134,10 +135,10 @@ public class InheritanceTestCase extends AbstractExportingTestCase { public void testInheritance() throws IOException, ParseException { String dir = "src/test/derived/inheritance/"; SchemaBuilder builder = new SchemaBuilder(); - builder.importFile(dir + "grandparent.sd"); - builder.importFile(dir + "father.sd"); - builder.importFile(dir + "mother.sd"); - builder.importFile(dir + "child.sd"); + builder.addSchemaFile(dir + "grandparent.sd"); + builder.addSchemaFile(dir + "father.sd"); + builder.addSchemaFile(dir + "mother.sd"); + builder.addSchemaFile(dir + "child.sd"); builder.build(); derive("inheritance", builder, builder.getSchema("child")); assertCorrectConfigFiles("inheritance"); @@ -146,7 +147,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase { @Test public void testIndexSettingInheritance() { SDDocumentType parent = new SDDocumentType("parent"); - Schema parentSchema = new Schema("parent"); + Schema parentSchema = new Schema("parent", MockApplicationPackage.createEmpty()); parentSchema.addDocument(parent); SDField prefixed = parent.addField("prefixed", DataType.STRING); prefixed.parseIndexingScript("{ index }"); @@ -154,7 +155,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase { SDDocumentType child = new SDDocumentType("child"); child.inherit(parent); - Schema childSchema = new Schema("child"); + Schema childSchema = new Schema("child", MockApplicationPackage.createEmpty()); childSchema.addDocument(child); prefixed = (SDField)child.getField("prefixed"); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/LiteralBoostTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/LiteralBoostTestCase.java index f8f1bf9e4f1..84b412170bf 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/LiteralBoostTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/LiteralBoostTestCase.java @@ -2,6 +2,7 @@ package com.yahoo.searchdefinition.derived; import com.yahoo.config.model.application.provider.BaseDeployLogger; +import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.document.DataType; import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.searchdefinition.RankProfile; @@ -30,7 +31,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase { */ @Test public void testLiteralBoost() { - Schema schema = new Schema("literalboost"); + Schema schema = new Schema("literalboost", MockApplicationPackage.createEmpty()); RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); SDDocumentType document = new SDDocumentType("literalboost"); schema.addDocument(document); @@ -63,7 +64,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase { */ @Test public void testNonDefaultRankLiteralBoost() { - Schema schema = new Schema("literalboost"); + Schema schema = new Schema("literalboost", MockApplicationPackage.createEmpty()); RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); SDDocumentType document = new SDDocumentType("literalboost"); schema.addDocument(document); @@ -89,7 +90,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase { /** Tests literal boosts in two fields going to the same index */ @Test public void testTwoLiteralBoostFields() { - Schema schema = new Schema("msb"); + Schema schema = new Schema("msb", MockApplicationPackage.createEmpty()); RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); SDDocumentType document = new SDDocumentType("msb"); schema.addDocument(document); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/MailTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/MailTestCase.java index 9ad6dfbb972..016dee659a9 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/MailTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/MailTestCase.java @@ -17,7 +17,7 @@ public class MailTestCase extends AbstractExportingTestCase { public void testMail() throws IOException, ParseException { String dir = "src/test/derived/mail/"; SchemaBuilder sb = new SchemaBuilder(); - sb.importFile(dir + "mail.sd"); + sb.addSchemaFile(dir + "mail.sd"); assertCorrectDeriving(sb, dir, new TestableDeployLogger()); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaOrdererTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaOrdererTestCase.java index b3f2fb62ac2..34d33a00d9e 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaOrdererTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaOrdererTestCase.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.test.MockApplicationPackage; import com.yahoo.document.ReferenceDataType; import com.yahoo.document.TemporaryStructuredDataType; import com.yahoo.searchdefinition.DocumentReference; @@ -62,7 +63,7 @@ public class SchemaOrdererTestCase extends AbstractSchemaTestCase { } private static Schema createSchema(String name, Map<String, Schema> schemas) { - Schema schema = new Schema(name); + Schema schema = new Schema(name, MockApplicationPackage.createEmpty()); SDDocumentType document = new SDDocumentType(name); document.setDocumentReferences(new DocumentReferences(emptyMap())); schema.addDocument(document); 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 c0f2b6887d2..3031494a090 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 @@ -20,8 +20,8 @@ public class SimpleInheritTestCase extends AbstractExportingTestCase { final String expectedResultsDirName = "src/test/derived/" + name + "/"; SchemaBuilder builder = new SchemaBuilder(); - builder.importFile(expectedResultsDirName + "parent.sd"); - builder.importFile(expectedResultsDirName + "child.sd"); + builder.addSchemaFile(expectedResultsDirName + "parent.sd"); + builder.addSchemaFile(expectedResultsDirName + "child.sd"); builder.build(); 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 b2c2a54ce5e..4063646cab9 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 @@ -32,7 +32,7 @@ public class StructInheritanceTestCase extends AbstractExportingTestCase { public void requireThatStructCanInherit() throws IOException, ParseException { String dir = "src/test/derived/structinheritance/"; SchemaBuilder builder = new SchemaBuilder(); - builder.importFile(dir + "simple.sd"); + builder.addSchemaFile(dir + "simple.sd"); builder.build(false); derive("structinheritance", builder, builder.getSchema("simple")); assertCorrectConfigFiles("structinheritance"); @@ -44,7 +44,7 @@ public class StructInheritanceTestCase extends AbstractExportingTestCase { exceptionRule.expectMessage("cannot inherit from base and redeclare field name"); String dir = "src/test/derived/structinheritance/"; SchemaBuilder builder = new SchemaBuilder(); - builder.importFile(dir + "bad.sd"); + builder.addSchemaFile(dir + "bad.sd"); builder.build(); 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 4994cffb92a..f9641e0bcc1 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 @@ -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.test.MockApplicationPackage; import com.yahoo.searchdefinition.*; import com.yahoo.vespa.config.search.SummarymapConfig; import com.yahoo.config.model.application.provider.BaseDeployLogger; @@ -73,7 +74,7 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase { } @Test public void testPositionDeriving() { - Schema schema = new Schema("store"); + Schema schema = new Schema("store", MockApplicationPackage.createEmpty()); SDDocumentType document = new SDDocumentType("store"); schema.addDocument(document); String fieldName = "location"; @@ -190,11 +191,11 @@ public class SummaryMapTestCase extends AbstractSchemaTestCase { private Schema buildSearch(String field) throws ParseException { var builder = new SchemaBuilder(new RankProfileRegistry()); - builder.importString(joinLines("search test {", - " document test {", - field, - " }", - "}")); + builder.addSchema(joinLines("search test {", + " document test {", + field, + " }", + "}")); builder.build(); 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 c996fb0c1b9..58f5e4afadc 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 @@ -135,20 +135,20 @@ public class SummaryTestCase extends AbstractSchemaTestCase { private static Schema buildCampaignAdModel() throws ParseException { SchemaBuilder builder = new SchemaBuilder(); - builder.importString("search campaign { document campaign {} }"); - builder.importString(joinLines("search ad {", - " document ad {", - " field campaign_ref type reference<campaign> {", - " indexing: summary | attribute", - " }", - " field other_campaign_ref type reference<campaign> {", - " indexing: summary | attribute", - " }", - " }", - " document-summary my_summary {", - " summary other_campaign_ref type reference<campaign> {}", - " }", - "}")); + builder.addSchema("search campaign { document campaign {} }"); + builder.addSchema(joinLines("search ad {", + " document ad {", + " field campaign_ref type reference<campaign> {", + " indexing: summary | attribute", + " }", + " field other_campaign_ref type reference<campaign> {", + " indexing: summary | attribute", + " }", + " }", + " document-summary my_summary {", + " summary other_campaign_ref type reference<campaign> {}", + " }", + "}")); builder.build(); 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 c3a78bab441..34a6282b4e6 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 @@ -18,14 +18,14 @@ public class TwoStreamingStructsTestCase extends AbstractExportingTestCase { String root = "src/test/derived/twostreamingstructs"; SchemaBuilder builder = new SchemaBuilder(); - builder.importFile(root + "/streamingstruct.sd"); - builder.importFile(root + "/whatever.sd"); + builder.addSchemaFile(root + "/streamingstruct.sd"); + builder.addSchemaFile(root + "/whatever.sd"); builder.build(); assertCorrectDeriving(builder, builder.getSchema("streamingstruct"), root); builder = new SchemaBuilder(); - builder.importFile(root + "/streamingstruct.sd"); - builder.importFile(root + "/whatever.sd"); + builder.addSchemaFile(root + "/streamingstruct.sd"); + builder.addSchemaFile(root + "/whatever.sd"); builder.build(); assertCorrectDeriving(builder, builder.getSchema("streamingstruct"), root); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/TypeConversionTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/TypeConversionTestCase.java index 13289d72884..dbb32e61144 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/TypeConversionTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/TypeConversionTestCase.java @@ -2,6 +2,7 @@ package com.yahoo.searchdefinition.derived; import com.yahoo.config.model.application.provider.BaseDeployLogger; +import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.document.DataType; import com.yahoo.searchdefinition.RankProfileRegistry; import com.yahoo.searchdefinition.Schema; @@ -25,7 +26,7 @@ public class TypeConversionTestCase extends AbstractSchemaTestCase { /** Tests that exact-string stuff is not spilled over to the default index */ @Test public void testExactStringToStringTypeConversion() { - Schema schema = new Schema("test"); + Schema schema = new Schema("test", MockApplicationPackage.createEmpty()); RankProfileRegistry rankProfileRegistry = RankProfileRegistry.createRankProfileRegistryWithBuiltinRankProfiles(schema); SDDocumentType document = new SDDocumentType("test"); schema.addDocument(document); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java index 138992477c0..5ab5a8057e8 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java @@ -24,7 +24,7 @@ public class VsmFieldsTestCase { @SuppressWarnings("deprecation") @Test public void reference_type_field_is_unsearchable() { - Schema schema = new Schema("test", new Application(MockApplicationPackage.createEmpty()), new MockFileRegistry(), new TestableDeployLogger(), new TestProperties()); + Schema schema = new Schema("test", MockApplicationPackage.createEmpty(), new MockFileRegistry(), new TestableDeployLogger(), new TestProperties()); schema.addDocument(new SDDocumentType("test")); SDField refField = new TemporarySDField("ref_field", ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create("parent_type"))); refField.parseIndexingScript("{ summary }"); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/AddAttributeTransformToSummaryOfImportedFieldsTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/AddAttributeTransformToSummaryOfImportedFieldsTest.java index 715b7b803e2..9ca97f4dbc7 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/AddAttributeTransformToSummaryOfImportedFieldsTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/AddAttributeTransformToSummaryOfImportedFieldsTest.java @@ -48,7 +48,7 @@ public class AddAttributeTransformToSummaryOfImportedFieldsTest { } private static Schema createSearch(String documentType) { - return new Schema(documentType, new Application(MockApplicationPackage.createEmpty()), new MockFileRegistry(), new TestableDeployLogger(), new TestProperties()); + return new Schema(documentType, MockApplicationPackage.createEmpty(), new MockFileRegistry(), new TestableDeployLogger(), new TestProperties()); } private static Schema createSearchWithDocument(String documentName) { 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 03125c48d1d..59ac2069568 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 @@ -44,7 +44,7 @@ public class DisallowComplexMapAndWsetKeyTypesTestCase { private void testFieldType(String fieldType) throws ParseException { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " struct mystruct {}\n" + 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 dd958fb34cd..5f26109f43f 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 @@ -21,14 +21,14 @@ public class FastAccessValidatorTest { @Test public void throws_exception_on_incompatible_use_of_fastaccess() throws ParseException { SchemaBuilder builder = new SchemaBuilder(new RankProfileRegistry()); - builder.importString( + builder.addSchema( TestUtil.joinLines( "schema parent {", " document parent {", " field int_field type int { indexing: attribute }", " }", "}")); - builder.importString( + builder.addSchema( TestUtil.joinLines( "schema test {", " document test { ", 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 43077fadfcd..6e62fc564a7 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 @@ -83,7 +83,7 @@ public class ImplicitSchemaFieldsTestCase extends AbstractSchemaTestCase { @Test public void testRequireThatDerivedConfigurationWorks() throws IOException, ParseException { SchemaBuilder sb = new SchemaBuilder(); - sb.importFile("src/test/examples/nextgen/simple.sd"); + sb.addSchemaFile("src/test/examples/nextgen/simple.sd"); sb.build(); 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 6eab1dddc79..b08f7d824b8 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 @@ -69,19 +69,19 @@ public class ImportedFieldsTestCase { private static Schema buildAdSearch(String sdContent) throws ParseException { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(joinLines( + builder.addSchema(joinLines( "schema campaign {", " document campaign {", " field budget type int { indexing: attribute }", " }", "}")); - builder.importString(joinLines( + builder.addSchema(joinLines( "schema person {", " document person {", " field name type string { indexing: attribute }", " }", "}")); - builder.importString(sdContent); + builder.addSchema(sdContent); builder.build(); return builder.getSchema("ad"); } @@ -313,17 +313,17 @@ public class ImportedFieldsTestCase { private static Schema buildChildSearch(String parentSdContent, String sdContent) throws ParseException { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(parentSdContent); - builder.importString(sdContent); + builder.addSchema(parentSdContent); + builder.addSchema(sdContent); builder.build(); return builder.getSchema("child"); } private static Schema buildChildSearch(String grandParentSdContent, String parentSdContent, String sdContent) throws ParseException { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(grandParentSdContent); - builder.importString(parentSdContent); - builder.importString(sdContent); + builder.addSchema(grandParentSdContent); + builder.addSchema(parentSdContent); + builder.addSchema(sdContent); builder.build(); return builder.getSchema("child"); } @@ -490,37 +490,37 @@ public class ImportedFieldsTestCase { private SchemaBuilder buildParentsUsingInheritance() throws ParseException { var builder = new SchemaBuilder(); - builder.importString(joinLines("schema parent_a {", - "document parent_a {", - " struct Entry {", - " field key type string {}", - " field value type string {}", - " }", - " field entries type array<Entry> {", - " indexing: summary", - " struct-field key { indexing: attribute }", - " struct-field value { indexing: attribute }", - " }", - "}", - "}")); - - builder.importString(joinLines("schema parent_b {", - "document parent_b inherits parent_a {", - "}", - "}")); - - builder.importString(joinLines("schema child {", - "document child {", - " field ref_parent_a type reference<parent_a> {", - " indexing: attribute", - " }", - " field ref_parent_b type reference<parent_b> {", - " indexing: attribute", - " }", - "}", - "import field ref_parent_a.entries as entries_from_a {}", - "import field ref_parent_b.entries as entries_from_b {}", - "}")); + builder.addSchema(joinLines("schema parent_a {", + "document parent_a {", + " struct Entry {", + " field key type string {}", + " field value type string {}", + " }", + " field entries type array<Entry> {", + " indexing: summary", + " struct-field key { indexing: attribute }", + " struct-field value { indexing: attribute }", + " }", + "}", + "}")); + + builder.addSchema(joinLines("schema parent_b {", + "document parent_b inherits parent_a {", + "}", + "}")); + + builder.addSchema(joinLines("schema child {", + "document child {", + " field ref_parent_a type reference<parent_a> {", + " indexing: attribute", + " }", + " field ref_parent_b type reference<parent_b> {", + " indexing: attribute", + " }", + "}", + "import field ref_parent_a.entries as entries_from_a {}", + "import field ref_parent_b.entries as entries_from_b {}", + "}")); builder.build(); return builder; diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingScriptRewriterTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingScriptRewriterTestCase.java index 3105e3c7efd..4dffaf71ae0 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingScriptRewriterTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingScriptRewriterTestCase.java @@ -2,6 +2,7 @@ package com.yahoo.searchdefinition.processing; import com.yahoo.config.model.application.provider.BaseDeployLogger; +import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.document.DataType; import com.yahoo.searchdefinition.Index; import com.yahoo.searchdefinition.RankProfileRegistry; @@ -154,7 +155,7 @@ public class IndexingScriptRewriterTestCase extends AbstractSchemaTestCase { private static ScriptExpression processField(SDField unprocessedField) { SDDocumentType sdoc = new SDDocumentType("test"); sdoc.addField(unprocessedField); - Schema schema = new Schema("test"); + Schema schema = new Schema("test", MockApplicationPackage.createEmpty()); schema.addDocument(sdoc); new Processing().process(schema, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(), true, false, Set.of()); 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 7eea2fca0e6..48d471de9d1 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 @@ -176,16 +176,16 @@ public class MatchedElementsOnlyResolverTestCase { private Schema buildSearch(String field, String summary) throws ParseException { var builder = new SchemaBuilder(new RankProfileRegistry()); - builder.importString(joinLines("search test {", - " document test {", - " struct elem {", - " field name type string {}", - " field weight type int {}", - " }", - field, - " }", - summary, - "}")); + builder.addSchema(joinLines("search test {", + " document test {", + " struct elem {", + " field name type string {}", + " field weight type int {}", + " }", + field, + " }", + summary, + "}")); builder.build(); return builder.getSchema(); } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java index 74fa7c72554..b14c7287537 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java @@ -23,7 +23,6 @@ import com.yahoo.searchdefinition.document.TemporarySDField; */ public class ParentChildSearchModel { - private final Application application = new Application(MockApplicationPackage.createEmpty()); public Schema parentSchema; public Schema childSchema; @@ -33,7 +32,7 @@ public class ParentChildSearchModel { } protected Schema createSearch(String name) { - Schema result = new Schema(name, application, new MockFileRegistry(), new TestableDeployLogger(), new TestProperties()); + Schema result = new Schema(name, MockApplicationPackage.createEmpty(), new MockFileRegistry(), new TestableDeployLogger(), new TestProperties()); result.addDocument(new SDDocumentType(name)); return result; } 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 2707f60f828..cf817d98b52 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 @@ -77,7 +77,7 @@ class RankProfileSearchFixture { rankProfiles + "\n" + "}"; - builder.importString(sdContent); + builder.addSchema(sdContent); builder.build(); 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 4f18c9b68fd..59aa085ac7f 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 @@ -34,7 +34,7 @@ public class RankingExpressionTypeResolverTestCase { public void tensorFirstPhaseMustProduceDouble() throws Exception { try { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { ", " field a type tensor(x[10],y[3]) {", @@ -62,7 +62,7 @@ public class RankingExpressionTypeResolverTestCase { public void tensorFirstPhaseFromConstantMustProduceDouble() throws Exception { try { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { ", " field a type tensor(d0[3]) {", @@ -111,7 +111,7 @@ public class RankingExpressionTypeResolverTestCase { public void tensorSecondPhaseMustProduceDouble() throws Exception { try { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { ", " field a type tensor(x[10],y[3]) {", @@ -141,7 +141,7 @@ public class RankingExpressionTypeResolverTestCase { public void tensorConditionsMustHaveTypeCompatibleBranches() throws Exception { try { SchemaBuilder schemaBuilder = new SchemaBuilder(); - schemaBuilder.importString(joinLines( + schemaBuilder.addSchema(joinLines( "search test {", " document test { ", " field a type tensor(x[10],y[5]) {", @@ -173,7 +173,7 @@ public class RankingExpressionTypeResolverTestCase { public void testFunctionInvocationTypes() throws Exception { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { ", " field a type tensor(x[10],y[3]) {", @@ -206,7 +206,7 @@ public class RankingExpressionTypeResolverTestCase { @Test public void testTensorFunctionInvocationTypes_Nested() throws Exception { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { ", " field a type tensor(x[10],y[1]) {", @@ -248,7 +248,7 @@ public class RankingExpressionTypeResolverTestCase { @Test public void testAttributeInvocationViaBoundIdentifier() throws Exception { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(joinLines( + builder.addSchema(joinLines( "search newsarticle {", " document newsarticle {", " field title type string {", @@ -287,7 +287,7 @@ public class RankingExpressionTypeResolverTestCase { @Test public void testTensorFunctionInvocationTypes_NestedSameName() throws Exception { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { ", " field a type tensor(x[10],y[1]) {", @@ -332,7 +332,7 @@ public class RankingExpressionTypeResolverTestCase { @Test public void testTensorFunctionInvocationTypes_viaFuncWithExpr() throws Exception { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test {", " field t1 type tensor<float>(y{}) { indexing: attribute | summary }", @@ -354,7 +354,7 @@ public class RankingExpressionTypeResolverTestCase { @Test public void importedFieldsAreAvailable() throws Exception { SchemaBuilder builder = new SchemaBuilder(); - builder.importString(joinLines( + builder.addSchema(joinLines( "search parent {", " document parent {", " field a type tensor(x[5],y[1000]) {", @@ -363,7 +363,7 @@ public class RankingExpressionTypeResolverTestCase { " }", "}" )); - builder.importString(joinLines( + builder.addSchema(joinLines( "search child {", " document child { ", " field ref type reference<parent> {", @@ -385,7 +385,7 @@ public class RankingExpressionTypeResolverTestCase { public void undeclaredQueryFeaturesAreAccepted() throws Exception { InspectableDeployLogger logger = new InspectableDeployLogger(); SchemaBuilder builder = new SchemaBuilder(logger); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { ", " field anyfield type double {" + @@ -411,7 +411,7 @@ public class RankingExpressionTypeResolverTestCase { public void undeclaredQueryFeaturesAreAcceptedWithWarningWhenUsingTensors() throws Exception { InspectableDeployLogger logger = new InspectableDeployLogger(); SchemaBuilder builder = new SchemaBuilder(logger); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { ", " field anyfield type tensor(d[2]) {", @@ -451,7 +451,7 @@ public class RankingExpressionTypeResolverTestCase { new TensorFieldType(TensorType.fromSpec("tensor(d[2])"))), builder.getQueryProfileRegistry().getTypeRegistry()); builder.getQueryProfileRegistry().getTypeRegistry().register(myType); - builder.importString(joinLines( + builder.addSchema(joinLines( "search test {", " document test { ", " field anyfield type tensor(d[2]) {", 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 93de116883a..f09d4e6836d 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 @@ -88,7 +88,7 @@ public class RankingExpressionWithTransformerTokensTestCase { " rank-profile my_profile inherits default {}\n" + "}"; SchemaBuilder schemaBuilder = new SchemaBuilder(application, new MockFileRegistry(), new BaseDeployLogger(), new TestProperties(), rankProfileRegistry, queryProfileRegistry); - schemaBuilder.importString(sdContent); + schemaBuilder.addSchema(sdContent); schemaBuilder.build(); Schema schema = schemaBuilder.getSchema(); RankProfile rp = rankProfileRegistry.get(schema, "my_profile"); 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 c9437761e0d..95034f9b4b7 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 @@ -46,9 +46,9 @@ public class ReferenceFieldTestCase { " field salesperson_ref type reference<salesperson> { indexing: attribute }\n" + " }\n" + "}"; - builder.importString(campaignSdContent); - builder.importString(salespersonSdContent); - builder.importString(adSdContent); + builder.addSchema(campaignSdContent); + builder.addSchema(salespersonSdContent); + builder.addSchema(adSdContent); builder.build(); Schema schema = builder.getSchema("ad"); assertSearchContainsReferenceField("campaign_ref", "campaign", schema.getDocument()); @@ -70,8 +70,8 @@ public class ReferenceFieldTestCase { " field campaign_ref type reference<campaign> { indexing: attribute }\n" + " }\n" + "}"; - builder.importString(campaignSdContent); - builder.importString(adSdContent); + builder.addSchema(campaignSdContent); + builder.addSchema(adSdContent); exceptionRule.expect(DocumentGraphValidator.DocumentGraphException.class); exceptionRule.expectMessage("Document dependency cycle detected: campaign->ad->campaign."); builder.build(); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedRankingExpressionFunctionNamesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedRankingExpressionFunctionNamesTestCase.java index 922680e8f1a..a7b1144e505 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedRankingExpressionFunctionNamesTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedRankingExpressionFunctionNamesTestCase.java @@ -22,7 +22,7 @@ public class ReservedRankingExpressionFunctionNamesTestCase { TestDeployLogger deployLogger = new TestDeployLogger(); RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); SchemaBuilder builder = new SchemaBuilder(deployLogger, rankProfileRegistry); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field a type string { \n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorTransformTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorTransformTestCase.java index eec2ef4c3a0..efc2bb57a30 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorTransformTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorTransformTestCase.java @@ -141,7 +141,7 @@ public class TensorTransformTestCase extends AbstractSchemaTestCase { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); QueryProfileRegistry queryProfiles = setupQueryProfileTypes(); SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry, queryProfiles); - builder.importString( + builder.addSchema( "search test {\n" + " document test { \n" + " field double_field type double { \n" + diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ValidateFieldTypesTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ValidateFieldTypesTest.java index fe9d19310a9..22fd4e45c4a 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ValidateFieldTypesTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ValidateFieldTypesTest.java @@ -51,7 +51,7 @@ public class ValidateFieldTypesTest { private static Schema createSearch(String documentType) { return new Schema(documentType, - new Application(MockApplicationPackage.createEmpty()), + MockApplicationPackage.createEmpty(), new MockFileRegistry(), new TestableDeployLogger(), new TestProperties()); diff --git a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderImportedFieldsTestCase.java b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderImportedFieldsTestCase.java index 754979fb391..b18f6e5d839 100644 --- a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderImportedFieldsTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderImportedFieldsTestCase.java @@ -29,24 +29,24 @@ public class DocumentModelBuilderImportedFieldsTestCase extends AbstractReferenc private static class TestDocumentModelBuilder { private final SchemaBuilder builder = new SchemaBuilder(); public TestDocumentModelBuilder addCampaign() throws ParseException { - builder.importString(joinLines("search campaign {", - " document campaign {", - " field cool_field type string { indexing: attribute }", - " field swag_field type long { indexing: attribute }", - " }", - "}")); + builder.addSchema(joinLines("search campaign {", + " document campaign {", + " field cool_field type string { indexing: attribute }", + " field swag_field type long { indexing: attribute }", + " }", + "}")); return this; } public TestDocumentModelBuilder addPerson() throws ParseException { - builder.importString(joinLines("search person {", - " document person {", - " field name type string { indexing: attribute }", - " }", - "}")); + builder.addSchema(joinLines("search person {", + " document person {", + " field name type string { indexing: attribute }", + " }", + "}")); return this; } public DocumentModel build(String adSdContent) throws ParseException { - builder.importString(adSdContent); + builder.addSchema(adSdContent); builder.build(); return builder.getModel(); } diff --git a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderReferenceTypeTestCase.java b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderReferenceTypeTestCase.java index f9b9bf2610e..700e097e5cf 100644 --- a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderReferenceTypeTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderReferenceTypeTestCase.java @@ -58,19 +58,19 @@ public class DocumentModelBuilderReferenceTypeTestCase extends AbstractReference private static class TestDocumentModelBuilder { private final SchemaBuilder builder = new SchemaBuilder(); public TestDocumentModelBuilder addCampaign() throws ParseException { - builder.importString(joinLines("search campaign {", - " document campaign {}", - "}")); + builder.addSchema(joinLines("search campaign {", + " document campaign {}", + "}")); return this; } public TestDocumentModelBuilder addPerson() throws ParseException { - builder.importString(joinLines("search person {", - " document person {}", - "}")); + builder.addSchema(joinLines("search person {", + " document person {}", + "}")); return this; } public DocumentModel build(String adSdContent) throws ParseException { - builder.importString(adSdContent); + builder.addSchema(adSdContent); builder.build(); return builder.getModel(); } diff --git a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderTestCase.java b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderTestCase.java index 9dfd05b6fdc..e59e9706bb5 100644 --- a/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderTestCase.java @@ -36,8 +36,8 @@ public class DocumentModelBuilderTestCase extends AbstractSchemaTestCase { @Test public void testDocumentTypesWithDocumentField() throws IOException, ParseException { SchemaBuilder search = new SchemaBuilder(); - search.importFile("src/test/configmodel/types/other_doc.sd"); - search.importFile("src/test/configmodel/types/type_with_doc_field.sd"); + search.addSchemaFile("src/test/configmodel/types/other_doc.sd"); + search.addSchemaFile("src/test/configmodel/types/type_with_doc_field.sd"); search.build(); DocumentModel model = search.getModel(); @@ -49,9 +49,9 @@ public class DocumentModelBuilderTestCase extends AbstractSchemaTestCase { @Test public void testMultipleInheritanceArray() throws IOException, ParseException { SchemaBuilder search = new SchemaBuilder(); - search.importFile("src/test/cfg/search/data/travel/schemas/TTData.sd"); - search.importFile("src/test/cfg/search/data/travel/schemas/TTEdge.sd"); - search.importFile("src/test/cfg/search/data/travel/schemas/TTPOI.sd"); + search.addSchemaFile("src/test/cfg/search/data/travel/schemas/TTData.sd"); + search.addSchemaFile("src/test/cfg/search/data/travel/schemas/TTEdge.sd"); + search.addSchemaFile("src/test/cfg/search/data/travel/schemas/TTPOI.sd"); search.build(); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java index 6830ce79f9f..50fdaf0cfa1 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java @@ -2,6 +2,7 @@ package com.yahoo.vespa.model.search.test; import com.yahoo.component.ComponentId; +import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.container.QrSearchersConfig; import com.yahoo.document.DataType; import com.yahoo.search.config.ClusterConfig; @@ -40,7 +41,7 @@ public class SchemaClusterTest { public void testSdConfigLogical() { // sd1 SDDocumentType sdt1 = new SDDocumentType("s1"); - Schema schema1 = new Schema("s1"); + Schema schema1 = new Schema("s1", MockApplicationPackage.createEmpty()); SDField f1 = new SDField("f1", DataType.STRING); f1.addAttribute(new Attribute("f1", DataType.STRING)); f1.setIndexingScript(new ScriptExpression(new StatementExpression(new AttributeExpression("f1")))); @@ -49,7 +50,7 @@ public class SchemaClusterTest { // sd2 SDDocumentType sdt2 = new SDDocumentType("s2"); - Schema schema2 = new Schema("s2"); + Schema schema2 = new Schema("s2", MockApplicationPackage.createEmpty()); SDField f2=new SDField("f2", DataType.STRING); f2.addAttribute(new Attribute("f2", DataType.STRING)); f2.setIndexingScript(new ScriptExpression(new StatementExpression(new AttributeExpression("f2")))); @@ -57,8 +58,8 @@ public class SchemaClusterTest { schema2.addDocument(sdt2); SchemaBuilder builder = new SchemaBuilder(); - builder.importRawSchema(schema1); - builder.importRawSchema(schema2); + builder.addSchemaFile(schema1); + builder.addSchemaFile(schema2); builder.build(); } |