Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joschi authored and renovate[bot] committed Aug 6, 2023
1 parent 45c25c3 commit 59c3544
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Expand Up @@ -3,9 +3,9 @@
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.classic.methods.HttpPut;
import org.apache.hc.client5.http.utils.URIUtils;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.message.HttpRequestWrapper;
import org.apache.hc.core5.net.URIBuilder;
import org.junit.Test;

import java.net.URI;
Expand Down Expand Up @@ -77,8 +77,8 @@ public void querylessUrlAndMethodWithNameInWrappedRequest() throws URISyntaxExce
}

private static HttpRequest rewriteRequestURI(HttpRequest request) throws URISyntaxException {
URI uri = new URIBuilder(request.getUri()).setFragment(null).build();
HttpRequestWrapper wrapper = new HttpRequestWrapper(request);
URI uri = URIUtils.rewriteURI(wrapper.getUri(), null, true);
wrapper.setUri(uri);

return wrapper;
Expand Down
Expand Up @@ -6,8 +6,8 @@
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpServer;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequest;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequests;
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
import org.apache.hc.client5.http.async.methods.SimpleRequestBuilder;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManager;
import org.apache.hc.core5.concurrent.FutureCallback;
Expand Down Expand Up @@ -74,7 +74,9 @@ public void registersExpectedMetricsGivenNameStrategy() throws Exception {
client = InstrumentedHttpAsyncClients.custom(metricRegistry, metricNameStrategy).disableAutomaticRetries().build();
client.start();

final SimpleHttpRequest request = SimpleHttpRequests.get("http://localhost:" + httpServer.getAddress().getPort() + "/");
final SimpleHttpRequest request = SimpleRequestBuilder
.get("http://localhost:" + httpServer.getAddress().getPort() + "/")
.build();
final String metricName = "some.made.up.metric.name";

httpServer.createContext("/", exchange -> {
Expand Down Expand Up @@ -114,7 +116,9 @@ public void registersExpectedExceptionMetrics() throws Exception {
client.start();

final CountDownLatch countDownLatch = new CountDownLatch(1);
final SimpleHttpRequest request = SimpleHttpRequests.get("http://localhost:" + httpServer.getAddress().getPort() + "/");
final SimpleHttpRequest request = SimpleRequestBuilder
.get("http://localhost:" + httpServer.getAddress().getPort() + "/")
.build();
final String requestMetricName = "request";
final String exceptionMetricName = "exception";

Expand Down Expand Up @@ -160,7 +164,9 @@ public void usesCustomClientConnectionManager() throws Exception {
client = InstrumentedHttpAsyncClients.custom(metricRegistry, metricNameStrategy, clientConnectionManager).disableAutomaticRetries().build();
client.start();

final SimpleHttpRequest request = SimpleHttpRequests.get("http://localhost:" + httpServer.getAddress().getPort() + "/");
final SimpleHttpRequest request = SimpleRequestBuilder
.get("http://localhost:" + httpServer.getAddress().getPort() + "/")
.build();
final String metricName = "some.made.up.metric.name";

httpServer.createContext("/", exchange -> {
Expand Down

0 comments on commit 59c3544

Please sign in to comment.