Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation warnings in Azure Vert.x HTTP Client #3744

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ public void buildWithDefaultConnectionOptions() {
.assertNext(response -> assertEquals(200, response.getStatusCode()))
.verifyComplete();

assertEquals(options.getConnectTimeout(), 10000);
assertEquals(options.getIdleTimeout(), 60);
assertEquals(options.getReadIdleTimeout(), 60);
assertEquals(options.getWriteIdleTimeout(), 60);
assertEquals(10000, options.getConnectTimeout());
assertEquals(60, options.getIdleTimeout());
assertEquals(60, options.getReadIdleTimeout());
assertEquals(60, options.getWriteIdleTimeout());
} finally {
((VertxHttpClient) client).close();
}
Expand All @@ -138,10 +138,10 @@ public void buildWithConnectionOptions() {
.assertNext(response -> assertEquals(200, response.getStatusCode()))
.verifyComplete();

assertEquals(options.getConnectTimeout(), 10000);
assertEquals(options.getIdleTimeout(), 20);
assertEquals(options.getReadIdleTimeout(), 30);
assertEquals(options.getWriteIdleTimeout(), 40);
assertEquals(10000, options.getConnectTimeout());
assertEquals(20, options.getIdleTimeout());
assertEquals(30, options.getReadIdleTimeout());
assertEquals(40, options.getWriteIdleTimeout());
} finally {
((VertxHttpClient) client).close();
}
Expand All @@ -163,11 +163,11 @@ public void allProxyOptions(ProxyOptions.Type type) {

try {
io.vertx.core.net.ProxyOptions vertxProxyOptions = options.getProxyOptions();
assertEquals(vertxProxyOptions.getHost(), address.getHostName());
assertEquals(vertxProxyOptions.getPort(), address.getPort());
assertEquals(vertxProxyOptions.getType().name(), type.name());
assertEquals(vertxProxyOptions.getUsername(), PROXY_USER);
assertEquals(vertxProxyOptions.getPassword(), PROXY_PASSWORD);
assertEquals(address.getHostName(), vertxProxyOptions.getHost());
assertEquals(address.getPort(), vertxProxyOptions.getPort());
assertEquals(type.name(), vertxProxyOptions.getType().name());
assertEquals(PROXY_USER, vertxProxyOptions.getUsername());
assertEquals(PROXY_PASSWORD, vertxProxyOptions.getPassword());

List<String> proxyHosts = new ArrayList<>();
proxyHosts.add("foo*");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

public final class BufferedVertxHttpResponse extends VertxHttpAsyncResponse {
final class BufferedVertxHttpResponse extends VertxHttpAsyncResponse {

private final Buffer body;

BufferedVertxHttpResponse(HttpRequest request, io.vertx.ext.web.client.HttpResponse response, Buffer body) {
BufferedVertxHttpResponse(HttpRequest request, io.vertx.ext.web.client.HttpResponse<Buffer> response, Buffer body) {
super(request, response);
this.body = body;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

public class VertxHttpAsyncResponse extends VertxHttpResponse {
class VertxHttpAsyncResponse extends VertxHttpResponse {

VertxHttpAsyncResponse(HttpRequest request, HttpResponse response) {
VertxHttpAsyncResponse(HttpRequest request, HttpResponse<Buffer> response) {
super(request, response);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,10 @@ public HttpClient build() {
}
}

String nonProxyHostsString = proxyOptions.getNonProxyHosts();
String nonProxyHostsString = buildProxyOptions.getNonProxyHosts();
if (nonProxyHostsString != null) {
// Undo Azure ProxyOptions string sanitization since Vert.x has its own logic
List<String> nonProxyHosts = Arrays.asList(nonProxyHostsString.split("\\|"))
.stream()
List<String> nonProxyHosts = Arrays.stream(nonProxyHostsString.split("\\|"))
.map(host -> host.replaceAll("\\\\E", "")
.replaceAll("\\\\Q", "")
.replaceAll("\\.\\.", ""))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ private static final Vertx getVertx() {

Bean<?> bean = beanManager.resolve(beans);
Object reference = beanManager.getReference(bean, Vertx.class, beanManager.createCreationalContext(bean));
return Vertx.class.cast(reference);
return (Vertx) reference;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
import com.azure.core.http.HttpResponse;
import com.azure.core.util.CoreUtils;
import io.vertx.core.MultiMap;
import io.vertx.core.buffer.Buffer;
import reactor.core.publisher.Mono;

abstract class VertxHttpResponse extends HttpResponse {

private final io.vertx.ext.web.client.HttpResponse response;
private final io.vertx.ext.web.client.HttpResponse<Buffer> response;
private final HttpHeaders headers;

VertxHttpResponse(HttpRequest request, io.vertx.ext.web.client.HttpResponse response) {
VertxHttpResponse(HttpRequest request, io.vertx.ext.web.client.HttpResponse<Buffer> response) {
super(request);
this.response = response;
this.headers = fromVertxHttpHeaders(response.headers());
Expand All @@ -42,7 +43,7 @@ private HttpHeaders fromVertxHttpHeaders(MultiMap headers) {
return azureHeaders;
}

protected io.vertx.ext.web.client.HttpResponse getVertxHttpResponse() {
protected io.vertx.ext.web.client.HttpResponse<Buffer> getVertxHttpResponse() {
return this.response;
}

Expand Down