aboutsummaryrefslogtreecommitdiffstats
path: root/vespaclient-java/src/test/java/com/yahoo/vespaget
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2020-08-05 09:09:29 +0200
committerGitHub <noreply@github.com>2020-08-05 09:09:29 +0200
commit78d1d7c83099639947edb423c67df4961a2cf5e4 (patch)
tree52b17fad75ba741518f59f01f0a3ab1372a8774b /vespaclient-java/src/test/java/com/yahoo/vespaget
parent2e82ff0ff2e24811d96c42126d81526da7ea3779 (diff)
parent2e225436140011754c7d467d5174624d4e451552 (diff)
Merge pull request #13985 from vespa-engine/balder/minor-fieldset-cleanup
Balder/minor fieldset cleanup
Diffstat (limited to 'vespaclient-java/src/test/java/com/yahoo/vespaget')
-rw-r--r--vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java19
-rw-r--r--vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java6
2 files changed, 17 insertions, 8 deletions
diff --git a/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java b/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java
index 50b499b8df2..20d12d3f55f 100644
--- a/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java
+++ b/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java
@@ -1,15 +1,24 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespaget;
+import com.yahoo.document.fieldset.AllFields;
+import com.yahoo.document.fieldset.DocIdOnly;
import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
import java.util.Iterator;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* Test class for {@link CommandLineOptions}
@@ -45,7 +54,7 @@ public class CommandLineOptionsTest {
assertFalse(params.help);
assertFalse(params.documentIds.hasNext());
assertFalse(params.printIdsOnly);
- assertEquals("[all]", params.fieldSet);
+ assertEquals(AllFields.NAME, params.fieldSet);
assertEquals("default-get", params.route);
assertTrue(params.cluster.isEmpty());
assertEquals("client", params.configId);
@@ -92,7 +101,7 @@ public class CommandLineOptionsTest {
public void testInvalidCombination3() {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("Field set option can not be used in combination with print ids option.");
- getParsedOptions("--printids", "--fieldset", "[header]");
+ getParsedOptions("--printids", "--fieldset", AllFields.NAME);
}
@Test
@@ -138,7 +147,7 @@ public class CommandLineOptionsTest {
@Test
public void testPrintids() {
ClientParameters params = getParsedOptions("--printids");
- assertEquals("[id]", params.fieldSet);
+ assertEquals(DocIdOnly.NAME, params.fieldSet);
}
@Test
diff --git a/vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java b/vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java
index c662e2fed62..d8b5c267bf2 100644
--- a/vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java
+++ b/vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java
@@ -1,11 +1,11 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespaget;
-import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yahoo.document.DataType;
import com.yahoo.document.Document;
import com.yahoo.document.DocumentId;
+import com.yahoo.document.fieldset.AllFields;
import com.yahoo.documentapi.messagebus.MessageBusDocumentAccess;
import com.yahoo.documentapi.messagebus.MessageBusSyncSession;
import com.yahoo.documentapi.messagebus.loadtypes.LoadType;
@@ -96,7 +96,7 @@ public class DocumentRetrieverTest {
.setCluster("")
.setRoute("default")
.setConfigId("client")
- .setFieldSet("[all]")
+ .setFieldSet(AllFields.NAME)
.setPrintIdsOnly(false)
.setHelp(false)
.setShowDocSize(false)
@@ -180,7 +180,7 @@ public class DocumentRetrieverTest {
}
@Test
- public void testJsonOutput() throws DocumentRetrieverException, JsonParseException, IOException {
+ public void testJsonOutput() throws DocumentRetrieverException, IOException {
ClientParameters params = createParameters()
.setDocumentIds(asIterator(DOC_ID_1, DOC_ID_2, DOC_ID_3))
.setJsonOutput(true)