aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-04-11 00:55:49 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2024-04-11 00:55:49 +0200
commit4218e7ad46fd2334ffa5ee1ab1ce6ef58b9e8275 (patch)
tree6eacda8b0f6666b32846feb44bfe601d26f2be18 /config-model/src/test/java/com
parent6557f10a81c6c95eed0be9eead84f026bcf6e958 (diff)
Arrays.asList => List.of
Diffstat (limited to 'config-model/src/test/java/com')
-rw-r--r--config-model/src/test/java/com/yahoo/config/model/graph/GraphMock.java11
-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.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/LiteralBoostTestCase.java8
-rw-r--r--config-model/src/test/java/com/yahoo/schema/derived/SchemaOrdererTestCase.java32
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java7
-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/PositionTestCase.java4
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionsTestCase.java11
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidatorTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java9
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java5
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java4
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSchemaChainsBuilderTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/configserver/ConfigserverClusterTest.java13
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java10
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java5
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java5
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java7
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java9
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java4
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterBuilder.java7
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/utils/DocType.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/utils/SchemaBuilder.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java10
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/test/utils/ApplicationPackageUtils.java3
34 files changed, 89 insertions, 121 deletions
diff --git a/config-model/src/test/java/com/yahoo/config/model/graph/GraphMock.java b/config-model/src/test/java/com/yahoo/config/model/graph/GraphMock.java
index 327d48f9276..4c6a5d0e74b 100644
--- a/config-model/src/test/java/com/yahoo/config/model/graph/GraphMock.java
+++ b/config-model/src/test/java/com/yahoo/config/model/graph/GraphMock.java
@@ -8,7 +8,6 @@ import com.yahoo.config.model.builder.xml.ConfigModelBuilder;
import com.yahoo.config.model.builder.xml.ConfigModelId;
import org.w3c.dom.Element;
-import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -20,7 +19,7 @@ public class GraphMock {
public static class BA extends ConfigModelBuilder<A> {
public BA() { super(A.class); }
- @Override public List<ConfigModelId> handlesElements() { return Arrays.asList(); }
+ @Override public List<ConfigModelId> handlesElements() { return List.of(); }
@Override public void doBuild(A model, Element spec, ConfigModelContext modelContext) { }
}
public static class A extends ConfigModel {
@@ -29,7 +28,7 @@ public class GraphMock {
public static class BB extends ConfigModelBuilder<B> {
public BB() { super(B.class); }
- @Override public List<ConfigModelId> handlesElements() { return Arrays.asList(); }
+ @Override public List<ConfigModelId> handlesElements() { return List.of(); }
@Override public void doBuild(B model, Element spec, ConfigModelContext modelContext) { }
}
public static class B extends ConfigModel {
@@ -40,7 +39,7 @@ public class GraphMock {
public static class BC extends ConfigModelBuilder<C> {
public BC() { super(C.class); }
- @Override public List<ConfigModelId> handlesElements() { return Arrays.asList(); }
+ @Override public List<ConfigModelId> handlesElements() { return List.of(); }
@Override public void doBuild(C model, Element spec, ConfigModelContext modelContext) { }
}
public static class C extends ConfigModel {
@@ -51,7 +50,7 @@ public class GraphMock {
public static class BD extends ConfigModelBuilder<D> {
public BD() { super(D.class); }
- @Override public List<ConfigModelId> handlesElements() { return Arrays.asList(); }
+ @Override public List<ConfigModelId> handlesElements() { return List.of(); }
@Override public void doBuild(D model, Element spec, ConfigModelContext modelContext) { }
}
public static class D extends ConfigModel {
@@ -60,7 +59,7 @@ public class GraphMock {
public static class BE extends ConfigModelBuilder<E> {
public BE() { super(E.class); }
- @Override public List<ConfigModelId> handlesElements() { return Arrays.asList(); }
+ @Override public List<ConfigModelId> handlesElements() { return List.of(); }
@Override public void doBuild(E model, Element spec, ConfigModelContext modelContext) { }
}
public static class E extends ConfigModel {
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 628f5042140..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());
@@ -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 8677a14e66b..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;
@@ -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);
@@ -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);
@@ -103,7 +103,7 @@ public class LiteralBoostTestCase extends AbstractExportingTestCase {
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 f83892a7a71..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,7 +12,6 @@ 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;
@@ -73,9 +72,8 @@ public class SchemaOrdererTestCase extends AbstractSchemaTestCase {
}
private static void assertOrder(List<String> expectedSearchOrder, List<String> inputNames) {
- inputNames.sort(String::compareTo);
Map<String, Schema> schemas = createSchemas();
- List<Schema> inputSchemas = inputNames.stream()
+ List<Schema> inputSchemas = inputNames.stream().sorted()
.map(schemas::get)
.map(Objects::requireNonNull)
.toList();
@@ -100,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/processing/IndexingScriptRewriterTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/IndexingScriptRewriterTestCase.java
index b487622a928..310706cb0d1 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;
@@ -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; }",
@@ -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"));
}
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/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/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/vespa/model/application/validation/PublicApiBundleValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidatorTest.java
index 19be886d3e5..c5ef2238f9b 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/PublicApiBundleValidatorTest.java
@@ -8,7 +8,6 @@ import org.junit.jupiter.api.io.TempDir;
import java.io.File;
import java.io.IOException;
-import java.util.Arrays;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -42,7 +41,7 @@ public class PublicApiBundleValidatorTest {
assertThat(output, containsString("uses non-public Vespa APIs: ["));
// List of packages should be sorted
- List<String> packages = Arrays.asList(output.substring(output.indexOf("[") + 1, output.indexOf("]")).split(", "));
+ List<String> packages = List.of(output.substring(output.indexOf("[") + 1, output.indexOf("]")).split(", "));
assertThat(packages, hasSize(2));
assertThat(packages, contains("ai.vespa.lib.non_public", "com.yahoo.lib.non_public"));
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java
index e4b9b45489d..829bd6148a6 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StartupCommandChangeValidatorTest.java
@@ -54,7 +54,7 @@ public class StartupCommandChangeValidatorTest {
private static MockRoot createRootWithChildren(TreeConfigProducer<?>... children) {
MockRoot root = new MockRoot();
- Arrays.asList(children).forEach(root::addChild);
+ List.of(children).forEach(root::addChild);
root.freezeModelTopology();
return root;
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java
index 91ba97817d6..8778f0c26c0 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/ContentClusterFixture.java
@@ -9,7 +9,6 @@ import com.yahoo.vespa.model.content.utils.ContentClusterUtils;
import com.yahoo.vespa.model.content.utils.SchemaBuilder;
import com.yahoo.vespa.model.search.DocumentDatabase;
-import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -32,15 +31,15 @@ public abstract class ContentClusterFixture {
public ContentClusterFixture(String entireSd) throws Exception {
currentCluster = new ContentClusterBuilder().build(
- ContentClusterUtils.createMockRoot(Arrays.asList(entireSd)));
+ ContentClusterUtils.createMockRoot(List.of(entireSd)));
nextCluster = new ContentClusterBuilder().build(
- ContentClusterUtils.createMockRoot(Arrays.asList(entireSd)));
+ ContentClusterUtils.createMockRoot(List.of(entireSd)));
}
private static ContentCluster createCluster(String sdContent) throws Exception {
return new ContentClusterBuilder().build(
ContentClusterUtils.createMockRoot(
- Arrays.asList(new SchemaBuilder().content(sdContent).build())));
+ List.of(new SchemaBuilder().content(sdContent).build())));
}
protected DocumentDatabase currentDb() {
@@ -65,7 +64,7 @@ public abstract class ContentClusterFixture {
}
public void assertValidation(VespaConfigChangeAction exp) {
- assertValidation(Arrays.asList(exp));
+ assertValidation(List.of(exp));
}
public void assertValidation(List<VespaConfigChangeAction> exp) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java
index 684bd619ba1..129649ae1fb 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java
@@ -8,7 +8,6 @@ import com.yahoo.vespa.model.application.validation.change.VespaConfigChangeActi
import org.junit.jupiter.api.Test;
import java.time.Instant;
-import java.util.Arrays;
import java.util.List;
import static com.yahoo.vespa.model.application.validation.change.ConfigChangeTestUtils.newRefeedAction;
@@ -50,7 +49,7 @@ public class DocumentDatabaseChangeValidatorTest {
"field f3 type string { indexing: summary } " +
"field f4 type array<s> { struct-field s1 { indexing: attribute } }");
Instant.now();
- f.assertValidation(Arrays.asList(
+ f.assertValidation(List.of(
newRestartAction(ClusterSpec.Id.from("test"),
"Field 'f1' changed: add attribute aspect"),
newRestartAction(ClusterSpec.Id.from("test"),
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java
index 0e3d74a6995..26a4f532362 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentTypeChangeValidatorTest.java
@@ -14,7 +14,6 @@ import com.yahoo.vespa.model.application.validation.change.VespaRefeedAction;
import org.junit.jupiter.api.Test;
import java.time.Instant;
-import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@@ -108,7 +107,7 @@ public class DocumentTypeChangeValidatorTest {
"field f2 type string { indexing: summary } field f1 type int { indexing: summary }");
Instant.now();
Instant.now();
- f.assertValidation(Arrays.asList(newRefeedAction(ClusterSpec.Id.from("test"), ValidationId.fieldTypeChange, "Field 'f1' changed: data type: 'string' -> 'int'"),
+ f.assertValidation(List.of(newRefeedAction(ClusterSpec.Id.from("test"), ValidationId.fieldTypeChange, "Field 'f1' changed: data type: 'string' -> 'int'"),
newRefeedAction(ClusterSpec.Id.from("test"), ValidationId.fieldTypeChange, "Field 'f2' changed: data type: 'int' -> 'string'")));
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java
index 6b58cac3f6c..cd54a20523f 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java
@@ -12,7 +12,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.List;
public class IndexingScriptChangeValidatorTest {
@@ -126,7 +125,7 @@ public class IndexingScriptChangeValidatorTest {
void requireThatMultipleChangesRequireReindexing() throws Exception {
new Fixture(FIELD + " { indexing: index } " + FIELD_F2 + " { indexing: index }",
FIELD + " { indexing: index \n stemming: none } " + FIELD_F2 + " { indexing: index \n normalizing: none }").
- assertValidation(Arrays.asList(expectedReindexingAction("f1", "stemming: 'best' -> 'none'",
+ assertValidation(List.of(expectedReindexingAction("f1", "stemming: 'best' -> 'none'",
"{ input f1 | tokenize normalize stem:\"BEST\" | index f1; }",
"{ input f1 | tokenize normalize | index f1; }"),
expectedReindexingAction("f2", "normalizing: 'ACCENT' -> 'NONE'",
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
index fac82f3e675..924419daeae 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
@@ -26,7 +26,6 @@ import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.List;
import java.util.Set;
@@ -876,8 +875,8 @@ public class ContentBuilderTest extends DomBuilderTest {
VespaModel m = new VespaModelCreatorWithMockPkg(new MockApplicationPackage.Builder()
.withHosts(getHosts())
.withServices(combined)
- .withSchemas(Arrays.asList(MockApplicationPackage.MUSIC_SCHEMA,
- MockApplicationPackage.BOOK_SCHEMA))
+ .withSchemas(List.of(MockApplicationPackage.MUSIC_SCHEMA,
+ MockApplicationPackage.BOOK_SCHEMA))
.build())
.create();
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java
index 853cfdd9429..0e616661191 100755
--- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV2BuilderTest.java
@@ -18,7 +18,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Element;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -112,7 +111,7 @@ public class DomAdminV2BuilderTest extends DomBuilderTest {
@Test
void multitenant() {
- List<ConfigServerSpec> configServerSpecs = Arrays.asList(
+ List<ConfigServerSpec> configServerSpecs = List.of(
new TestProperties.Spec("test1", 19070, 2181),
new TestProperties.Spec("test2", 19070, 2181),
new TestProperties.Spec("test3", 19070, 2181));
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java
index 764e31fe13a..c7525dec6a3 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSchemaTuningBuilderTest.java
@@ -8,7 +8,7 @@ import com.yahoo.vespa.model.search.Tuning;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Element;
-import java.util.Arrays;
+import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
@@ -22,7 +22,7 @@ public class DomSchemaTuningBuilderTest extends DomBuilderTest {
private static Element parseXml(String... xmlLines) {
return parse("<tuning>",
"<searchnode>",
- CollectionUtil.mkString(Arrays.asList(xmlLines), "\n"),
+ CollectionUtil.mkString(List.of(xmlLines), "\n"),
"</searchnode>",
"</tuning>");
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSchemaChainsBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSchemaChainsBuilderTest.java
index 6b384269910..56f492f3fca 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSchemaChainsBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomSchemaChainsBuilderTest.java
@@ -20,7 +20,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Element;
-import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -98,7 +97,7 @@ public class DomSchemaChainsBuilderTest extends DomBuilderTest {
@Test
void ensureSearchChainsExists() {
- for (String id : Arrays.asList("provider:1", "source:1@provider:1", "default")) {
+ for (String id : List.of("provider:1", "source:1@provider:1", "default")) {
assertNotNull(getSearchChain(id), "Missing search chain " + id);
}
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/ConfigserverClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/ConfigserverClusterTest.java
index 5e6863360e7..4e14fbcd671 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/ConfigserverClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/ConfigserverClusterTest.java
@@ -21,7 +21,6 @@ import com.yahoo.vespa.model.container.configserver.option.CloudConfigOptions;
import com.yahoo.vespa.model.container.xml.ConfigServerContainerModelBuilder;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
@@ -44,7 +43,7 @@ public class ConfigserverClusterTest {
@Test
void zookeeperConfig_only_config_servers_set_hosted() {
- TestOptions testOptions = createTestOptions(Arrays.asList("cfg1", "localhost", "cfg3"), List.of());
+ TestOptions testOptions = createTestOptions(List.of("cfg1", "localhost", "cfg3"), List.of());
ZookeeperServerConfig config = getConfig(ZookeeperServerConfig.class, testOptions);
assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::hostname, "cfg1", "localhost", "cfg3");
assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::id, 0, 1, 2);
@@ -55,7 +54,7 @@ public class ConfigserverClusterTest {
@Test
void zookeeperConfig_with_config_servers_and_zk_ids_hosted() {
- TestOptions testOptions = createTestOptions(Arrays.asList("cfg1", "localhost", "cfg3"), List.of(4, 2, 3));
+ TestOptions testOptions = createTestOptions(List.of("cfg1", "localhost", "cfg3"), List.of(4, 2, 3));
ZookeeperServerConfig config = getConfig(ZookeeperServerConfig.class, testOptions);
assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::hostname, "cfg1", "localhost", "cfg3");
assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::id, 4, 2, 3);
@@ -66,7 +65,7 @@ public class ConfigserverClusterTest {
@Test
void zookeeperConfig_self_hosted() {
final boolean hostedVespa = false;
- TestOptions testOptions = createTestOptions(Arrays.asList("cfg1", "localhost", "cfg3"), Arrays.asList(4, 2, 3), hostedVespa);
+ TestOptions testOptions = createTestOptions(List.of("cfg1", "localhost", "cfg3"), List.of(4, 2, 3), hostedVespa);
ZookeeperServerConfig config = getConfig(ZookeeperServerConfig.class, testOptions);
assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::hostname, "cfg1", "localhost", "cfg3");
assertZookeeperServerProperty(config.server(), ZookeeperServerConfig.Server::id, 4, 2, 3);
@@ -78,7 +77,7 @@ public class ConfigserverClusterTest {
@Test
void zookeeperConfig_uneven_number_of_config_servers_and_zk_ids() {
assertThrows(IllegalArgumentException.class, () -> {
- TestOptions testOptions = createTestOptions(Arrays.asList("cfg1", "localhost", "cfg3"), List.of(1));
+ TestOptions testOptions = createTestOptions(List.of("cfg1", "localhost", "cfg3"), List.of(1));
getConfig(ZookeeperServerConfig.class, testOptions);
});
}
@@ -86,7 +85,7 @@ public class ConfigserverClusterTest {
@Test
void zookeeperConfig_negative_zk_id() {
assertThrows(IllegalArgumentException.class, () -> {
- TestOptions testOptions = createTestOptions(Arrays.asList("cfg1", "localhost", "cfg3"), List.of(1, 2, -1));
+ TestOptions testOptions = createTestOptions(List.of("cfg1", "localhost", "cfg3"), List.of(1, 2, -1));
getConfig(ZookeeperServerConfig.class, testOptions);
});
}
@@ -135,7 +134,7 @@ public class ConfigserverClusterTest {
private static <T> void assertZookeeperServerProperty(
List<ZookeeperServerConfig.Server> zkServers, Function<ZookeeperServerConfig.Server, T> propertyMapper, T... expectedProperties) {
List<T> actualPropertyValues = zkServers.stream().map(propertyMapper).toList();
- List<T> expectedPropertyValues = Arrays.asList(expectedProperties);
+ List<T> expectedPropertyValues = List.of(expectedProperties);
assertEquals(expectedPropertyValues, actualPropertyValues);
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java
index 10adca12f91..46097da434e 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JvmOptionsTest.java
@@ -19,13 +19,12 @@ import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
@@ -218,18 +217,17 @@ public class JvmOptionsTest extends ContainerModelBuilderTestBase {
}
private String verifyLogMessage(TestLogger logger, String... invalidOptions) {
- List<String> strings = Arrays.asList(invalidOptions.clone());
+ List<String> strings = List.of(invalidOptions);
// Verify that nothing is logged if there are no invalid options
if (strings.isEmpty()) {
- assertEquals(0, logger.msgs.size(), logger.msgs.size() > 0 ? logger.msgs.get(0).getSecond() : "");
+ assertEquals(0, logger.msgs.size(), !logger.msgs.isEmpty() ? logger.msgs.get(0).getSecond() : "");
return null;
}
- assertTrue(logger.msgs.size() > 0, "Expected 1 or more log messages for invalid JM options, got none");
+ assertFalse(logger.msgs.isEmpty(), "Expected 1 or more log messages for invalid JM options, got none");
Pair<Level, String> firstOption = logger.msgs.get(0);
assertEquals(Level.WARNING, firstOption.getFirst());
- Collections.sort(strings);
return firstOption.getSecond();
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
index 4cf950e319d..96e1f2edf76 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
@@ -42,7 +42,6 @@ import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg;
import com.yahoo.yolean.Exceptions;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -70,7 +69,7 @@ public class ContentClusterTest extends ContentBaseTest {
@Test
void testHierarchicRedundancy() {
- ContentCluster cc = parse("" +
+ ContentCluster cc = parse(
"<content version=\"1.0\" id=\"storage\">\n" +
" <documents/>" +
" <engine>" +
@@ -1102,7 +1101,7 @@ public class ContentClusterTest extends ContentBaseTest {
assertEquals(2, config.cluster().size());
- assertClusterHasBucketSpaceMappings(config, "foo_c", Arrays.asList("bunnies", "hares"), List.of());
+ assertClusterHasBucketSpaceMappings(config, "foo_c", List.of("bunnies", "hares"), List.of());
assertClusterHasBucketSpaceMappings(config, "bar_c", List.of(), List.of("rabbits"));
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java
index 55ec9f4efe2..8c08b9054a4 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java
@@ -12,7 +12,6 @@ import com.yahoo.vespa.model.content.utils.DocType;
import com.yahoo.vespa.model.content.utils.SchemaBuilder;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import static com.yahoo.config.model.test.TestUtil.joinLines;
@@ -60,12 +59,12 @@ public class ContentSchemaClusterTest {
private static ContentClusterBuilder createClusterBuilderWithGlobalType() {
return new ContentClusterBuilder()
- .docTypes(Arrays.asList(DocType.indexGlobal("global"), DocType.index("regular")));
+ .docTypes(List.of(DocType.indexGlobal("global"), DocType.index("regular")));
}
private static ContentClusterBuilder createClusterBuilderWithOnlyDefaultTypes() {
return new ContentClusterBuilder()
- .docTypes(Arrays.asList(DocType.index("marve"), DocType.index("fleksnes")));
+ .docTypes(List.of(DocType.index("marve"), DocType.index("fleksnes")));
}
private static ProtonConfig getProtonConfig(ContentCluster cluster) {
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 b41d92bd63f..901c307723e 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
@@ -21,7 +21,6 @@ import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -489,7 +488,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
private DocprocClusterSpec(String name, DocprocChainSpec ... chains) {
this.name = name;
- this.chains.addAll(Arrays.asList(chains));
+ this.chains.addAll(List.of(chains));
}
}
@@ -500,7 +499,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
private DocprocChainSpec(String name, String ... inherits) {
this.name = name;
- this.inherits.addAll(Arrays.asList(inherits));
+ this.inherits.addAll(List.of(inherits));
}
}
@@ -542,7 +541,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest {
}
public static List<String> generateSchemas(String ... sdNames) {
- return generateSchemas(Arrays.asList(sdNames));
+ return generateSchemas(List.of(sdNames));
}
public static List<String> generateSchemas(List<String> sdNames) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java
index 68856fe3488..2fb9a67a9ae 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java
@@ -4,7 +4,6 @@ package com.yahoo.vespa.model.content;
import com.yahoo.documentmodel.NewDocumentType;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -45,7 +44,7 @@ public class ReservedDocumentTypeNameValidatorTest {
@Test
void validation_is_case_insensitive() {
ReservedDocumentTypeNameValidator validator = new ReservedDocumentTypeNameValidator();
- Map<String, NewDocumentType> orderedDocTypes = new TreeMap<>(asDocTypeMapping(Arrays.asList("NULL", "True", "anD")));
+ Map<String, NewDocumentType> orderedDocTypes = new TreeMap<>(asDocTypeMapping(List.of("NULL", "True", "anD")));
try {
validator.validate(orderedDocTypes);
fail();
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java
index 3de46f00db5..06794a3c1f3 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java
@@ -5,7 +5,6 @@ import com.yahoo.documentmodel.NewDocumentType;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@@ -26,14 +25,14 @@ public class TopologicalDocumentTypeSorterTest {
@Test
void require_that_types_with_references_are_sorted_in_topological_order() {
- assertOrder(Arrays.asList("b", "a"), new DocumentTypesBuilder()
+ assertOrder(List.of("b", "a"), new DocumentTypesBuilder()
.add("a", List.of("b"))
.add("b"));
- assertOrder(Arrays.asList("c", "b", "a"), new DocumentTypesBuilder()
- .add("a", Arrays.asList("b", "c"))
+ assertOrder(List.of("c", "b", "a"), new DocumentTypesBuilder()
+ .add("a", List.of("b", "c"))
.add("b", List.of("c"))
.add("c"));
- assertOrder(Arrays.asList("b", "a", "d", "c"), new DocumentTypesBuilder()
+ assertOrder(List.of("b", "a", "d", "c"), new DocumentTypesBuilder()
.add("a", List.of("b"))
.add("b")
.add("c", List.of("d"))
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java
index 3bd7b7a4c1a..1043ddd2c0b 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java
@@ -6,9 +6,7 @@ import com.yahoo.text.XML;
import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
import org.junit.jupiter.api.Test;
-import java.util.Arrays;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -35,7 +33,7 @@ public class GlobalDistributionBuilderTest {
" <document type=\"" + GLOBAL_2.getName() + "\" global=\"true\"/>" +
"</documents>";
- Set<NewDocumentType> expectedResult = new HashSet<>(Arrays.asList(GLOBAL_1, GLOBAL_2));
+ Set<NewDocumentType> expectedResult = Set.of(GLOBAL_1, GLOBAL_2);
Set<NewDocumentType> actualResult = builder.build(new ModelElement(XML.getDocument(documentsElement).getDocumentElement()));
assertEquals(expectedResult, actualResult);
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterBuilder.java b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterBuilder.java
index 61ce5172ceb..277b07023e6 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterBuilder.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/ContentClusterBuilder.java
@@ -7,7 +7,6 @@ import com.yahoo.vespa.model.content.cluster.ContentCluster;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
import static com.yahoo.config.model.test.TestUtil.joinLines;
@@ -21,7 +20,7 @@ public class ContentClusterBuilder {
private String name = "mycluster";
private int redundancy = 1;
private int searchableCopies = 1;
- private List<DocType> docTypes = Arrays.asList(DocType.index("test"));
+ private List<DocType> docTypes = List.of(DocType.index("test"));
private String groupXml = getSimpleGroupXml();
private Optional<String> dispatchXml = Optional.empty();
private Optional<Double> protonDiskLimit = Optional.empty();
@@ -54,8 +53,8 @@ public class ContentClusterBuilder {
}
public ContentClusterBuilder docTypes(String ... docTypes) {
- this.docTypes = Arrays.asList(docTypes).stream().
- map(type -> DocType.index(type)).
+ this.docTypes = Arrays.stream(docTypes).
+ map(DocType::index).
toList();
return this;
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/DocType.java b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/DocType.java
index 3ffb33a47c8..ce05fa27e2e 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/DocType.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/DocType.java
@@ -1,7 +1,6 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.content.utils;
-import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -46,7 +45,7 @@ public class DocType {
}
public static String listToXml(DocType... docTypes) {
- return listToXml(Arrays.asList(docTypes));
+ return listToXml(List.of(docTypes));
}
public static String listToXml(List<DocType> docTypes) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/SchemaBuilder.java b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/SchemaBuilder.java
index 304f3dc426f..55ad9149a17 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/utils/SchemaBuilder.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/utils/SchemaBuilder.java
@@ -38,8 +38,7 @@ public class SchemaBuilder {
}
public static List<String> createSchemas(String ... docTypes) {
- return Arrays.asList(docTypes)
- .stream()
+ return Arrays.stream(docTypes)
.map(type -> new SchemaBuilder().name(type).build())
.toList();
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java
index 7efacd6b5ad..e17db551798 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java
@@ -12,7 +12,6 @@ import com.yahoo.vespa.model.search.SearchCluster;
import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -181,7 +180,7 @@ public class SchemaTester {
}
public static List<String> generateSchemas(String schemaContent, String rankProfile, String ... schemaNames) {
- return generateSchemas(schemaContent, rankProfile, Arrays.asList(schemaNames));
+ return generateSchemas(schemaContent, rankProfile, List.of(schemaNames));
}
public static List<String> generateSchemas(String schemaContent, String rankProfile, List<String> schemaNames) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java b/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java
index 41003f03c0d..b9be56d8d69 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/test/ApiConfigModel.java
@@ -10,7 +10,6 @@ import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
/**
@@ -50,7 +49,7 @@ public class ApiConfigModel extends ConfigModel {
@Override
public List<ConfigModelId> handlesElements() {
- return Arrays.asList(ConfigModelId.fromName("api"));
+ return List.of(ConfigModelId.fromName("api"));
}
@Override
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java b/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java
index 61bd3d885f5..d9be865bc7d 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/test/SimpleConfigModel.java
@@ -10,7 +10,6 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
/**
@@ -20,8 +19,8 @@ import java.util.List;
*/
public class SimpleConfigModel extends ConfigModel implements TestApi {
- private List<SimpleService> simpleServices = new ArrayList<>();
- private List<ParentService> parentServices = new ArrayList<>();
+ private final List<SimpleService> simpleServices = new ArrayList<>();
+ private final List<ParentService> parentServices = new ArrayList<>();
public SimpleConfigModel(ConfigModelContext modelContext) {
super(modelContext);
@@ -43,7 +42,7 @@ public class SimpleConfigModel extends ConfigModel implements TestApi {
@Override
public List<ConfigModelId> handlesElements() {
- return Arrays.asList(ConfigModelId.fromName("simple"));
+ return List.of(ConfigModelId.fromName("simple"));
}
@Override
@@ -54,11 +53,10 @@ public class SimpleConfigModel extends ConfigModel implements TestApi {
NodeList childNodes = spec.getChildNodes();
for (int i=0; i < childNodes.getLength(); i++) {
Node child = childNodes.item(i);
- if (! (child instanceof Element)) {
+ if (! (child instanceof Element e)) {
// skip #text and #comment nodes
continue;
}
- Element e = (Element)child;
String service = e.getTagName();
if (service.equals("simpleservice")) {
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 b9bc34688b7..ce373e558ef 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
@@ -2,7 +2,6 @@
package com.yahoo.vespa.model.test.utils;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
/**
@@ -50,7 +49,7 @@ public class ApplicationPackageUtils {
}
public static List<String> generateSchemas(String ... sdNames) {
- return generateSchemas(Arrays.asList(sdNames));
+ return generateSchemas(List.of(sdNames));
}
public static List<String> generateSchemas(List<String> sdNames) {