diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2019-07-17 17:16:37 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2019-07-17 17:20:53 +0200 |
commit | e441ff217eda5e82c43b26171bd781f004f3d3a7 (patch) | |
tree | 2a55a42e8cab82327d6f6524e974aa7383d0cd06 /http-utils/src/test/java/ai | |
parent | 87a900b73f23c13b777288c2b4202b5f52e802a6 (diff) |
Simplify mechanism for overriding 'http' -> 'https'
Override using ssl socket factory for 'http' scheme. Removing the
request interceptor as it is no longer needed.
Diffstat (limited to 'http-utils/src/test/java/ai')
-rw-r--r-- | http-utils/src/test/java/ai/vespa/util/http/VespaHttpClientBuilderTest.java | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/http-utils/src/test/java/ai/vespa/util/http/VespaHttpClientBuilderTest.java b/http-utils/src/test/java/ai/vespa/util/http/VespaHttpClientBuilderTest.java deleted file mode 100644 index 7ffd0e459b0..00000000000 --- a/http-utils/src/test/java/ai/vespa/util/http/VespaHttpClientBuilderTest.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package ai.vespa.util.http; - -import ai.vespa.util.http.VespaHttpClientBuilder.HttpToHttpsRewritingRequestInterceptor; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.protocol.BasicHttpContext; -import org.junit.Test; - -import java.net.URI; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -/** - * @author bjorncs - */ -public class VespaHttpClientBuilderTest { - - @Test - public void request_interceptor_modifies_scheme_of_requests() { - verifyProcessedUriMatchesExpectedOutput("http://dummyhostname:8080/a/path/to/resource?query=value", - "https://dummyhostname:8080/a/path/to/resource?query=value"); - } - - @Test - public void request_interceptor_add_handles_implicit_http_port() { - verifyProcessedUriMatchesExpectedOutput("http://dummyhostname/a/path/to/resource?query=value", - "https://dummyhostname:80/a/path/to/resource?query=value"); - } - - private static void verifyProcessedUriMatchesExpectedOutput(String inputUri, String expectedOutputUri) { - var interceptor = new HttpToHttpsRewritingRequestInterceptor(); - HttpGet request = new HttpGet(inputUri); - interceptor.process(request, new BasicHttpContext()); - URI modifiedUri = request.getURI(); - URI expectedUri = URI.create(expectedOutputUri); - assertThat(modifiedUri).isEqualTo(expectedUri); - } - -}
\ No newline at end of file |