summaryrefslogtreecommitdiffstats
path: root/vespaclient-java
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahooinc.com>2022-05-16 13:20:56 +0200
committergjoranv <gv@verizonmedia.com>2022-06-08 11:45:22 +0200
commit4639be4f03d58a0b8df7b1ecb573e7d344a53ed5 (patch)
tree236d8b271e2e51c5e15df08bc19c4c97860ca16a /vespaclient-java
parent1e03a00cd6f69cf63d942885e97ff7582778c7f5 (diff)
Remove top-level <clients> element and LoadType concept
Load types have not been properly supported for some time, so remove the remaining API surfaces exposing them. Since load type config was the last remaining use of <clients> in services.xml, remove that one as well.
Diffstat (limited to 'vespaclient-java')
-rw-r--r--vespaclient-java/src/main/java/com/yahoo/vespafeeder/Arguments.java1
-rw-r--r--vespaclient-java/src/main/java/com/yahoo/vespaget/ClientParameters.java13
-rw-r--r--vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java9
-rw-r--r--vespaclient-java/src/main/java/com/yahoo/vespaget/DocumentRetriever.java40
-rw-r--r--vespaclient-java/src/main/java/com/yahoo/vespaget/Main.java3
-rw-r--r--vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java3
-rw-r--r--vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java23
7 files changed, 6 insertions, 86 deletions
diff --git a/vespaclient-java/src/main/java/com/yahoo/vespafeeder/Arguments.java b/vespaclient-java/src/main/java/com/yahoo/vespafeeder/Arguments.java
index 52f2857c7e5..2ae3ecf113b 100644
--- a/vespaclient-java/src/main/java/com/yahoo/vespafeeder/Arguments.java
+++ b/vespaclient-java/src/main/java/com/yahoo/vespafeeder/Arguments.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespafeeder;
-import com.yahoo.vespa.config.content.LoadTypeConfig;
import com.yahoo.feedapi.DummySessionFactory;
import com.yahoo.feedapi.MessageBusSessionFactory;
import com.yahoo.feedapi.MessagePropertyProcessor;
diff --git a/vespaclient-java/src/main/java/com/yahoo/vespaget/ClientParameters.java b/vespaclient-java/src/main/java/com/yahoo/vespaget/ClientParameters.java
index d3431818b63..3ea641fc642 100644
--- a/vespaclient-java/src/main/java/com/yahoo/vespaget/ClientParameters.java
+++ b/vespaclient-java/src/main/java/com/yahoo/vespaget/ClientParameters.java
@@ -35,8 +35,6 @@ public class ClientParameters {
public final int traceLevel;
// Document request priority
public final DocumentProtocol.Priority priority;
- // Determines the Vespa load type
- public final String loadTypeName;
// If full documents are printed, they will be printed as JSON (instead of XML)
public final boolean jsonOutput;
@@ -45,7 +43,7 @@ public class ClientParameters {
boolean help, Iterator<String> documentIds, boolean printIdsOnly,
String fieldSet, String route, String cluster, String configId,
boolean showDocSize, double timeout, boolean noRetry, int traceLevel,
- DocumentProtocol.Priority priority, String loadTypeName, boolean jsonOutput) {
+ DocumentProtocol.Priority priority, boolean jsonOutput) {
this.help = help;
this.documentIds = documentIds;
@@ -59,7 +57,6 @@ public class ClientParameters {
this.noRetry = noRetry;
this.traceLevel = traceLevel;
this.priority = priority;
- this.loadTypeName = loadTypeName;
this.jsonOutput = jsonOutput;
}
@@ -76,7 +73,6 @@ public class ClientParameters {
private boolean noRetry;
private int traceLevel;
private DocumentProtocol.Priority priority;
- private String loadTypeName;
private boolean jsonOutput;
public Builder setHelp(boolean help) {
@@ -139,11 +135,6 @@ public class ClientParameters {
return this;
}
- public Builder setLoadTypeName(String loadTypeName) {
- this.loadTypeName = loadTypeName;
- return this;
- }
-
public Builder setJsonOutput(boolean jsonOutput) {
this.jsonOutput = jsonOutput;
return this;
@@ -152,7 +143,7 @@ public class ClientParameters {
public ClientParameters build() {
return new ClientParameters(
help, documentIds, printIdsOnly, fieldSet, route, cluster, configId,
- showDocSize, timeout, noRetry, traceLevel, priority, loadTypeName, jsonOutput);
+ showDocSize, timeout, noRetry, traceLevel, priority, jsonOutput);
}
}
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 da9f48f44b1..bc5680d38b7 100644
--- a/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java
+++ b/vespaclient-java/src/main/java/com/yahoo/vespaget/CommandLineOptions.java
@@ -37,7 +37,6 @@ public class CommandLineOptions {
public static final String NORETRY_OPTION = "noretry";
public static final String TRACE_OPTION = "trace";
public static final String PRIORITY_OPTION = "priority";
- public static final String LOADTYPE_OPTION = "loadtype";
public static final String JSONOUTPUT_OPTION = "jsonoutput";
public static final String XMLOUTPUT_OPTION = "xmloutput";
@@ -123,12 +122,6 @@ public class CommandLineOptions {
.longOpt(PRIORITY_OPTION)
.argName("priority").build());
- options.addOption(Option.builder("l")
- .hasArg(true)
- .desc("Load type (default \"\").")
- .longOpt(LOADTYPE_OPTION)
- .argName("loadtype").build());
-
options.addOption(Option.builder("j")
.hasArg(false)
.desc("JSON output (default format)")
@@ -163,7 +156,6 @@ public class CommandLineOptions {
String route = cl.getOptionValue(ROUTE_OPTION, "");
String configId = cl.getOptionValue(CONFIGID_OPTION, "");
boolean help = cl.hasOption(HELP_OPTION);
- String loadtype = cl.getOptionValue(LOADTYPE_OPTION, "");
boolean noRetry = cl.hasOption(NORETRY_OPTION);
boolean showDocSize = cl.hasOption(SHOWDOCSIZE_OPTION);
boolean jsonOutput = cl.hasOption(JSONOUTPUT_OPTION);
@@ -211,7 +203,6 @@ public class CommandLineOptions {
.setFieldSet(fieldSet)
.setHelp(help)
.setPrintIdsOnly(printIdsOnly)
- .setLoadTypeName(loadtype)
.setNoRetry(noRetry)
.setCluster(cluster)
.setRoute(route)
diff --git a/vespaclient-java/src/main/java/com/yahoo/vespaget/DocumentRetriever.java b/vespaclient-java/src/main/java/com/yahoo/vespaget/DocumentRetriever.java
index 2454f5c8627..f0f36b06f8b 100644
--- a/vespaclient-java/src/main/java/com/yahoo/vespaget/DocumentRetriever.java
+++ b/vespaclient-java/src/main/java/com/yahoo/vespaget/DocumentRetriever.java
@@ -8,8 +8,6 @@ import com.yahoo.documentapi.SyncParameters;
import com.yahoo.documentapi.messagebus.MessageBusDocumentAccess;
import com.yahoo.documentapi.messagebus.MessageBusParams;
import com.yahoo.documentapi.messagebus.MessageBusSyncSession;
-import com.yahoo.documentapi.messagebus.loadtypes.LoadType;
-import com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet;
import com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage;
import com.yahoo.documentapi.messagebus.protocol.GetDocumentReply;
import com.yahoo.messagebus.Message;
@@ -20,7 +18,6 @@ import com.yahoo.vespaclient.ClusterDef;
import com.yahoo.vespaclient.ClusterList;
import java.util.Iterator;
-import java.util.Map;
/**
* The document retriever is responsible for retrieving documents using the Document API and printing the result to standard out.
@@ -33,7 +30,6 @@ public class DocumentRetriever {
private final ClusterList clusterList;
private final DocumentAccessFactory documentAccessFactory;
private final ClientParameters params;
- private final LoadTypeSet loadTypeSet; // TODO remove on Vespa 8
private MessageBusSyncSession session;
private MessageBusDocumentAccess documentAccess;
@@ -43,21 +39,6 @@ public class DocumentRetriever {
ClientParameters params) {
this.clusterList = clusterList;
this.documentAccessFactory = documentAccessFactory;
- this.loadTypeSet = new LoadTypeSet(); // TODO remove on Vespa 8
- this.params = params;
- }
-
- /**
- * @deprecated load types are deprecated. Use constructor without LoadTypeSet instead.
- */
- @Deprecated(forRemoval = true) // TODO: Remove on Vespa 8
- public DocumentRetriever(ClusterList clusterList,
- DocumentAccessFactory documentAccessFactory,
- LoadTypeSet loadTypeSet,
- ClientParameters params) {
- this.clusterList = clusterList;
- this.documentAccessFactory = documentAccessFactory;
- this.loadTypeSet = loadTypeSet;
this.params = params;
}
@@ -81,7 +62,6 @@ public class DocumentRetriever {
public void retrieveDocuments() throws DocumentRetrieverException {
boolean first = true;
String route = params.cluster.isEmpty() ? params.route : resolveClusterRoute(params.cluster);
- LoadType loadType = params.loadTypeName.isEmpty() ? null : resolveLoadType(params.loadTypeName);
MessageBusParams messageBusParams = createMessageBusParams(params.configId, params.timeout, route);
documentAccess = documentAccessFactory.createDocumentAccess(messageBusParams);
@@ -104,7 +84,7 @@ public class DocumentRetriever {
}
}
String docid = iter.next();
- Message msg = createDocumentRequest(docid, loadType);
+ Message msg = createDocumentRequest(docid);
Reply reply = session.syncSend(msg);
printReply(reply);
}
@@ -133,17 +113,8 @@ public class DocumentRetriever {
return clusterDef.getRoute();
}
- private LoadType resolveLoadType(String loadTypeName) throws DocumentRetrieverException {
- Map<String, LoadType> loadTypesNameMap = loadTypeSet.getNameMap();
- if (!loadTypesNameMap.containsKey(loadTypeName)) {
- throw new DocumentRetrieverException(String.format("Loadtype with name '%s' does not exist.\n", loadTypeName));
- } else {
- return loadTypesNameMap.get(loadTypeName);
- }
- }
-
private MessageBusParams createMessageBusParams(String configId, double timeout, String route) {
- MessageBusParams messageBusParams = new MessageBusParams(loadTypeSet);
+ MessageBusParams messageBusParams = new MessageBusParams();
messageBusParams.setRoute(route);
messageBusParams.setProtocolConfigId(configId);
messageBusParams.setRoutingConfigId(configId);
@@ -155,15 +126,10 @@ public class DocumentRetriever {
return messageBusParams;
}
- @SuppressWarnings("removal") // TODO: Remove on Vespa 8
- private Message createDocumentRequest(String docid, LoadType loadType) {
+ private Message createDocumentRequest(String docid) {
GetDocumentMessage msg = new GetDocumentMessage(new DocumentId(docid), params.fieldSet);
msg.setPriority(params.priority); // TODO: Remove on Vespa 8
msg.setRetryEnabled(!params.noRetry);
-
- if (loadType != null) {
- msg.setLoadType(loadType);
- }
return msg;
}
diff --git a/vespaclient-java/src/main/java/com/yahoo/vespaget/Main.java b/vespaclient-java/src/main/java/com/yahoo/vespaget/Main.java
index 7596246d16e..f5851041ceb 100644
--- a/vespaclient-java/src/main/java/com/yahoo/vespaget/Main.java
+++ b/vespaclient-java/src/main/java/com/yahoo/vespaget/Main.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespaget;
-import com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet;
import com.yahoo.vespaclient.ClusterList;
import java.util.logging.Level;
@@ -38,12 +37,10 @@ public class Main {
Runtime.getRuntime().addShutdownHook(new Thread(documentRetriever::shutdown));
}
- @SuppressWarnings("removal") // TODO: Remove on Vespa 8
private static DocumentRetriever createDocumentRetriever(ClientParameters params) {
return new DocumentRetriever(
new ClusterList("client"),
new DocumentAccessFactory(),
- new LoadTypeSet(params.configId), // TODO: Remove on Vespa 8
params
);
}
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 b634e899b74..d47810fa81f 100644
--- a/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java
+++ b/vespaclient-java/src/test/java/com/yahoo/vespaget/CommandLineOptionsTest.java
@@ -66,7 +66,6 @@ public class CommandLineOptionsTest {
assertFalse(params.noRetry);
assertEquals(0, params.traceLevel);
assertEquals(DocumentProtocol.Priority.NORMAL_2, params.priority);
- assertTrue(params.loadTypeName.isEmpty());
}
@Test
@@ -80,7 +79,6 @@ public class CommandLineOptionsTest {
"--noretry",
"--trace", "1",
"--priority", Integer.toString(DocumentProtocol.Priority.HIGH_3.getValue()),
- "--loadtype", "dummyloadtype",
"id:1", "id:2"
);
@@ -92,7 +90,6 @@ public class CommandLineOptionsTest {
assertTrue(params.noRetry);
assertEquals(1, params.traceLevel);
assertEquals(DocumentProtocol.Priority.HIGH_3, params.priority);
- assertEquals("dummyloadtype", params.loadTypeName);
Iterator<String> documentsIds = params.documentIds;
assertEquals("id:1", documentsIds.next());
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 30d117ab105..df847852c83 100644
--- a/vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java
+++ b/vespaclient-java/src/test/java/com/yahoo/vespaget/DocumentRetrieverTest.java
@@ -8,8 +8,6 @@ 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;
-import com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet;
import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol;
import com.yahoo.documentapi.messagebus.protocol.GetDocumentMessage;
import com.yahoo.documentapi.messagebus.protocol.GetDocumentReply;
@@ -101,7 +99,6 @@ public class DocumentRetrieverTest {
.setPrintIdsOnly(false)
.setHelp(false)
.setShowDocSize(false)
- .setLoadTypeName("")
.setNoRetry(false)
.setTraceLevel(0)
.setTimeout(0)
@@ -139,24 +136,19 @@ public class DocumentRetrieverTest {
.setDocumentIds(asIterator(DOC_ID_1))
.setPriority(DocumentProtocol.Priority.HIGH_1)
.setNoRetry(true)
- .setLoadTypeName("loadtype")
.build();
when(mockedSession.syncSend(any())).thenReturn(createDocumentReply(DOC_ID_1));
- LoadTypeSet loadTypeSet = new LoadTypeSet(); // TODO remove on Vespa 8
- loadTypeSet.addLoadType(1, "loadtype", DocumentProtocol.Priority.HIGH_1);
DocumentRetriever documentRetriever = new DocumentRetriever(
new ClusterList(),
mockedFactory,
- loadTypeSet,
params);
documentRetriever.retrieveDocuments();
verify(mockedSession, times(1)).syncSend(argThat((ArgumentMatcher<GetDocumentMessage>) o ->
o.getPriority().equals(DocumentProtocol.Priority.HIGH_1) &&
- !o.getRetryEnabled() &&
- o.getLoadType().equals(new LoadType(1, "loadtype", DocumentProtocol.Priority.HIGH_1)))); // TODO: Remove on Vespa 8
+ !o.getRetryEnabled()));
assertContainsDocument(DOC_ID_1);
}
@@ -221,19 +213,6 @@ public class DocumentRetrieverTest {
}
@Test
- public void testInvalidLoadType() throws DocumentRetrieverException {
- exception.expect(DocumentRetrieverException.class);
- exception.expectMessage("Loadtype with name 'undefinedloadtype' does not exist.\n");
-
- ClientParameters params = createParameters()
- .setLoadTypeName("undefinedloadtype")
- .build();
-
- DocumentRetriever documentRetriever = createDocumentRetriever(params);
- documentRetriever.retrieveDocuments();
- }
-
- @Test
public void testClusterLookup() throws DocumentRetrieverException {
final String cluster = "storage",
expectedRoute = "[Content:cluster=storage]";