aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-01-25 09:50:28 +0100
committerJon Bratseth <bratseth@gmail.com>2022-01-25 09:50:28 +0100
commitb7a8165a120311fdafe2f09a1cd39d8621c8891b (patch)
tree56b823acbea42edd5d2650b2aff4cbd04971040f /config-model
parent46be850bd8ecd8b38b4d54fa5f4bbeeef0997a2a (diff)
Simplify
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java13
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/test/MockApplicationPackage.java33
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java30
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/Deriver.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java24
-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/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/TwoStreamingStructsTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java2
-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/content/IndexingAndDocprocRoutingTest.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaClusterTest.java4
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java9
16 files changed, 72 insertions, 81 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
index 26c658d9668..300a77d4a6b 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
@@ -440,7 +440,9 @@ public class DeployState implements ConfigDefinitionStore {
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
QueryProfiles queryProfiles = new QueryProfilesBuilder().build(applicationPackage, logger);
SemanticRules semanticRules = new SemanticRuleBuilder().build(applicationPackage);
- Application application = createApplication(rankProfileRegistry, queryProfiles, validationParameters);
+ Application application = new ApplicationBuilder(applicationPackage, fileRegistry, logger, properties,
+ rankProfileRegistry, queryProfiles.getRegistry())
+ .build(! validationParameters.ignoreValidationErrors());
return new DeployState(application,
rankProfileRegistry,
fileRegistry,
@@ -465,15 +467,6 @@ public class DeployState implements ConfigDefinitionStore {
reindexing);
}
- private Application createApplication(RankProfileRegistry rankProfileRegistry,
- QueryProfiles queryProfiles,
- ValidationParameters validationParameters) {
- ApplicationBuilder builder = new ApplicationBuilder(applicationPackage, fileRegistry, logger, properties,
- rankProfileRegistry, queryProfiles.getRegistry());
- builder.importFromApplicationPackage();
- return builder.build(! validationParameters.ignoreValidationErrors());
- }
-
}
}
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 d35349afe4a..72a8f004b22 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
@@ -95,8 +95,8 @@ public class MockApplicationPackage implements ApplicationPackage {
/** Returns the root of this application package relative to the current dir */
protected File root() { return root; }
+ @SuppressWarnings("deprecation") // not redundant
@Override
- @SuppressWarnings("deprecation") // NOT redundant
public String getApplicationName() {
return "mock application";
}
@@ -118,23 +118,26 @@ public class MockApplicationPackage implements ApplicationPackage {
@Override
public List<NamedReader> getSchemas() {
ArrayList<NamedReader> readers = new ArrayList<>();
- ApplicationBuilder applicationBuilder = new ApplicationBuilder(this,
- new MockFileRegistry(),
- new BaseDeployLogger(),
- new TestProperties(),
- new RankProfileRegistry(),
- queryProfileRegistry);
- for (String sd : schemas) {
- try {
- String name = applicationBuilder.addSchema(sd).getName();
- readers.add(new NamedReader(name + ApplicationPackage.SD_NAME_SUFFIX, new StringReader(sd)));
- } catch (ParseException e) {
- throw new RuntimeException(e);
- }
- }
+ for (String sd : schemas)
+ readers.add(new NamedReader(extractSdName(sd) + ApplicationPackage.SD_NAME_SUFFIX, new StringReader(sd)));
return readers;
}
+ /** To avoid either double parsing or supplying a name explicitly */
+ private String extractSdName(String sd) {
+ String s = sd.split("\n")[0];
+ if (s.startsWith("schema"))
+ s = s.substring("schema".length()).trim();
+ else if (s.startsWith("search"))
+ s = s.substring("search".length()).trim();
+ else
+ throw new IllegalArgumentException("Expected the first line of a schema but got '" + sd + "'");
+ int end = s.indexOf(' ');
+ if (end < 0)
+ end = s.indexOf('}');
+ return s.substring(0, end).trim();
+ }
+
@Override
public Map<ConfigDefinitionKey, UnparsedConfigDefinition> getAllExistingConfigDefs() {
return Collections.emptyMap();
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java
index bc6df6121cd..033c0d819a1 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java
@@ -126,6 +126,8 @@ public class ApplicationBuilder {
this.deployLogger = deployLogger;
this.properties = properties;
this.documentsOnly = documentsOnly;
+ for (NamedReader reader : applicationPackage.getSchemas())
+ addSchema(reader);
}
/**
@@ -136,19 +138,13 @@ public class ApplicationBuilder {
* @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 Schema addSchemaFile(String fileName) throws IOException, ParseException {
+ public Schema add(String fileName) throws IOException, ParseException {
File file = new File(fileName);
return addSchema(IOUtils.readFile(file), file.getAbsoluteFile().getParent());
}
- private Schema addSchemaFile(Path file) throws IOException, ParseException {
- return addSchemaFile(file.toString());
- }
-
- public void importFromApplicationPackage() {
- for (NamedReader reader : applicationPackage.getSchemas()) {
- importFrom(reader);
- }
+ private Schema add(Path file) throws IOException, ParseException {
+ return add(file.toString());
}
/**
@@ -157,7 +153,7 @@ public class ApplicationBuilder {
*
* @param reader the reader whose content to import
*/
- private void importFrom(NamedReader reader) {
+ private void addSchema(NamedReader reader) {
try {
String schemaName = addSchema(IOUtils.readAll(reader), reader.getName()).getName();
String schemaFileName = stripSuffix(reader.getName(), ApplicationPackage.SD_NAME_SUFFIX);
@@ -197,7 +193,7 @@ public class ApplicationBuilder {
Schema schema = new SDParser(stream, applicationPackage, fileRegistry, deployLogger, properties,
rankProfileRegistry, documentsOnly)
.schema(documentTypeManager, schemaDir);
- addSchemaFile(schema);
+ add(schema);
return schema;
} catch (TokenMgrException e) {
throw new ParseException("Unknown symbol: " + e.getMessage());
@@ -214,7 +210,7 @@ public class ApplicationBuilder {
* @param schema the object to import
* @throws IllegalArgumentException if the given search object has already been processed
*/
- public void addSchemaFile(Schema schema) {
+ public void add(Schema schema) {
if (schema.getName() == null)
throw new IllegalArgumentException("Schema has no name");
schemas.add(schema);
@@ -386,7 +382,7 @@ public class ApplicationBuilder {
rankProfileRegistry,
queryprofileRegistry);
for (String fileName : fileNames) {
- builder.addSchemaFile(fileName);
+ builder.add(fileName);
}
builder.build(true);
return builder;
@@ -427,7 +423,7 @@ public class ApplicationBuilder {
rankProfileRegistry,
queryProfileRegistry);
for (Iterator<Path> i = Files.list(new File(dir).toPath()).filter(p -> p.getFileName().toString().endsWith(".sd")).iterator(); i.hasNext(); ) {
- builder.addSchemaFile(i.next());
+ builder.add(i.next());
}
builder.build(true);
return builder;
@@ -492,13 +488,13 @@ public class ApplicationBuilder {
*
* @param rawSchema the raw object to build from
* @return the built {@link ApplicationBuilder} object
- * @see #addSchemaFile(Schema)
+ * @see #add(Schema)
*/
public static ApplicationBuilder createFromRawSchema(Schema rawSchema,
RankProfileRegistry rankProfileRegistry,
QueryProfileRegistry queryProfileRegistry) {
ApplicationBuilder builder = new ApplicationBuilder(rankProfileRegistry, queryProfileRegistry);
- builder.addSchemaFile(rawSchema);
+ builder.add(rawSchema);
builder.build();
return builder;
}
@@ -508,7 +504,7 @@ public class ApplicationBuilder {
*
* @param rawSchema the raw object to build from
* @return the built {@link Schema} object
- * @see #addSchemaFile(Schema)
+ * @see #add(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 475631f9241..cf9d46ae985 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 {
ApplicationBuilder builder = new ApplicationBuilder();
try {
for (String schema : schemas)
- builder.addSchemaFile(schema);
+ builder.add(schema);
} catch (ParseException | IOException e) {
throw new IllegalArgumentException(e);
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/SchemaImporterTestCase.java
index 1d01fd8cafa..31b47e4c719 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();
ApplicationBuilder sb = new ApplicationBuilder(rankProfileRegistry, new QueryProfileRegistry());
- sb.addSchemaFile("src/test/examples/simple.sd");
+ sb.add("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/derived/ExportingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java
index 48f0c862468..1bb02ca36ec 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
@@ -145,8 +145,8 @@ public class ExportingTestCase extends AbstractExportingTestCase {
public void testTensor2() throws IOException, ParseException {
String dir = "src/test/derived/tensor2/";
ApplicationBuilder builder = new ApplicationBuilder();
- builder.addSchemaFile(dir + "first.sd");
- builder.addSchemaFile(dir + "second.sd");
+ builder.add(dir + "first.sd");
+ builder.add(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/InheritanceTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/InheritanceTestCase.java
index 13de3f95fa5..fcc2d116690 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
@@ -42,8 +42,8 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
public void requireThatIndexedStructFieldCanBeInherited() throws IOException, ParseException {
String dir = "src/test/derived/inheritstruct/";
ApplicationBuilder builder = new ApplicationBuilder();
- builder.addSchemaFile(dir + "parent.sd");
- builder.addSchemaFile(dir + "child.sd");
+ builder.add(dir + "parent.sd");
+ builder.add(dir + "child.sd");
builder.build();
derive("inheritstruct", builder, builder.getSchema("child"));
assertCorrectConfigFiles("inheritstruct");
@@ -67,7 +67,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
ApplicationBuilder builder = new ApplicationBuilder();
for (int fileIdx = startIdx; fileIdx < startIdx + files.size(); ++fileIdx) {
String fileName = files.get(fileIdx % files.size());
- builder.addSchemaFile(dir + fileName);
+ builder.add(dir + fileName);
}
builder.build();
DocumentmanagerConfig.Builder b = new DocumentmanagerConfig.Builder();
@@ -112,8 +112,8 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
public void requireThatStructTypesAreInheritedFromParent() throws IOException, ParseException {
String dir = "src/test/derived/inheritfromparent/";
ApplicationBuilder builder = new ApplicationBuilder();
- builder.addSchemaFile(dir + "parent.sd");
- builder.addSchemaFile(dir + "child.sd");
+ builder.add(dir + "parent.sd");
+ builder.add(dir + "child.sd");
builder.build();
derive("inheritfromparent", builder, builder.getSchema("child"));
assertCorrectConfigFiles("inheritfromparent");
@@ -123,9 +123,9 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
public void requireThatStructTypesAreInheritedFromGrandParent() throws IOException, ParseException {
String dir = "src/test/derived/inheritfromgrandparent/";
ApplicationBuilder builder = new ApplicationBuilder();
- builder.addSchemaFile(dir + "grandparent.sd");
- builder.addSchemaFile(dir + "parent.sd");
- builder.addSchemaFile(dir + "child.sd");
+ builder.add(dir + "grandparent.sd");
+ builder.add(dir + "parent.sd");
+ builder.add(dir + "child.sd");
builder.build();
derive("inheritfromgrandparent", builder, builder.getSchema("child"));
assertCorrectConfigFiles("inheritfromgrandparent");
@@ -135,10 +135,10 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
public void testInheritance() throws IOException, ParseException {
String dir = "src/test/derived/inheritance/";
ApplicationBuilder builder = new ApplicationBuilder();
- builder.addSchemaFile(dir + "grandparent.sd");
- builder.addSchemaFile(dir + "father.sd");
- builder.addSchemaFile(dir + "mother.sd");
- builder.addSchemaFile(dir + "child.sd");
+ builder.add(dir + "grandparent.sd");
+ builder.add(dir + "father.sd");
+ builder.add(dir + "mother.sd");
+ builder.add(dir + "child.sd");
builder.build();
derive("inheritance", builder, builder.getSchema("child"));
assertCorrectConfigFiles("inheritance");
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 53bf55fc73f..6ae4f625bb3 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/";
ApplicationBuilder sb = new ApplicationBuilder();
- sb.addSchemaFile(dir + "mail.sd");
+ sb.add(dir + "mail.sd");
assertCorrectDeriving(sb, dir, new TestableDeployLogger());
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SimpleInheritTestCase.java
index 8a4e403072b..8d5ee7e5405 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 + "/";
ApplicationBuilder builder = new ApplicationBuilder();
- builder.addSchemaFile(expectedResultsDirName + "parent.sd");
- builder.addSchemaFile(expectedResultsDirName + "child.sd");
+ builder.add(expectedResultsDirName + "parent.sd");
+ builder.add(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 c684ec17e42..1141eec1820 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/";
ApplicationBuilder builder = new ApplicationBuilder();
- builder.addSchemaFile(dir + "simple.sd");
+ builder.add(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/";
ApplicationBuilder builder = new ApplicationBuilder();
- builder.addSchemaFile(dir + "bad.sd");
+ builder.add(dir + "bad.sd");
builder.build();
derive("structinheritance", builder, builder.getSchema("bad"));
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/TwoStreamingStructsTestCase.java
index 53948e2d5c8..7e0b3bddbc4 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";
ApplicationBuilder builder = new ApplicationBuilder();
- builder.addSchemaFile(root + "/streamingstruct.sd");
- builder.addSchemaFile(root + "/whatever.sd");
+ builder.add(root + "/streamingstruct.sd");
+ builder.add(root + "/whatever.sd");
builder.build();
assertCorrectDeriving(builder, builder.getSchema("streamingstruct"), root);
builder = new ApplicationBuilder();
- builder.addSchemaFile(root + "/streamingstruct.sd");
- builder.addSchemaFile(root + "/whatever.sd");
+ builder.add(root + "/streamingstruct.sd");
+ builder.add(root + "/whatever.sd");
builder.build();
assertCorrectDeriving(builder, builder.getSchema("streamingstruct"), root);
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ImplicitSchemaFieldsTestCase.java
index cfc1779ded0..62f805f7b62 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 {
ApplicationBuilder sb = new ApplicationBuilder();
- sb.addSchemaFile("src/test/examples/nextgen/simple.sd");
+ sb.add("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/vespa/documentmodel/DocumentModelBuilderTestCase.java b/config-model/src/test/java/com/yahoo/vespa/documentmodel/DocumentModelBuilderTestCase.java
index 857a1499264..6fbe73011df 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 {
ApplicationBuilder search = new ApplicationBuilder();
- search.addSchemaFile("src/test/configmodel/types/other_doc.sd");
- search.addSchemaFile("src/test/configmodel/types/type_with_doc_field.sd");
+ search.add("src/test/configmodel/types/other_doc.sd");
+ search.add("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 {
ApplicationBuilder search = new ApplicationBuilder();
- 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.add("src/test/cfg/search/data/travel/schemas/TTData.sd");
+ search.add("src/test/cfg/search/data/travel/schemas/TTEdge.sd");
+ search.add("src/test/cfg/search/data/travel/schemas/TTPOI.sd");
search.build();
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java
index cea8d724c30..bcb197ed540 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java
@@ -444,7 +444,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
for (SearchClusterSpec cluster : searchClusterSpecs) {
for (SearchDefSpec def : cluster.searchDefs) {
- sds.add(ApplicationPackageUtils.generateSearchDefinition(def.typeName, def.field1Name, def.field2Name));
+ sds.add(ApplicationPackageUtils.generateSchema(def.typeName, def.field1Name, def.field2Name));
}
}
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 8aa75d9c1e9..27c2e5f8937 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
@@ -58,8 +58,8 @@ public class SchemaClusterTest {
schema2.addDocument(sdt2);
ApplicationBuilder builder = new ApplicationBuilder();
- builder.addSchemaFile(schema1);
- builder.addSchemaFile(schema2);
+ builder.add(schema1);
+ builder.add(schema2);
builder.build();
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java
index 1992b01788f..3a5bb3dc1b3 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java
@@ -11,10 +11,9 @@ import java.util.List;
*/
public class ApplicationPackageUtils {
- public static String generateSearchDefinition(String name, String field1, String field2) {
- return "" +
- "search " + name + "{" +
- " document " + name + "{" +
+ public static String generateSchema(String name, String field1, String field2) {
+ return "schema " + name + " {" +
+ " document " + name + " {" +
" field " + field1 + " type string {\n" +
" indexing: index | summary\n" +
" summary: dynamic\n" +
@@ -51,7 +50,7 @@ public class ApplicationPackageUtils {
List<String> sds = new ArrayList<>();
int i = 0;
for (String sdName : sdNames) {
- sds.add(generateSearchDefinition(sdName, "f" + (i + 1), "f" + (i + 2)));
+ sds.add(generateSchema(sdName, "f" + (i + 1), "f" + (i + 2)));
i = i + 2;
}
return sds;