From ff819a053621ed56020eaac8e19b9aef77e235d0 Mon Sep 17 00:00:00 2001 From: slisaasquatch Date: Sat, 3 Dec 2022 15:20:38 -0800 Subject: [PATCH 1/2] Code formatting --- .../client5reactive/FutureCallbacks.java | 2 +- .../client5reactive/HttpReactiveClient.java | 60 ++++++++++--------- .../HttpReactiveClientImpl.java | 5 +- .../client5reactive/HttpReactiveClients.java | 6 +- .../client5reactive/FutureCallbacksTests.java | 2 +- .../client5reactive/examples/Example.java | 4 +- 6 files changed, 42 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/saasquatch/client5reactive/FutureCallbacks.java b/src/main/java/com/saasquatch/client5reactive/FutureCallbacks.java index c41b6d5..d92f765 100644 --- a/src/main/java/com/saasquatch/client5reactive/FutureCallbacks.java +++ b/src/main/java/com/saasquatch/client5reactive/FutureCallbacks.java @@ -1,8 +1,8 @@ package com.saasquatch.client5reactive; +import io.reactivex.rxjava3.core.MaybeEmitter; import java.util.concurrent.CancellationException; import org.apache.hc.core5.concurrent.FutureCallback; -import io.reactivex.rxjava3.core.MaybeEmitter; /** * Utilities for {@link FutureCallback}s. Not public. diff --git a/src/main/java/com/saasquatch/client5reactive/HttpReactiveClient.java b/src/main/java/com/saasquatch/client5reactive/HttpReactiveClient.java index 287cf6f..e8c23ed 100644 --- a/src/main/java/com/saasquatch/client5reactive/HttpReactiveClient.java +++ b/src/main/java/com/saasquatch/client5reactive/HttpReactiveClient.java @@ -23,8 +23,8 @@ /** * Thin wrapper around Apache {@link HttpAsyncClient} to expose * Reactive Streams interfaces.
- * The methods in this interface aim to mirror the ones in {@link HttpAsyncClient} and {@link - * CloseableHttpAsyncClient}. + * The methods in this interface aim to mirror the ones in {@link HttpAsyncClient} and + * {@link CloseableHttpAsyncClient}. * * @author sli * @see HttpReactiveClients @@ -32,10 +32,11 @@ public interface HttpReactiveClient { /** - * Execute the given request. This method is equivalent to {@link HttpAsyncClient#execute(AsyncRequestProducer, - * AsyncResponseConsumer, HandlerFactory, HttpContext, FutureCallback)}. If the {@link Future} - * produced by the equivalent {@link HttpAsyncClient} method completes with {@code null}, then the - * returning {@link Publisher} of this method will complete with no element. + * Execute the given request. This method is equivalent to + * {@link HttpAsyncClient#execute(AsyncRequestProducer, AsyncResponseConsumer, HandlerFactory, + * HttpContext, FutureCallback)}. If the {@link Future} produced by the equivalent + * {@link HttpAsyncClient} method completes with {@code null}, then the returning + * {@link Publisher} of this method will complete with no element. */ Publisher execute(@Nonnull AsyncRequestProducer requestProducer, @Nonnull AsyncResponseConsumer responseConsumer, @@ -43,9 +44,11 @@ Publisher execute(@Nonnull AsyncRequestProducer requestProducer, @Nullable HttpContext context); /** - * Convenience method for {@link #execute(AsyncRequestProducer, AsyncResponseConsumer, - * HandlerFactory, HttpContext)}, equivalent to {@link CloseableHttpAsyncClient#execute(AsyncRequestProducer, - * AsyncResponseConsumer, HttpContext, FutureCallback)} + * Convenience method for + * {@link #execute(AsyncRequestProducer, AsyncResponseConsumer, HandlerFactory, HttpContext)}, + * equivalent to + * {@link CloseableHttpAsyncClient#execute(AsyncRequestProducer, AsyncResponseConsumer, + * HttpContext, FutureCallback)} */ default Publisher execute(@Nonnull AsyncRequestProducer requestProducer, @Nonnull AsyncResponseConsumer responseConsumer, @Nullable HttpContext context) { @@ -53,9 +56,11 @@ default Publisher execute(@Nonnull AsyncRequestProducer requestProducer, } /** - * Convenience method for {@link #execute(AsyncRequestProducer, AsyncResponseConsumer, - * HandlerFactory, HttpContext)}, equivalent to {@link CloseableHttpAsyncClient#execute(AsyncRequestProducer, - * AsyncResponseConsumer, FutureCallback)}. + * Convenience method for + * {@link #execute(AsyncRequestProducer, AsyncResponseConsumer, HandlerFactory, HttpContext)}, + * equivalent to + * {@link CloseableHttpAsyncClient#execute(AsyncRequestProducer, AsyncResponseConsumer, + * FutureCallback)}. */ default Publisher execute(@Nonnull AsyncRequestProducer requestProducer, @Nonnull AsyncResponseConsumer responseConsumer) { @@ -64,8 +69,9 @@ default Publisher execute(@Nonnull AsyncRequestProducer requestProducer, /** * Execute a simple in-memory request and get a simple in-memory response. This method is - * equivalent to {@link CloseableHttpAsyncClient#execute(SimpleHttpRequest, HttpContext, - * FutureCallback)}. The returning {@link Publisher} completes with exactly 1 element. + * equivalent to + * {@link CloseableHttpAsyncClient#execute(SimpleHttpRequest, HttpContext, FutureCallback)}. The + * returning {@link Publisher} completes with exactly 1 element. */ default Publisher execute(@Nonnull SimpleHttpRequest request, @Nullable HttpContext context) { @@ -73,17 +79,17 @@ default Publisher execute(@Nonnull SimpleHttpRequest request } /** - * Convenience method for {@link #execute(SimpleHttpRequest, HttpContext)}, equivalent to {@link - * CloseableHttpAsyncClient#execute(SimpleHttpRequest, FutureCallback)}. + * Convenience method for {@link #execute(SimpleHttpRequest, HttpContext)}, equivalent to + * {@link CloseableHttpAsyncClient#execute(SimpleHttpRequest, FutureCallback)}. */ default Publisher execute(@Nonnull SimpleHttpRequest request) { return execute(request, null); } /** - * Execute the given request and get a streaming response body as a {@link Publisher} of {@link - * ByteBuffer}s. The returning {@link Publisher} completes with exactly 1 element. The {@link - * Publisher} within the returning {@link Publisher} may contain 0 to n elements. + * Execute the given request and get a streaming response body as a {@link Publisher} of + * {@link ByteBuffer}s. The returning {@link Publisher} completes with exactly 1 element. The + * {@link Publisher} within the returning {@link Publisher} may contain 0 to n elements. */ Publisher>> streamingExecute( @Nonnull AsyncRequestProducer requestProducer, @@ -91,8 +97,8 @@ Publisher>> streamingExecute( @Nullable HttpContext context); /** - * Convenience method for {@link #streamingExecute(AsyncRequestProducer, HandlerFactory, - * HttpContext)} + * Convenience method for + * {@link #streamingExecute(AsyncRequestProducer, HandlerFactory, HttpContext)} */ default Publisher>> streamingExecute( @Nonnull AsyncRequestProducer requestProducer, @Nullable HttpContext context) { @@ -100,8 +106,8 @@ default Publisher>> streamingExecute } /** - * Convenience method for {@link #streamingExecute(AsyncRequestProducer, HandlerFactory, - * HttpContext)} + * Convenience method for + * {@link #streamingExecute(AsyncRequestProducer, HandlerFactory, HttpContext)} */ default Publisher>> streamingExecute( @Nonnull AsyncRequestProducer requestProducer) { @@ -109,8 +115,8 @@ default Publisher>> streamingExecute } /** - * Execute a simple in-memory request and get a streaming response. Convenience method for {@link - * #streamingExecute(AsyncRequestProducer, HandlerFactory, HttpContext)} + * Execute a simple in-memory request and get a streaming response. Convenience method for + * {@link #streamingExecute(AsyncRequestProducer, HandlerFactory, HttpContext)} */ default Publisher>> streamingExecute( @Nonnull SimpleHttpRequest request, @Nullable HttpContext context) { @@ -118,8 +124,8 @@ default Publisher>> streamingExecute } /** - * Convenience method for {@link #streamingExecute(AsyncRequestProducer, HandlerFactory, - * HttpContext)} + * Convenience method for + * {@link #streamingExecute(AsyncRequestProducer, HandlerFactory, HttpContext)} */ default Publisher>> streamingExecute( @Nonnull SimpleHttpRequest request) { diff --git a/src/main/java/com/saasquatch/client5reactive/HttpReactiveClientImpl.java b/src/main/java/com/saasquatch/client5reactive/HttpReactiveClientImpl.java index 3fc4e5d..e82bf90 100644 --- a/src/main/java/com/saasquatch/client5reactive/HttpReactiveClientImpl.java +++ b/src/main/java/com/saasquatch/client5reactive/HttpReactiveClientImpl.java @@ -1,7 +1,9 @@ package com.saasquatch.client5reactive; +import io.reactivex.rxjava3.core.Maybe; import java.nio.ByteBuffer; import java.util.Objects; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.hc.client5.http.async.HttpAsyncClient; import org.apache.hc.core5.http.HttpResponse; @@ -13,9 +15,6 @@ import org.apache.hc.core5.http.protocol.HttpContext; import org.apache.hc.core5.reactive.ReactiveResponseConsumer; import org.reactivestreams.Publisher; -import io.reactivex.rxjava3.core.Maybe; - -import javax.annotation.Nonnull; /** * Concrete implementation of {@link HttpReactiveClient}. diff --git a/src/main/java/com/saasquatch/client5reactive/HttpReactiveClients.java b/src/main/java/com/saasquatch/client5reactive/HttpReactiveClients.java index 15a6d87..7581db9 100644 --- a/src/main/java/com/saasquatch/client5reactive/HttpReactiveClients.java +++ b/src/main/java/com/saasquatch/client5reactive/HttpReactiveClients.java @@ -19,9 +19,9 @@ private HttpReactiveClients() {} /** * Create a {@link HttpReactiveClient} from a given {@link HttpAsyncClient}. Note that the created * {@link HttpReactiveClient} is simply a wrapper of the {@link HttpAsyncClient} and does not - * support state management, so you'll need to manage the state of the given {@link - * HttpAsyncClient} yourself by calling {@link CloseableHttpAsyncClient#start()}, {@link - * CloseableHttpAsyncClient#close()}, etc. + * support state management, so you'll need to manage the state of the given + * {@link HttpAsyncClient} yourself by calling {@link CloseableHttpAsyncClient#start()}, + * {@link CloseableHttpAsyncClient#close()}, etc. */ @Nonnull public static HttpReactiveClient create(@Nonnull HttpAsyncClient httpAsyncClient) { diff --git a/src/test/java/com/saasquatch/client5reactive/FutureCallbacksTests.java b/src/test/java/com/saasquatch/client5reactive/FutureCallbacksTests.java index f442249..2ae6c05 100644 --- a/src/test/java/com/saasquatch/client5reactive/FutureCallbacksTests.java +++ b/src/test/java/com/saasquatch/client5reactive/FutureCallbacksTests.java @@ -1,10 +1,10 @@ package com.saasquatch.client5reactive; +import io.reactivex.rxjava3.core.Maybe; import java.io.IOException; import java.util.concurrent.CancellationException; import org.apache.hc.core5.concurrent.BasicFuture; import org.junit.jupiter.api.Test; -import io.reactivex.rxjava3.core.Maybe; public class FutureCallbacksTests { diff --git a/src/test/java/com/saasquatch/client5reactive/examples/Example.java b/src/test/java/com/saasquatch/client5reactive/examples/Example.java index 7e2937c..6333dd3 100644 --- a/src/test/java/com/saasquatch/client5reactive/examples/Example.java +++ b/src/test/java/com/saasquatch/client5reactive/examples/Example.java @@ -24,7 +24,7 @@ public static void main(String[] args) throws Exception { final HttpReactiveClient reactiveClient = HttpReactiveClients.create(asyncClient); // Execute a simple in-memory request Single.fromPublisher( - reactiveClient.execute(SimpleRequestBuilder.get("https://www.example.com").build())) + reactiveClient.execute(SimpleRequestBuilder.get("https://www.example.com").build())) .doOnSuccess(response -> { // Get the response status and body in memory System.out.println(response.getCode()); @@ -35,7 +35,7 @@ public static void main(String[] args) throws Exception { // Execute a streaming request // In this case, the request is a simple in-memory request without a request body Single.fromPublisher(reactiveClient.streamingExecute( - SimpleRequestBuilder.get("https://www.example.com").build())) + SimpleRequestBuilder.get("https://www.example.com").build())) .flatMapPublisher(message -> { // Get the status before subscribing to the streaming body System.out.println(message.getHead().getCode()); From 45b08c5e718412c8906ae7ba904b829a08c13b39 Mon Sep 17 00:00:00 2001 From: slisaasquatch Date: Thu, 8 Dec 2022 10:13:31 -0800 Subject: [PATCH 2/2] Dependency version bump --- README.md | 4 ++-- pom.xml | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6bf87ec..9f74d77 100644 --- a/README.md +++ b/README.md @@ -101,14 +101,14 @@ Maven com.github.saasquatch apache-client5-reactive - 0.0.5 + 0.0.6 ``` Gradle ```gradle -implementation 'com.github.saasquatch:apache-client5-reactive:0.0.5' +implementation 'com.github.saasquatch:apache-client5-reactive:0.0.6' ``` ## License diff --git a/pom.xml b/pom.xml index f8dd646..ed26503 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,10 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.saasquatch apache-client5-reactive - 0.0.5-SNAPSHOT + 0.0.6-SNAPSHOT jar apache-client5-reactive @@ -19,7 +20,7 @@ UTF-8 - 5.8.1 + 5.9.1 @@ -38,17 +39,17 @@ org.apache.httpcomponents.client5 httpclient5 - 5.1.2 + 5.2.1 org.apache.httpcomponents.core5 httpcore5-reactive - 5.1.1 + 5.2 io.reactivex.rxjava3 rxjava - 3.1.2 + 3.1.5 com.google.code.findbugs @@ -58,7 +59,7 @@ org.slf4j slf4j-simple - 1.7.32 + 2.0.5 test