From 97cac93bafb8edc3fad1eb4943e1eea1e36a67dd Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Thu, 14 Mar 2024 11:48:20 +0100 Subject: Only need SearchCluster --- .../RankingExpressionWithOnnxModelTestCase.java | 5 ++- .../vespa/model/content/cluster/ClusterTest.java | 4 +-- .../search/test/DocumentDatabaseTestCase.java | 19 +++++------ .../vespa/model/search/test/SchemaTester.java | 38 ++++++++++------------ 4 files changed, 29 insertions(+), 37 deletions(-) diff --git a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxModelTestCase.java b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxModelTestCase.java index 2d78b9cdf23..7bccb7da630 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxModelTestCase.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxModelTestCase.java @@ -11,7 +11,6 @@ import com.yahoo.vespa.config.search.core.OnnxModelsConfig; import com.yahoo.vespa.config.search.core.RankingConstantsConfig; import com.yahoo.vespa.model.VespaModel; import com.yahoo.vespa.model.search.DocumentDatabase; -import com.yahoo.vespa.model.search.IndexedSearchCluster; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; @@ -57,7 +56,7 @@ public class RankingExpressionWithOnnxModelTestCase { } private void assertGeneratedConfig(VespaModel vespaModel) { - DocumentDatabase db = ((IndexedSearchCluster)vespaModel.getSearchClusters().get(0)).getDocumentDbs().get(0); + DocumentDatabase db = vespaModel.getSearchClusters().get(0).getDocumentDbs().get(0); RankingConstantsConfig.Builder rankingConstantsConfigBuilder = new RankingConstantsConfig.Builder(); db.getConfig(rankingConstantsConfigBuilder); @@ -128,7 +127,7 @@ public class RankingExpressionWithOnnxModelTestCase { } private void assertTransformedFeature(VespaModel model) { - DocumentDatabase db = ((IndexedSearchCluster)model.getSearchClusters().get(0)).getDocumentDbs().get(0); + DocumentDatabase db = model.getSearchClusters().get(0).getDocumentDbs().get(0); RankProfilesConfig.Builder builder = new RankProfilesConfig.Builder(); ((RankProfilesConfig.Producer) db).getConfig(builder); RankProfilesConfig config = new RankProfilesConfig(builder); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java index 4015c3e0904..0cdcf0534c2 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java @@ -8,7 +8,7 @@ import com.yahoo.vespa.config.search.DispatchConfig; import com.yahoo.vespa.config.search.DispatchNodesConfig; import com.yahoo.vespa.config.search.core.ProtonConfig; import com.yahoo.vespa.model.content.Content; -import com.yahoo.vespa.model.search.IndexedSearchCluster; +import com.yahoo.vespa.model.search.SearchCluster; import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils; import org.junit.jupiter.api.Test; @@ -30,7 +30,7 @@ public class ClusterTest { " 1.1", " 2.3", "")); - IndexedSearchCluster searchCluster = cluster.getSearch().getIndexed(); + SearchCluster searchCluster = cluster.getSearch().getIndexed(); assertNotNull(searchCluster); assertEquals(1.1, searchCluster.getQueryTimeout(), DELTA); assertEquals(2.3, searchCluster.getVisibilityDelay(), DELTA); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java index eb4ec1af157..d3741405c15 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.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.search.test; -import com.google.common.collect.ImmutableMap; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.deploy.TestProperties; import com.yahoo.path.Path; @@ -16,10 +15,8 @@ import com.yahoo.vespa.configdefinition.IlscriptsConfig; import com.yahoo.vespa.model.VespaModel; import com.yahoo.vespa.model.content.ContentSearchCluster; import com.yahoo.vespa.model.content.utils.DocType; -import com.yahoo.vespa.model.search.IndexedSearchCluster; import org.junit.jupiter.api.Test; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -190,13 +187,13 @@ public class DocumentDatabaseTestCase { List sds = List.of("type1", "type2", "type3"); var tester = new SchemaTester(); var model = tester.createModel(sds); - IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster) model.getSearchClusters().get(0); + var searchCluster = model.getSearchClusters().get(0); ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch(); String type1Id = "test/search/cluster.test/type1"; String type2Id = "test/search/cluster.test/type2"; String type3Id = "test/search/cluster.test/type3"; { - assertEquals(3, indexedSearchCluster.getDocumentDbs().size()); + assertEquals(3, searchCluster.getDocumentDbs().size()); ProtonConfig proton = tester.getProtonConfig(contentSearchCluster); assertEquals(3, proton.documentdb().size()); assertEquals("type1", proton.documentdb(0).inputdoctypename()); @@ -255,9 +252,9 @@ public class DocumentDatabaseTestCase { constants.put(Path.fromString("constants/my_constant_1.json.lz4"), ""); constants.put(Path.fromString("constants/my_constant_2.json.lz4"), ""); var model = tester.createModel(schemaConstants, "", schemas, constants); - IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster) model.getSearchClusters().get(0); + var searchCluster = model.getSearchClusters().get(0); RankingConstantsConfig.Builder b = new RankingConstantsConfig.Builder(); - indexedSearchCluster.getDocumentDbs().get(0).getConfig(b); + searchCluster.getDocumentDbs().get(0).getConfig(b); RankingConstantsConfig config = b.build(); assertEquals(2, config.constant().size()); @@ -379,7 +376,7 @@ public class DocumentDatabaseTestCase { void testThatAttributesMaxUnCommittedMemoryIsControlledByFeatureFlag() { assertAttributesConfigIndependentOfMode("index", List.of("type1"), List.of("test/search/cluster.test/type1"), - ImmutableMap.of("type1", List.of("f2", "f2_nfa")), + Map.of("type1", List.of("f2", "f2_nfa")), new DeployState.Builder().properties(new TestProperties().maxUnCommittedMemory(193452)), 193452); } @@ -387,20 +384,20 @@ public class DocumentDatabaseTestCase { void testThatAttributesConfigIsProducedForIndexed() { assertAttributesConfigIndependentOfMode("index", List.of("type1"), List.of("test/search/cluster.test/type1"), - ImmutableMap.of("type1", List.of("f2", "f2_nfa"))); + Map.of("type1", List.of("f2", "f2_nfa"))); } @Test void testThatAttributesConfigIsProducedForStreamingForFastAccessFields() { assertAttributesConfigIndependentOfMode("streaming", List.of("type1"), List.of("test/search/type1"), - ImmutableMap.of("type1", List.of("f2"))); + Map.of("type1", List.of("f2"))); } @Test void testThatAttributesConfigIsNotProducedForStoreOnlyEvenForFastAccessFields() { assertAttributesConfigIndependentOfMode("store-only", List.of("type1"), - List.of("test/search"), Collections.emptyMap()); + List.of("test/search"), Map.of()); } } 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 48c85840adb..7efacd6b5ad 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 @@ -8,7 +8,7 @@ import com.yahoo.vespa.config.search.core.ProtonConfig; import com.yahoo.vespa.model.VespaModel; import com.yahoo.vespa.model.content.ContentSearchCluster; import com.yahoo.vespa.model.content.utils.DocType; -import com.yahoo.vespa.model.search.IndexedSearchCluster; +import com.yahoo.vespa.model.search.SearchCluster; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; import java.util.ArrayList; @@ -39,23 +39,20 @@ public class SchemaTester { return createVespaServicesXml(nameAndModes, ""); } private String createVespaServicesXml(List nameAndModes, String xmlTuning) { - StringBuilder retval = new StringBuilder(); - retval.append("" + - "\n" + - "\n" + - "\n" + - " \n" + - "\n" + - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n" + - "\n" + - " 1\n"); - retval.append(DocType.listToXml(nameAndModes)); - retval.append( + return "\n" + + "\n" + + "\n" + + " \n" + + "\n" + + "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n" + + "\n" + + " 1\n" + + DocType.listToXml(nameAndModes) + " \n" + " \n" + " \n" + @@ -69,8 +66,7 @@ public class SchemaTester { " \n" + " \n" + " \n" + - "\n"); - return retval.toString(); + "\n"; } ProtonConfig getProtonConfig(ContentSearchCluster cluster) { @@ -84,7 +80,7 @@ public class SchemaTester { VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(schemas, mode), generateSchemas("", "", schemas), Map.of()).create(); - IndexedSearchCluster indexedSearchCluster = (IndexedSearchCluster)model.getSearchClusters().get(0); + SearchCluster indexedSearchCluster = model.getSearchClusters().get(0); ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch(); assertEquals(1, indexedSearchCluster.getDocumentDbs().size()); String type1Id = "test/search/cluster.test/type1"; -- cgit v1.2.3