diff options
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition/processing')
15 files changed, 81 insertions, 81 deletions
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()); |