summaryrefslogtreecommitdiffstats
path: root/vespa-http-client
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2019-03-22 18:23:40 +0100
committerGitHub <noreply@github.com>2019-03-22 18:23:40 +0100
commita62e538f10f8d92af21de38000f97aea6ca7a500 (patch)
tree5a067c41c5a02ca06c6343d8e4f22f25a9d6ee7a /vespa-http-client
parent125c97eedfa07ab3d5c32bc775e5bb50b3feebd3 (diff)
parentb9335fafb8bba7d9bb162ad90ec3192ba7c84fb1 (diff)
Merge pull request #8881 from vespa-engine/bratseth/remove-dependencies
Bratseth/remove dependencies
Diffstat (limited to 'vespa-http-client')
-rw-r--r--vespa-http-client/abi-spec.json483
-rw-r--r--vespa-http-client/pom.xml85
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/FeedClient.java3
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/Result.java2
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Cluster.java3
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/ConnectionParams.java2
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java3
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/FeedParams.java2
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/SessionParams.java3
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/package-info.java8
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java5
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/Vtag.java7
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/package-info.java1
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/package-info.java10
-rw-r--r--vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/package-info.java1
-rw-r--r--vespa-http-client/src/test/java/com/yahoo/vespa/http/client/JsonTestHelper.java52
-rw-r--r--vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/operationProcessor/IncompleteResultsThrottlerTest.java128
-rw-r--r--vespa-http-client/src/test/java/com/yahoo/vespa/http/client/runner/JsonReaderTest.java2
18 files changed, 190 insertions, 610 deletions
diff --git a/vespa-http-client/abi-spec.json b/vespa-http-client/abi-spec.json
index 94c373ec5bd..9e26dfeeb6e 100644
--- a/vespa-http-client/abi-spec.json
+++ b/vespa-http-client/abi-spec.json
@@ -1,482 +1 @@
-{
- "com.yahoo.vespa.http.client.FeedClient$ResultCallback": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "interface",
- "abstract"
- ],
- "methods": [
- "public abstract void onCompletion(java.lang.String, com.yahoo.vespa.http.client.Result)",
- "public void onEndpointException(com.yahoo.vespa.http.client.FeedEndpointException)"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.FeedClient": {
- "superClass": "java.lang.Object",
- "interfaces": [
- "java.lang.AutoCloseable"
- ],
- "attributes": [
- "public",
- "interface",
- "abstract"
- ],
- "methods": [
- "public void stream(java.lang.String, java.lang.CharSequence)",
- "public void stream(java.lang.String, java.lang.CharSequence, java.lang.Object)",
- "public abstract void stream(java.lang.String, java.lang.String, java.lang.CharSequence, java.lang.Object)",
- "public abstract void close()",
- "public abstract java.lang.String getStatsAsJson()",
- "public static void feedJson(java.io.InputStream, com.yahoo.vespa.http.client.FeedClient, java.util.concurrent.atomic.AtomicInteger)",
- "public static void feedXml(java.io.InputStream, com.yahoo.vespa.http.client.FeedClient, java.util.concurrent.atomic.AtomicInteger)"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.FeedClientFactory": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public"
- ],
- "methods": [
- "public void <init>()",
- "public static com.yahoo.vespa.http.client.FeedClient create(com.yahoo.vespa.http.client.config.SessionParams, com.yahoo.vespa.http.client.FeedClient$ResultCallback)"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.FeedConnectException": {
- "superClass": "com.yahoo.vespa.http.client.FeedEndpointException",
- "interfaces": [],
- "attributes": [
- "public"
- ],
- "methods": [
- "public void <init>(java.lang.Throwable, com.yahoo.vespa.http.client.config.Endpoint)"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.FeedEndpointException": {
- "superClass": "java.lang.RuntimeException",
- "interfaces": [],
- "attributes": [
- "public",
- "abstract"
- ],
- "methods": [
- "protected void <init>(java.lang.String, java.lang.Throwable, com.yahoo.vespa.http.client.config.Endpoint)",
- "public com.yahoo.vespa.http.client.config.Endpoint getEndpoint()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.FeedProtocolException": {
- "superClass": "com.yahoo.vespa.http.client.FeedEndpointException",
- "interfaces": [],
- "attributes": [
- "public"
- ],
- "methods": [
- "public void <init>(int, java.lang.String, java.lang.Throwable, com.yahoo.vespa.http.client.config.Endpoint)",
- "public int getHttpStatusCode()",
- "public java.lang.String getHttpResponseMessage()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.Result$Detail": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public void <init>(com.yahoo.vespa.http.client.config.Endpoint, com.yahoo.vespa.http.client.Result$ResultType, java.lang.String, java.lang.Exception)",
- "public void <init>(com.yahoo.vespa.http.client.config.Endpoint)",
- "public com.yahoo.vespa.http.client.config.Endpoint getEndpoint()",
- "public boolean isSuccess()",
- "public com.yahoo.vespa.http.client.Result$ResultType getResultType()",
- "public java.lang.Exception getException()",
- "public java.lang.String getTraceMessage()",
- "public java.lang.String toString()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.Result$ResultType": {
- "superClass": "java.lang.Enum",
- "interfaces": [],
- "attributes": [
- "public",
- "final",
- "enum"
- ],
- "methods": [
- "public static com.yahoo.vespa.http.client.Result$ResultType[] values()",
- "public static com.yahoo.vespa.http.client.Result$ResultType valueOf(java.lang.String)"
- ],
- "fields": [
- "public static final enum com.yahoo.vespa.http.client.Result$ResultType OPERATION_EXECUTED",
- "public static final enum com.yahoo.vespa.http.client.Result$ResultType TRANSITIVE_ERROR",
- "public static final enum com.yahoo.vespa.http.client.Result$ResultType CONDITION_NOT_MET",
- "public static final enum com.yahoo.vespa.http.client.Result$ResultType FATAL_ERROR"
- ]
- },
- "com.yahoo.vespa.http.client.Result": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public"
- ],
- "methods": [
- "public void <init>(com.yahoo.vespa.http.client.core.Document, java.util.Collection, java.lang.StringBuilder)",
- "public java.lang.String getDocumentId()",
- "public java.lang.String getOperationId()",
- "public java.lang.CharSequence getDocumentDataAsCharSequence()",
- "public java.lang.Object getContext()",
- "public boolean isSuccess()",
- "public java.util.List getDetails()",
- "public boolean hasLocalTrace()",
- "public java.lang.String toString()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.Session": {
- "superClass": "java.lang.Object",
- "interfaces": [
- "java.lang.AutoCloseable"
- ],
- "attributes": [
- "public",
- "interface",
- "abstract"
- ],
- "methods": [
- "public abstract java.io.OutputStream stream(java.lang.CharSequence)",
- "public abstract java.util.concurrent.BlockingQueue results()",
- "public abstract void close()",
- "public abstract java.lang.String getStatsAsJson()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.SessionFactory": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public void <init>()",
- "public static com.yahoo.vespa.http.client.Session create(com.yahoo.vespa.http.client.config.SessionParams)",
- "public static com.yahoo.vespa.http.client.Session create(com.yahoo.vespa.http.client.config.Endpoint)"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.SimpleLoggerResultCallback": {
- "superClass": "java.lang.Object",
- "interfaces": [
- "com.yahoo.vespa.http.client.FeedClient$ResultCallback"
- ],
- "attributes": [
- "public"
- ],
- "methods": [
- "protected void println(java.lang.String)",
- "public void <init>(java.util.concurrent.atomic.AtomicInteger, int)",
- "public void printProgress()",
- "protected com.yahoo.vespa.http.client.SimpleLoggerResultCallback$DocumentRate newSamplingPeriod(java.time.Instant)",
- "public void onCompletion(java.lang.String, com.yahoo.vespa.http.client.Result)"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.SyncFeedClient$SyncOperation": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public"
- ],
- "methods": [
- "public void <init>(java.lang.String, java.lang.CharSequence)",
- "public void <init>(java.lang.String, java.lang.CharSequence, java.lang.Object)"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.SyncFeedClient$SyncResult": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public"
- ],
- "methods": [
- "public java.util.List results()",
- "public java.lang.Exception exception()",
- "public boolean isSuccess()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.SyncFeedClient": {
- "superClass": "java.lang.Object",
- "interfaces": [
- "java.lang.AutoCloseable"
- ],
- "attributes": [
- "public"
- ],
- "methods": [
- "public void <init>(com.yahoo.vespa.http.client.config.SessionParams)",
- "public com.yahoo.vespa.http.client.SyncFeedClient$SyncResult stream(java.util.List)",
- "public void close()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.config.Cluster$Builder": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public void <init>()",
- "public com.yahoo.vespa.http.client.config.Cluster$Builder addEndpoint(com.yahoo.vespa.http.client.config.Endpoint)",
- "public com.yahoo.vespa.http.client.config.Cluster$Builder setRoute(java.lang.String)",
- "public com.yahoo.vespa.http.client.config.Cluster build()",
- "public java.lang.String getRoute()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.config.Cluster": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public java.util.List getEndpoints()",
- "public java.lang.String getRoute()",
- "public java.lang.String toString()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.config.ConnectionParams$Builder": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public void <init>()",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setSslContext(javax.net.ssl.SSLContext)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setHostnameVerifier(javax.net.ssl.HostnameVerifier)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder addHeader(java.lang.String, java.lang.String)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder addDynamicHeader(java.lang.String, com.yahoo.vespa.http.client.config.ConnectionParams$HeaderProvider)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setNumPersistentConnectionsPerEndpoint(int)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setProxyHost(java.lang.String)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setProxyPort(int)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setUseCompression(boolean)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setMaxRetries(int)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setDryRun(boolean)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setMinTimeBetweenRetries(long, java.util.concurrent.TimeUnit)",
- "public long getMinTimeBetweenRetriesMs()",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setTraceLevel(int)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setTraceEveryXOperation(int)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams$Builder setPrintTraceToStdErr(boolean)",
- "public com.yahoo.vespa.http.client.config.ConnectionParams build()",
- "public int getNumPersistentConnectionsPerEndpoint()",
- "public java.lang.String getProxyHost()",
- "public boolean isDryRun()",
- "public int getMaxRetries()",
- "public int getTraceLevel()",
- "public int getTraceEveryXOperation()",
- "public boolean getPrintTraceToStdErr()",
- "public int getProxyPort()",
- "public javax.net.ssl.SSLContext getSslContext()",
- "public javax.net.ssl.HostnameVerifier getHostnameVerifier()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.config.ConnectionParams$HeaderProvider": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "interface",
- "abstract"
- ],
- "methods": [
- "public abstract java.lang.String getHeaderValue()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.config.ConnectionParams": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public javax.net.ssl.SSLContext getSslContext()",
- "public javax.net.ssl.HostnameVerifier getHostnameVerifier()",
- "public java.util.Collection getHeaders()",
- "public java.util.Map getDynamicHeaders()",
- "public int getNumPersistentConnectionsPerEndpoint()",
- "public java.lang.String getProxyHost()",
- "public int getProxyPort()",
- "public boolean getUseCompression()",
- "public int getMaxRetries()",
- "public long getMinTimeBetweenRetriesMs()",
- "public boolean isDryRun()",
- "public int getTraceLevel()",
- "public int getTraceEveryXOperation()",
- "public boolean getPrintTraceToStdErr()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.config.Endpoint": {
- "superClass": "java.lang.Object",
- "interfaces": [
- "java.io.Serializable"
- ],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public static com.yahoo.vespa.http.client.config.Endpoint create(java.lang.String)",
- "public static com.yahoo.vespa.http.client.config.Endpoint create(java.lang.String, int, boolean)",
- "public java.lang.String getHostname()",
- "public int getPort()",
- "public boolean isUseSsl()",
- "public java.lang.String toString()",
- "public boolean equals(java.lang.Object)",
- "public int hashCode()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.config.FeedParams$Builder": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public void <init>()",
- "public com.yahoo.vespa.http.client.config.FeedParams$Builder withSilentUpgrade(boolean)",
- "public com.yahoo.vespa.http.client.config.FeedParams$Builder setMaxSleepTimeMs(long)",
- "public com.yahoo.vespa.http.client.config.FeedParams$Builder setDenyIfBusyV3(boolean)",
- "public com.yahoo.vespa.http.client.config.FeedParams$Builder setDataFormat(com.yahoo.vespa.http.client.config.FeedParams$DataFormat)",
- "public com.yahoo.vespa.http.client.config.FeedParams$Builder setRoute(java.lang.String)",
- "public com.yahoo.vespa.http.client.config.FeedParams$Builder setServerTimeout(long, java.util.concurrent.TimeUnit)",
- "public com.yahoo.vespa.http.client.config.FeedParams$Builder setClientTimeout(long, java.util.concurrent.TimeUnit)",
- "public com.yahoo.vespa.http.client.config.FeedParams$Builder setMaxChunkSizeBytes(int)",
- "public com.yahoo.vespa.http.client.config.FeedParams$Builder setMaxInFlightRequests(int)",
- "public com.yahoo.vespa.http.client.config.FeedParams$Builder setLocalQueueTimeOut(long)",
- "public com.yahoo.vespa.http.client.config.FeedParams$Builder setPriority(java.lang.String)",
- "public com.yahoo.vespa.http.client.config.FeedParams build()",
- "public long getClientTimeout(java.util.concurrent.TimeUnit)",
- "public long getServerTimeout(java.util.concurrent.TimeUnit)",
- "public java.lang.String getRoute()",
- "public com.yahoo.vespa.http.client.config.FeedParams$DataFormat getDataFormat()",
- "public int getMaxChunkSizeBytes()",
- "public int getmaxInFlightRequests()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.config.FeedParams$DataFormat": {
- "superClass": "java.lang.Enum",
- "interfaces": [],
- "attributes": [
- "public",
- "final",
- "enum"
- ],
- "methods": [
- "public static com.yahoo.vespa.http.client.config.FeedParams$DataFormat[] values()",
- "public static com.yahoo.vespa.http.client.config.FeedParams$DataFormat valueOf(java.lang.String)"
- ],
- "fields": [
- "public static final enum com.yahoo.vespa.http.client.config.FeedParams$DataFormat XML_UTF8",
- "public static final enum com.yahoo.vespa.http.client.config.FeedParams$DataFormat JSON_UTF8"
- ]
- },
- "com.yahoo.vespa.http.client.config.FeedParams": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public boolean getDenyIfBusyV3()",
- "public long getMaxSleepTimeMs()",
- "public boolean getSilentUpgrade()",
- "public com.yahoo.vespa.http.client.config.FeedParams$DataFormat getDataFormat()",
- "public java.lang.String getRoute()",
- "public long getServerTimeout(java.util.concurrent.TimeUnit)",
- "public long getClientTimeout(java.util.concurrent.TimeUnit)",
- "public int getMaxChunkSizeBytes()",
- "public java.lang.String getPriority()",
- "public java.lang.String toUriParameters()",
- "public int getMaxInFlightRequests()",
- "public long getLocalQueueTimeOut()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.config.SessionParams$Builder": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public void <init>()",
- "public com.yahoo.vespa.http.client.config.SessionParams$Builder addCluster(com.yahoo.vespa.http.client.config.Cluster)",
- "public com.yahoo.vespa.http.client.config.SessionParams$Builder setFeedParams(com.yahoo.vespa.http.client.config.FeedParams)",
- "public com.yahoo.vespa.http.client.config.SessionParams$Builder setConnectionParams(com.yahoo.vespa.http.client.config.ConnectionParams)",
- "public com.yahoo.vespa.http.client.config.SessionParams$Builder setErrorReporter(com.yahoo.vespa.http.client.config.SessionParams$ErrorReporter)",
- "public com.yahoo.vespa.http.client.config.SessionParams$Builder setClientQueueSize(int)",
- "public com.yahoo.vespa.http.client.config.SessionParams$Builder setThrottlerMinSize(int)",
- "public com.yahoo.vespa.http.client.config.SessionParams build()",
- "public com.yahoo.vespa.http.client.config.FeedParams getFeedParams()",
- "public com.yahoo.vespa.http.client.config.ConnectionParams getConnectionParams()",
- "public int getClientQueueSize()",
- "public int getThrottlerMinSize()"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.config.SessionParams$ErrorReporter": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "interface",
- "abstract"
- ],
- "methods": [
- "public abstract void onSessionError(com.yahoo.vespa.http.client.config.Endpoint, java.lang.String, java.lang.String)"
- ],
- "fields": []
- },
- "com.yahoo.vespa.http.client.config.SessionParams": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public java.util.List getClusters()",
- "public com.yahoo.vespa.http.client.config.FeedParams getFeedParams()",
- "public com.yahoo.vespa.http.client.config.ConnectionParams getConnectionParams()",
- "public int getClientQueueSize()",
- "public int getThrottlerMinSize()",
- "public com.yahoo.vespa.http.client.config.SessionParams$ErrorReporter getErrorReport()"
- ],
- "fields": []
- }
-} \ No newline at end of file
+{} \ No newline at end of file
diff --git a/vespa-http-client/pom.xml b/vespa-http-client/pom.xml
index f98b39c70b1..b42c4c32a08 100644
--- a/vespa-http-client/pom.xml
+++ b/vespa-http-client/pom.xml
@@ -15,77 +15,78 @@
<description>Independent external feeding API towards Vespa.</description>
<dependencies>
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>annotations</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
+
+ <!-- NOTE: Adding dependencies here may break clients because this is used outside an OSGi container with
+ manually set up classpaths and possibly no access to the with-dependencies jar.
+
+ Vespa dependencies should not be added.
+ -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.4</version>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <scope>test</scope>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>annotations</artifactId>
- <version>${project.version}</version>
+ <groupId>io.airlift</groupId>
+ <artifactId>airline</artifactId>
+ <version>0.6</version>
</dependency>
+
+ <!-- Test dependencies -->
<dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>vespajlib</artifactId>
- <version>${project.version}</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.4</version>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>component</artifactId>
- <version>${project.version}</version>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>annotations</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.8.4</version>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
+ <groupId>uk.co.datumedge</groupId>
+ <artifactId>hamcrest-json</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-xml</artifactId>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>io.airlift</groupId>
- <artifactId>airline</artifactId>
- <version>0.6</version>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-server</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>testutil</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.8.4</version>
+ <scope>test</scope>
</dependency>
+
</dependencies>
<build>
<plugins>
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/FeedClient.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/FeedClient.java
index e800fbea584..433fee69e4e 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/FeedClient.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/FeedClient.java
@@ -14,9 +14,10 @@ import java.util.concurrent.atomic.AtomicInteger;
*
* A {@link FeedClientFactory} is provided to instantiate Sessions.
*
+ * See com.yahoo.text.Text.stripInvalidCharacters(String) to remove invalid characters from string fields before feeding
+ *
* @author dybis
* @see FeedClientFactory
- * @see com.yahoo.text.Text#stripInvalidCharacters(String) to remove invalid characters from string fields before feeding
*/
public interface FeedClient extends AutoCloseable {
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/Result.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/Result.java
index 92dd0715f06..821e12b4140 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/Result.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/Result.java
@@ -4,7 +4,6 @@ package com.yahoo.vespa.http.client;
import com.yahoo.vespa.http.client.config.Endpoint;
import com.yahoo.vespa.http.client.core.Document;
import com.yahoo.vespa.http.client.core.Exceptions;
-import net.jcip.annotations.Immutable;
import java.util.ArrayList;
import java.util.Collection;
@@ -83,7 +82,6 @@ public class Result {
/**
* Information in a Result for a single operation sent to a single endpoint.
*/
- @Immutable
public static final class Detail {
private final ResultType resultType;
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Cluster.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Cluster.java
index 557aeedb4c1..4707cdb705c 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Cluster.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Cluster.java
@@ -1,8 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.http.client.config;
-import net.jcip.annotations.Immutable;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
@@ -13,7 +11,6 @@ import java.util.List;
*
* @author Einar M R Rosenvinge
*/
-@Immutable
public final class Cluster {
/**
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/ConnectionParams.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/ConnectionParams.java
index 3747f37eb00..3296cf13875 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/ConnectionParams.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/ConnectionParams.java
@@ -4,7 +4,6 @@ package com.yahoo.vespa.http.client.config;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
-import net.jcip.annotations.Immutable;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import javax.net.ssl.HostnameVerifier;
@@ -26,7 +25,6 @@ import java.util.concurrent.TimeUnit;
*
* @author Einar M R Rosenvinge
*/
-@Immutable
public final class ConnectionParams {
/**
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java
index de7bfb5bb19..7ba6dd04a80 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/Endpoint.java
@@ -1,8 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.http.client.config;
-import net.jcip.annotations.Immutable;
-
import java.io.Serializable;
/**
@@ -11,7 +9,6 @@ import java.io.Serializable;
*
* @author Einar M R Rosenvinge
*/
-@Immutable
public final class Endpoint implements Serializable {
/**
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/FeedParams.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/FeedParams.java
index 4adf3912dbd..30f1ad11d3a 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/FeedParams.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/FeedParams.java
@@ -2,7 +2,6 @@
package com.yahoo.vespa.http.client.config;
import com.google.common.annotations.Beta;
-import net.jcip.annotations.Immutable;
import java.util.concurrent.TimeUnit;
@@ -13,7 +12,6 @@ import java.util.concurrent.TimeUnit;
* @author Einar M R Rosenvinge
*/
-@Immutable
public final class FeedParams {
public boolean getDenyIfBusyV3() {
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/SessionParams.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/SessionParams.java
index eb3e8ec982b..daa6eecb823 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/SessionParams.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/SessionParams.java
@@ -1,8 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.http.client.config;
-import net.jcip.annotations.Immutable;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -18,7 +16,6 @@ import java.util.List;
* @see com.yahoo.vespa.http.client.SessionFactory
* @see Builder
*/
-@Immutable
public final class SessionParams {
/**
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/package-info.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/package-info.java
index 17789e890d6..8300720e3ea 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/package-info.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/config/package-info.java
@@ -1,10 +1,8 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
* Settings for creating clients/sessions.
+ *
+ * NOTE: This is a PUBLIC API, but not annotated as such because this is not a bundle and
+ * we don't want to introduce Vespa dependencies.
*/
-@ExportPackage
-@PublicApi
package com.yahoo.vespa.http.client.config;
-
-import com.yahoo.api.annotations.PublicApi;
-import com.yahoo.osgi.annotation.ExportPackage;
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java
index fd228fb99c5..4468355698f 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java
@@ -3,7 +3,6 @@ package com.yahoo.vespa.http.client.core.communication;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.yahoo.component.Vtag;
import com.yahoo.vespa.http.client.config.ConnectionParams;
import com.yahoo.vespa.http.client.config.Endpoint;
import com.yahoo.vespa.http.client.config.FeedParams;
@@ -412,8 +411,8 @@ class ApacheGatewayConnection implements GatewayConnection {
clientBuilder.setConnectionManager(connMgr);
}
- clientBuilder.setUserAgent(String.format("vespa-http-client (%s)", Vtag.currentVersion.toFullString()));
- clientBuilder.setDefaultHeaders(List.of(new BasicHeader(Headers.CLIENT_VERSION, Vtag.currentVersion.toFullString())));
+ clientBuilder.setUserAgent(String.format("vespa-http-client (%s)", Vtag.currentVersion));
+ clientBuilder.setDefaultHeaders(List.of(new BasicHeader(Headers.CLIENT_VERSION, Vtag.currentVersion)));
clientBuilder.setMaxConnPerRoute(1);
clientBuilder.setMaxConnTotal(1);
clientBuilder.disableContentCompression();
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/Vtag.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/Vtag.java
new file mode 100644
index 00000000000..f21a86dfc1b
--- /dev/null
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/Vtag.java
@@ -0,0 +1,7 @@
+// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+package com.yahoo.vespa.http.client.core.communication;
+
+class Vtag {
+ static final String currentVersion = "7.0.0";
+}
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/package-info.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/package-info.java
index 56bd3e5cf99..211397476bd 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/package-info.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/package-info.java
@@ -1,3 +1,2 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-@com.yahoo.api.annotations.PackageMarker
package com.yahoo.vespa.http.client.core;
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/package-info.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/package-info.java
index bd828363702..b14c2ffa4cc 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/package-info.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/package-info.java
@@ -5,10 +5,8 @@
* is the central interface which is used to interact with a cluster.
* Use {@link com.yahoo.vespa.http.client.SessionFactory} to
* instantiate a {@link com.yahoo.vespa.http.client.Session}.
- **/
-@ExportPackage
-@PublicApi
+ *
+ * NOTE: This is a PUBLIC API, but not annotated as such because this is not a bundle and
+ * we don't want to introduce Vespa dependencies.
+ */
package com.yahoo.vespa.http.client;
-
-import com.yahoo.api.annotations.PublicApi;
-import com.yahoo.osgi.annotation.ExportPackage;
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/package-info.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/package-info.java
index 506273cc6cd..00012f0f52f 100644
--- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/package-info.java
+++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/runner/package-info.java
@@ -1,3 +1,2 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-@com.yahoo.api.annotations.PackageMarker
package com.yahoo.vespa.http.client.runner;
diff --git a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/JsonTestHelper.java b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/JsonTestHelper.java
new file mode 100644
index 00000000000..0081497fb20
--- /dev/null
+++ b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/JsonTestHelper.java
@@ -0,0 +1,52 @@
+// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.http.client;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Joiner;
+import org.hamcrest.MatcherAssert;
+
+import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs;
+
+import java.io.UncheckedIOException;
+
+public class JsonTestHelper {
+
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+ /**
+ * Convenience method to input JSON without escaping double quotes and newlines
+ * Each parameter represents a line of JSON encoded data
+ * The lines are joined with newline and single quotes are replaced with double quotes
+ */
+ public static String inputJson(String... lines) {
+ return Joiner.on("\n").join(lines).replaceAll("'", "\"");
+ }
+
+ /** Structurally compare two JSON encoded strings */
+ public static void assertJsonEquals(String inputJson, String expectedJson) {
+ MatcherAssert.assertThat(inputJson, sameJSONAs(expectedJson));
+ }
+
+ /** Structurally compare a {@link JsonNode} and a JSON string. */
+ public static void assertJsonEquals(JsonNode left, String rightJson) {
+ try {
+ String leftJson = mapper.writeValueAsString(left);
+ assertJsonEquals(leftJson, rightJson);
+ } catch (JsonProcessingException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+
+ /** Structurally compare two {@link JsonNode}s. */
+ public static void assertJsonEquals(JsonNode left, JsonNode right) {
+ try {
+ String leftJson = mapper.writeValueAsString(left);
+ String rightJson = mapper.writeValueAsString(right);
+ assertJsonEquals(leftJson, rightJson);
+ } catch (JsonProcessingException e) {
+ throw new UncheckedIOException(e);
+ }
+ }
+}
diff --git a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/operationProcessor/IncompleteResultsThrottlerTest.java b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/operationProcessor/IncompleteResultsThrottlerTest.java
index 47aeb4d3b0f..1267514b0d8 100644
--- a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/operationProcessor/IncompleteResultsThrottlerTest.java
+++ b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/core/operationProcessor/IncompleteResultsThrottlerTest.java
@@ -1,9 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.http.client.core.operationProcessor;
-import com.yahoo.collections.Tuple2;
import com.yahoo.vespa.http.client.core.ThrottlePolicy;
-import com.yahoo.vespa.http.client.core.operationProcessor.IncompleteResultsThrottler;
import org.junit.Test;
import java.util.ArrayList;
@@ -35,57 +33,6 @@ public class IncompleteResultsThrottlerTest {
}
/**
- * A mock 'gateway' this is slower with more requests in-flight. It starts to become really much slower at
- * 'breakPoint' number of parallel requests.
- */
- class MockServer {
- final LinkedList<Tuple2<Long, IncompleteResultsThrottler> > messageDoneByTime = new LinkedList<>();
- final int breakPoint;
- final Random random = new Random();
- long time = 0;
-
- MockServer(int breakPoint) {
- this.breakPoint = breakPoint;
- }
-
- /**
- * Figures out when next processed data will be ready.
- * @return time in ms for next request to be finished.
- */
- long nextRequestFinished() {
- if (messageDoneByTime.isEmpty()) {
- return Integer.MAX_VALUE;
- }
- return messageDoneByTime.peek().first;
- }
-
- /**
- * Advance simulation time and call finished on any requests.
- * @param time to move to
- */
- void moveTime(long time) {
- this.time = time;
- while (!messageDoneByTime.isEmpty() && messageDoneByTime.peek().first <= time) {
- messageDoneByTime.pop().second.resultReady(true);
- }
- }
-
- /**
- * New request.
- * @param blocker do callback on blocker when request is done.
- */
- void newRequest(IncompleteResultsThrottler blocker) {
- long nextTime = (long)(20 + 0.1 * messageDoneByTime.size());
-
- if (messageDoneByTime.size() > breakPoint) {
- nextTime += (long) (40 + (random.nextDouble()) * 0.01 * messageDoneByTime.size()* messageDoneByTime.size());
- }
- nextTime += time + random.nextInt()%4;
- messageDoneByTime.push(new Tuple2<>(nextTime, blocker));
- }
- }
-
- /**
* Simulate running requests.
* @param clientCount number of parallel clients.
* @param breakPoint how many requests the server should handle in parallel before it gets slower.
@@ -267,4 +214,79 @@ public class IncompleteResultsThrottlerTest {
int distance = Math.abs(sweetSpot - size);
return 1 + 20 * distance;
}
+
+ /**
+ * A mock 'gateway' this is slower with more requests in-flight. It starts to become really much slower at
+ * 'breakPoint' number of parallel requests.
+ */
+ class MockServer {
+ final LinkedList<Tuple2<Long, IncompleteResultsThrottler> > messageDoneByTime = new LinkedList<>();
+ final int breakPoint;
+ final Random random = new Random();
+ long time = 0;
+
+ MockServer(int breakPoint) {
+ this.breakPoint = breakPoint;
+ }
+
+ /**
+ * Figures out when next processed data will be ready.
+ * @return time in ms for next request to be finished.
+ */
+ long nextRequestFinished() {
+ if (messageDoneByTime.isEmpty()) {
+ return Integer.MAX_VALUE;
+ }
+ return messageDoneByTime.peek().first;
+ }
+
+ /**
+ * Advance simulation time and call finished on any requests.
+ * @param time to move to
+ */
+ void moveTime(long time) {
+ this.time = time;
+ while (!messageDoneByTime.isEmpty() && messageDoneByTime.peek().first <= time) {
+ messageDoneByTime.pop().second.resultReady(true);
+ }
+ }
+
+ /**
+ * New request.
+ * @param blocker do callback on blocker when request is done.
+ */
+ void newRequest(IncompleteResultsThrottler blocker) {
+ long nextTime = (long)(20 + 0.1 * messageDoneByTime.size());
+
+ if (messageDoneByTime.size() > breakPoint) {
+ nextTime += (long) (40 + (random.nextDouble()) * 0.01 * messageDoneByTime.size()* messageDoneByTime.size());
+ }
+ nextTime += time + random.nextInt()%4;
+ messageDoneByTime.push(new Tuple2<>(nextTime, blocker));
+ }
+ }
+
+ private static class Tuple2<T1, T2> {
+
+ public final T1 first;
+ public final T2 second;
+
+ public Tuple2(final T1 first, final T2 second) {
+ this.first = first;
+ this.second = second;
+ }
+
+ @Override
+ public int hashCode() { throw new UnsupportedOperationException(); }
+
+ @Override
+ public boolean equals(final Object obj) { throw new UnsupportedOperationException(); }
+
+ @Override
+ public String toString() {
+ return "Tuple2(" + first + ", " + second + ")";
+ }
+
+ }
+
}
diff --git a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/runner/JsonReaderTest.java b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/runner/JsonReaderTest.java
index 134274ff869..e2046fe17a6 100644
--- a/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/runner/JsonReaderTest.java
+++ b/vespa-http-client/src/test/java/com/yahoo/vespa/http/client/runner/JsonReaderTest.java
@@ -12,7 +12,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
-import static com.yahoo.test.json.JsonTestHelper.inputJson;
+import static com.yahoo.vespa.http.client.JsonTestHelper.inputJson;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;