aboutsummaryrefslogtreecommitdiffstats
path: root/vespa-feed-client/src/test/java
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@yahooinc.com>2023-07-13 11:44:30 +0200
committerBjørn Christian Seime <bjorncs@yahooinc.com>2023-07-13 11:49:55 +0200
commitb2dcd9de3f8ed19bd115ab46156c4752c6875a90 (patch)
treed7cc2652576e09048ec819c976fe75a6aab94442 /vespa-feed-client/src/test/java
parent96d8009fb2921d4fc3152a89b97a888bd7e6f166 (diff)
Remove Apache based implementation
Diffstat (limited to 'vespa-feed-client/src/test/java')
-rw-r--r--vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/ApacheClusterTest.java77
1 files changed, 0 insertions, 77 deletions
diff --git a/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/ApacheClusterTest.java b/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/ApacheClusterTest.java
deleted file mode 100644
index cf9a36f2aa8..00000000000
--- a/vespa-feed-client/src/test/java/ai/vespa/feed/client/impl/ApacheClusterTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package ai.vespa.feed.client.impl;
-
-import ai.vespa.feed.client.FeedClientBuilder.Compression;
-import ai.vespa.feed.client.HttpResponse;
-import com.github.tomakehurst.wiremock.matching.RequestPatternBuilder;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URI;
-import java.time.Duration;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.zip.GZIPOutputStream;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.any;
-import static com.github.tomakehurst.wiremock.client.WireMock.anyRequestedFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.anyUrl;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
-import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-class ApacheClusterTest {
-
- @RegisterExtension
- final WireMockExtension server = new WireMockExtension();
-
- @Test
- void testClient() throws Exception {
- for (Compression compression : Compression.values()) {
- try (ApacheCluster cluster = new ApacheCluster(new FeedClientBuilderImpl(List.of(URI.create("http://localhost:" + server.port())))
- .setCompression(compression))) {
- server.stubFor(any(anyUrl()))
- .setResponse(okJson("{}").build());
-
- CompletableFuture<HttpResponse> vessel = new CompletableFuture<>();
- cluster.dispatch(new HttpRequest("POST",
- "/path",
- Map.of("name1", () -> "value1",
- "name2", () -> "value2"),
- "content".getBytes(UTF_8),
- Duration.ofSeconds(10)),
- vessel);
-
- AutoCloseable verifyResponse = () -> {
- HttpResponse response = vessel.get(15, TimeUnit.SECONDS);
- assertEquals("{}", new String(response.body(), UTF_8));
- assertEquals(200, response.code());
- };
- AutoCloseable verifyServer = () -> {
- server.verify(1, anyRequestedFor(anyUrl()));
- RequestPatternBuilder expected = postRequestedFor(urlEqualTo("/path")).withHeader("name1", equalTo("value1"))
- .withHeader("name2", equalTo("value2"))
- .withHeader("Content-Type", equalTo("application/json; charset=UTF-8"))
- .withRequestBody(equalTo("content"));
- expected = switch (compression) {
- case auto, none -> expected.withoutHeader("Content-Encoding");
- case gzip -> expected.withHeader("Content-Encoding", equalTo("gzip"));
- };
- server.verify(1, expected);
- server.resetRequests();
- };
- try (verifyServer; verifyResponse) { }
- }
- }
- }
-
-}