aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-01-24 22:56:16 +0100
committerJon Bratseth <bratseth@gmail.com>2022-01-24 22:56:16 +0100
commit6b32f86f4a06c81576ef92f3959d45be4d2ac389 (patch)
tree942c7308dc36010ceba5f70d1ac1c6c8691f9e9c /config-model
parentc9be2d021bdf5b57a00fab40db35a3e3ece95760 (diff)
Make Application immutable
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java2
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/Application.java28
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/DocumentOnlySchema.java8
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/Schema.java48
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/SchemaBuilder.java85
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java2
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/TemporaryImportedFields.java6
-rw-r--r--config-model/src/main/javacc/SDParser.jj14
-rw-r--r--config-model/src/test/java/com/yahoo/document/test/SDDocumentTypeTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/AttributeSettingsTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/DiversityTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/DocumentGraphValidatorTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.java11
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/ImportedFieldsEnumeratorTest.java7
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankProfileRegistryTest.java5
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankProfileTestCase.java29
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankPropertiesTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingConstantTest.java18
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionConstantsTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionInliningTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java16
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionValidationTestCase.java24
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/SchemaTestCase.java12
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/UrlFieldValidationTestCase.java10
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/EmptyRankProfileTestCase.java3
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java5
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/IdTestCase.java3
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java29
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/LiteralBoostTestCase.java7
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/MailTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaOrdererTestCase.java3
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/StructInheritanceTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryMapTestCase.java13
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java28
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/TypeConversionTestCase.java3
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/AddAttributeTransformToSummaryOfImportedFieldsTest.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/DisallowComplexMapAndWsetKeyTypesTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java4
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/ImportedFieldsTestCase.java78
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/IndexingScriptRewriterTestCase.java3
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/MatchedElementsOnlyResolverTestCase.java20
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java3
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankProfileSearchFixture.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionTypeResolverTestCase.java28
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTransformerTokensTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/ReferenceFieldTestCase.java10
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/ReservedRankingExpressionFunctionNamesTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/TensorTransformTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/ValidateFieldTypesTest.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderImportedFieldsTestCase.java24
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderReferenceTypeTestCase.java14
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderTestCase.java10
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java9
59 files changed, 362 insertions, 343 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java b/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java
index 5822b1bca05..e4790a16f86 100644
--- a/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java
+++ b/config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java
@@ -126,7 +126,7 @@ public class MockApplicationPackage implements ApplicationPackage {
queryProfileRegistry);
for (String sd : schemas) {
try {
- String name = schemaBuilder.importString(sd);
+ String name = schemaBuilder.addSchema(sd).getName();
readers.add(new NamedReader(name + ApplicationPackage.SD_NAME_SUFFIX, new StringReader(sd)));
} catch (ParseException e) {
throw new RuntimeException(e);
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/Application.java b/config-model/src/main/java/com/yahoo/searchdefinition/Application.java
index fe29c9cf313..9c1cc839092 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/Application.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/Application.java
@@ -20,23 +20,28 @@ import java.util.Map;
public class Application {
private final ApplicationPackage applicationPackage;
- private final Map<String, Schema> schemas = new LinkedHashMap<>();
+ private final Map<String, Schema> schemas;
private final DocumentModel documentModel = new DocumentModel();
- public Application(ApplicationPackage applicationPackage) {
+ public Application(ApplicationPackage applicationPackage, List<Schema> schemas, DeployLogger logger) {
this.applicationPackage = applicationPackage;
- }
- public ApplicationPackage applicationPackage() { return applicationPackage; }
+ Map<String, Schema> schemaMap = new LinkedHashMap<>();
+ for (Schema schema : schemas) {
+ if (schemaMap.containsKey(schema.getName()))
+ throw new IllegalArgumentException("Duplicate schema '" + schema.getName() + "' in " + this);
+ schemaMap.put(schema.getName(), schema);
+ }
+ this.schemas = Collections.unmodifiableMap(schemaMap);
- public void add(Schema schema) {
- if (schemas.containsKey(schema.getName()))
- throw new IllegalArgumentException("Duplicate schema '" + schema.getName() + "' in " + this);
- schemas.put(schema.getName(), schema);
+ schemas.forEach(schema -> schema.setOwner(this));
+ schemas.forEach(schema -> schema.validate(logger));
}
+ public ApplicationPackage applicationPackage() { return applicationPackage; }
+
/** Returns an unmodifiable list of the schemas of this application */
- public Map<String, Schema> schemas() { return Collections.unmodifiableMap(schemas); }
+ public Map<String, Schema> schemas() { return schemas; }
public void buildDocumentModel(List<Schema> schemasSomewhatOrdered) {
var builder = new DocumentModelBuilder(documentModel);
@@ -45,11 +50,6 @@ public class Application {
public DocumentModel documentModel() { return documentModel; }
- /** Validates this. Must be called after all content is added to it. */
- public void validate(DeployLogger logger) {
- schemas.values().forEach(schema -> schema.validate(logger));
- }
-
@Override
public String toString() { return "application " + applicationPackage.getApplicationId(); }
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentOnlySchema.java b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentOnlySchema.java
index c672b662874..1d71a9f1494 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentOnlySchema.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentOnlySchema.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.application.api.ApplicationPackage;
import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.config.application.api.FileRegistry;
import com.yahoo.config.model.api.ModelContext;
@@ -14,8 +15,11 @@ import com.yahoo.searchdefinition.document.SDDocumentType;
*/
public class DocumentOnlySchema extends Schema {
- public DocumentOnlySchema(Application application, FileRegistry fileRegistry, DeployLogger deployLogger, ModelContext.Properties properties) {
- super(application, fileRegistry, deployLogger, properties);
+ public DocumentOnlySchema(ApplicationPackage applicationPackage,
+ FileRegistry fileRegistry,
+ DeployLogger deployLogger,
+ ModelContext.Properties properties) {
+ super(applicationPackage, fileRegistry, deployLogger, properties);
}
@Override
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java b/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java
index 6ef4084e5b7..4df118545eb 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java
@@ -55,6 +55,9 @@ public class Schema implements ImmutableSchema {
/** The unique name of this schema */
private String name;
+ /** The application package this is constructed from */
+ private final ApplicationPackage applicationPackage;
+
/** The name of the schema this should inherit all the content of, if any */
private final Optional<String> inherited;
@@ -93,21 +96,22 @@ public class Schema implements ImmutableSchema {
/** The resulting processed field */
private Optional<ImportedFields> importedFields = Optional.empty();
- private final Application owner;
private final DeployLogger deployLogger;
private final ModelContext.Properties properties;
+ private Application owner;
+
/** Testing only */
- public Schema(String name) {
- this(name, Optional.empty(), null, null, new BaseDeployLogger(), new TestProperties());
+ public Schema(String name, ApplicationPackage applicationPackage) {
+ this(name, applicationPackage, Optional.empty(), null, new BaseDeployLogger(), new TestProperties());
}
public Schema(String name,
- Application application,
+ ApplicationPackage applicationPackage,
FileRegistry fileRegistry,
DeployLogger deployLogger,
ModelContext.Properties properties) {
- this(name, Optional.empty(), application, fileRegistry, deployLogger, properties);
+ this(name, applicationPackage, Optional.empty(), fileRegistry, deployLogger, properties);
}
/**
@@ -115,30 +119,30 @@ public class Schema implements ImmutableSchema {
*
* @param name of the schema
* @param inherited the schema this inherits, if any
- * @param application the application containing this
*/
public Schema(String name,
+ ApplicationPackage applicationPackage,
Optional<String> inherited,
- Application application,
FileRegistry fileRegistry,
DeployLogger deployLogger,
ModelContext.Properties properties) {
- this(inherited, application, fileRegistry, deployLogger, properties, false);
- this.name = name;
+ this(inherited, applicationPackage, fileRegistry, deployLogger, properties, false);
+ this.name = Objects.requireNonNull(name, "A schema must have a name");
}
- protected Schema(Application application, FileRegistry fileRegistry, DeployLogger deployLogger, ModelContext.Properties properties) {
- this(Optional.empty(), application, fileRegistry, deployLogger, properties, true);
+ protected Schema(ApplicationPackage applicationPackage, FileRegistry fileRegistry,
+ DeployLogger deployLogger, ModelContext.Properties properties) {
+ this(Optional.empty(), applicationPackage, fileRegistry, deployLogger, properties, true);
}
private Schema(Optional<String> inherited,
- Application application,
+ ApplicationPackage applicationPackage,
FileRegistry fileRegistry,
DeployLogger deployLogger,
ModelContext.Properties properties,
boolean documentsOnly) {
this.inherited = inherited;
- this.owner = application;
+ this.applicationPackage = applicationPackage;
this.deployLogger = deployLogger;
this.properties = properties;
this.documentsOnly = documentsOnly;
@@ -147,6 +151,17 @@ public class Schema implements ImmutableSchema {
onnxModels = new OnnxModels(fileRegistry, Optional.of(this));
}
+ /**
+ * Assigns the owner of this
+ *
+ * @throws IllegalStateException if an owner is already assigned
+ */
+ public void setOwner(Application owner) {
+ if (this.owner != null)
+ throw new IllegalStateException("Cannot reassign the owner of " + this);
+ this.owner = owner;
+ }
+
protected void setName(String name) { this.name = name; }
@Override
@@ -307,16 +322,13 @@ public class Schema implements ImmutableSchema {
*/
@Override
public Reader getRankingExpression(String fileName) {
- return owner.applicationPackage().getRankingExpression(fileName);
+ return applicationPackage.getRankingExpression(fileName);
}
public Application application() { return owner; }
@Override
- public ApplicationPackage applicationPackage() {
- if (owner == null) return null;
- return owner.applicationPackage();
- }
+ public ApplicationPackage applicationPackage() { return applicationPackage; }
@Override
public DeployLogger getDeployLogger() { return deployLogger; }
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/SchemaBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/SchemaBuilder.java
index 8b22612108f..efa0d0784bb 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/SchemaBuilder.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/SchemaBuilder.java
@@ -48,8 +48,9 @@ import java.util.Set;
// NOTE: Since this was created we have added Application, and much of the content in this should migrate there.
public class SchemaBuilder {
- private final DocumentTypeManager docTypeMgr = new DocumentTypeManager();
- private final Application application;
+ private final ApplicationPackage applicationPackage;
+ private final List<Schema> schemas = new ArrayList<>();
+ private final DocumentTypeManager documentTypeManager = new DocumentTypeManager();
private final RankProfileRegistry rankProfileRegistry;
private final QueryProfileRegistry queryProfileRegistry;
private final FileRegistry fileRegistry;
@@ -58,7 +59,7 @@ public class SchemaBuilder {
/** True to build the document aspect only, skipping instantiation of rank profiles */
private final boolean documentsOnly;
- private boolean isBuilt = false;
+ private Application application;
private final Set<Class<? extends Processor>> processorsToSkip = new HashSet<>();
@@ -122,7 +123,7 @@ public class SchemaBuilder {
RankProfileRegistry rankProfileRegistry,
QueryProfileRegistry queryProfileRegistry,
boolean documentsOnly) {
- this.application = new Application(applicationPackage);
+ this.applicationPackage = applicationPackage;
this.rankProfileRegistry = rankProfileRegistry;
this.queryProfileRegistry = queryProfileRegistry;
this.fileRegistry = fileRegistry;
@@ -139,17 +140,17 @@ public class SchemaBuilder {
* @throws IOException thrown if the file can not be read for some reason
* @throws ParseException thrown if the file does not contain a valid search definition
*/
- public String importFile(String fileName) throws IOException, ParseException {
+ public Schema addSchemaFile(String fileName) throws IOException, ParseException {
File file = new File(fileName);
- return importString(IOUtils.readFile(file), file.getAbsoluteFile().getParent());
+ return addSchema(IOUtils.readFile(file), file.getAbsoluteFile().getParent());
}
- private String importFile(Path file) throws IOException, ParseException {
- return importFile(file.toString());
+ private Schema addSchemaFile(Path file) throws IOException, ParseException {
+ return addSchemaFile(file.toString());
}
public void importFromApplicationPackage() {
- for (NamedReader reader : application.applicationPackage().getSchemas()) {
+ for (NamedReader reader : applicationPackage.getSchemas()) {
importFrom(reader);
}
}
@@ -158,11 +159,11 @@ public class SchemaBuilder {
* Reads and parses the schema string provided by the given reader. Once all schemas have been
* imported, call {@link #build()}.
*
- * @param reader the reader whose content to import
+ * @param reader the reader whose content to import
*/
private void importFrom(NamedReader reader) {
try {
- String schemaName = importString(IOUtils.readAll(reader), reader.getName());
+ String schemaName = addSchema(IOUtils.readAll(reader), reader.getName()).getName();
String schemaFileName = stripSuffix(reader.getName(), ApplicationPackage.SD_NAME_SUFFIX);
if ( ! schemaFileName.equals(schemaName)) {
throw new IllegalArgumentException("The file containing schema '" + schemaName + "' must be named '" +
@@ -184,22 +185,24 @@ public class SchemaBuilder {
}
/**
- * Import search definition.
+ * Adds a schema to this.
*
- * @param str the string to parse
- * @return the name of the imported object
+ * @param string the string to parse
+ * @return the schema
* @throws ParseException thrown if the file does not contain a valid search definition
*/
- public String importString(String str) throws ParseException {
- return importString(str, null);
+ public Schema addSchema(String string) throws ParseException {
+ return addSchema(string, null);
}
- private String importString(String str, String schemaDir) throws ParseException {
+ private Schema addSchema(String str, String schemaDir) throws ParseException {
SimpleCharStream stream = new SimpleCharStream(str);
try {
- return importRawSchema(new SDParser(stream, fileRegistry, deployLogger, properties, application,
- rankProfileRegistry, documentsOnly)
- .schema(docTypeMgr, schemaDir));
+ Schema schema = new SDParser(stream, applicationPackage, fileRegistry, deployLogger, properties,
+ rankProfileRegistry, documentsOnly)
+ .schema(documentTypeManager, schemaDir);
+ addSchemaFile(schema);
+ return schema;
} catch (TokenMgrException e) {
throw new ParseException("Unknown symbol: " + e.getMessage());
} catch (ParseException pe) {
@@ -213,15 +216,12 @@ public class SchemaBuilder {
* programmatically constructed schemas used in unit tests.
*
* @param schema the object to import
- * @return the name of the imported object
* @throws IllegalArgumentException if the given search object has already been processed
*/
- public String importRawSchema(Schema schema) {
+ public void addSchemaFile(Schema schema) {
if (schema.getName() == null)
throw new IllegalArgumentException("Schema has no name");
- String rawName = schema.getName();
- application.add(schema);
- return rawName;
+ schemas.add(schema);
}
/**
@@ -240,16 +240,14 @@ public class SchemaBuilder {
* @throws IllegalStateException thrown if this method has already been called
*/
public void build(boolean validate) {
- if (isBuilt) throw new IllegalStateException("Application already built");
+ if (application != null) throw new IllegalStateException("Application already built");
- new TemporarySDTypeResolver(application.schemas().values(), deployLogger).process();
-
- if (validate)
- application.validate(deployLogger);
+ application = new Application(applicationPackage, schemas, deployLogger);
+ new TemporarySDTypeResolver(schemas, deployLogger).process();
List<SDDocumentType> sdocs = new ArrayList<>();
sdocs.add(SDDocumentType.VESPA_DOCUMENT);
- for (Schema schema : application.schemas().values()) {
+ for (Schema schema : schemas) {
if (schema.hasDocument()) {
sdocs.add(schema.getDocument());
}
@@ -262,22 +260,21 @@ public class SchemaBuilder {
new FieldOperationApplier().process(sdoc);
}
- var resolver = new DocumentReferenceResolver(application.schemas().values());
+ var resolver = new DocumentReferenceResolver(schemas);
sdocs.forEach(resolver::resolveReferences);
sdocs.forEach(resolver::resolveInheritedReferences);
- var importedFieldsEnumerator = new ImportedFieldsEnumerator(application.schemas().values());
+ var importedFieldsEnumerator = new ImportedFieldsEnumerator(schemas);
sdocs.forEach(importedFieldsEnumerator::enumerateImportedFields);
if (validate)
new DocumentGraphValidator().validateDocumentGraph(sdocs);
- List<Schema> schemasSomewhatOrdered = new ArrayList<>(application.schemas().values());
+ List<Schema> schemasSomewhatOrdered = new ArrayList<>(schemas);
for (Schema schema : new SearchOrderer().order(schemasSomewhatOrdered)) {
new FieldOperationApplierForSearch().process(schema); // TODO: Why is this not in the regular list?
process(schema, new QueryProfiles(queryProfileRegistry, deployLogger), validate);
}
application.buildDocumentModel(schemasSomewhatOrdered);
- isBuilt = true;
}
/** Returns a modifiable set of processors we should skip for these schemas. Useful for testing. */
@@ -302,7 +299,7 @@ public class SchemaBuilder {
* @throws IllegalStateException if there is not exactly one search.
*/
public Schema getSchema() {
- if ( ! isBuilt) throw new IllegalStateException("Application not built.");
+ if (application == null) throw new IllegalStateException("Application not built");
if (application.schemas().size() != 1)
throw new IllegalStateException("This call only works if we have 1 schema. Schemas: " +
application.schemas().values());
@@ -322,7 +319,7 @@ public class SchemaBuilder {
* @throws IllegalStateException if {@link #build()} has not been called.
*/
public Schema getSchema(String name) {
- if ( ! isBuilt) throw new IllegalStateException("Application not built.");
+ if (application == null) throw new IllegalStateException("Application not built");
if (name == null) return getSchema();
return application.schemas().get(name);
}
@@ -351,7 +348,7 @@ public class SchemaBuilder {
public static SchemaBuilder createFromString(String sd, DeployLogger logger) throws ParseException {
SchemaBuilder builder = new SchemaBuilder(logger);
- builder.importString(sd);
+ builder.addSchema(sd);
builder.build(true);
return builder;
}
@@ -359,7 +356,7 @@ public class SchemaBuilder {
public static SchemaBuilder createFromStrings(DeployLogger logger, String ... schemas) throws ParseException {
SchemaBuilder builder = new SchemaBuilder(logger);
for (var schema : schemas)
- builder.importString(schema);
+ builder.addSchema(schema);
builder.build(true);
return builder;
}
@@ -427,7 +424,7 @@ public class SchemaBuilder {
rankProfileRegistry,
queryprofileRegistry);
for (String fileName : fileNames) {
- builder.importFile(fileName);
+ builder.addSchemaFile(fileName);
}
builder.build(true);
return builder;
@@ -468,7 +465,7 @@ public class SchemaBuilder {
rankProfileRegistry,
queryProfileRegistry);
for (Iterator<Path> i = Files.list(new File(dir).toPath()).filter(p -> p.getFileName().toString().endsWith(".sd")).iterator(); i.hasNext(); ) {
- builder.importFile(i.next());
+ builder.addSchemaFile(i.next());
}
builder.build(true);
return builder;
@@ -533,13 +530,13 @@ public class SchemaBuilder {
*
* @param rawSchema the raw object to build from
* @return the built {@link SchemaBuilder} object
- * @see #importRawSchema(Schema)
+ * @see #addSchemaFile(Schema)
*/
public static SchemaBuilder createFromRawSchema(Schema rawSchema,
RankProfileRegistry rankProfileRegistry,
QueryProfileRegistry queryProfileRegistry) {
SchemaBuilder builder = new SchemaBuilder(rankProfileRegistry, queryProfileRegistry);
- builder.importRawSchema(rawSchema);
+ builder.addSchemaFile(rawSchema);
builder.build();
return builder;
}
@@ -549,7 +546,7 @@ public class SchemaBuilder {
*
* @param rawSchema the raw object to build from
* @return the built {@link Schema} object
- * @see #importRawSchema(Schema)
+ * @see #addSchemaFile(Schema)
*/
public static Schema buildFromRawSchema(Schema rawSchema,
RankProfileRegistry rankProfileRegistry,
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java
index b1fe4942f4a..15cf7c36208 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java
@@ -21,7 +21,7 @@ public class Deriver {
SchemaBuilder builder = new SchemaBuilder();
try {
for (String schema : schemas)
- builder.importFile(schema);
+ builder.addSchemaFile(schema);
} catch (ParseException | IOException e) {
throw new IllegalArgumentException(e);
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporaryImportedFields.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporaryImportedFields.java
index 96f2f2f1d24..b4d76445507 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporaryImportedFields.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporaryImportedFields.java
@@ -29,11 +29,7 @@ public class TemporaryImportedFields {
}
public boolean hasField(String fieldName) {
- boolean has = fields.get(fieldName) != null;
- if (has) return true;
- if (owner.inherited().isEmpty()) return false;
- if (owner.inherited().get().temporaryImportedFields().isEmpty()) return false;
- return owner.inherited().get().temporaryImportedFields().get().hasField(fieldName);
+ return fields.get(fieldName) != null;
}
public Map<String, TemporaryImportedField> fields() {
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj
index 92633f61e67..b4d2af42f55 100644
--- a/config-model/src/main/javacc/SDParser.jj
+++ b/config-model/src/main/javacc/SDParser.jj
@@ -22,7 +22,7 @@ import com.yahoo.document.*;
import com.yahoo.documentmodel.*;
import com.yahoo.compress.Compressor;
import com.yahoo.compress.CompressionType;
-import com.yahoo.searchdefinition.Application;
+import com.yahoo.config.application.api.ApplicationPackage;
import com.yahoo.searchdefinition.DistributableResource;
import com.yahoo.searchdefinition.document.*;
import com.yahoo.searchdefinition.document.annotation.SDAnnotationType;
@@ -73,7 +73,7 @@ import java.util.logging.Level;
public class SDParser {
private DocumentTypeManager docMan = null;
- private Application application;
+ private ApplicationPackage applicationPackage;
private FileRegistry fileRegistry;
private DeployLogger deployLogger;
private ModelContext.Properties properties;
@@ -86,17 +86,17 @@ public class SDParser {
* @param documentsOnly true to only parse the document aspect of a schema (e.g skip rank profiles)
*/
public SDParser(SimpleCharStream stream,
+ ApplicationPackage applicationPackage,
FileRegistry fileRegistry,
DeployLogger deployLogger,
ModelContext.Properties properties,
- Application application,
RankProfileRegistry rankProfileRegistry,
boolean documentsOnly) {
this(stream);
+ this.applicationPackage = applicationPackage;
this.fileRegistry = fileRegistry;
this.deployLogger = deployLogger;
this.properties = properties;
- this.application = application;
this.rankProfileRegistry = rankProfileRegistry;
this.documentsOnly = documentsOnly;
}
@@ -423,7 +423,7 @@ Schema rootSchema(String dir) :
}
{
( ( <SCHEMA> | <SEARCH> ) name = identifier() (<INHERITS> inherited = identifier() )? {
- schema = new Schema(name, Optional.ofNullable(inherited), application, fileRegistry, deployLogger, properties);
+ schema = new Schema(name, applicationPackage, Optional.ofNullable(inherited), fileRegistry, deployLogger, properties);
rankProfileRegistry.add(new DefaultRankProfile(schema, rankProfileRegistry, schema.rankingConstants()));
rankProfileRegistry.add(new UnrankedRankProfile(schema, rankProfileRegistry, schema.rankingConstants()));}
lbrace() (rootSchemaItem(schema) (<NL>)*)* <RBRACE> (<NL>)* <EOF>)
@@ -464,7 +464,7 @@ Object rootSchemaItem(Schema schema) : { }
*/
Schema rootDocument(String dir) :
{
- Schema schema = new DocumentOnlySchema(application, fileRegistry, deployLogger, properties);
+ Schema schema = new DocumentOnlySchema(applicationPackage, fileRegistry, deployLogger, properties);
}
{
( (rootDocumentItem(schema) (<NL>)*)*<EOF> )
@@ -2561,7 +2561,7 @@ void constantTensor(RankProfile profile, String name) :
{
<LBRACE> (<NL>)*
(( tensorString = tensorValue() |
- tensorType = tensorTypeWithPrefix(constantTensorErrorMessage(profile.getName(), name)) ) (<NL>)* )* <RBRACE>
+ tensorType = tensorTypeWithPrefix(constantTensorErrorMessage(profile.name(), name)) ) (<NL>)* )* <RBRACE>
{
if (tensorType != null) {
profile.addConstantTensor(name, new TensorValue(Tensor.from(tensorType, tensorString)));
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();
}