summaryrefslogtreecommitdiffstats
path: root/vespaclient-java
diff options
context:
space:
mode:
authorGeir Storli <geirstorli@yahoo.no>2019-01-21 16:06:53 +0100
committerGitHub <noreply@github.com>2019-01-21 16:06:53 +0100
commit8372a883c5a5fa100f88fc9b80824359b5bb70cd (patch)
tree660ce3ef61f060b33bd97eac1185715606b8e2bd /vespaclient-java
parent3722c1cdd91fce30d1c2538b2a8749d9321e194b (diff)
parenteb0b1134a66507e3bd8f09793c22cd824d01dff5 (diff)
Merge pull request #8198 from vespa-engine/7
7 MERGEOK
Diffstat (limited to 'vespaclient-java')
-rw-r--r--vespaclient-java/pom.xml5
-rw-r--r--vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java18
-rw-r--r--vespaclient-java/src/main/java/com/yahoo/vespavisit/VdsVisit.java11
-rw-r--r--vespaclient-java/src/main/sh/vespa-visit.16
-rw-r--r--vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java19
-rw-r--r--vespaclient-java/src/test/java/com/yahoo/vespavisit/VdsVisitTestCase.java4
6 files changed, 20 insertions, 43 deletions
diff --git a/vespaclient-java/pom.xml b/vespaclient-java/pom.xml
index a7ac908279b..93f1579f58c 100644
--- a/vespaclient-java/pom.xml
+++ b/vespaclient-java/pom.xml
@@ -1,17 +1,16 @@
<?xml version="1.0"?>
<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
-<!-- TODO: Remove this module on Vespa 7 -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yahoo.vespa</groupId>
<artifactId>parent</artifactId>
- <version>6-SNAPSHOT</version>
+ <version>7-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>vespaclient-java</artifactId>
- <version>6-SNAPSHOT</version>
+ <version>7-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
diff --git a/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java b/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java
index 20d25b63d30..703cdeba247 100644
--- a/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java
+++ b/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java
@@ -68,7 +68,7 @@ public class CommandLineOptions {
options.addOption(Option.builder("e")
.hasArg(false)
- .desc("Retrieve header fields only. [Deprecated].")
+ .desc("Retrieve header fields only. [Removed in Vespa 7].")
.longOpt(HEADERSONLY_OPTION).build());
options.addOption(Option.builder("f")
@@ -133,12 +133,12 @@ public class CommandLineOptions {
options.addOption(Option.builder("j")
.hasArg(false)
- .desc("JSON output")
+ .desc("JSON output (default format)")
.longOpt(JSONOUTPUT_OPTION).build());
options.addOption(Option.builder("x")
.hasArg(false)
- .desc("XML output (default format)")
+ .desc("XML output")
.longOpt(XMLOUTPUT_OPTION).build());
return options;
@@ -180,17 +180,15 @@ public class CommandLineOptions {
throw new IllegalArgumentException("Cannot combine both xml and json output");
}
- if (printIdsOnly && headersOnly) {
- throw new IllegalArgumentException("Print ids and headers only options are mutually exclusive.");
+ if (headersOnly) {
+ throw new IllegalArgumentException("Headers only option has been removed.");
}
- if ((printIdsOnly || headersOnly) && !fieldSet.isEmpty()) {
- throw new IllegalArgumentException("Field set option can not be used in combination with print ids or headers only options.");
+ if (printIdsOnly && !fieldSet.isEmpty()) {
+ throw new IllegalArgumentException("Field set option can not be used in combination with print ids option.");
}
if (printIdsOnly) {
fieldSet = "[id]";
- } else if (headersOnly) {
- fieldSet = "[header]";
} else if (fieldSet.isEmpty()) {
fieldSet = "[all]";
}
@@ -226,7 +224,7 @@ public class CommandLineOptions {
.setTraceLevel(trace)
.setPriority(priority)
.setTimeout(timeout)
- .setJsonOutput((!jsonOutput && !xmlOutput) ? false : jsonOutput) // TODO Vespa 7 Change default to JSON
+ .setJsonOutput(!xmlOutput)
.build();
} catch (ParseException pe) {
throw new IllegalArgumentException(pe.getMessage());
diff --git a/vespaclient-java/src/main/java/com/yahoo/vespavisit/VdsVisit.java b/vespaclient-java/src/main/java/com/yahoo/vespavisit/VdsVisit.java
index a5c8fadc3a1..4430af19fbc 100644
--- a/vespaclient-java/src/main/java/com/yahoo/vespavisit/VdsVisit.java
+++ b/vespaclient-java/src/main/java/com/yahoo/vespavisit/VdsVisit.java
@@ -189,7 +189,7 @@ public class VdsVisit {
.desc("Only visit up to the given timestamp (microseconds).")
.type(Number.class).build());
- options.addOption("e", "headersonly", false, "Only visit headers of documents.[Deprecated]");
+ options.addOption("e", "headersonly", false, "Only visit headers of documents.[Removed in Vespa 7]");
options.addOption(Option.builder("l")
.longOpt("fieldset")
@@ -345,17 +345,16 @@ public class VdsVisit {
options.addOption(Option.builder()
.longOpt("jsonoutput")
- .desc("Output documents as JSON")
+ .desc("Output documents as JSON (default format)")
.hasArg(false)
.build());
options.addOption(Option.builder("x")
.longOpt("xmloutput")
- .desc("Output documents as XML (default format)")
+ .desc("Output documents as XML")
.hasArg(false)
.build());
-
options.addOption(Option.builder()
.longOpt("bucketspace")
.hasArg(true)
@@ -481,7 +480,7 @@ public class VdsVisit {
params.setToTimestamp(((Number) line.getParsedOptionValue("t")).longValue());
}
if (line.hasOption("e")) {
- params.fieldSet("[header]");
+ throw new IllegalArgumentException("Headers only option has been removed.");
}
if (line.hasOption("l")) {
params.fieldSet(line.getOptionValue("l"));
@@ -586,7 +585,7 @@ public class VdsVisit {
if (jsonOutput && xmlOutput) {
throw new IllegalArgumentException("Cannot combine both xml and json output");
}
- allParams.setJsonOutput((!jsonOutput && !xmlOutput) ? false : jsonOutput); // TODO Vespa 7 Change default to JSON
+ allParams.setJsonOutput(!xmlOutput);
allParams.setVisitorParameters(params);
return allParams;
diff --git a/vespaclient-java/src/main/sh/vespa-visit.1 b/vespaclient-java/src/main/sh/vespa-visit.1
index fb2f102234d..5ed40b1a410 100644
--- a/vespaclient-java/src/main/sh/vespa-visit.1
+++ b/vespaclient-java/src/main/sh/vespa-visit.1
@@ -35,12 +35,6 @@ visited. The time is given in microseconds since 1970.
If this option is given, only documents up to and including the given timestamp
will be visited. The time is given in microseconds since 1970.
.TP
-\fB\-e\fR, \fB\-\-headersonly\fR
-By default, the whole documents stored are processed. If this option is given
-only the header parts of documents will be processed. By defining the big
-document fields as body fields, you can efficiently visit all the header fields
-using this option.
-.TP
\fB\-i\fR, \fB\-\-printids\fR
Using this option, only the document identifiers will be printed to STDOUT.
In addition, if visiting removes, an additional tag will be added so you can
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 05f8964e516..8848b6f1e7f 100644
--- a/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java
+++ b/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java
@@ -89,23 +89,9 @@ public class CommandLineOptionsTest {
}
@Test
- public void testInvalidCombination1() {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("Print ids and headers only options are mutually exclusive.");
- getParsedOptions("--headersonly", "--printids");
- }
-
- @Test
- public void testInvalidCombination2() {
- exception.expect(IllegalArgumentException.class);
- exception.expectMessage("Field set option can not be used in combination with print ids or headers only options.");
- getParsedOptions("--headersonly", "--fieldset", "[header]");
- }
-
- @Test
public void testInvalidCombination3() {
exception.expect(IllegalArgumentException.class);
- exception.expectMessage("Field set option can not be used in combination with print ids or headers only options.");
+ exception.expectMessage("Field set option can not be used in combination with print ids option.");
getParsedOptions("--printids", "--fieldset", "[header]");
}
@@ -157,8 +143,9 @@ public class CommandLineOptionsTest {
@Test
public void testHeadersOnly() {
+ exception.expect(IllegalArgumentException.class);
+ exception.expectMessage("Headers only option has been removed.");
ClientParameters params = getParsedOptions("--headersonly");
- assertEquals("[header]", params.fieldSet);
}
@Test
diff --git a/vespaclient-java/src/test/java/com/yahoo/vespavisit/VdsVisitTestCase.java b/vespaclient-java/src/test/java/com/yahoo/vespavisit/VdsVisitTestCase.java
index 32e29ba51ec..570f38045e6 100644
--- a/vespaclient-java/src/test/java/com/yahoo/vespavisit/VdsVisitTestCase.java
+++ b/vespaclient-java/src/test/java/com/yahoo/vespavisit/VdsVisitTestCase.java
@@ -74,7 +74,7 @@ public class VdsVisitTestCase {
// Short options testing (for options that do not collide with each other)
String[] args = new String[] {
"-o", "654321",
- "-e"
+ "-i"
};
VdsVisit.ArgumentParser parser = createMockArgumentParser();
VdsVisit.VdsVisitParameters allParams = parser.parse(args);
@@ -84,7 +84,7 @@ public class VdsVisitTestCase {
assertNotNull(params);
assertEquals(654321, allParams.getFullTimeout());
assertEquals(654321, params.getTimeoutMs());
- assertEquals("[header]", params.getFieldSet());
+ assertEquals("[id]", params.getFieldSet());
}
@Test