diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-03-07 13:40:05 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-03-07 13:50:27 +0000 |
commit | b01d4f920079471bc830c7bb464a3fd0dda8b64c (patch) | |
tree | 3124914b42a53b2f994acad098f5d4646ee0d0ec /config-model/src | |
parent | d0ef3da03680e2f34660154f12efff0b4a9d13ed (diff) |
unit test re-declarning summary field
Diffstat (limited to 'config-model/src')
5 files changed, 21 insertions, 3 deletions
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 e9939a53fc5..67d8d679275 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/ApplicationBuilder.java @@ -426,7 +426,7 @@ public class ApplicationBuilder { } /** - * Convenience factory methdd to create a SearchBuilder from multiple SD files. Only for testing. + * Convenience factory methods to create a SearchBuilder from multiple SD files. Only for testing. */ public static ApplicationBuilder createFromFiles(Collection<String> fileNames) throws IOException, ParseException { return createFromFiles(fileNames, new BaseDeployLogger()); diff --git a/config-model/src/test/examples/multiplesummaries.sd b/config-model/src/test/examples/multiplesummaries.sd index 07ab3c5a104..83e817718aa 100644 --- a/config-model/src/test/examples/multiplesummaries.sd +++ b/config-model/src/test/examples/multiplesummaries.sd @@ -28,6 +28,11 @@ search multiplesummaries { summary field3 type array<int> { } + # TODO disallow duplicates + summary field1 type weightedset<string> { + source: field1 + } + } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/MultipleSummariesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/MultipleSummariesTestCase.java index 0fcc6e09b02..1bf07aff9d5 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/MultipleSummariesTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/MultipleSummariesTestCase.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.deploy.TestProperties; import com.yahoo.searchdefinition.parser.ParseException; import org.junit.Test; @@ -12,8 +13,11 @@ import java.io.IOException; * @author bratseth */ public class MultipleSummariesTestCase extends AbstractSchemaTestCase { + @Test public void testArrayImporting() throws IOException, ParseException { - ApplicationBuilder.buildFromFile("src/test/examples/multiplesummaries.sd"); + var builder = new ApplicationBuilder(new TestProperties().setExperimentalSdParsing(true)); + builder.addSchemaFile("src/test/examples/multiplesummaries.sd"); + builder.build(true); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java index 2ce88e2148d..231881114b5 100755 --- a/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/StructTestCase.java @@ -1,3 +1,4 @@ + // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.searchdefinition; diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/MultipleSummariesTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/MultipleSummariesTestCase.java index 0e6d7b8442f..b13e88f5f1f 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/MultipleSummariesTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/MultipleSummariesTestCase.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.deploy.TestProperties; import com.yahoo.searchdefinition.parser.ParseException; import org.junit.Test; @@ -14,6 +15,13 @@ import java.io.IOException; public class MultipleSummariesTestCase extends AbstractExportingTestCase { @Test public void testMultipleSummaries() throws IOException, ParseException { - assertCorrectDeriving("multiplesummaries"); + assertCorrectDeriving("multiplesummaries", + new TestProperties().setExperimentalSdParsing(false)); + } + + @Test + public void testMultipleSummariesNew() throws IOException, ParseException { + assertCorrectDeriving("multiplesummaries", + new TestProperties().setExperimentalSdParsing(true)); } } |