summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-03-14 11:48:20 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2024-03-14 12:01:54 +0100
commit97cac93bafb8edc3fad1eb4943e1eea1e36a67dd (patch)
tree16ae2a8bd7e325908c32a03cff352a8b0d395665 /config-model
parent339d895cfbafe99f6c21e186bb8103d5bab10923 (diff)
Only need SearchCluster
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/test/java/com/yahoo/schema/processing/RankingExpressionWithOnnxModelTestCase.java5
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java4
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java19
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaTester.java38
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 {
" <query-timeout>1.1</query-timeout>",
" <visibility-delay>2.3</visibility-delay>",
"</search>"));
- 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<String> 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<DocType> nameAndModes, String xmlTuning) {
- StringBuilder retval = new StringBuilder();
- retval.append("" +
- "<?xml version='1.0' encoding='utf-8' ?>\n" +
- "<services version='1.0'>\n" +
- "<admin version='2.0'>\n" +
- " <adminserver hostalias='node0' />\n" +
- "</admin>\n" +
- "<container version='1.0'>\n" +
- " <nodes>\n" +
- " <node hostalias='node0'/>\n" +
- " </nodes>\n" +
- " <search/>\n" +
- "</container>\n" +
- "<content version='1.0' id='test'>\n" +
- " <redundancy>1</redundancy>\n");
- retval.append(DocType.listToXml(nameAndModes));
- retval.append(
+ return "<?xml version='1.0' encoding='utf-8' ?>\n" +
+ "<services version='1.0'>\n" +
+ "<admin version='2.0'>\n" +
+ " <adminserver hostalias='node0' />\n" +
+ "</admin>\n" +
+ "<container version='1.0'>\n" +
+ " <nodes>\n" +
+ " <node hostalias='node0'/>\n" +
+ " </nodes>\n" +
+ " <search/>\n" +
+ "</container>\n" +
+ "<content version='1.0' id='test'>\n" +
+ " <redundancy>1</redundancy>\n" +
+ DocType.listToXml(nameAndModes) +
" <engine>\n" +
" <proton>\n" +
" <tuning>\n" +
@@ -69,8 +66,7 @@ public class SchemaTester {
" <node hostalias='node0' distribution-key='0'/>\n" +
" </nodes>\n" +
" </content>\n" +
- "</services>\n");
- return retval.toString();
+ "</services>\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";