JAVA-26733 Upgrade wiremock to the latest version (#15206)

This commit is contained in:
timis1
2023-11-20 11:44:00 +02:00
committed by GitHub
parent a7ab16d81e
commit 40315beb0d
12 changed files with 30 additions and 27 deletions
@@ -8,7 +8,7 @@ import static org.mockserver.model.HttpResponse.response;
import java.io.IOException;
import java.net.ServerSocket;
import org.apache.http.HttpStatus;
import org.apache.hc.core5.http.HttpStatus;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.mockserver.client.MockServerClient;
@@ -38,8 +38,6 @@ import org.junit.jupiter.api.Test;
class HttpAsyncClientLiveTest extends GetRequestMockServer {
private static final String HOST = "http://www.google.com";
private static final String HOST_WITH_SSL = "https://mms.nw.ru/";
private static final String HOST_WITH_PROXY = "http://httpbin.org/";
private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://browserspy.dk/password-ok.php";// "http://localhost:8080/spring-security-rest-basic-auth/api/foos/1";
@@ -136,7 +134,7 @@ class HttpAsyncClientLiveTest extends GetRequestMockServer {
client.start();
final SimpleHttpRequest request = new SimpleHttpRequest("GET",HOST_WITH_SSL);
final SimpleHttpRequest request = new SimpleHttpRequest("GET", HOST_WITH_SSL);
final Future<SimpleHttpResponse> future = client.execute(request, null);
final HttpResponse response = future.get();
@@ -201,7 +199,7 @@ class HttpAsyncClientLiveTest extends GetRequestMockServer {
@Override
public void run() {
try {
final Future<SimpleHttpResponse> future = client.execute(SimpleHttpRequest.copy(request), context, null);
final Future<SimpleHttpResponse> future = client.execute(SimpleRequestBuilder.copy(request).build(), context, null);
final HttpResponse response = future.get();
assertThat(response.getCode(), equalTo(200));
} catch (final Exception ex) {
@@ -1,10 +1,10 @@
package com.baeldung.httpclient;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import java.io.IOException;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.core5.http.HttpEntity;
public final class ResponseUtil {
private ResponseUtil() {
}
@@ -103,7 +103,7 @@ class HttpClientAdvancedConfigurationIntegrationTest {
void givenServerThatIsBehindProxy_whenClientIsConfiguredToSendRequestViaProxy_shouldReturn200() throws IOException {
//given
proxyMock.stubFor(get(urlMatching(".*"))
.willReturn(aResponse().proxiedFrom("http://localhost:8089/")));
.willReturn(aResponse().proxiedFrom("http://localhost:8089")));
serviceMock.stubFor(get(urlEqualTo("/private"))
.willReturn(aResponse().withStatus(200)));
@@ -129,7 +129,7 @@ class HttpClientAdvancedConfigurationIntegrationTest {
public void givenServerThatIsBehindAuthorizationProxy_whenClientSendRequest_shouldAuthorizeProperly() throws IOException {
//given
proxyMock.stubFor(get(urlMatching("/private"))
.willReturn(aResponse().proxiedFrom("http://localhost:8089/")));
.willReturn(aResponse().proxiedFrom("http://localhost:8089")));
serviceMock.stubFor(get(urlEqualTo("/private"))
.willReturn(aResponse().withStatus(200)));