summaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude')
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java2
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/IndexedBackendTestCase.java47
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/PartialFillTestCase.java7
3 files changed, 23 insertions, 33 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
index ff91f346195..4adbce3add9 100644
--- a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
@@ -7,6 +7,7 @@ import com.yahoo.concurrent.InThreadExecutorService;
import com.yahoo.container.QrSearchersConfig;
import com.yahoo.container.handler.ClustersStatus;
import com.yahoo.container.handler.VipStatus;
+import com.yahoo.prelude.fastsearch.ClusterParams;
import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig;
import com.yahoo.prelude.fastsearch.FastHit;
import com.yahoo.prelude.fastsearch.VespaBackend;
@@ -213,6 +214,7 @@ public class ClusterSearcherTestCase {
}
MyMockBackend(boolean expectAttributePrefetch) {
+ super(new ClusterParams("container.0"));
this.expectAttributePrefetch = expectAttributePrefetch;
init();
}
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/IndexedBackendTestCase.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/IndexedBackendTestCase.java
index 917206bf00c..58427bee30a 100644
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/IndexedBackendTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/IndexedBackendTestCase.java
@@ -36,16 +36,13 @@ import static org.junit.jupiter.api.Assertions.*;
public class IndexedBackendTestCase {
private static final String SCHEMA = "test";
private static final String CLUSTER = "test";
+ private static final ClusterParams CLUSTER_PARAMS = new ClusterParams("testhittype", "container.0", null,
+ documentdbInfoConfig(SCHEMA), schemaInfo(SCHEMA));
@Test
void testNullQuery() {
Logger.getLogger(IndexedBackend.class.getName()).setLevel(Level.ALL);
- IndexedBackend fastSearcher = new IndexedBackend("container.0",
- MockDispatcher.create(List.of()),
- new SummaryParameters(null),
- new ClusterParams("testhittype"),
- documentdbInfoConfig(SCHEMA),
- schemaInfo(SCHEMA));
+ IndexedBackend fastSearcher = new IndexedBackend(CLUSTER_PARAMS, MockDispatcher.create(List.of()));
String query = "?junkparam=ignored";
Result result = doSearch(fastSearcher, new Query(query), 0, 10);
@@ -65,12 +62,8 @@ public class IndexedBackendTestCase {
@Test
void testSinglePassGroupingIsForcedWithSingleNodeGroups() {
- IndexedBackend fastSearcher = new IndexedBackend("container.0",
- MockDispatcher.create(List.of(new Node(CLUSTER, 0, "host0", 0))),
- new SummaryParameters(null),
- new ClusterParams("testhittype"),
- documentdbInfoConfig(SCHEMA),
- schemaInfo(SCHEMA));
+ IndexedBackend fastSearcher = new IndexedBackend(CLUSTER_PARAMS,
+ MockDispatcher.create(List.of(new Node(CLUSTER, 0, "host0", 0))));
Query q = new Query("?query=foo");
GroupingRequest request1 = GroupingRequest.newInstance(q);
request1.setRootOperation(new AllOperation());
@@ -88,12 +81,8 @@ public class IndexedBackendTestCase {
@Test
void testRankProfileValidation() {
- IndexedBackend fastSearcher = new IndexedBackend("container.0",
- MockDispatcher.create(List.of(new Node(CLUSTER, 0, "host0", 0))),
- new SummaryParameters(null),
- new ClusterParams("testhittype"),
- documentdbInfoConfig(SCHEMA),
- schemaInfo(SCHEMA));
+ IndexedBackend fastSearcher = new IndexedBackend(CLUSTER_PARAMS,
+ MockDispatcher.create(List.of(new Node(CLUSTER, 0, "host0", 0))));
assertFalse(searchError("?query=q", fastSearcher).contains("does not contain requested rank profile"));
assertFalse(searchError("?query=q&ranking.profile=default", fastSearcher).contains("does not contain requested rank profile"));
assertTrue(searchError("?query=q&ranking.profile=nosuch", fastSearcher).contains("does not contain requested rank profile"));
@@ -101,18 +90,15 @@ public class IndexedBackendTestCase {
@Test
void testSummaryNeedsQuery() {
- var documentDb = new DocumentdbInfoConfig(new DocumentdbInfoConfig.Builder().documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name(SCHEMA)));
var schema = new Schema.Builder(SCHEMA)
.add(new DocumentSummary.Builder("default").build())
.add(new RankProfile.Builder("default").setHasRankFeatures(false)
.setHasSummaryFeatures(false)
.build());
- IndexedBackend backend = new IndexedBackend("container.0",
- MockDispatcher.create(Collections.singletonList(new Node(CLUSTER, 0, "host0", 0))),
- new SummaryParameters(null),
- new ClusterParams("testhittype"),
- documentDb,
- new SchemaInfo(List.of(schema.build()), List.of()));
+ var backend = new IndexedBackend(new ClusterParams(CLUSTER_PARAMS.getSearcherName(), CLUSTER_PARAMS.getServerId(),
+ CLUSTER_PARAMS.getDefaultSummary(), CLUSTER_PARAMS.getDocumentdbInfoConfig(),
+ new SchemaInfo(List.of(schema.build()), List.of())),
+ MockDispatcher.create(Collections.singletonList(new Node(CLUSTER, 0, "host0", 0))));
Query q = new Query("?query=foo");
Result result = doSearch(backend, q, 0, 10);
assertFalse(backend.summaryNeedsQuery(q));
@@ -127,12 +113,7 @@ public class IndexedBackendTestCase {
void testSinglePassGroupingIsNotForcedWithSingleNodeGroups() {
MockDispatcher dispatcher = MockDispatcher.create(List.of(new Node(CLUSTER, 0, "host0", 0), new Node(CLUSTER, 2, "host1", 0)));
- IndexedBackend fastSearcher = new IndexedBackend("container.0",
- dispatcher,
- new SummaryParameters(null),
- new ClusterParams("testhittype"),
- documentdbInfoConfig(SCHEMA),
- schemaInfo(SCHEMA));
+ IndexedBackend fastSearcher = new IndexedBackend(CLUSTER_PARAMS, dispatcher);
Query q = new Query("?query=foo");
GroupingRequest request1 = GroupingRequest.newInstance(q);
request1.setRootOperation(new AllOperation());
@@ -185,12 +166,12 @@ public class IndexedBackendTestCase {
return searcher.search(SCHEMA, new Query(query));
}
- private DocumentdbInfoConfig documentdbInfoConfig(String schemaName) {
+ private static DocumentdbInfoConfig documentdbInfoConfig(String schemaName) {
var db = new DocumentdbInfoConfig.Documentdb.Builder().name(schemaName);
return new DocumentdbInfoConfig.Builder().documentdb(db).build();
}
- private SchemaInfo schemaInfo(String schemaName) {
+ private static SchemaInfo schemaInfo(String schemaName) {
var schema = new Schema.Builder(schemaName);
schema.add(new RankProfile.Builder("default").build());
return new SchemaInfo(List.of(schema.build()), List.of());
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/PartialFillTestCase.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/PartialFillTestCase.java
index 7760e204d4b..7e3509cbef9 100644
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/PartialFillTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/PartialFillTestCase.java
@@ -17,9 +17,13 @@ import static org.junit.jupiter.api.Assertions.*;
* @author havardpe
*/
public class PartialFillTestCase {
+ private static final ClusterParams CLUSTER_PARAMS = new ClusterParams("container.0");
public static class FS4 extends VespaBackend {
public List<Result> history = new ArrayList<>();
+ FS4() {
+ super(CLUSTER_PARAMS);
+ }
protected Result doSearch2(String schema, Query query) {
return new Result(query);
}
@@ -29,6 +33,9 @@ public class PartialFillTestCase {
}
public static class BadFS4 extends VespaBackend {
+ BadFS4() {
+ super(CLUSTER_PARAMS);
+ }
protected Result doSearch2(String schema, Query query) {
return new Result(query);
}