aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/schema
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/test/java/com/yahoo/schema')
-rw-r--r--config-model/src/test/java/com/yahoo/schema/AttributeUtils.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/DocumentGraphValidatorTest.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/DocumentReferenceResolverTest.java14
-rw-r--r--config-model/src/test/java/com/yahoo/schema/ImportedFieldsEnumeratorTest.java2
-rw-r--r--config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/AttributeListTestCase.java35
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/IdTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java3
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java6
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java16
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java36
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/TypeConversionTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/VsmFieldsTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/AddDataTypeAndTransformToSummaryOfImportedFieldsTest.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/AddExtraFieldsToDocumentTest.java13
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ImplicitSchemaFieldsTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ImplicitStructTypesTestCase.java9
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/IndexingOutputsTestCase.java2
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java17
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ParentChildSearchModel.java5
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTransformerTokensTestCase.java13
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java11
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/ValidateFieldTypesTest.java4
27 files changed, 128 insertions, 102 deletions
diff --git a/config-model/src/test/java/com/yahoo/schema/AttributeUtils.java b/config-model/src/test/java/com/yahoo/schema/AttributeUtils.java
index 69e7e14b3be..9ae24d6bfd4 100644
--- a/config-model/src/test/java/com/yahoo/schema/AttributeUtils.java
+++ b/config-model/src/test/java/com/yahoo/schema/AttributeUtils.java
@@ -8,8 +8,8 @@ import com.yahoo.schema.document.SDField;
*/
public class AttributeUtils {
- public static void addAttributeAspect(SDField field) {
- field.parseIndexingScript("{ attribute }");
+ public static void addAttributeAspect(String schemaName, SDField field) {
+ field.parseIndexingScript(schemaName, "{ attribute }");
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/DocumentGraphValidatorTest.java b/config-model/src/test/java/com/yahoo/schema/DocumentGraphValidatorTest.java
index defc7e59080..88761fc5d3f 100644
--- a/config-model/src/test/java/com/yahoo/schema/DocumentGraphValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/DocumentGraphValidatorTest.java
@@ -9,7 +9,6 @@ import com.yahoo.schema.document.TemporarySDField;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -142,14 +141,13 @@ public class DocumentGraphValidatorTest {
Schema campaignSchema = new Schema(name, MockApplicationPackage.createEmpty());
SDDocumentType document = new SDDocumentType(name);
campaignSchema.addDocument(document);
- document.setDocumentReferences(new DocumentReferences(Collections.emptyMap()));
+ document.setDocumentReferences(new DocumentReferences(Map.of()));
Arrays.stream(parents)
.map(Schema::getDocument)
.forEach(document::inherit);
return campaignSchema;
}
- @SuppressWarnings("deprecation")
private static void createDocumentReference(Schema from, Schema to, String refFieldName) {
SDDocumentType fromDocument = from.getDocument();
SDField refField = new TemporarySDField(fromDocument, refFieldName, NewDocumentReferenceDataType.forDocumentName(to.getName()));
diff --git a/config-model/src/test/java/com/yahoo/schema/DocumentReferenceResolverTest.java b/config-model/src/test/java/com/yahoo/schema/DocumentReferenceResolverTest.java
index 76006ad28d7..99946406344 100644
--- a/config-model/src/test/java/com/yahoo/schema/DocumentReferenceResolverTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/DocumentReferenceResolverTest.java
@@ -8,10 +8,9 @@ import com.yahoo.schema.document.SDDocumentType;
import com.yahoo.schema.document.SDField;
import org.junit.jupiter.api.Test;
+import java.util.List;
import java.util.Map;
-import static java.util.Arrays.asList;
-import static java.util.Collections.singletonList;
import static org.junit.jupiter.api.Assertions.*;
/**
@@ -34,13 +33,13 @@ public class DocumentReferenceResolverTest {
SDDocumentType fooDocument = new SDDocumentType("foo", fooSchema);
SDField fooRefToBarField = new SDField
(fooDocument, "bar_ref", new NewDocumentReferenceDataType(barDocument.getDocumentType()));
- AttributeUtils.addAttributeAspect(fooRefToBarField);
+ AttributeUtils.addAttributeAspect(fooSchema.getName(), fooRefToBarField);
SDField irrelevantField = new SDField(fooDocument, "irrelevant_stuff", DataType.INT);
fooDocument.addField(fooRefToBarField);
fooDocument.addField(irrelevantField);
fooSchema.addDocument(fooDocument);
- DocumentReferenceResolver resolver = new DocumentReferenceResolver(asList(fooSchema, barSchema));
+ DocumentReferenceResolver resolver = new DocumentReferenceResolver(List.of(fooSchema, barSchema));
resolver.resolveReferences(fooDocument);
assertTrue(fooDocument.getDocumentReferences().isPresent());
@@ -50,7 +49,6 @@ public class DocumentReferenceResolverTest {
assertSame(fooRefToBarField, fooReferenceMap.get("bar_ref").referenceField());
}
- @SuppressWarnings("deprecation")
@Test
void throws_user_friendly_exception_if_referenced_document_does_not_exist() {
Throwable exception = assertThrows(IllegalArgumentException.class, () -> {
@@ -60,11 +58,11 @@ public class DocumentReferenceResolverTest {
SDField fooRefToBarField = new SDField(
fooDocument,
"bar_ref", NewDocumentReferenceDataType.forDocumentName("bar"));
- AttributeUtils.addAttributeAspect(fooRefToBarField);
+ AttributeUtils.addAttributeAspect(fooSchema.getName(), fooRefToBarField);
fooDocument.addField(fooRefToBarField);
fooSchema.addDocument(fooDocument);
- DocumentReferenceResolver resolver = new DocumentReferenceResolver(singletonList(fooSchema));
+ DocumentReferenceResolver resolver = new DocumentReferenceResolver(List.of(fooSchema));
resolver.resolveReferences(fooDocument);
});
assertTrue(exception.getMessage().contains("Invalid document reference 'bar_ref': Could not find document type 'bar'"));
@@ -86,7 +84,7 @@ public class DocumentReferenceResolverTest {
fooDocument.addField(fooRefToBarField);
fooSchema.addDocument(fooDocument);
- DocumentReferenceResolver resolver = new DocumentReferenceResolver(asList(fooSchema, barSchema));
+ DocumentReferenceResolver resolver = new DocumentReferenceResolver(List.of(fooSchema, barSchema));
resolver.resolveReferences(fooDocument);
});
assertTrue(exception.getMessage().contains("The field 'bar_ref' is an invalid document reference. The field must be an attribute."));
diff --git a/config-model/src/test/java/com/yahoo/schema/ImportedFieldsEnumeratorTest.java b/config-model/src/test/java/com/yahoo/schema/ImportedFieldsEnumeratorTest.java
index 8c0b8c32d81..b96a43e9b53 100644
--- a/config-model/src/test/java/com/yahoo/schema/ImportedFieldsEnumeratorTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/ImportedFieldsEnumeratorTest.java
@@ -22,7 +22,7 @@ public class ImportedFieldsEnumeratorTest {
Schema parentSchema = new Schema(PARENT, MockApplicationPackage.createEmpty());
SDDocumentType parentDocument = new SDDocumentType(PARENT, parentSchema);
var parentField = new SDField(parentDocument, "their_field", DataType.INT);
- AttributeUtils.addAttributeAspect(parentField);
+ AttributeUtils.addAttributeAspect(parentSchema.getName(), parentField);
parentDocument.addField(parentField);
parentSchema.addDocument(parentDocument);
diff --git a/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java b/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java
index a11e743b4d2..6252fe62a1d 100644
--- a/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/SchemaImporterTestCase.java
@@ -40,7 +40,7 @@ public class SchemaImporterTestCase extends AbstractSchemaTestCase {
SDDocumentType document = schema.getDocument();
assertEquals("simple", document.getName());
- assertEquals(20, document.getFieldCount());
+ assertEquals(19, document.getFieldCount());
SDField field;
Attribute attribute;
diff --git a/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java b/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java
index 6442edd547d..8ffbab84fd7 100644
--- a/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/SummaryTestCase.java
@@ -359,7 +359,7 @@ public class SummaryTestCase {
ApplicationBuilder.createFromStrings(logger, sd);
if (explicit) {
assertEquals(1, logger.entries.size());
- assertEquals(Level.FINE, logger.entries.get(0).level);
+ assertEquals(Level.WARNING, logger.entries.get(0).level);
assertEquals("For schema 'test', field 'foo', summary 'bar':" +
" Specifying the type is deprecated, ignored and will be an error in Vespa 9." +
" Remove the type specification to silence this warning.", logger.entries.get(0).message);
@@ -392,7 +392,7 @@ public class SummaryTestCase {
ApplicationBuilder.createFromStrings(logger, sd);
if (explicit) {
assertEquals(1, logger.entries.size());
- assertEquals(Level.FINE, logger.entries.get(0).level);
+ assertEquals(Level.WARNING, logger.entries.get(0).level);
assertEquals("For schema 'test', document-summary 'bar', summary field 'foo':" +
" Specifying the type is deprecated, ignored and will be an error in Vespa 9." +
" Remove the type specification to silence this warning.", logger.entries.get(0).message);
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/AttributeListTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/AttributeListTestCase.java
index 0cfb9474365..f21999df94c 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/AttributeListTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/AttributeListTestCase.java
@@ -14,6 +14,7 @@ import java.util.Iterator;
import static com.yahoo.config.model.test.TestUtil.joinLines;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* Tests attribute deriving
@@ -126,4 +127,38 @@ public class AttributeListTestCase extends AbstractSchemaTestCase {
assertFalse(attributes.hasNext());
}
+ @Test
+ void bad_map_attribute() throws ParseException {
+ run_bad_struct_or_map_attribute("map<string,string>");
+ }
+
+ @Test
+ void bad_array_of_struct_attribute() throws ParseException {
+ run_bad_struct_or_map_attribute("array<s>");
+ }
+
+ private void run_bad_struct_or_map_attribute(String type) throws ParseException {
+ run_bad_struct_or_map_attribute(type, false, true);
+ run_bad_struct_or_map_attribute(type, true, false);
+ run_bad_struct_or_map_attribute(type, true, true);
+ }
+
+ private void run_bad_struct_or_map_attribute(String type, boolean fs, boolean ilscript) throws ParseException {
+ var exception = assertThrows(IllegalArgumentException.class, () -> ApplicationBuilder.createFromString(
+ joinLines("search test {",
+ " document test {",
+ " struct s {",
+ " field a type string { }",
+ " }",
+ " field metadata type " + type + " {",
+ " indexing: summary" + (ilscript ? "| attribute" : ""),
+ " " + (fs ? "attribute: fast-search" : ""),
+ " }",
+ " }",
+ "}")).getSchema());
+ assertEquals("For schema 'test': Field 'metadata' of type '" + type + "' cannot be an attribute." +
+ " Instead specify the struct fields to be searchable as attribute",
+ exception.getMessage());
+ }
+
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/IdTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/IdTestCase.java
index 188017e0af1..60adf7cbaf0 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/IdTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/IdTestCase.java
@@ -30,7 +30,7 @@ public class IdTestCase extends AbstractExportingTestCase {
SDDocumentType document = new SDDocumentType("test");
schema.addDocument(document);
SDField uri = new SDField(document, "URI", DataType.URI);
- uri.parseIndexingScript("{ summary | index }");
+ uri.parseIndexingScript(schema.getName(), "{ summary | index }");
document.addField(uri);
new Processing().process(schema, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(),
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java
index 766c19bd01c..596ea99c36d 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/IndexSchemaTestCase.java
@@ -6,7 +6,6 @@ import com.yahoo.document.Field;
import com.yahoo.document.StructDataType;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -194,7 +193,7 @@ public class IndexSchemaTestCase {
private static void assertFlat(Field fieldToFlatten, Field... expectedFields) {
List<Field> actual = new LinkedList<>(IndexSchema.flattenField(fieldToFlatten));
- List<Field> expected = new LinkedList<>(Arrays.asList(expectedFields));
+ List<Field> expected = new LinkedList<>(List.of(expectedFields));
Collections.sort(actual);
Collections.sort(expected);
for (Field field : actual) {
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java
index 472fa58230e..b1dc2e66bee 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/InheritanceTestCase.java
@@ -65,7 +65,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
derive("inheritdiamond", builder, builder.getSchema("child"));
assertCorrectConfigFiles("inheritdiamond");
}
- List<String> files = Arrays.asList("grandparent.sd", "mother.sd", "father.sd", "child.sd");
+ List<String> files = List.of("grandparent.sd", "mother.sd", "father.sd", "child.sd");
File outDir = newFolder(tmpDir, "out");
for (int startIdx = 0; startIdx < files.size(); ++startIdx) {
var builder = new ApplicationBuilder(new TestProperties());
@@ -159,7 +159,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
Schema parentSchema = new Schema("parent", MockApplicationPackage.createEmpty());
parentSchema.addDocument(parent);
SDField prefixed = parent.addField("prefixed", DataType.STRING);
- prefixed.parseIndexingScript("{ index }");
+ prefixed.parseIndexingScript(parentSchema.getName(), "{ index }");
prefixed.addIndex(new Index("prefixed", true));
SDDocumentType child = new SDDocumentType("child");
@@ -175,7 +175,7 @@ public class InheritanceTestCase extends AbstractExportingTestCase {
@Test
void testInheritStructDiamondNew() throws IOException, ParseException {
String dir = "src/test/derived/declstruct/";
- List<String> files = Arrays.asList("common.sd", "foo.sd", "bar.sd", "foobar.sd");
+ List<String> files = List.of("common.sd", "foo.sd", "bar.sd", "foobar.sd");
var builder = new ApplicationBuilder(new TestProperties());
for (String fileName : files) {
builder.addSchemaFile(dir + fileName);
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java
index 97a3f06ac64..505960256b8 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java
@@ -15,7 +15,7 @@ import com.yahoo.schema.processing.Processing;
import com.yahoo.vespa.model.container.search.QueryProfiles;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
+import java.util.List;
import java.util.Set;
import static com.yahoo.schema.processing.AssertIndexingScript.assertIndexing;
@@ -36,7 +36,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
SDDocumentType document = new SDDocumentType("literalboost");
schema.addDocument(document);
SDField field1 = document.addField("a", DataType.STRING);
- field1.parseIndexingScript("{ index }");
+ field1.parseIndexingScript(schema.getName(), "{ index }");
field1.setLiteralBoost(20);
RankProfile other = new RankProfile("other", schema, rankProfileRegistry);
rankProfileRegistry.add(other);
@@ -50,7 +50,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
derived.getAttributeFields(); // TODO: assert content
// Check il script addition
- assertIndexing(Arrays.asList("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }",
+ assertIndexing(List.of("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }",
"clear_state | guard { input a | tokenize | index a_literal; }"),
schema);
@@ -69,7 +69,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
SDDocumentType document = new SDDocumentType("literalboost");
schema.addDocument(document);
SDField field1 = document.addField("a", DataType.STRING);
- field1.parseIndexingScript("{ index }");
+ field1.parseIndexingScript(schema.getName(), "{ index }");
RankProfile other = new RankProfile("other", schema, rankProfileRegistry);
rankProfileRegistry.add(other);
other.addRankSetting(new RankProfile.RankSetting("a", RankProfile.RankSetting.Type.LITERALBOOST, 333));
@@ -78,7 +78,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
DerivedConfiguration derived = new DerivedConfiguration(schema, rankProfileRegistry);
// Check il script addition
- assertIndexing(Arrays.asList("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }",
+ assertIndexing(List.of("clear_state | guard { input a | tokenize normalize stem:\"BEST\" | index a; }",
"clear_state | guard { input a | tokenize | index a_literal; }"),
schema);
@@ -95,15 +95,15 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
SDDocumentType document = new SDDocumentType("msb");
schema.addDocument(document);
SDField field1 = document.addField("title", DataType.STRING);
- field1.parseIndexingScript("{ summary | index }");
+ field1.parseIndexingScript(schema.getName(), "{ summary | index }");
field1.setLiteralBoost(20);
SDField field2 = document.addField("body", DataType.STRING);
- field2.parseIndexingScript("{ summary | index }");
+ field2.parseIndexingScript(schema.getName(), "{ summary | index }");
field2.setLiteralBoost(20);
schema = ApplicationBuilder.buildFromRawSchema(schema, rankProfileRegistry, new QueryProfileRegistry());
new DerivedConfiguration(schema, rankProfileRegistry);
- assertIndexing(Arrays.asList("clear_state | guard { input title | tokenize normalize stem:\"BEST\" | summary title | index title; }",
+ assertIndexing(List.of("clear_state | guard { input title | tokenize normalize stem:\"BEST\" | summary title | index title; }",
"clear_state | guard { input body | tokenize normalize stem:\"BEST\" | summary body | index body; }",
"clear_state | guard { input title | tokenize | index title_literal; }",
"clear_state | guard { input body | tokenize | index body_literal; }"),
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java
index 593f26eb074..8ae6ada7a63 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java
@@ -12,13 +12,11 @@ import com.yahoo.schema.document.SDField;
import com.yahoo.schema.document.TemporarySDField;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import static java.util.Collections.emptyMap;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
@@ -63,7 +61,7 @@ public class SchemaOrdererTestCase extends AbstractSchemaTestCase {
private static Schema createSchema(String name, Map<String, Schema> schemas) {
Schema schema = new Schema(name, MockApplicationPackage.createEmpty());
SDDocumentType document = new SDDocumentType(name);
- document.setDocumentReferences(new DocumentReferences(emptyMap()));
+ document.setDocumentReferences(new DocumentReferences(Map.of()));
schema.addDocument(document);
schemas.put(schema.getName(), schema);
return schema;
@@ -74,9 +72,8 @@ public class SchemaOrdererTestCase extends AbstractSchemaTestCase {
}
private static void assertOrder(List<String> expectedSearchOrder, List<String> inputNames) {
- inputNames.sort((a, b) -> a.compareTo(b));
Map<String, Schema> schemas = createSchemas();
- List<Schema> inputSchemas = inputNames.stream()
+ List<Schema> inputSchemas = inputNames.stream().sorted()
.map(schemas::get)
.map(Objects::requireNonNull)
.toList();
@@ -88,7 +85,6 @@ public class SchemaOrdererTestCase extends AbstractSchemaTestCase {
assertEquals(expectedSearchOrder, actualSearchOrder);
}
- @SuppressWarnings("deprecation")
private static void createDocumentReference(Schema from, Schema to, String refFieldName) {
SDDocumentType fromDocument = from.getDocument();
SDField refField = new TemporarySDField(fromDocument, refFieldName, NewDocumentReferenceDataType.forDocumentName(to.getName()));
@@ -102,44 +98,44 @@ public class SchemaOrdererTestCase extends AbstractSchemaTestCase {
@Test
void testPerfectOrderingIsKept() {
- assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("grandParent", "mother", "father", "daughter", "son", "product", "pc", "alone"));
+ assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
+ List.of("grandParent", "mother", "father", "daughter", "son", "product", "pc", "alone"));
}
@Test
void testOneLevelReordering() {
- assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("grandParent", "daughter", "son", "mother", "father", "pc", "product", "alone"));
+ assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
+ List.of("grandParent", "daughter", "son", "mother", "father", "pc", "product", "alone"));
}
@Test
void testMultiLevelReordering() {
- assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("daughter", "son", "mother", "father", "grandParent", "pc", "product", "alone"));
+ assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
+ List.of("daughter", "son", "mother", "father", "grandParent", "pc", "product", "alone"));
}
@Test
void testAloneIsKeptInPlaceWithMultiLevelReordering() {
- assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("alone", "daughter", "son", "mother", "father", "grandParent", "pc", "product"));
+ assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
+ List.of("alone", "daughter", "son", "mother", "father", "grandParent", "pc", "product"));
}
@Test
void testPartialMultiLevelReordering() {
- assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("daughter", "grandParent", "mother", "son", "father", "product", "pc", "alone"));
+ assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
+ List.of("daughter", "grandParent", "mother", "son", "father", "product", "pc", "alone"));
}
@Test
void testMultilevelReorderingAccrossHierarchies() {
- assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
- Arrays.asList("daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone"));
+ assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "son"),
+ List.of("daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone"));
}
@Test
void referees_are_ordered_before_referrer() {
- assertOrder(Arrays.asList("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "accessory-pc", "son"),
- Arrays.asList("accessory-pc", "daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone"));
+ assertOrder(List.of("alone", "grandParent", "mother", "father", "daughter", "product", "pc", "accessory-pc", "son"),
+ List.of("accessory-pc", "daughter", "pc", "son", "mother", "grandParent", "father", "product", "alone"));
}
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java
index a27bc824b45..63510785ca5 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/SummaryTestCase.java
@@ -172,7 +172,7 @@ public class SummaryTestCase extends AbstractSchemaTestCase {
schema.addDocument(document);
String fieldName = "location";
SDField field = document.addField(fieldName, PositionDataType.INSTANCE);
- field.parseIndexingScript("{ attribute | summary }");
+ field.parseIndexingScript(schema.getName(), "{ attribute | summary }");
new Processing().process(schema, new BaseDeployLogger(), new RankProfileRegistry(), new QueryProfiles(),
true, false, Set.of());
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/TypeConversionTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/TypeConversionTestCase.java
index d2b3acc9a1e..cdfe376416b 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/TypeConversionTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/TypeConversionTestCase.java
@@ -32,7 +32,7 @@ public class TypeConversionTestCase extends AbstractSchemaTestCase {
SDDocumentType document = new SDDocumentType("test");
schema.addDocument(document);
SDField a = new SDField(document, "a", DataType.STRING);
- a.parseIndexingScript("{ index }");
+ a.parseIndexingScript(schema.getName(), "{ index }");
document.addField(a);
new Processing().process(schema, new BaseDeployLogger(), rankProfileRegistry, new QueryProfiles(),
diff --git a/config-model/src/test/java/com/yahoo/schema/derived/VsmFieldsTestCase.java b/config-model/src/test/java/com/yahoo/schema/derived/VsmFieldsTestCase.java
index 852f567ccfa..a90b4fa8d9f 100644
--- a/config-model/src/test/java/com/yahoo/schema/derived/VsmFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/derived/VsmFieldsTestCase.java
@@ -46,7 +46,7 @@ public class VsmFieldsTestCase {
void reference_type_field_is_unsearchable() {
Schema schema = createSchema();
SDField field = new TemporarySDField(schema.getDocument(), "ref_field", NewDocumentReferenceDataType.forDocumentName("parent_type"));
- field.parseIndexingScript("{ summary }");
+ field.parseIndexingScript(schema.getName(), "{ summary }");
schema.getDocument().addField(field);
VsmfieldsConfig cfg = vsmfieldsConfig(schema);
@@ -59,7 +59,7 @@ public class VsmFieldsTestCase {
private void testIndexMatching(Matching matching, VsmfieldsConfig.Fieldspec.Normalize.Enum normalize, String arg1) {
Schema schema = createSchema();
SDField field = new TemporarySDField(schema.getDocument(), "f", DataType.STRING);
- field.parseIndexingScript("{ index }");
+ field.parseIndexingScript(schema.getName(), "{ index }");
field.setMatching(matching);
schema.getDocument().addField(field);
VsmfieldsConfig cfg = vsmfieldsConfig(schema);
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/AddDataTypeAndTransformToSummaryOfImportedFieldsTest.java b/config-model/src/test/java/com/yahoo/schema/processing/AddDataTypeAndTransformToSummaryOfImportedFieldsTest.java
index f09a95b89a0..3da6f250853 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/AddDataTypeAndTransformToSummaryOfImportedFieldsTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/AddDataTypeAndTransformToSummaryOfImportedFieldsTest.java
@@ -19,7 +19,7 @@ import com.yahoo.vespa.documentmodel.SummaryField;
import com.yahoo.vespa.documentmodel.SummaryTransform;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
+import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -63,7 +63,7 @@ public class AddDataTypeAndTransformToSummaryOfImportedFieldsTest {
SDField targetField = new SDField(doc, "target_field", DataType.INT);
DocumentReference documentReference = new DocumentReference(new Field("reference_field"), targetSchema);
ImportedField importedField = new ImportedSimpleField(fieldName, documentReference, targetField);
- return new ImportedFields(Collections.singletonMap(fieldName, importedField));
+ return new ImportedFields(Map.of(fieldName, importedField));
}
private static DocumentSummary createDocumentSummary(String fieldName, Schema schema) {
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/AddExtraFieldsToDocumentTest.java b/config-model/src/test/java/com/yahoo/schema/processing/AddExtraFieldsToDocumentTest.java
index aad6df62993..27e9aae04b5 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/AddExtraFieldsToDocumentTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/AddExtraFieldsToDocumentTest.java
@@ -43,9 +43,9 @@ public class AddExtraFieldsToDocumentTest {
assertSummary(schema, "foo", "my_a", SummaryTransform.COPY, "a");
assertSummary(schema, "foo", "my_b", SummaryTransform.COPY, "b");
assertSummary(schema, "foo", "my_c", SummaryTransform.ATTRIBUTE, "c");
- // Extra fields should still be created
- assertField(schema, "my_a", DataType.STRING);
- assertField(schema,"my_b", DataType.INT);
+ // Extra fields should not be created
+ assertNull(schema.getDocument().getField("my_a"));
+ assertNull(schema.getDocument().getField("my_b"));
assertNull(schema.getDocument().getField("my_c"));
}
@@ -78,11 +78,4 @@ public class AddExtraFieldsToDocumentTest {
assertEquals(transform, field.getTransform());
assertEquals(source, field.getSingleSource());
}
-
- private void assertField(Schema schema, String name, DataType type) {
- var field = schema.getDocument().getField(name);
- assertNotNull(field);
- assertEquals(field.getDataType(), type);
- }
-
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSchemaFieldsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSchemaFieldsTestCase.java
index ff7e43b2936..b9685d9a4ff 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSchemaFieldsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitSchemaFieldsTestCase.java
@@ -37,11 +37,11 @@ public class ImplicitSchemaFieldsTestCase extends AbstractSchemaTestCase {
SDDocumentType docType = schema.getDocument();
assertNotNull(docType);
assertNotNull(docType.getField("foo"));
- assertNotNull(docType.getField("bar"));
- assertNotNull(docType.getField("cox"));
+ assertNull(docType.getField("bar"));
+ assertNull(docType.getField("cox"));
assertNotNull(docType.getField("mytags"));
- assertNotNull(docType.getField("alltags"));
- assertEquals(5, docType.getFieldCount());
+ assertNull(docType.getField("alltags"));
+ assertEquals(2, docType.getFieldCount());
}
@Test
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitStructTypesTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitStructTypesTestCase.java
index 135a9fa295a..e4d1b5da29e 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ImplicitStructTypesTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ImplicitStructTypesTestCase.java
@@ -34,9 +34,9 @@ public class ImplicitStructTypesTestCase extends AbstractSchemaTestCase {
assertNotNull(docType);
assertField(docType, "doc_str", DataType.STRING);
- assertField(docType, "doc_str_sum", DataType.STRING);
+ assertNoField(docType, "doc_str_sum");
assertField(docType, "doc_uri", DataType.URI);
- assertField(docType, "docsum_str", DataType.STRING);
+ assertNoField(docType, "docsum_str");
}
@SuppressWarnings({ "UnusedDeclaration" })
@@ -60,6 +60,11 @@ public class ImplicitStructTypesTestCase extends AbstractSchemaTestCase {
assertTrue(field instanceof SDField);
}
+ private static void assertNoField(SDDocumentType docType, String fieldName) {
+ var field = getSecretField(docType, fieldName);
+ assertNull(field);
+ }
+
private static Field getSecretField(SDDocumentType docType, String fieldName) {
for (Field field : docType.fieldSet()) {
if (field.getName().equals(fieldName)) {
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/IndexingOutputsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IndexingOutputsTestCase.java
index f56d2b21a2d..d5af996bd59 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/IndexingOutputsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/IndexingOutputsTestCase.java
@@ -78,7 +78,7 @@ public class IndexingOutputsTestCase {
""";
var builder = ApplicationBuilder.createFromString(sd);
var schema = builder.getSchema();
- assertEquals("{ input foo | summary baz | summary bar; }",
+ assertEquals("{ input foo | summary bar; }",
schema.getConcreteField("bar").getIndexingScript().toString());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java
index c2cc28ea6b3..de99d46b9ca 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java
@@ -18,7 +18,7 @@ import com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression;
import com.yahoo.vespa.model.container.search.QueryProfiles;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
+import java.util.List;
import java.util.OptionalDouble;
import java.util.OptionalInt;
import java.util.OptionalLong;
@@ -64,7 +64,7 @@ public class IndexingScriptRewriterTestCase extends AbstractSchemaTestCase {
field.addSummaryField(createStaticSummaryField(field, "test"));
field.addSummaryField(createStaticSummaryField(field, "other"));
field.addSummaryField(createDynamicSummaryField(field, "dyn2"));
- assertIndexingScript("{ input test | tokenize normalize stem:\"BEST\" | summary other | " +
+ assertIndexingScript("{ input test | tokenize normalize stem:\"BEST\" | " +
"summary test | index test; }", field);
}
@@ -105,7 +105,7 @@ public class IndexingScriptRewriterTestCase extends AbstractSchemaTestCase {
@Test
void testDerivingFromSimple() throws Exception {
- assertIndexing(Arrays.asList("clear_state | guard { input access | attribute access; }",
+ assertIndexing(List.of("clear_state | guard { input access | attribute access; }",
"clear_state | guard { input category | split \";\" | attribute category_arr; }",
"clear_state | guard { input category | tokenize | index category; }",
"clear_state | guard { input categories_src | lowercase | normalize | tokenize normalize stem:\"BEST\" | index categories; }",
@@ -113,7 +113,7 @@ public class IndexingScriptRewriterTestCase extends AbstractSchemaTestCase {
"clear_state | guard { input chatter | tokenize normalize stem:\"BEST\" | index chatter; }",
"clear_state | guard { input description | tokenize normalize stem:\"BEST\" | summary description | index description; }",
"clear_state | guard { input exactemento_src | lowercase | tokenize normalize stem:\"BEST\" | index exactemento | summary exactemento; }",
- "clear_state | guard { input longdesc | summary longdesc | summary longstat; }",
+ "clear_state | guard { input longdesc | summary longdesc; }",
"clear_state | guard { input measurement | attribute measurement | summary measurement; }",
"clear_state | guard { input measurement | to_array | attribute measurement_arr; }",
"clear_state | guard { input popularity | attribute popularity; }",
@@ -127,8 +127,7 @@ public class IndexingScriptRewriterTestCase extends AbstractSchemaTestCase {
@Test
void testIndexRewrite() throws Exception {
assertIndexing(
- Arrays.asList("clear_state | guard { input title_src | lowercase | normalize | " +
- " tokenize | index title; }",
+ List.of("clear_state | guard { input title_src | lowercase | normalize | tokenize | index title; }",
"clear_state | guard { input title_src | summary title_s; }"),
ApplicationBuilder.buildFromFile("src/test/examples/indexrewrite.sd"));
}
@@ -151,7 +150,7 @@ public class IndexingScriptRewriterTestCase extends AbstractSchemaTestCase {
void requireThatMaxTermOccurrencesIsPropagated() {
var field = new SDField("test", DataType.STRING);
field.getMatching().maxTermOccurrences(10);
- field.parseIndexingScript("{ summary | index }");
+ field.parseIndexingScript("test", "{ summary | index }");
assertIndexingScript("{ input test | tokenize normalize stem:\"BEST\" max-occurrences:10 | summary test | index test; }",
field);
}
@@ -173,14 +172,14 @@ public class IndexingScriptRewriterTestCase extends AbstractSchemaTestCase {
private static SDField createField(String name, DataType type, String script) {
SDField field = new SDField(null, name, type);
- field.parseIndexingScript(script);
+ field.parseIndexingScript("test", script);
return field;
}
private static SDField createPredicateField(
String name, DataType type, String script, int arity, OptionalLong lower_bound, OptionalLong upper_bound) {
SDField field = new SDField(null, name, type);
- field.parseIndexingScript(script);
+ field.parseIndexingScript("test", script);
Index index = new Index("foo");
index.setBooleanIndexDefiniton(new BooleanIndexDefinition(
OptionalInt.of(arity), lower_bound, upper_bound, OptionalDouble.empty()));
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java
index 71c91533f54..4053834784f 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/IndexingValidationTestCase.java
@@ -8,7 +8,7 @@ import com.yahoo.yolean.Exceptions;
import org.junit.jupiter.api.Test;
import java.io.IOException;
-import java.util.Arrays;
+import java.util.List;
import static com.yahoo.schema.processing.AssertIndexingScript.assertIndexing;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -154,7 +154,7 @@ public class IndexingValidationTestCase extends AbstractExportingTestCase {
@Test
void testExtraField() throws IOException, ParseException {
assertIndexing(
- Arrays.asList("clear_state | guard { input my_index | tokenize normalize stem:\"BEST\" | index my_index | summary my_index }",
+ List.of("clear_state | guard { input my_index | tokenize normalize stem:\"BEST\" | index my_index | summary my_index }",
"clear_state | guard { input my_input | tokenize normalize stem:\"BEST\" | index my_extra | summary my_extra }"),
ApplicationBuilder.buildFromFile("src/test/examples/indexing_extra.sd"));
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ParentChildSearchModel.java b/config-model/src/test/java/com/yahoo/schema/processing/ParentChildSearchModel.java
index af275feffed..129d65584ba 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ParentChildSearchModel.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ParentChildSearchModel.java
@@ -36,8 +36,11 @@ public class ParentChildSearchModel {
}
protected static TemporarySDField createField(SDDocumentType repo, String name, DataType dataType, String indexingScript) {
+ return createField(repo, repo.getName(), name, dataType, indexingScript);
+ }
+ protected static TemporarySDField createField(SDDocumentType repo, String schemaName, String name, DataType dataType, String indexingScript) {
TemporarySDField result = new TemporarySDField(repo, name, dataType);
- result.parseIndexingScript(indexingScript);
+ result.parseIndexingScript(schemaName, indexingScript);
return result;
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java
index 007006bf6d3..87a66046fe5 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/PositionTestCase.java
@@ -13,8 +13,8 @@ import com.yahoo.vespa.documentmodel.SummaryTransform;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.Iterator;
+import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
@@ -27,7 +27,7 @@ public class PositionTestCase {
@Test
void inherited_position_zcurve_field_is_not_added_to_document_fieldset() throws Exception {
- ApplicationBuilder sb = ApplicationBuilder.createFromFiles(Arrays.asList(
+ ApplicationBuilder sb = ApplicationBuilder.createFromFiles(List.of(
"src/test/examples/position_base.sd",
"src/test/examples/position_inherited.sd"));
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTransformerTokensTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTransformerTokensTestCase.java
index 9213f97fd9f..6cbd8faf3b0 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTransformerTokensTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithTransformerTokensTestCase.java
@@ -19,7 +19,7 @@ import com.yahoo.searchlib.rankingexpression.evaluation.TensorValue;
import com.yahoo.tensor.Tensor;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
+import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -94,16 +94,17 @@ public class RankingExpressionWithTransformerTokensTestCase {
MockApplicationPackage application = (MockApplicationPackage) MockApplicationPackage.createEmpty();
RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
QueryProfileRegistry queryProfileRegistry = application.getQueryProfiles();
- String sdContent = "search test {\n" +
- " document test {}\n" +
- " rank-profile my_profile inherits default {}\n" +
- "}";
+ String sdContent = """
+ search test {
+ document test {}
+ rank-profile my_profile inherits default {}
+ }""";
ApplicationBuilder schemaBuilder = new ApplicationBuilder(application, new MockFileRegistry(), new BaseDeployLogger(), new TestProperties(), rankProfileRegistry, queryProfileRegistry);
schemaBuilder.addSchema(sdContent);
schemaBuilder.build(true);
Schema schema = schemaBuilder.getSchema();
RankProfile rp = rankProfileRegistry.get(schema, "my_profile");
- return new RankProfileTransformContext(rp, queryProfileRegistry, Collections.emptyMap(), null, Collections.emptyMap(), Collections.emptyMap());
+ return new RankProfileTransformContext(rp, queryProfileRegistry, Map.of(), null, Map.of(), Map.of());
}
}
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java
index 0f16330ce11..a602503a71c 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java
@@ -21,7 +21,6 @@ import ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModels;
import org.junit.jupiter.api.Test;
import java.io.IOException;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -102,12 +101,12 @@ public class RankingExpressionsTestCase extends AbstractSchemaTestCase {
{
AttributeFields attributes = new AttributeFields(schema);
- verifyProfile(rankProfileRegistry.get(schema, "base"), Arrays.asList("large_f", "large_m"),
- Arrays.asList(new Pair<>("rankingExpression(large_f).expressionName", "base.large_f"), new Pair<>("rankingExpression(large_m).expressionName", "base.large_m")),
+ verifyProfile(rankProfileRegistry.get(schema, "base"), List.of("large_f", "large_m"),
+ List.of(new Pair<>("rankingExpression(large_f).expressionName", "base.large_f"), new Pair<>("rankingExpression(large_m).expressionName", "base.large_m")),
largeExpressions, queryProfiles, models, attributes, properties);
- for (String child : Arrays.asList("child_a", "child_b")) {
- verifyProfile(rankProfileRegistry.get(schema, child), Arrays.asList("large_f", "large_m", "large_local_f", "large_local_m"),
- Arrays.asList(new Pair<>("rankingExpression(large_f).expressionName", child + ".large_f"), new Pair<>("rankingExpression(large_m).expressionName", child + ".large_m"),
+ for (String child : List.of("child_a", "child_b")) {
+ verifyProfile(rankProfileRegistry.get(schema, child), List.of("large_f", "large_m", "large_local_f", "large_local_m"),
+ List.of(new Pair<>("rankingExpression(large_f).expressionName", child + ".large_f"), new Pair<>("rankingExpression(large_m).expressionName", child + ".large_m"),
new Pair<>("rankingExpression(large_local_f).expressionName", child + ".large_local_f"), new Pair<>("rankingExpression(large_local_m).expressionName", child + ".large_local_m"),
new Pair<>("vespa.rank.firstphase", "rankingExpression(firstphase)"), new Pair<>("rankingExpression(firstphase).expressionName", child + ".firstphase")),
largeExpressions, queryProfiles, models, attributes, properties);
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/ValidateFieldTypesTest.java b/config-model/src/test/java/com/yahoo/schema/processing/ValidateFieldTypesTest.java
index be72d2b12fa..8585a206d77 100644
--- a/config-model/src/test/java/com/yahoo/schema/processing/ValidateFieldTypesTest.java
+++ b/config-model/src/test/java/com/yahoo/schema/processing/ValidateFieldTypesTest.java
@@ -18,7 +18,7 @@ import com.yahoo.vespa.documentmodel.DocumentSummary;
import com.yahoo.vespa.documentmodel.SummaryField;
import org.junit.jupiter.api.Test;
-import java.util.Collections;
+import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -65,7 +65,7 @@ public class ValidateFieldTypesTest {
SDField targetField = new SDField(targetSchema.getDocument(), "target_field", dataType);
DocumentReference documentReference = new DocumentReference(new Field("reference_field"), targetSchema);
ImportedField importedField = new ImportedSimpleField(fieldName, documentReference, targetField);
- return new ImportedFields(Collections.singletonMap(fieldName, importedField));
+ return new ImportedFields(Map.of(fieldName, importedField));
}
private static DocumentSummary createDocumentSummary(String fieldName, DataType dataType, Schema schema) {