aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java')
-rw-r--r--container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java32
1 files changed, 11 insertions, 21 deletions
diff --git a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java
index 8be60b7c3b0..30fb33ee8c8 100644
--- a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java
+++ b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java
@@ -23,6 +23,7 @@ import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import static org.junit.jupiter.api.Assertions.*;
@@ -76,7 +77,7 @@ public class StreamingVisitorTest {
};
}
- private class QueryArguments {
+ private static class QueryArguments {
// General query parameters
String query = "test";
double timeout = 0.5;
@@ -188,25 +189,21 @@ public class StreamingVisitorTest {
return query;
}
- private void verifyVisitorParameters(VisitorParameters params, QueryArguments qa, String searchCluster, String docType, Route route) {
+ private void verifyVisitorParameters(VisitorParameters params, QueryArguments qa, String searchCluster, String schema, Route route) {
//System.out.println("params="+params);
// Verify parameters based on properties
if (qa.userId != null) {
- assertEquals(docType + " and ( id.user=="+qa.userId + " )", params.getDocumentSelection());
+ assertEquals(schema + " and ( id.user=="+qa.userId + " )", params.getDocumentSelection());
} else if (qa.groupName != null) {
- assertEquals(docType + " and ( id.group==\""+qa.groupName+"\" )", params.getDocumentSelection());
+ assertEquals(schema + " and ( id.group==\""+qa.groupName+"\" )", params.getDocumentSelection());
} else if ((qa.selection == null) || qa.selection.isEmpty()) {
- assertEquals(docType, params.getDocumentSelection());
+ assertEquals(schema, params.getDocumentSelection());
} else {
- assertEquals(docType + " and ( " + qa.selection + " )", params.getDocumentSelection());
+ assertEquals(schema + " and ( " + qa.selection + " )", params.getDocumentSelection());
}
assertEquals(qa.from, params.getFromTimestamp());
assertEquals(qa.to, params.getToTimestamp());
- if (qa.priority != null) {
- assertEquals(qa.priority, params.getPriority());
- } else {
- assertEquals(DocumentProtocol.Priority.VERY_HIGH, params.getPriority());
- }
+ assertEquals(Objects.requireNonNullElse(qa.priority, DocumentProtocol.Priority.VERY_HIGH), params.getPriority());
if (qa.maxBucketsPerVisitor != 0) {
assertEquals(qa.maxBucketsPerVisitor, params.getMaxBucketsPerVisitor());
} else {
@@ -227,17 +224,10 @@ public class StreamingVisitorTest {
//System.err.println("query="+new String(params.getLibraryParameters().get("querystackcount")));
assertNotNull(params.getLibraryParameters().get("querystackcount")); // TODO: Check contents
assertEquals(searchCluster, new String(params.getLibraryParameters().get("searchcluster")));
- if (qa.summary != null) {
- assertEquals(qa.summary, new String(params.getLibraryParameters().get("summaryclass")));
- } else {
- assertEquals("default", new String(params.getLibraryParameters().get("summaryclass")));
- }
+ assertEquals(schema, new String(params.getLibraryParameters().get("schema")));
+ assertEquals(Objects.requireNonNullElse(qa.summary, "default"), new String(params.getLibraryParameters().get("summaryclass")));
assertEquals(Integer.toString(qa.offset+qa.hits), new String(params.getLibraryParameters().get("summarycount")));
- if (qa.profile != null) {
- assertEquals(qa.profile, new String(params.getLibraryParameters().get("rankprofile")));
- } else {
- assertEquals("default", new String(params.getLibraryParameters().get("rankprofile")));
- }
+ assertEquals(Objects.requireNonNullElse(qa.profile, "default"), new String(params.getLibraryParameters().get("rankprofile")));
//System.err.println("queryflags="+new String(params.getLibraryParameters().get("queryflags")));
assertNotNull(params.getLibraryParameters().get("queryflags")); // TODO: Check contents
if (qa.location != null) {