From d56cca64fbb5dfbe55ff9a713a6b66a7b56bd223 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Fri, 12 Jul 2019 20:54:24 +0200 Subject: [PATCH 01/30] Upgrade to RxJava 3 --- build.sbt | 24 ++-- .../rxhttp/AsyncCompletionHandlerWrapper.java | 10 +- .../rxhttp/AsyncHandlerWrapper.java | 26 +++- .../rxhttp/CollectingSubscriber.java | 15 +- .../be/wegenenverkeer/rxhttp/Dechunker.java | 100 ++++++------- ...erator.java => FlowableBodyGenerator.java} | 44 +++--- .../wegenenverkeer/rxhttp/RxHttpClient.java | 70 ++++------ .../rxhttp/ServerResponseHeadersImpl.java | 4 + .../be/wegenenverkeer/DechunkersTest.java | 100 ++++--------- .../designtests/RxHttpClientDesignTests.java | 131 +++++++++++------- .../RxHttpClientMultipleRequests.java | 18 ++- ...ClientObservableOfServerElementsTests.java | 85 ++++++------ .../designtests/RxHttpClientPostTests.java | 73 +++++----- .../RxHttpClientTestChunkedResponse.java | 31 ++--- .../designtests/UsingWireMock.java | 2 +- ...st.java => FlowableBodyGeneratorTest.java} | 27 ++-- .../rxhttp/aws/TestS3ApiCall.java | 13 +- .../rxhttp/scala/ImplicitConversions.scala | 22 +-- .../designtests/RxHTTPClientGetSpecs.scala | 36 ++--- 19 files changed, 400 insertions(+), 431 deletions(-) rename modules/java/src/main/java/be/wegenenverkeer/rxhttp/{ObservableBodyGenerator.java => FlowableBodyGenerator.java} (77%) rename modules/java/src/test/java/be/wegenenverkeer/rxhttp/{ObservableBodyGeneratorTest.java => FlowableBodyGeneratorTest.java} (81%) diff --git a/build.sbt b/build.sbt index bbb2a19..f4e6f71 100644 --- a/build.sbt +++ b/build.sbt @@ -1,8 +1,8 @@ val Organization = "be.wegenenverkeer" -val Version = "1.2.0" +val Version = "2.0.0-SNAPSHOT" -val ScalaVersion = "2.12.8" +val ScalaVersion = "2.13.0" val ScalaBuildOptions = Seq("-unchecked", "-deprecation", @@ -12,15 +12,19 @@ val ScalaBuildOptions = Seq("-unchecked", "-language:postfixOps") -val asyncClient = "org.asynchttpclient" % "async-http-client" % "2.8.1" -val rxjava = "io.reactivex" % "rxjava" % "1.2.4" -val rxscala = "io.reactivex" %% "rxscala" % "0.26.5" +val asyncClient = "org.asynchttpclient" % "async-http-client" % "2.10.1" + +val rxStreamsVersion = "1.0.2" +val rxJavaVersion = "3.0.0-RC1" + val slf4j = "org.slf4j" % "slf4j-api" % "1.7.25" val commonsCodec = "commons-codec" % "commons-codec" % "1.10" val json = "com.fasterxml.jackson.core" % "jackson-databind" % "2.9.8" % "provided" - +val rx = "org.reactivestreams" % "reactive-streams" % rxStreamsVersion +val rxFlow = "org.reactivestreams" % "reactive-streams-flow-adapters" % rxStreamsVersion +val rxJava = "io.reactivex.rxjava3" % "rxjava" % rxJavaVersion val junit = "junit" % "junit" % "4.11" % "test" -val specs2 = "org.specs2" %% "specs2-core" % "3.8.6" % "test" +val specs2 = "org.specs2" %% "specs2-core" % "4.6.0" % "test" val slf4jSimple = "org.slf4j" % "slf4j-simple" % "1.7.6" % "test" val wiremock = "com.github.tomakehurst" % "wiremock-jre8" % "2.23.2" % "test" val junitInterface = "com.novocode" % "junit-interface" % "0.11" % Test @@ -28,8 +32,10 @@ val jsonPath = "com.jayway.jsonpath" % "json-path" % "1.2.0" % "test" val commonDependencies = Seq( asyncClient, - rxjava, slf4j, + rx, + rxFlow, + rxJava, commonsCodec, json ) @@ -37,7 +43,6 @@ val commonDependencies = Seq( val javaDependencies = commonDependencies ++ Seq(slf4jSimple, junitInterface) val scalaDependencies = commonDependencies ++ Seq( - rxscala, specs2 ) @@ -83,6 +88,7 @@ lazy val testSettings = Seq( lazy val javaModule = (project in file("modules/java")).settings( name := "RxHttpClient-java", moduleSettings, + javacOptions ++= Seq("--release", "11"), libraryDependencies ++= javaDependencies, extraJavaSettings ) diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncCompletionHandlerWrapper.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncCompletionHandlerWrapper.java index 49a31c0..7816eb8 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncCompletionHandlerWrapper.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncCompletionHandlerWrapper.java @@ -1,11 +1,11 @@ package be.wegenenverkeer.rxhttp; +import io.reactivex.exceptions.ProtocolViolationException; +import io.reactivex.subjects.AsyncSubject; import org.asynchttpclient.AsyncCompletionHandler; import org.asynchttpclient.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import rx.exceptions.OnErrorFailedException; -import rx.subjects.AsyncSubject; import java.util.function.Function; @@ -45,15 +45,15 @@ public F onCompleted(Response response) { (r) -> { F value = handler.apply(wrap(r)); if (value != null) subject.onNext(value); - subject.onCompleted(); + subject.onComplete(); }, subject::onError, subject::onError ); } catch (Throwable t) { //TODO Should this logging not be done in the global onError handler? See Class RxJavaErrorHandler - if (t instanceof OnErrorFailedException) { - logger.error("onError handler failed: " + t.getMessage(), t); + if (t instanceof ProtocolViolationException) { + logger.error("Protocol Violation Exception: " + t.getMessage(), t); } subject.onError(t); } diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncHandlerWrapper.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncHandlerWrapper.java index 7020f90..99a5b1d 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncHandlerWrapper.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncHandlerWrapper.java @@ -1,12 +1,18 @@ package be.wegenenverkeer.rxhttp; import io.netty.handler.codec.http.HttpHeaders; +import io.reactivex.Flowable; +import io.reactivex.Observable; +import io.reactivex.ObservableSource; +import io.reactivex.subjects.BehaviorSubject; import org.asynchttpclient.AsyncHandler; import org.asynchttpclient.HttpResponseBodyPart; import org.asynchttpclient.HttpResponseStatus; +import org.asynchttpclient.handler.StreamedAsyncHandler; +import org.reactivestreams.Publisher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import rx.subjects.BehaviorSubject; + import java.io.UnsupportedEncodingException; import java.util.Optional; @@ -18,6 +24,10 @@ */ class AsyncHandlerWrapper implements AsyncHandler { + //Note: we don't use the StreamedAsyncHandler because on very small responses, the Publisher gets shut down before it can start emitting + //values (or so it seems). + // See also this message: https://groups.google.com/forum/#!searchin/asynchttpclient/streamedasynchandler%7Csort:date/asynchttpclient/h5E98f50Zco/b6fgEtTbAQAJ + final private static Logger logger = LoggerFactory.getLogger(AsyncHandlerWrapper.class); final private BehaviorSubject subject; @@ -49,15 +59,14 @@ public void onThrowable(Throwable t) { */ @Override public State onBodyPartReceived(HttpResponseBodyPart bodyPart) { - if (!subject.hasObservers()) { + if(!subject.hasObservers()) { trace("No observers: Aborting."); //bodyPart.markUnderlyingConnectionAsToBeClosed(); onCompleted(); //send the uncompleted message return State.ABORT; } - ServerResponseBodyPart sbp = new ServerResponseBodyPartImpl(bodyPart.getBodyPartBytes(), bodyPart.isLast()); - trace(String.format("onNext: '%s' %s", toUtf8String(sbp), sbp.isLast() ? "(last)" : "")); - subject.onNext(sbp); + subject.onNext(new ServerResponseBodyPartImpl(bodyPart.getBodyPartBytes(), bodyPart.isLast())); + return State.CONTINUE; } @@ -99,6 +108,10 @@ public int getStatusCode() { public Optional getStatusText() { return Optional.ofNullable(responseStatus.getStatusText()); } + + public String toString(){ + return String.format("Server response: %d", statuscode); + } }); return State.CONTINUE; } @@ -127,7 +140,7 @@ public State onHeadersReceived(HttpHeaders headers) { @Override public Boolean onCompleted() { trace("Completed"); - subject.onCompleted(); + subject.onComplete(); return true; } @@ -136,4 +149,5 @@ private static void trace(String msg) { logger.trace(msg); } } + } \ No newline at end of file diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CollectingSubscriber.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CollectingSubscriber.java index 23003da..e86f857 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CollectingSubscriber.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CollectingSubscriber.java @@ -1,11 +1,14 @@ package be.wegenenverkeer.rxhttp; -import rx.Subscriber; +import io.reactivex.subscribers.DefaultSubscriber; +import io.reactivex.subscribers.ResourceSubscriber; +import org.reactivestreams.Subscriber; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Flow; import java.util.concurrent.Future; import java.util.function.Function; @@ -18,7 +21,7 @@ * * Created by Karel Maesen, Geovise BVBA on 19/12/14. */ -public class CollectingSubscriber extends Subscriber { +public class CollectingSubscriber extends DefaultSubscriber { final private CompletableFuture> cfuture = new CompletableFuture<>(); @@ -50,7 +53,7 @@ void processPart(byte[] bytes) { * The {@code Observable} will not call this method if it calls {@link #onError}. */ @Override - public void onCompleted() { + public void onComplete() { cfuture.complete(Collections.unmodifiableList(accumulator)); } @@ -58,7 +61,7 @@ public void onCompleted() { * Notifies the Observer that the {@code Observable} has experienced an error condition. *

* If the {@code Observable} calls this method, it will not thereafter call {@link #onNext} or - * {@link #onCompleted}. + * {@link #onComplete}. * * @param e the exception encountered by the Observable */ @@ -72,7 +75,7 @@ public void onError(Throwable e) { *

* The {@code Observable} may call this method 0 or more times. *

- * The {@code Observable} will not call this method again after it calls either {@link #onCompleted} or + * The {@code Observable} will not call this method again after it calls either {@link #onComplete} or * {@link #onError}. * * @param serverResponseElement the item emitted by the Observable @@ -88,7 +91,7 @@ public void onNext(ServerResponseElement serverResponseElement) { * @return the items already received. */ public List collectImmediately(){ - this.unsubscribe(); + this.cancel(); return new ArrayList<>(accumulator); } diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Dechunker.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Dechunker.java index 6ecef32..6cacfd1 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Dechunker.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Dechunker.java @@ -1,7 +1,13 @@ package be.wegenenverkeer.rxhttp; -import rx.Observable; -import rx.Subscriber; +import io.reactivex.FlowableOperator; +import io.reactivex.FlowableSubscriber; +import io.reactivex.ObservableOperator; +import io.reactivex.Observer; +import io.reactivex.subscribers.DefaultSubscriber; +import io.reactivex.subscribers.DisposableSubscriber; +import org.reactivestreams.Subscriber; +import org.reactivestreams.Subscription; import java.nio.charset.Charset; import java.util.Arrays; @@ -13,72 +19,70 @@ * * */ -public class Dechunker implements Observable.Operator { +public class Dechunker implements FlowableOperator { private final String separator; - private final boolean emptyIsSeparator; - private final Charset charset; - - - /** - * Creates an instance - * @param separator the separator character(s) - * @param emptyIsSeparator if set to true, empty chunks are treated as separators - * @param charset the character set of the message stream - */ - public Dechunker(String separator, boolean emptyIsSeparator, Charset charset) { - this.separator = separator; - this.emptyIsSeparator = emptyIsSeparator; - this.charset = charset; + + + public Dechunker(String sep) { + this.separator = sep; + } @Override - public Subscriber call(Subscriber subscriber) { - return new Subscriber(subscriber){ + public Subscriber apply(Subscriber subscriber) throws Exception { + return new Op(subscriber, separator); + } + + static final class Op implements FlowableSubscriber, Subscription { + final Subscriber child; + final String separator; private String previous = ""; + Subscription s; + + public Op(Subscriber child, String separator) { + this.child = child; + this.separator = separator; + } + + + @Override + public void onSubscribe(Subscription s) { + this.s =s; + child.onSubscribe(this); + } @Override - public void onCompleted() { - if (!subscriber.isUnsubscribed()) { - if (!previous.isEmpty()) { - subscriber.onNext(previous); + public void onNext(String str) { + String[] events = toChunks(str); + for( String ev : events) { + if(!ev.isEmpty()) { + child.onNext(ev); } - subscriber.onCompleted(); } } @Override - public void onError(Throwable e) { - if (!subscriber.isUnsubscribed()) { - subscriber.onError(e); - } + public void onError(Throwable t) { + child.onError(t); } @Override - public void onNext(ServerResponseElement element) { - if ( element instanceof ServerResponseBodyPart ) { - ServerResponseBodyPart sbp = (ServerResponseBodyPart) element; - if( emitOnEmpty(sbp) ) { - subscriber.onNext(previous); - previous = ""; - } - String[] events = toChunks(bytesToString(sbp)); - for( String ev : events) { - if(!ev.isEmpty()) { - subscriber.onNext(ev); - } - } + public void onComplete() { + if (!previous.isEmpty()) { + child.onNext(previous); } } - - private boolean emitOnEmpty(ServerResponseBodyPart sbp) { - return emptyIsSeparator && sbp.isEmpty() && !previous.isEmpty(); + @Override + public void request(long n) { + s.request(n); } - private String bytesToString(ServerResponseBodyPart part) { - return new String(part.getBodyPartBytes(), charset); + @Override + public void cancel() { + s.cancel(); } private String[] toChunks(String chunk) { @@ -92,9 +96,9 @@ private String[] toChunks(String chunk) { return Arrays.copyOfRange(parts,0, parts.length - 1); } } + } + - }; - } } diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ObservableBodyGenerator.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/FlowableBodyGenerator.java similarity index 77% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/ObservableBodyGenerator.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/FlowableBodyGenerator.java index e869f3c..b3a5da3 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ObservableBodyGenerator.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/FlowableBodyGenerator.java @@ -1,13 +1,15 @@ package be.wegenenverkeer.rxhttp; import io.netty.buffer.ByteBuf; +import io.reactivex.Flowable; +import io.reactivex.Observable; +import io.reactivex.observers.DisposableObserver; import org.asynchttpclient.request.body.Body; import org.asynchttpclient.request.body.generator.BodyGenerator; +import org.reactivestreams.Subscriber; +import org.reactivestreams.Subscription; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Subscriber; -import rx.Subscription; import java.io.IOException; import java.nio.ByteBuffer; @@ -22,49 +24,51 @@ * To avoid this call subscribeOn before passing in the Observable with a Scheduler specific for your use case, f.e. Schedulers.io() * Otherwise this is fully back-pressured. */ -public class ObservableBodyGenerator implements BodyGenerator { +public class FlowableBodyGenerator implements BodyGenerator { - private static final Logger logger = LoggerFactory.getLogger(ObservableBodyGenerator.class); + private static final Logger logger = LoggerFactory.getLogger(FlowableBodyGenerator.class); private static final int DEFAULT_CAPACITY = 10; - private final Observable observable; + private final Flowable observable; private Subscription subscription; private BlockingQueue queue; private volatile Throwable throwable = null; - public ObservableBodyGenerator(Observable observable) { + public FlowableBodyGenerator(Flowable observable) { this(observable, DEFAULT_CAPACITY); } - public ObservableBodyGenerator(Observable observable, int queueCapacity) { + public FlowableBodyGenerator(Flowable observable, int queueCapacity) { this.observable = observable; this.queue = new ArrayBlockingQueue<>(queueCapacity); } @Override public Body createBody() { - subscription = this.observable.subscribe(new Subscriber() { + this.observable.subscribe(new Subscriber() { - @Override - public void onStart() { - request(queue.remainingCapacity()); //request as many as the queue can handle - } @Override - public void onCompleted() { + public void onComplete() { try { queue.put(new BodyPart(new byte[0], true)); //blocks until space available in queue } catch (InterruptedException e) { - ObservableBodyGenerator.logger.warn("Interrupted", e); + FlowableBodyGenerator.logger.warn("Interrupted", e); } } @Override public void onError(Throwable t) { - ObservableBodyGenerator.logger.warn("Unable to read", t); - ObservableBodyGenerator.this.throwable = t; + FlowableBodyGenerator.logger.warn("Unable to read", t); + FlowableBodyGenerator.this.throwable = t; + } + + @Override + public void onSubscribe(Subscription s) { + subscription = s; + subscription.request(queue.remainingCapacity()); } @Override @@ -73,9 +77,9 @@ public void onNext(byte[] bytes) { if (bytes.length > 0) { queue.put(new BodyPart(bytes, false)); //blocks until space available in queue } - request(Math.max(queue.remainingCapacity(), 1)); // always request at least one + subscription.request(Math.max(queue.remainingCapacity(), 1)); // always request at least one } catch (InterruptedException e) { - ObservableBodyGenerator.logger.warn("Interrupted", e); + FlowableBodyGenerator.logger.warn("Interrupted", e); } } }); @@ -134,7 +138,7 @@ public BodyState transferTo(ByteBuf targetBuf) throws IOException { @Override public void close() { - ObservableBodyGenerator.this.subscription.unsubscribe(); + FlowableBodyGenerator.this.subscription.cancel(); } } diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java index 834ce3b..806337c 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java @@ -2,18 +2,17 @@ import be.wegenenverkeer.rxhttp.aws.*; import io.netty.handler.ssl.SslContext; -import org.asynchttpclient.AsyncCompletionHandler; +import io.reactivex.BackpressureStrategy; +import io.reactivex.Flowable; +import io.reactivex.Observable; +import io.reactivex.subjects.AsyncSubject; +import io.reactivex.subjects.BehaviorSubject; import org.asynchttpclient.AsyncHttpClient; import org.asynchttpclient.DefaultAsyncHttpClientConfig; -import org.asynchttpclient.Response; import org.asynchttpclient.filter.RequestFilter; import org.asynchttpclient.filter.ThrottleRequestFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.subjects.AsyncSubject; -import rx.subjects.BehaviorSubject; - import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -23,8 +22,6 @@ import java.util.concurrent.ThreadFactory; import java.util.function.Function; -import static be.wegenenverkeer.rxhttp.CompleteResponseHandler.withCompleteResponse; -import static be.wegenenverkeer.rxhttp.ServerResponse.wrap; import static org.asynchttpclient.Dsl.asyncHttpClient; /** @@ -44,7 +41,7 @@ public class RxHttpClient { protected RxHttpClient(AsyncHttpClient innerClient, RestClientConfig config, ClientRequestLogFormatter logFmt, RequestSigner... requestSigners) { this.innerClient = innerClient; this.config = config; - this.requestSigners = Collections.unmodifiableList(Arrays.asList(requestSigners)); + this.requestSigners = List.of(requestSigners); this.logFormatter = logFmt; } @@ -57,32 +54,9 @@ public CompletableFuture execute(ClientRequest request, Function future = new CompletableFuture<>(); - innerClient.executeRequest(request.unwrap(), new AsyncCompletionHandler() { - @Override - public F onCompleted(Response response) { - try { - withCompleteResponse(response, - (r) -> { - F transformed = transformer.apply(wrap(response)); - future.complete(transformed); - }, - future::completeExceptionally, - future::completeExceptionally - ); - } catch (Throwable t) { - logger.error("onError handler failed: " + t.getMessage(), t); - future.completeExceptionally(t); - } - return null; - } - - @Override - public void onThrowable(Throwable t) { - super.onThrowable(t); - future.completeExceptionally(t); - } - }); - return future; + return innerClient.executeRequest(request.unwrap()).toCompletableFuture() + .thenApply( ServerResponse::wrap ) + .thenApply( transformer ); } /** @@ -120,6 +94,7 @@ public Observable executeObservably(ClientRequest request return Observable.defer(() -> { BehaviorSubject subject = BehaviorSubject.create(); innerClient.executeRequest(request.unwrap(), new AsyncHandlerWrapper(subject)); + return subject; }); } @@ -135,11 +110,11 @@ public Observable executeObservably(ClientRequest request * * @param request the request to send * @param separator the separator - * @return a cold observable of messages (UTF8 Strings) - * @see Observable#defer + * @return a cold Flowable of messages (UTF8 Strings) + */ - public Observable executeAndDechunk(ClientRequest request, String separator) { - return executeObservably(request).lift(new Dechunker(separator, false, UTF8)); + public Flowable executeAndDechunk(ClientRequest request, String separator) { + return executeAndDechunk(request, separator, Charset.forName("UTF8")); } /** @@ -154,11 +129,14 @@ public Observable executeAndDechunk(ClientRequest request, String separa * @param request the request to send * @param separator the separator * @param charset the character set of the messages - * @return a cold observable of messages (Strings in the specified Charset) - * @see Observable#defer + * @return a cold Flowable of messages (Strings in the specified Charset) */ - public Observable executeAndDechunk(ClientRequest request, String separator, Charset charset) { - return executeObservably(request).lift(new Dechunker(separator, false, charset)); + public Flowable executeAndDechunk(ClientRequest request, String separator, Charset charset) { + return executeObservably(request) + .filter(sre -> sre instanceof ServerResponseBodyPart) + .map( sre -> new String(((ServerResponseBodyPart)sre).getBodyPartBytes(), charset)) + .toFlowable(BackpressureStrategy.BUFFER) + .lift(new Dechunker(separator)); } @@ -319,7 +297,7 @@ public RxHttpClient build() { BuildValidation validation = validate(config); - validation.logWarnings(logger); + validation.logWarnings(); if (validation.hasErrors()) { throw new IllegalStateException(validation.getErrorMessage()); } @@ -934,9 +912,9 @@ boolean hasErrors() { return !errors.isEmpty(); } - void logWarnings(Logger logger) { + void logWarnings() { for (String msg : warnings) { - logger.warn(msg); + Builder.logger.warn(msg); } } diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java index 2e31d63..03eee7c 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java @@ -42,4 +42,8 @@ public Optional getHeader(String name) { if (l.isEmpty()) return Optional.empty(); return Optional.ofNullable(l.get(0)); } + + public String toString(){ + return headers.toString(); + } } diff --git a/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java b/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java index a2e2baa..56849fd 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java +++ b/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java @@ -1,18 +1,15 @@ package be.wegenenverkeer; import be.wegenenverkeer.rxhttp.Dechunker; -import be.wegenenverkeer.rxhttp.ServerResponseBodyPart; +import io.reactivex.Flowable; +import io.reactivex.subscribers.TestSubscriber; import org.junit.Test; -import rx.Observable; -import rx.observers.TestSubscriber; import java.nio.charset.Charset; import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; -import static be.wegenenverkeer.TestSRBP.bp; -import static be.wegenenverkeer.TestSRBP.last; import static org.junit.Assert.assertEquals; /** @@ -23,105 +20,58 @@ public class DechunkersTest { private static Charset UTF8 = Charset.forName("UTF8"); @Test - public void testStringDechunker(){ + public void testStringDechunker() { assertEquals(Arrays.asList("first", "second"), receivedOnInput( - bp("fi"), - bp("rst"), - bp("\n"), - bp("sec"), - last("ond") - )); - } - - @Test - public void testStringDechunkerEmptySeparator(){ - assertEquals(Arrays.asList("first", "second"), receivedOnInput( - bp("fi"), - bp("rst"), - bp(""), - bp("sec"), - last("ond") + "fi", + "rst", + "\n", + "sec", + "ond" )); } + @Test - public void testStringDechunkerSingleEl(){ + public void testStringDechunkerSingleEl() { assertEquals(Arrays.asList("first", "second"), receivedOnInput( - last("first\nsecond") + "first\nsecond" )); } @Test - public void testStringDechunkerLastCombined(){ + public void testStringDechunkerLastCombined() { assertEquals(Arrays.asList("first", "second", "third"), receivedOnInput( - bp("first\n"), - last("second\nthird") + "first\n", + "second\nthird" )); } @Test - public void testStringDechunkerCombinedThenEmpty(){ + public void testStringDechunkerCombinedThenEmpty() { assertEquals(Arrays.asList("first", "second", "third"), receivedOnInput( - bp("first\nsecond"),bp(""), - last("third") + "first\nsecond", "\n", + "third" )); } @Test - public void testStringDechunkerSeparatorAsChunk(){ + public void testStringDechunkerSeparatorAsChunk() { assertEquals(Arrays.asList("first", "second", "third"), receivedOnInput( - bp("fi"), bp("rst\n"), bp("\n"), bp("sec"),bp("ond\n"), bp("\n"), - last("third") + "fi", "rst\n", "\n", "sec", "ond\n", "\n", + "third" )); } - - public List receivedOnInput(TestSRBP... chunks) { + public List receivedOnInput(String... chunks) { TestSubscriber subscriber = new TestSubscriber<>(); - Observable.from(chunks) - .lift(new Dechunker("\n", true, UTF8)) + Flowable.fromArray(chunks) + .lift(new Dechunker("\n")) .subscribe(subscriber); - subscriber.awaitTerminalEvent(10, TimeUnit.MILLISECONDS); - return subscriber.getOnNextEvents(); + subscriber.awaitDone(10, TimeUnit.MILLISECONDS); + return subscriber.values(); } } -class TestSRBP implements ServerResponseBodyPart { - - static TestSRBP bp(String body){ - return new TestSRBP(body, false); - } - - static TestSRBP last(String body){ - return new TestSRBP(body, true); - } - - - byte[] bytes; - boolean isLast; - TestSRBP(String input, boolean last) { - bytes = input.getBytes(Charset.forName("UTF8")); - this.isLast = last; - } - - - @Override - public byte[] getBodyPartBytes() { - return bytes; - } - - public boolean isLast(){ - return this.isLast; - } - - @Override - public String toString() { - return "TestSRBP{" + - "bytes=" + new String(bytes) + - ", isLast=" + isLast + - '}'; - } -} diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java index 8ce919e..616e847 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java @@ -1,20 +1,20 @@ package be.wegenenverkeer.designtests; import be.wegenenverkeer.rxhttp.*; -import com.jayway.jsonpath.JsonPath; +import io.reactivex.Observable; +import io.reactivex.observers.TestObserver; +import io.reactivex.subscribers.TestSubscriber; import org.junit.Test; -import rx.Observable; -import rx.observers.TestSubscriber; -import java.util.*; +import java.nio.charset.Charset; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import java.util.function.Function; import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; /** * Behavior Unit test @@ -24,13 +24,50 @@ public class RxHttpClientDesignTests extends UsingWireMock{ @Test - public void GETHappyPath() throws InterruptedException { + public void GETObservably() { //set up stub String expectBody = "{ 'contacts': [1,2,3] }"; stubFor(get(urlPathEqualTo("/contacts")) .withQueryParam("q", equalTo("test")) .withHeader("Accept", equalTo("application/json")) - .willReturn(aResponse().withFixedDelay(200) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(expectBody))); + + //set up use case + String path = "/contacts"; + ClientRequest request = client.requestBuilder() + .setMethod("GET") + .setUrlRelativetoBase(path) + .addQueryParam("q", "test") + .build(); + + Observable observable = client.executeObservably(request, bytes -> new String(bytes, Charset.forName("UTF8"))); + + +// String out = observable.blockingFirst(); +// + TestObserver sub = new TestObserver<>(); + observable.subscribe(sub); + + sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + sub.assertNoErrors(); + + sub.assertValues(expectBody); + + + + } + + @Test + public void GETHappyPath() { + //set up stub + String expectBody = "{ 'contacts': [1,2,3] }"; + stubFor(get(urlPathEqualTo("/contacts")) + .withQueryParam("q", equalTo("test")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBody(expectBody))); @@ -46,23 +83,23 @@ public void GETHappyPath() throws InterruptedException { Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber sub = new TestSubscriber<>(); + TestObserver sub = new TestObserver<>(); observable.subscribe(sub); - sub.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); sub.assertNoErrors(); - sub.assertReceivedOnNext(items(expectBody)); + sub.assertValues(expectBody); + } /** * Proves that UTF-8 charset is used as default. - * @throws InterruptedException */ @Test - public void testCharsetEncodingDefaultsToUTF8() throws InterruptedException { + public void testCharsetEncodingDefaultsToUTF8() { //set up stub String expectBody = "{ 'contacts': 'žẽūș' }"; // with chars only available in UTF-8 @@ -86,21 +123,20 @@ public void testCharsetEncodingDefaultsToUTF8() throws InterruptedException { Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber sub = new TestSubscriber<>(); + TestObserver sub = new TestObserver<>(); observable.subscribe(sub); - sub.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); sub.assertNoErrors(); - sub.assertReceivedOnNext(items(expectBody)); + sub.assertValues(expectBody); } /** * Proves that charset when present in content type gets priority over default UTF-8 - * @throws InterruptedException */ @Test - public void testCharsetEncodingInContentType() throws InterruptedException { + public void testCharsetEncodingInContentType() { //set up stub String expectBody = "{ 'contacts': 'žẽūș' }"; // with chars only available in UTF-8 @@ -124,14 +160,14 @@ public void testCharsetEncodingInContentType() throws InterruptedException { Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber sub = new TestSubscriber<>(); + TestObserver sub = new TestObserver<>(); observable.subscribe(sub); - sub.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); sub.assertNoErrors(); try { - sub.assertReceivedOnNext(items(expectBody)); + sub.assertValues(expectBody); fail("Expecting wrongly parsed body"); } catch (AssertionError exp) { // failure expected @@ -167,7 +203,7 @@ public void GETHappyPathWithFuture() throws InterruptedException, TimeoutExcepti } @Test - public void testHttp4xxResponseOnGET() throws InterruptedException { + public void testHttp4xxResponseOnGET() { stubFor(get(urlPathEqualTo("/contacts")).willReturn(aResponse().withStatus(404))); //set up use case @@ -175,24 +211,21 @@ public void testHttp4xxResponseOnGET() throws InterruptedException { ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase(path).build(); Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber testsubscriber = new TestSubscriber<>(); - observable.subscribe(testsubscriber); - - testsubscriber.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + TestObserver sub = new TestObserver<>(); + observable.subscribe(sub); - List onErrorEvents = testsubscriber.getOnErrorEvents(); - assertFalse(onErrorEvents.isEmpty()); - if (onErrorEvents.get(0) instanceof HttpClientError) { - HttpClientError hce = (HttpClientError) onErrorEvents.get(0); - assertEquals(404, hce.getStatusCode()); - } else { - fail("Didn't receive a HttpClientError"); - } + sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + sub.assertError( t -> { + if(t instanceof HttpClientError) { + return ((HttpClientError)t).getStatusCode() == 404; + } + return false; + }); } @Test - public void testHttp5xxResponseOnGET() throws InterruptedException { + public void testHttp5xxResponseOnGET(){ //set up stub stubFor(get(urlEqualTo("/contacts")) .withHeader("Accept", equalTo("application/json")) @@ -207,25 +240,23 @@ public void testHttp5xxResponseOnGET() throws InterruptedException { .build(); Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber testsubscriber = new TestSubscriber<>(); + TestObserver testsubscriber = new TestObserver<>(); observable.subscribe(testsubscriber); - testsubscriber.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); - List onErrorEvents = testsubscriber.getOnErrorEvents(); - assertFalse(onErrorEvents.isEmpty()); - if (onErrorEvents.get(0) instanceof HttpServerError) { - HttpServerError hce = (HttpServerError) onErrorEvents.get(0); - assertEquals(500, hce.getStatusCode()); - } else { - fail("Didn't receive a HttpClientError"); - } + testsubscriber.assertError( t -> { + if(t instanceof HttpServerError) { + return ((HttpServerError)t).getStatusCode() == 500; + } + return false; + }); } @Test - public void testConnectionTimeOut() throws InterruptedException { + public void testConnectionTimeOut(){ //set up stub stubFor(get(urlEqualTo("/contacts")) .withHeader("Accept", equalTo("application/json")) @@ -245,14 +276,12 @@ public void testConnectionTimeOut() throws InterruptedException { ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase(path).build(); Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber testsubscriber = new TestSubscriber<>(); + TestObserver testsubscriber = new TestObserver<>(); observable.subscribe(testsubscriber); - testsubscriber.awaitTerminalEvent(1000, TimeUnit.MILLISECONDS); + testsubscriber.awaitDone(1000, TimeUnit.MILLISECONDS); - List onErrorEvents = testsubscriber.getOnErrorEvents(); - assertFalse(onErrorEvents.isEmpty()); - assertTrue(onErrorEvents.get(0) instanceof TimeoutException); + testsubscriber.assertError(TimeoutException.class); } diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java index 6b69683..0d216f1 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java @@ -3,19 +3,17 @@ import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.ServerResponse; import com.jayway.jsonpath.JsonPath; +import io.reactivex.Observable; +import io.reactivex.observers.TestObserver; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.observables.BlockingObservable; -import rx.observers.TestSubscriber; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.function.Function; import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.junit.Assert.assertEquals; /** * Created by Karel Maesen, Geovise BVBA on 27/11/15. @@ -25,7 +23,7 @@ public class RxHttpClientMultipleRequests extends UsingWireMock{ private static Logger LOGGER = LoggerFactory.getLogger(RxHttpClientMultipleRequests.class); @Test - public void demonstrateComposableObservable() throws InterruptedException { + public void demonstrateComposableObservable() { //set up stubs String expectBody = "{ 'contacts': ['contacts/1','contacts/2','contacts/3', 'contacts/4', 'contacts/5', 'contacts/6', 'contacts/7'] }"; stubFor(get(urlPathEqualTo("/contacts")) @@ -74,21 +72,21 @@ public void demonstrateComposableObservable() throws InterruptedException { .flatMap(body -> { List l = JsonPath.read(body, "$.contacts"); LOGGER.info("Retrieved contact list"); - return Observable.from(l); - }).concatMap( contactUrl -> followLink.apply(contactUrl) ); + return Observable.fromIterable(l); + }).concatMap(followLink::apply); LOGGER.info("Observable created"); //verify behaviour - TestSubscriber sub = new TestSubscriber<>(); + TestObserver sub = new TestObserver<>(); LOGGER.info("Subscribing to Observer"); observable.subscribe(sub); - sub.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); sub.assertNoErrors(); - assertEquals(items("ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN"), sub.getOnNextEvents()); + sub.assertValues("ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN"); } diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java index acef991..b020b5b 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java @@ -1,11 +1,11 @@ package be.wegenenverkeer.designtests; import be.wegenenverkeer.rxhttp.*; +import io.reactivex.Observable; +import io.reactivex.observers.TestObserver; import org.junit.Test; -import rx.Observable; -import rx.observers.TestSubscriber; -import java.util.List; +import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -19,41 +19,49 @@ public class RxHttpClientObservableOfServerElementsTests extends UsingWireMock { @Test - public void GETHappyPath() throws InterruptedException { + public void GETHappyPath(){ //set up stub String expectBody = "{ 'contacts': [1,2,3] }"; stubFor(get(urlPathEqualTo("/contacts")) - .withQueryParam("q", equalTo("test")) + //.withQueryParam("q", equalTo("test")) .withHeader("Accept", equalTo("application/json")) - .willReturn(aResponse().withFixedDelay(REQUEST_TIME_OUT / 3) + .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") - .withBody(expectBody))); +// .withBodyFile("sse-output.txt") + .withBody(expectBody) + ) + ); //set up use case String path = "/contacts"; ClientRequest request = client.requestBuilder() .setMethod("GET") .setUrlRelativetoBase(path) - .addQueryParam("q", "test") + //.addQueryParam("q", "test") .build(); Observable observable = client.executeObservably(request); - TestSubscriber sub = new TestSubscriber<>(); + TestObserver sub = new TestObserver<>(); observable.subscribe(sub); - sub.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.HOURS); sub.assertNoErrors(); - sub.assertTerminalEvent(); - for (ServerResponseElement el : sub.getOnNextEvents()) { + sub.assertComplete(); + + //we must receive at least 1 body part + sub.values().stream().forEach( t -> System.out.println(t)); + assertTrue( sub.values().stream().filter(t -> t instanceof ServerResponseBodyPart).count() > 0); + + for (ServerResponseElement el : sub.values()) { if (el instanceof ServerResponseStatus) { assertEquals(200, ((ServerResponseStatus) el).getStatusCode()); } else if (el instanceof ServerResponseBodyPart) { assertEquals(expectBody, new String(((ServerResponseBodyPart) el).getBodyPartBytes())); } else if (el instanceof ServerResponseHeaders) { - assertEquals("application/json", ((ServerResponseHeaders) el).getContentType().get()); + assertEquals(Optional.of("application/json"), ((ServerResponseHeaders) el).getContentType()); } else { fail("Unknown Server Response element: " + el.getClass().getCanonicalName()); } @@ -63,7 +71,7 @@ public void GETHappyPath() throws InterruptedException { } @Test - public void testHttp4xxResponseOnGET() throws InterruptedException { + public void testHttp4xxResponseOnGET() { stubFor(get(urlPathEqualTo("/contacts")).willReturn(aResponse().withStatus(404))); //set up use case @@ -72,24 +80,21 @@ public void testHttp4xxResponseOnGET() throws InterruptedException { Observable observable = client.executeObservably(request); - TestSubscriber testsubscriber = new TestSubscriber<>(); + TestObserver testsubscriber = new TestObserver<>(); observable.subscribe(testsubscriber); - testsubscriber.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); - List onErrorEvents = testsubscriber.getOnErrorEvents(); - assertFalse(onErrorEvents.isEmpty()); - if (onErrorEvents.get(0) instanceof HttpClientError) { - HttpClientError hce = (HttpClientError) onErrorEvents.get(0); - assertEquals(404, hce.getStatusCode()); - } else { - fail("Didn't receive a HttpClientError"); - } + testsubscriber.assertError(t -> { + if (t instanceof HttpClientError) { + return ((HttpClientError) t).getStatusCode() == 404; + } else return false; + }); } @Test - public void testHttp5xxResponseOnGET() throws InterruptedException { + public void testHttp5xxResponseOnGET() { //set up stub stubFor(get(urlEqualTo("/contacts")) .withHeader("Accept", equalTo("application/json")) @@ -107,25 +112,23 @@ public void testHttp5xxResponseOnGET() throws InterruptedException { Observable observable = client.executeObservably(request); - TestSubscriber testsubscriber = new TestSubscriber<>(); + TestObserver testsubscriber = new TestObserver<>(); observable.subscribe(testsubscriber); - testsubscriber.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + + testsubscriber.assertError(t -> { + if (t instanceof HttpServerError) { + return ((HttpServerError) t).getStatusCode() == 500; + } else return false; + }); - List onErrorEvents = testsubscriber.getOnErrorEvents(); - assertFalse(onErrorEvents.isEmpty()); - if (onErrorEvents.get(0) instanceof HttpServerError) { - HttpServerError hce = (HttpServerError) onErrorEvents.get(0); - assertEquals(500, hce.getStatusCode()); - } else { - fail("Didn't receive a HttpClientError"); - } } @Test - public void testConnectionTimeOut() throws InterruptedException { + public void testConnectionTimeOut() { //set up stub stubFor(get(urlEqualTo("/contacts")) .withHeader("Accept", equalTo("application/json")) @@ -138,14 +141,14 @@ public void testConnectionTimeOut() throws InterruptedException { Observable observable = client.executeObservably(request); - TestSubscriber testsubscriber = new TestSubscriber<>(); + TestObserver testsubscriber = new TestObserver<>(); observable.subscribe(testsubscriber); - testsubscriber.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + + testsubscriber.assertError(TimeoutException.class); + - List onErrorEvents = testsubscriber.getOnErrorEvents(); - assertFalse(onErrorEvents.isEmpty()); - assertTrue(onErrorEvents.get(0) instanceof TimeoutException); } diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java index 9b10a2b..4a4b6ce 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java @@ -3,29 +3,25 @@ import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.HttpClientError; import be.wegenenverkeer.rxhttp.ServerResponse; +import io.reactivex.Observable; +import io.reactivex.observers.TestObserver; import org.junit.Test; -import static org.junit.Assert.*; -import rx.Observable; -import rx.observers.TestSubscriber; -import java.util.List; import java.util.concurrent.TimeUnit; import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; /** * Test for POST requests. - * + *

* Created by Karel Maesen, Geovise BVBA on 19/12/14. */ -public class RxHttpClientPostTests extends UsingWireMock{ +public class RxHttpClientPostTests extends UsingWireMock { //this is a post that creates a contact entity, and then //retrieves it back from the server. @Test - public void POSTHappyPath() throws InterruptedException { + public void POSTHappyPath() { //set up stub String expectBody = "{ 'name': 'John Doe }"; stubFor(post(urlPathEqualTo("/contacts/new")) @@ -34,13 +30,13 @@ public void POSTHappyPath() throws InterruptedException { .withStatus(201) .withHeader("Content-Type", "application/json") .withHeader("Location", "/contacts/123")) - ); + ); stubFor(get(urlPathEqualTo("/contacts/123")) - .withHeader("Accept", equalTo("application/json")) - .willReturn(aResponse().withFixedDelay(REQUEST_TIME_OUT / 3) - .withStatus(200) - .withHeader("Content-Type", "application/json") - .withBody(expectBody)) + .withHeader("Accept", equalTo("application/json")) + .willReturn(aResponse().withFixedDelay(REQUEST_TIME_OUT / 3) + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(expectBody)) ); //set up use case @@ -53,32 +49,32 @@ public void POSTHappyPath() throws InterruptedException { Observable observable = client.executeToCompletion(request, resp -> resp.getHeader("Location").get()) .flatMap(url -> - client.executeToCompletion( - client.requestBuilder().setMethod("GET").setUrlRelativetoBase(url).build(), - resp -> resp.getResponseBody() - ) + client.executeToCompletion( + client.requestBuilder().setMethod("GET").setUrlRelativetoBase(url).build(), + ServerResponse::getResponseBody + ) ); - TestSubscriber sub = new TestSubscriber<>(); + TestObserver sub = new TestObserver<>(); observable.subscribe(sub); - sub.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); sub.assertNoErrors(); - sub.assertReceivedOnNext(items(expectBody)); + sub.assertValues(expectBody); } @Test - public void POSTFailure() throws InterruptedException { + public void POSTFailure() { //set up stub String expectFailedBody = "{ \"message\": \"unauthorized\" }"; stubFor(post(urlPathEqualTo("/contacts/new")) - .withHeader("Accept", equalTo("application/json")) - .willReturn(aResponse().withFixedDelay(REQUEST_TIME_OUT / 3) - .withStatus(403) - .withHeader("Content-Type", "application/json") - .withBody(expectFailedBody)) + .withHeader("Accept", equalTo("application/json")) + .willReturn(aResponse().withFixedDelay(REQUEST_TIME_OUT / 3) + .withStatus(403) + .withHeader("Content-Type", "application/json") + .withBody(expectFailedBody)) ); //set up use case @@ -90,19 +86,18 @@ public void POSTFailure() throws InterruptedException { Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber sub = new TestSubscriber<>(); + TestObserver sub = new TestObserver<>(); observable.subscribe(sub); - sub.awaitTerminalEvent(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); - List errorEvents = sub.getOnErrorEvents(); - assertEquals(errorEvents.size(), 1); - assertTrue(errorEvents.get(0) instanceof HttpClientError); - HttpClientError httpClientError = (HttpClientError) errorEvents.get(0); - assertTrue(httpClientError.getResponse().isPresent()); - ServerResponse serverResponse = httpClientError.getResponse().get(); - assertEquals(serverResponse.getStatusCode(), 403); - assertEquals(serverResponse.getContentType().get(), "application/json"); - assertEquals(serverResponse.getResponseBody(), expectFailedBody); + sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + sub.assertError(t -> { + if (t instanceof HttpClientError) { + HttpClientError hte = (HttpClientError) t; + ServerResponse sr = hte.getResponse().get(); + return hte.getStatusCode() == 403 && sr.getResponseBody().equals(expectFailedBody) + && sr.getContentType().get().equals("application/json"); + } else return false; + }); } } diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java index cf0a8b1..34dc1b2 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java @@ -1,23 +1,18 @@ package be.wegenenverkeer.designtests; -import be.wegenenverkeer.rxhttp.*; -import org.junit.Assert; -import org.junit.Ignore; +import be.wegenenverkeer.rxhttp.ClientRequest; +import io.reactivex.Flowable; +import io.reactivex.Observable; +import io.reactivex.observers.TestObserver; +import io.reactivex.subscribers.TestSubscriber; import org.junit.Test; -import rx.Observable; -import rx.Subscription; -import rx.observers.TestSubscriber; +import org.reactivestreams.Subscription; -import java.util.ArrayList; -import java.util.List; import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import java.util.concurrent.atomic.AtomicInteger; import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static org.junit.Assert.assertEquals; /** * Tests that demonstrate processing a long and slow chunked response. @@ -45,12 +40,12 @@ public void testChunkedTransfer(){ .setUrlRelativetoBase("/sse") .build(); - Observable observable = client.executeAndDechunk(request, "\n"); + Flowable observable = client.executeAndDechunk(request, "\n"); TestSubscriber subscriber = new TestSubscriber<>(); observable.subscribe(subscriber); - subscriber.awaitTerminalEvent(120, TimeUnit.MILLISECONDS); + subscriber.awaitDone(120, TimeUnit.MILLISECONDS); - assertEquals(10, subscriber.getOnNextEvents().size()); + subscriber.assertValueCount(10); } @@ -71,14 +66,14 @@ public void testCancellation() throws InterruptedException, ExecutionException, .setMethod("GET") .setUrlRelativetoBase("/sse") .build(); - Observable observable = client.executeAndDechunk(request, "\n"); + Flowable observable = client.executeAndDechunk(request, "\n"); TestSubscriber subscriber = new TestSubscriber<>(); - Subscription subscription = observable.subscribe(subscriber); + observable.subscribe(subscriber); Thread.sleep(50); - subscription.unsubscribe(); - assertEquals(0, subscriber.getOnNextEvents().size()); + subscriber.cancel(); + subscriber.assertValueCount(0); } diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java index e7d9c8f..c5ca10f 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java @@ -22,7 +22,7 @@ abstract public class UsingWireMock { - static final int REQUEST_TIME_OUT = 5000; + static final int REQUEST_TIME_OUT = 500; static final int DEFAULT_TIME_OUT = REQUEST_TIME_OUT * 5; static int port = 8089; diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/ObservableBodyGeneratorTest.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/FlowableBodyGeneratorTest.java similarity index 81% rename from modules/java/src/test/java/be/wegenenverkeer/rxhttp/ObservableBodyGeneratorTest.java rename to modules/java/src/test/java/be/wegenenverkeer/rxhttp/FlowableBodyGeneratorTest.java index 409e62c..eb402fc 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/ObservableBodyGeneratorTest.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/FlowableBodyGeneratorTest.java @@ -3,13 +3,12 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; +import io.reactivex.Flowable; +import io.reactivex.schedulers.Schedulers; import org.asynchttpclient.request.body.Body; import org.junit.Test; -import rx.Observable; -import rx.schedulers.Schedulers; import java.io.IOException; -import java.nio.ByteBuffer; import java.util.Random; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -17,7 +16,7 @@ import static org.asynchttpclient.request.body.Body.BodyState.STOP; import static org.junit.Assert.assertEquals; -public class ObservableBodyGeneratorTest { +public class FlowableBodyGeneratorTest { private final Random random = new Random(); private final int chunkSize = 1024 * 8; @@ -33,8 +32,8 @@ public void testSingleRead() throws IOException { final int srcArraySize = chunkSize - 1; final byte[] srcArray = sourceArray(srcArraySize); - Observable observable = Observable.just(srcArray); - ObservableBodyGenerator bodyGenerator = new ObservableBodyGenerator(observable); + Flowable observable = Flowable.just(srcArray); + FlowableBodyGenerator bodyGenerator = new FlowableBodyGenerator(observable); Body body = bodyGenerator.createBody(); final ByteBuf chunkBuffer = Unpooled.buffer(chunkSize); @@ -52,8 +51,8 @@ public void testMultipleReadsFromSingleSource() throws IOException { final int srcArraySize = (3 * chunkSize) + 42; final byte[] srcArray = sourceArray(srcArraySize); - Observable observable = Observable.just(srcArray); - ObservableBodyGenerator bodyGenerator = new ObservableBodyGenerator(observable); + Flowable observable = Flowable.just(srcArray); + FlowableBodyGenerator bodyGenerator = new FlowableBodyGenerator(observable); Body body = bodyGenerator.createBody(); final ByteBuf chunkBuffer = Unpooled.buffer(chunkSize); @@ -73,8 +72,8 @@ public void testMultipleReadsFromSingleSource() throws IOException { public void testMultipleReadsFromMultipleSource() throws IOException { final int srcArraySize = chunkSize; - Observable observable = Observable.just(sourceArray(srcArraySize), sourceArray(srcArraySize), sourceArray(srcArraySize), sourceArray(42)); - ObservableBodyGenerator bodyGenerator = new ObservableBodyGenerator(observable); + Flowable observable = Flowable.just(sourceArray(srcArraySize), sourceArray(srcArraySize), sourceArray(srcArraySize), sourceArray(42)); + FlowableBodyGenerator bodyGenerator = new FlowableBodyGenerator(observable); Body body = bodyGenerator.createBody(); final ByteBuf chunkBuffer = Unpooled.buffer(chunkSize); @@ -94,7 +93,7 @@ public void testMultipleReadsFromMultipleSource() throws IOException { public void testSlowProducer() throws IOException { final AtomicInteger size = new AtomicInteger(); - Observable observable = Observable + Flowable observable = Flowable .interval(50, TimeUnit.MILLISECONDS) .map(i -> { int arraySize = chunkSize - 128 + random.nextInt(256); @@ -103,7 +102,7 @@ public void testSlowProducer() throws IOException { }) .take(20); - ObservableBodyGenerator bodyGenerator = new ObservableBodyGenerator(observable, 1); + FlowableBodyGenerator bodyGenerator = new FlowableBodyGenerator(observable, 1); Body body = bodyGenerator.createBody(); final ByteBuf chunkBuffer = Unpooled.buffer(chunkSize); @@ -119,7 +118,7 @@ public void testSlowProducer() throws IOException { public void testSlowConsumer() throws IOException, InterruptedException { final AtomicInteger size = new AtomicInteger(); - Observable observable = Observable + Flowable observable = Flowable .fromCallable(() -> { int arraySize = chunkSize - 128 + random.nextInt(256); size.addAndGet(arraySize); @@ -128,7 +127,7 @@ public void testSlowConsumer() throws IOException, InterruptedException { .repeat(50) .observeOn(Schedulers.computation()); - ObservableBodyGenerator bodyGenerator = new ObservableBodyGenerator(observable, 2); + FlowableBodyGenerator bodyGenerator = new FlowableBodyGenerator(observable, 2); Body body = bodyGenerator.createBody(); final ByteBuf chunkBuffer = Unpooled.buffer(chunkSize); diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java index f436e9c..7fd5925 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java @@ -3,10 +3,10 @@ import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.RxHttpClient; import be.wegenenverkeer.rxhttp.ServerResponse; +import io.reactivex.Observable; +import io.reactivex.observers.TestObserver; import org.junit.Ignore; import org.junit.Test; -import rx.Observable; -import rx.observers.TestSubscriber; import java.util.ArrayList; import java.util.List; @@ -39,16 +39,13 @@ public void testS3ApiCall(){ Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber sub = new TestSubscriber<>(); + TestObserver sub = new TestObserver<>(); observable.subscribe(sub); - sub.awaitTerminalEvent(6000, TimeUnit.MILLISECONDS); - sub.getOnErrorEvents().forEach( t -> System.out.println(t.getMessage())); + sub.awaitDone(6000, TimeUnit.MILLISECONDS); sub.assertNoErrors(); - List expectedItems = new ArrayList(); - expectedItems.add("This is a test\n"); - sub.assertReceivedOnNext(expectedItems); + sub.assertValues("This is a test\n"); } } diff --git a/modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/ImplicitConversions.scala b/modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/ImplicitConversions.scala index 88c4f33..207f137 100644 --- a/modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/ImplicitConversions.scala +++ b/modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/ImplicitConversions.scala @@ -5,7 +5,8 @@ import java.util.concurrent.CompletionStage import java.util.function.BiConsumer import be.wegenenverkeer.rxhttp.{ClientRequest, ServerResponse, ServerResponseElement, RxHttpClient => JRxHttpClient} -import rx.lang.scala.Observable +import io.reactivex.BackpressureStrategy +import org.reactivestreams.Publisher import scala.concurrent.{Future, Promise} import scala.util.{Failure, Success} @@ -13,7 +14,6 @@ import scala.util.{Failure, Success} class RxHttpClient(val inner: JRxHttpClient) { - import rx.lang.scala.JavaConversions.toScalaObservable import java.util.function.{ Function ⇒ JFunction} private def toJavaFunction[A, B](f: A => B) : JFunction[A,B]= (a: A) => f(a) @@ -36,25 +36,25 @@ class RxHttpClient(val inner: JRxHttpClient) { def execute[T](req: ClientRequest, transform: ServerResponse => T) : Future[T] = fromJavaFuture(inner.execute[T](req, toJavaFunction(transform))) - def executeObservably[T](req: ClientRequest, transform : Array[Byte] => T) : Observable[T] = - toScalaObservable(inner.executeObservably(req, toJavaFunction(transform))) + def executeObservably[T](req: ClientRequest, transform : Array[Byte] => T) : Publisher[T] = + inner.executeObservably(req, toJavaFunction(transform)).toFlowable(BackpressureStrategy.BUFFER) - def executeObservably(req: ClientRequest) : Observable[ServerResponseElement] = - toScalaObservable(inner.executeObservably(req)) + def executeObservably(req: ClientRequest) : Publisher[ServerResponseElement] = + inner.executeObservably(req).toFlowable(BackpressureStrategy.BUFFER) - def executeToCompletion[T](req: ClientRequest, transform: Function[ServerResponse,T]): Observable[T] = - toScalaObservable(inner.executeToCompletion(req, toJavaFunction(transform))) + def executeToCompletion[T](req: ClientRequest, transform: Function[ServerResponse,T]): Publisher[T] = + inner.executeToCompletion(req, toJavaFunction(transform)).toFlowable(BackpressureStrategy.BUFFER) - def executeAndDechunk[String](req: ClientRequest, separator: String, charset : Charset = Charset.forName("UTF8")): Observable[String] = - toScalaObservable(inner.executeAndDechunk(req, separator.asInstanceOf[java.lang.String], charset)).map( _ .asInstanceOf[String]) + def executeAndDechunk[String](req: ClientRequest, separator: String, charset : Charset = Charset.forName("UTF8")): Publisher[String] = + inner.executeAndDechunk(req, separator.asInstanceOf[java.lang.String], charset).map( _ .asInstanceOf[String]) } /** - * Implicit conversion of RxHttpClient which adds methods that return [[rx.lang.scala.Observable]]s. + * Implicit conversion of RxHttpClient which adds methods that return Reactive Stream Publishers. * * Created by Karel Maesen, Geovise BVBA on 22/12/14. */ diff --git a/modules/scala/src/test/scala/be/wegenenverkeer/designtests/RxHTTPClientGetSpecs.scala b/modules/scala/src/test/scala/be/wegenenverkeer/designtests/RxHTTPClientGetSpecs.scala index 23ce7b3..2f2279e 100644 --- a/modules/scala/src/test/scala/be/wegenenverkeer/designtests/RxHTTPClientGetSpecs.scala +++ b/modules/scala/src/test/scala/be/wegenenverkeer/designtests/RxHTTPClientGetSpecs.scala @@ -7,10 +7,9 @@ import com.github.tomakehurst.wiremock.WireMockServer import com.github.tomakehurst.wiremock.client.WireMock._ import com.github.tomakehurst.wiremock.core.Options import com.github.tomakehurst.wiremock.core.WireMockConfiguration._ +import io.reactivex.Flowable +import io.reactivex.subscribers.TestSubscriber import org.specs2.mutable.{After, Specification} -import rx.lang.scala.Observable -import rx.lang.scala.observers.TestSubscriber -import rx.observers.TestObserver import scala.concurrent.{Await, Future} @@ -28,7 +27,7 @@ class RxHTTPClientGetSpecs extends Specification { "The GET request " should { - "return scala Observable with executeObservably" in new UsingMockServer { + "return a Flowable with executeObservably" in new UsingMockServer { val expectBody: String = "{ 'contacts': [1,2,3] }" stubFor(get(urlPathEqualTo("/contacts")) @@ -45,21 +44,14 @@ class RxHTTPClientGetSpecs extends Specification { .addQueryParam("q", "test") .build() - val observable: Observable[String] = client.executeObservably(req, (bytes: Array[Byte]) => new String(bytes)) - - val response = observable - .toBlocking - .singleOption - - response must beSome(expectBody) + val observable: Flowable[String] = Flowable.fromPublisher(client.executeObservably(req, (bytes: Array[Byte]) => new String(bytes))) + val response = observable.blockingLast() + response must_== expectBody } "return scala Future with execute" in new UsingMockServer { - - - val expectBody: String = "{ 'contacts': [1,2,3] }" stubFor(get(urlPathEqualTo("/contacts")) @@ -102,13 +94,11 @@ class RxHTTPClientGetSpecs extends Specification { .build() - val observable: Observable[String] = client.executeToCompletion(req, (resp: ServerResponse) => resp.getResponseBody) + val observable: Flowable[String] = Flowable.fromPublisher(client.executeToCompletion(req, (resp: ServerResponse) => resp.getResponseBody)) - val response = observable - .toBlocking - .singleOption + val response = observable.blockingLast() - response must beSome(expectBody) + response must_== expectBody } "return delimited evens (Strings)" in new UsingMockServer { @@ -120,14 +110,14 @@ class RxHTTPClientGetSpecs extends Specification { val request: ClientRequest = client.requestBuilder.setMethod("GET").setUrlRelativetoBase("/sse").build - val observable = client.executeAndDechunk(request, "\n") + val observable = Flowable.fromPublisher(client.executeAndDechunk(request, "\n")) - val testSub = TestSubscriber[String] + val testSub : TestSubscriber[String] = new TestSubscriber[String] observable.subscribe(testSub) - testSub.awaitTerminalEvent(1.seconds) + testSub.awaitDone(1, SECONDS) - testSub.getOnNextEvents.size must beEqualTo(10) + testSub.assertValueCount(10) } } From d594a220f5941dc742570d37281cbbbeba5c3d97 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Fri, 12 Jul 2019 21:01:41 +0200 Subject: [PATCH 02/30] Increases timeout in tests (for TravisCI) --- .../test/java/be/wegenenverkeer/designtests/UsingWireMock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java index c5ca10f..e7d9c8f 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java @@ -22,7 +22,7 @@ abstract public class UsingWireMock { - static final int REQUEST_TIME_OUT = 500; + static final int REQUEST_TIME_OUT = 5000; static final int DEFAULT_TIME_OUT = REQUEST_TIME_OUT * 5; static int port = 8089; From a4c6a17e525af4200f2237e7618e1a766dc35e0f Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Fri, 12 Jul 2019 23:14:12 +0200 Subject: [PATCH 03/30] RxJava-backed client in separate module --- build.sbt | 23 +- .../rxhttp/BaseRxHttpClient.java | 131 +++ .../rxhttp/BuildValidation.java | 52 + .../be/wegenenverkeer/rxhttp/Builder.java | 640 ++++++++++++ .../wegenenverkeer/rxhttp/ClientRequest.java | 2 +- .../rxhttp/ClientRequestBuilder.java | 0 .../rxhttp/ClientRequestLogFormatter.java | 0 .../rxhttp/CompatUtilities.java | 1 - .../DefaultClientRequestLogFormatter.java | 0 .../wegenenverkeer/rxhttp/HTTPStatusCode.java | 0 .../rxhttp/HttpClientError.java | 0 .../be/wegenenverkeer/rxhttp/HttpError.java | 0 .../rxhttp/HttpServerError.java | 0 .../rxhttp/MutableResponseProcessor.java | 1 + .../wegenenverkeer/rxhttp/RequestSigner.java | 0 .../rxhttp/RestClientConfig.java | 63 ++ .../wegenenverkeer/rxhttp/RxHttpClient.java | 87 ++ .../wegenenverkeer/rxhttp/ServerResponse.java | 0 .../rxhttp/ServerResponseBodyPart.java | 0 .../rxhttp/ServerResponseBodyPartImpl.java | 0 .../rxhttp/ServerResponseElement.java | 0 .../rxhttp/ServerResponseHeaders.java | 0 .../rxhttp/ServerResponseHeadersImpl.java | 2 +- .../rxhttp/ServerResponseStatus.java | 0 .../rxhttp/aws/AwsCredentials.java | 0 .../rxhttp/aws/AwsCredentialsProvider.java | 0 .../wegenenverkeer/rxhttp/aws/AwsRegion.java | 0 .../wegenenverkeer/rxhttp/aws/AwsService.java | 0 .../rxhttp/aws/AwsServiceEndPoint.java | 0 .../rxhttp/aws/AwsSignature4Signer.java | 0 .../aws/ConstantAwsCredentialProvider.java | 0 .../rxhttp/aws/DefaultEnvironment.java | 0 .../rxhttp/aws/Environment.java | 0 .../aws/EnvironmentCredentialsProvider.java | 0 .../aws/InstanceCredentialsProvider.java | 0 .../wegenenverkeer/rxhttp/aws/UrlEncoder.java | 0 .../get-header-key-duplicate.authz | 1 + .../get-header-key-duplicate.creq | 9 + .../get-header-key-duplicate.req | 7 + .../get-header-key-duplicate.sreq | 8 + .../get-header-key-duplicate.sts | 4 + .../get-header-value-order.authz | 1 + .../get-header-value-order.creq | 9 + .../aws4_testsuite/get-header-value-order.req | 8 + .../get-header-value-order.sreq | 9 + .../aws4_testsuite/get-header-value-order.sts | 4 + .../get-header-value-trim.authz | 1 + .../aws4_testsuite/get-header-value-trim.creq | 9 + .../aws4_testsuite/get-header-value-trim.req | 5 + .../aws4_testsuite/get-header-value-trim.sreq | 6 + .../aws4_testsuite/get-header-value-trim.sts | 4 + .../get-relative-relative.authz | 1 + .../aws4_testsuite/get-relative-relative.creq | 8 + .../aws4_testsuite/get-relative-relative.req | 4 + .../aws4_testsuite/get-relative-relative.sreq | 5 + .../aws4_testsuite/get-relative-relative.sts | 4 + .../aws4_testsuite/get-relative.authz | 1 + .../aws4_testsuite/get-relative.creq | 8 + .../resources/aws4_testsuite/get-relative.req | 4 + .../aws4_testsuite/get-relative.sreq | 5 + .../resources/aws4_testsuite/get-relative.sts | 4 + .../aws4_testsuite/get-slash-dot-slash.authz | 1 + .../aws4_testsuite/get-slash-dot-slash.creq | 8 + .../aws4_testsuite/get-slash-dot-slash.req | 4 + .../aws4_testsuite/get-slash-dot-slash.sreq | 5 + .../aws4_testsuite/get-slash-dot-slash.sts | 4 + .../get-slash-pointless-dot.authz | 1 + .../get-slash-pointless-dot.creq | 8 + .../get-slash-pointless-dot.req | 4 + .../get-slash-pointless-dot.sreq | 5 + .../get-slash-pointless-dot.sts | 4 + .../resources/aws4_testsuite/get-slash.authz | 1 + .../resources/aws4_testsuite/get-slash.creq | 8 + .../resources/aws4_testsuite/get-slash.req | 4 + .../resources/aws4_testsuite/get-slash.sreq | 5 + .../resources/aws4_testsuite/get-slash.sts | 4 + .../aws4_testsuite/get-slashes.authz | 1 + .../resources/aws4_testsuite/get-slashes.creq | 8 + .../resources/aws4_testsuite/get-slashes.req | 4 + .../resources/aws4_testsuite/get-slashes.sreq | 5 + .../resources/aws4_testsuite/get-slashes.sts | 4 + .../resources/aws4_testsuite/get-space.authz | 1 + .../resources/aws4_testsuite/get-space.creq | 8 + .../resources/aws4_testsuite/get-space.req | 4 + .../resources/aws4_testsuite/get-space.sreq | 5 + .../resources/aws4_testsuite/get-space.sts | 4 + .../aws4_testsuite/get-unreserved.authz | 1 + .../aws4_testsuite/get-unreserved.creq | 8 + .../aws4_testsuite/get-unreserved.req | 4 + .../aws4_testsuite/get-unreserved.sreq | 5 + .../aws4_testsuite/get-unreserved.sts | 4 + .../resources/aws4_testsuite/get-utf8.authz | 1 + .../resources/aws4_testsuite/get-utf8.creq | 8 + .../resources/aws4_testsuite/get-utf8.req | 4 + .../resources/aws4_testsuite/get-utf8.sreq | 5 + .../resources/aws4_testsuite/get-utf8.sts | 4 + .../get-vanilla-empty-query-key.authz | 1 + .../get-vanilla-empty-query-key.creq | 8 + .../get-vanilla-empty-query-key.req | 4 + .../get-vanilla-empty-query-key.sreq | 5 + .../get-vanilla-empty-query-key.sts | 4 + .../get-vanilla-query-order-key-case.authz | 1 + .../get-vanilla-query-order-key-case.creq | 8 + .../get-vanilla-query-order-key-case.req | 4 + .../get-vanilla-query-order-key-case.sreq | 5 + .../get-vanilla-query-order-key-case.sts | 4 + .../get-vanilla-query-order-key.authz | 1 + .../get-vanilla-query-order-key.creq | 8 + .../get-vanilla-query-order-key.req | 4 + .../get-vanilla-query-order-key.sreq | 5 + .../get-vanilla-query-order-key.sts | 4 + .../get-vanilla-query-order-value.authz | 1 + .../get-vanilla-query-order-value.creq | 8 + .../get-vanilla-query-order-value.req | 4 + .../get-vanilla-query-order-value.sreq | 5 + .../get-vanilla-query-order-value.sts | 4 + .../get-vanilla-query-unreserved.authz | 1 + .../get-vanilla-query-unreserved.creq | 8 + .../get-vanilla-query-unreserved.req | 4 + .../get-vanilla-query-unreserved.sreq | 5 + .../get-vanilla-query-unreserved.sts | 4 + .../aws4_testsuite/get-vanilla-query.authz | 1 + .../aws4_testsuite/get-vanilla-query.creq | 8 + .../aws4_testsuite/get-vanilla-query.req | 4 + .../aws4_testsuite/get-vanilla-query.sreq | 5 + .../aws4_testsuite/get-vanilla-query.sts | 4 + .../get-vanilla-ut8-query.authz | 1 + .../aws4_testsuite/get-vanilla-ut8-query.creq | 8 + .../aws4_testsuite/get-vanilla-ut8-query.req | 4 + .../aws4_testsuite/get-vanilla-ut8-query.sreq | 5 + .../aws4_testsuite/get-vanilla-ut8-query.sts | 4 + .../aws4_testsuite/get-vanilla.authz | 1 + .../resources/aws4_testsuite/get-vanilla.creq | 8 + .../resources/aws4_testsuite/get-vanilla.req | 4 + .../resources/aws4_testsuite/get-vanilla.sreq | 5 + .../resources/aws4_testsuite/get-vanilla.sts | 4 + .../aws4_testsuite/post-header-key-case.authz | 1 + .../aws4_testsuite/post-header-key-case.creq | 8 + .../aws4_testsuite/post-header-key-case.req | 4 + .../aws4_testsuite/post-header-key-case.sreq | 5 + .../aws4_testsuite/post-header-key-case.sts | 4 + .../aws4_testsuite/post-header-key-sort.authz | 1 + .../aws4_testsuite/post-header-key-sort.creq | 9 + .../aws4_testsuite/post-header-key-sort.req | 5 + .../aws4_testsuite/post-header-key-sort.sreq | 6 + .../aws4_testsuite/post-header-key-sort.sts | 4 + .../post-header-value-case.authz | 1 + .../post-header-value-case.creq | 9 + .../aws4_testsuite/post-header-value-case.req | 5 + .../post-header-value-case.sreq | 6 + .../aws4_testsuite/post-header-value-case.sts | 4 + .../post-vanilla-empty-query-value.authz | 1 + .../post-vanilla-empty-query-value.creq | 8 + .../post-vanilla-empty-query-value.req | 4 + .../post-vanilla-empty-query-value.sreq | 5 + .../post-vanilla-empty-query-value.sts | 4 + .../post-vanilla-query-nonunreserved.authz | 1 + .../post-vanilla-query-nonunreserved.creq | 8 + .../post-vanilla-query-nonunreserved.req | 4 + .../post-vanilla-query-nonunreserved.sreq | 5 + .../post-vanilla-query-nonunreserved.sts | 4 + .../post-vanilla-query-space.authz | 1 + .../post-vanilla-query-space.creq | 8 + .../post-vanilla-query-space.req | 4 + .../post-vanilla-query-space.sreq | 5 + .../post-vanilla-query-space.sts | 4 + .../aws4_testsuite/post-vanilla-query.authz | 1 + .../aws4_testsuite/post-vanilla-query.creq | 8 + .../aws4_testsuite/post-vanilla-query.req | 4 + .../aws4_testsuite/post-vanilla-query.sreq | 5 + .../aws4_testsuite/post-vanilla-query.sts | 4 + .../aws4_testsuite/post-vanilla.authz | 1 + .../aws4_testsuite/post-vanilla.creq | 8 + .../resources/aws4_testsuite/post-vanilla.req | 4 + .../aws4_testsuite/post-vanilla.sreq | 5 + .../resources/aws4_testsuite/post-vanilla.sts | 4 + ...ost-x-www-form-urlencoded-parameters.authz | 1 + ...post-x-www-form-urlencoded-parameters.creq | 9 + .../post-x-www-form-urlencoded-parameters.req | 6 + ...post-x-www-form-urlencoded-parameters.sreq | 7 + .../post-x-www-form-urlencoded-parameters.sts | 4 + .../post-x-www-form-urlencoded.authz | 1 + .../post-x-www-form-urlencoded.creq | 9 + .../post-x-www-form-urlencoded.req | 6 + .../post-x-www-form-urlencoded.sreq | 7 + .../post-x-www-form-urlencoded.sts | 4 + .../rxhttp/CollectingSubscriber.java | 107 -- .../wegenenverkeer/rxhttp/RxHttpClient.java | 928 ------------------ .../AsyncCompletionHandlerWrapper.java | 10 +- .../{ => rxjava}/AsyncHandlerWrapper.java | 16 +- .../{ => rxjava}/CompleteResponseHandler.java | 5 +- .../rxhttp/{ => rxjava}/Dechunker.java | 2 +- .../{ => rxjava}/FlowableBodyGenerator.java | 4 +- .../rxhttp/rxjava/RxJavaHttpClient.java | 164 ++++ .../be/wegenenverkeer/DechunkersTest.java | 2 +- .../designtests/RxHttpClientDesignTests.java | 39 +- .../RxHttpClientMultipleRequests.java | 10 +- ...ClientObservableOfServerElementsTests.java | 18 +- .../designtests/RxHttpClientPostTests.java | 10 +- .../RxHttpClientTestChunkedResponse.java | 3 - .../designtests/UsingWireMock.java | 11 +- .../rxhttp/FlowableBodyGeneratorTest.java | 1 + .../be/wegenenverkeer/rxhttp/TestBuilder.java | 5 +- .../wegenenverkeer/rxhttp/TestLoggerConf.java | 11 +- .../rxhttp/aws/Aws4TestCase.java | 3 - .../rxhttp/aws/Aws4TestSuite.java | 3 +- .../rxhttp/aws/TestClientRequest.java | 3 +- .../rxhttp/aws/TestS3ApiCall.java | 11 +- 208 files changed, 1937 insertions(+), 1126 deletions(-) create mode 100644 modules/core/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java create mode 100644 modules/core/src/main/java/be/wegenenverkeer/rxhttp/BuildValidation.java create mode 100644 modules/core/src/main/java/be/wegenenverkeer/rxhttp/Builder.java rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java (99%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestBuilder.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestLogFormatter.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java (99%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/DefaultClientRequestLogFormatter.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/HTTPStatusCode.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/HttpClientError.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/HttpError.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/HttpServerError.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java (99%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/RequestSigner.java (100%) create mode 100644 modules/core/src/main/java/be/wegenenverkeer/rxhttp/RestClientConfig.java create mode 100644 modules/core/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponse.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPart.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPartImpl.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseElement.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeaders.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java (93%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseStatus.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentials.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentialsProvider.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsRegion.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsService.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsServiceEndPoint.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsSignature4Signer.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/ConstantAwsCredentialProvider.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/DefaultEnvironment.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/Environment.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/EnvironmentCredentialsProvider.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/InstanceCredentialsProvider.java (100%) rename modules/{java => core}/src/main/java/be/wegenenverkeer/rxhttp/aws/UrlEncoder.java (100%) create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-order.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-order.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-order.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative-relative.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative-relative.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative-relative.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slashes.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slashes.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slashes.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slashes.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slashes.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-space.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-space.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-space.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-space.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-space.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-unreserved.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-unreserved.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-unreserved.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-unreserved.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-unreserved.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-utf8.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-utf8.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-utf8.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-utf8.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-utf8.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-case.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-case.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-case.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-value-case.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-value-case.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-value-case.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sts create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.authz create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.creq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.req create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sreq create mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sts delete mode 100644 modules/java/src/main/java/be/wegenenverkeer/rxhttp/CollectingSubscriber.java delete mode 100644 modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java rename modules/java/src/main/java/be/wegenenverkeer/rxhttp/{ => rxjava}/AsyncCompletionHandlerWrapper.java (84%) rename modules/java/src/main/java/be/wegenenverkeer/rxhttp/{ => rxjava}/AsyncHandlerWrapper.java (92%) rename modules/java/src/main/java/be/wegenenverkeer/rxhttp/{ => rxjava}/CompleteResponseHandler.java (82%) rename modules/java/src/main/java/be/wegenenverkeer/rxhttp/{ => rxjava}/Dechunker.java (98%) rename modules/java/src/main/java/be/wegenenverkeer/rxhttp/{ => rxjava}/FlowableBodyGenerator.java (97%) create mode 100644 modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java diff --git a/build.sbt b/build.sbt index f4e6f71..cbebf01 100644 --- a/build.sbt +++ b/build.sbt @@ -35,11 +35,15 @@ val commonDependencies = Seq( slf4j, rx, rxFlow, - rxJava, + commonsCodec, json ) +val rxJavaDependencies = Seq( + rxJava +) + val javaDependencies = commonDependencies ++ Seq(slf4jSimple, junitInterface) val scalaDependencies = commonDependencies ++ Seq( @@ -84,27 +88,34 @@ lazy val testSettings = Seq( libraryDependencies ++= mainTestDependencies, parallelExecution in Test := false ) - -lazy val javaModule = (project in file("modules/java")).settings( - name := "RxHttpClient-java", +lazy val coreModule = (project in file("modules/core")).settings( + name := "RxHttpClient-Base", moduleSettings, javacOptions ++= Seq("--release", "11"), libraryDependencies ++= javaDependencies, extraJavaSettings ) +lazy val rxJavaModule = (project in file("modules/java")).settings( + name := "RxHttpClient-RxJava", + moduleSettings, + javacOptions ++= Seq("--release", "11"), + libraryDependencies ++= javaDependencies ++ rxJavaDependencies, + extraJavaSettings +) dependsOn coreModule + lazy val scalaModule = (project in file("modules/scala")).settings( name := "RxHttpClient-scala", moduleSettings, libraryDependencies ++= scalaDependencies -) dependsOn javaModule +) dependsOn coreModule lazy val main = (project in file(".")) .settings( moduleSettings ++ disablePublishingRoot, name := "RxHttpClient" ) - .aggregate(javaModule, scalaModule) + .aggregate(coreModule, rxJavaModule, scalaModule) lazy val pomInfo = https://github.com/WegenenVerkeer/atomium diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java new file mode 100644 index 0000000..a0e77fc --- /dev/null +++ b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java @@ -0,0 +1,131 @@ +package be.wegenenverkeer.rxhttp; + +import org.asynchttpclient.AsyncHttpClient; +import org.reactivestreams.Publisher; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; + +/** + * A Reactive HTTP Client + * Created by Karel Maesen, Geovise BVBA on 05/12/14. + */ +public abstract class BaseRxHttpClient implements RxHttpClient { + + final private static Logger logger = LoggerFactory.getLogger(BaseRxHttpClient.class); + final private static Charset UTF8 = Charset.forName("UTF8"); + + final private AsyncHttpClient innerClient; + final private RestClientConfig config; + final private List requestSigners; + final private ClientRequestLogFormatter logFormatter; + + protected BaseRxHttpClient(AsyncHttpClient innerClient, RestClientConfig config, ClientRequestLogFormatter logFmt, RequestSigner... requestSigners) { + this.innerClient = innerClient; + this.config = config; + this.requestSigners = List.of(requestSigners); + this.logFormatter = logFmt; + } + + /** + * * Executes a request and returns an Observable for the complete response. + */ + @Override + public CompletableFuture execute(ClientRequest request, Function transformer) { + logger.info("Sending Request: " + toLogMessage(request)); + //Note: we don't use Observable.toBlocking().toFuture() + //because we need a CompletableFuture so that interop with Scala is possible + final CompletableFuture future = new CompletableFuture<>(); + + return innerClient.executeRequest(request.unwrap()).toCompletableFuture() + .thenApply( ServerResponse::wrap ) + .thenApply( transformer ); + } + + /** + * Returns a "cold" Observable for a stream of messages. + *

+ * All ServerResponseElements are filtered out, ResponseBodyParts are turned into (UTF8) Strings, + * and the chunks are combined and split at the specified separator characters. + *

+ * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made + * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. + * + * @param request the request to send + * @param separator the separator + * @return a cold Flowable of messages (UTF8 Strings) + + */ + @Override + public Publisher executeAndDechunk(ClientRequest request, String separator) { + return executeAndDechunk(request, separator, Charset.forName("UTF8")); + } + + + /** + * Returns the base URL that this client connects to. + * + * @return the base URL that this client connects to. + */ + @Override + public String getBaseUrl() { + return this.config.getBaseUrl(); + } + + /** + * Returns the configured default ACCEPT header for requests created using this instance's + * {@code ClientRequestBuilder}s. + * + * @return the configured default ACCEPT header for requests created using this instance's {@code ClientRequestBuilder}s. + */ + @Override + public String getAccept() { + return config.getAccept(); + } + + @Override + public List getRequestSigners() { + return requestSigners; + } + + /** + * Closes the underlying connection + */ + @Override + public void close() { + try { + this.innerClient.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * Returns a new {@code ClientRequestBuilder}. + * + * @return a new {@code ClientRequestBuilder}. + */ + @Override + public ClientRequestBuilder requestBuilder() { + return new ClientRequestBuilder(this); + } + + @Override + public String toLogMessage(ClientRequest request) { + return this.logFormatter.toLogMessage(request); + } + + + @Override + public AsyncHttpClient inner() { + return this.innerClient; + } + + + +} diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BuildValidation.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BuildValidation.java new file mode 100644 index 0000000..e122583 --- /dev/null +++ b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BuildValidation.java @@ -0,0 +1,52 @@ +package be.wegenenverkeer.rxhttp; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Karel Maesen, Geovise BVBA on 2019-07-12. + */ +public class BuildValidation { + + private static Logger logger = LoggerFactory.getLogger(BuildValidation.class); + List errors = new ArrayList<>(); + List warnings = new ArrayList<>(); + + void addError(String errMsg) { + errors.add(errMsg); + } + + void addWarning(String warningMsg) { + warnings.add(warningMsg); + } + + String getErrorMessage() { + StringBuilder builder = new StringBuilder(); + for (String msg : errors) { + builder.append(msg).append("\n"); + } + return chop(builder.toString()); + } + + boolean hasWarnings() { + return !warnings.isEmpty(); + } + + boolean hasErrors() { + return !errors.isEmpty(); + } + + void logWarnings() { + for (String msg : warnings) { + logger.warn(msg); + } + } + + private String chop(String s) { + if (s == null || s.isEmpty()) return s; + return s.substring(0, s.length() - 1); + } +} \ No newline at end of file diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/Builder.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/Builder.java new file mode 100644 index 0000000..80ae26c --- /dev/null +++ b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/Builder.java @@ -0,0 +1,640 @@ +package be.wegenenverkeer.rxhttp; + +/** + * Created by Karel Maesen, Geovise BVBA on 2019-07-12. + */ + +import be.wegenenverkeer.rxhttp.aws.*; +import io.netty.handler.ssl.SslContext; +import org.asynchttpclient.AsyncHttpClient; +import org.asynchttpclient.DefaultAsyncHttpClientConfig; +import org.asynchttpclient.filter.RequestFilter; +import org.asynchttpclient.filter.ThrottleRequestFilter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.ThreadFactory; + +import static org.asynchttpclient.Dsl.asyncHttpClient; + +/** + * A Builder for {@code RxHttpClient} builders. + */ +public abstract class Builder> { + + final private static Logger logger = LoggerFactory.getLogger(BaseRxHttpClient.class); + + private DefaultAsyncHttpClientConfig.Builder configBuilder = new DefaultAsyncHttpClientConfig.Builder(); + final private RestClientConfig rcConfig = new RestClientConfig(); + + private boolean isAws = false; + private AwsServiceEndPoint awsServiceEndPoint; + private AwsCredentialsProvider awsCredentialsProvider; + + protected List requestSigners = new LinkedList<>(); //TODO -- make this member private + private List headersToLog = new ArrayList<>(); + private ArrayList formParmsToLog = new ArrayList<>(); + + public T build() { + addRestClientConfigsToConfigBuilder(); + DefaultAsyncHttpClientConfig config = configBuilder.build(); + + BuildValidation validation = validate(config); + + validation.logWarnings(); + if (validation.hasErrors()) { + throw new IllegalStateException(validation.getErrorMessage()); + } + + if (isAws && awsCredentialsProvider == null) { + throw new IllegalStateException("Aws endpoint specified, but no CredentialsProvider set."); + } + + AsyncHttpClient innerClient = asyncHttpClient(config); + + if (isAws) { + requestSigners.add(new AwsSignature4Signer(this.awsServiceEndPoint, this.awsCredentialsProvider)); + } + + ClientRequestLogFormatter logFmt = new DefaultClientRequestLogFormatter(headersToLog, formParmsToLog); + + return createClient(innerClient, rcConfig, logFmt, requestSigners.toArray(new RequestSigner[0])); + } + + protected abstract T createClient(AsyncHttpClient innerClient, RestClientConfig rcConfig, ClientRequestLogFormatter logFmt, RequestSigner... signers); + + + + /** + * Perform additional configBuilder build steps based on rcConfig settings + */ + private void addRestClientConfigsToConfigBuilder() { + if (rcConfig.getMaxConnections() > 0) { + configBuilder.setMaxConnections(rcConfig.getMaxConnections()); + } + if (rcConfig.getMaxConnections() > 0 && rcConfig.isThrottling() && rcConfig.getThrottlingMaxWait() > 0) { + addThrottling(rcConfig.getMaxConnections(), rcConfig.getThrottlingMaxWait()); + } + } + + + private void addThrottling(int maxConnections, int maxWait) { + RequestFilter filter = new ThrottleRequestFilter(maxConnections, maxWait); + configBuilder.addRequestFilter(filter); + } + + public U addRequestSigner(RequestSigner requestSigner) { + if (requestSigner == null) { + throw new IllegalArgumentException("No null argument allowed"); + } + this.requestSigners.add(requestSigner); + return (U)this; + } + + /** + * Sets the default Accept request-header for requests built using this instance. + * + * @param acceptHeaderValue the Media-range and accept-params to use as value for the Accept request-header field + * @return (U)this Builder + * @see W3C HTTP 1.1 specs. + */ + public U setAccept(String acceptHeaderValue) { + rcConfig.setAccept(acceptHeaderValue); + return (U)this; + } + + /** + * Sets the base URL for this client. + *

+ *

The base url will be prepended to any relative URL path specified in the {@code RequestBuilder}

+ * + * @param url the base URL for this instance + * @return (U)this.Builder + */ + public U setBaseUrl(String url) { + if (this.isAws) throw new IllegalStateException("Not allowed to set Base URL on AWS EndPoint"); + rcConfig.setBaseUrl(url); + return (U)this; + } + + /** + * Validates the Builder (used before building the client) + * + * @param config the AsyncHttpClient config object + * @return a {@code BuildValidation} containing all Errors and Warnings + */ + private BuildValidation validate(DefaultAsyncHttpClientConfig config) { + BuildValidation bv = new BuildValidation(); + + if (rcConfig.getBaseUrl().isEmpty()) { + bv.addError("No baseURL is set"); + } + + try { + new URL(rcConfig.getBaseUrl()); + } catch (MalformedURLException e) { + bv.addError("Malformed URL: " + e.getMessage()); + } + + String messagePrefix = "RxHttpClient for " + rcConfig.getBaseUrl(); + + if (!config.isKeepAlive()) { + bv.addWarning(messagePrefix + " has ChannelPool (KeepAlive) support disabled!"); + } + + if (config.getMaxConnections() < 0 && rcConfig.isThrottling()) { + bv.addError("Configured throttling, but no max. Connections set"); + } + + if (rcConfig.isThrottling() && rcConfig.getThrottlingMaxWait() <= 0) { + bv.addError("Configured throttling, but timeout is set to " + rcConfig.getThrottlingMaxWait()); + } + + if (config.getMaxConnections() < 0) { + bv.addWarning(messagePrefix + " has no maximum connections set!"); + } + + if (config.getConnectionTtl() < 0 && config.getPooledConnectionIdleTimeout() < 0) { + bv.addWarning(messagePrefix + " has no connection TTL or pool idle timeout set!"); + } + + return bv; + } + + + /** + * Set the maximum number of connections an {@link org.asynchttpclient.AsyncHttpClient} can handle. + * + * @param maxConnections the maximum number of connections an {@link org.asynchttpclient.AsyncHttpClient} can handle. + * @return a {@link Builder} + */ + public U setMaxConnections(int maxConnections) { + //we set this setting first on the rcConfig object, because we need this information together with the other throttling settings + // to properly configure the RequestThrottler + rcConfig.setMaxConnections(maxConnections); + return (U)this; + } + + /** + * Set true if connection can be pooled by a ChannelPool. Default is true. + * + * @param allowPoolingConnections true if connection can be pooled by a ChannelPool + * @return a {@link Builder} + * @deprecated Use setKeepAlive(boolean) instead + */ + @Deprecated + public U setAllowPoolingConnections(boolean allowPoolingConnections) { + configBuilder.setKeepAlive(allowPoolingConnections); + return (U)this; + } + + /** + * Set true if connection can be pooled by a ChannelPool. Default is true. + * + * @param keepAlive true if connection can be pooled by a ChannelPool + * @return a {@link Builder} + */ + public U setKeepAlive(boolean keepAlive) { + configBuilder.setKeepAlive(keepAlive); + return (U)this; + } + + /** + * Throttles requests by blocking until connections in the pool become available, waiting for + * the response to arrives before executing the next request. + * + * @param maxWait timeout in millisceconds + * @return (U)this Builder + */ + public U setThrottling(int maxWait) { + rcConfig.enableThrottling(); + rcConfig.setThrottlingMaxWait(maxWait); + return (U)this; + } + + /** + * Set the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} can wait when connecting to a remote host + * + * @param connectTimeOut the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} can wait when connecting to a remote host + * @return a {@link Builder} + */ + public U setConnectTimeout(int connectTimeOut) { + configBuilder.setConnectTimeout(connectTimeOut); + return (U)this; + } + +// /** +// * Set the {@link org.asynchttpclient.Realm} that will be used for all requests. +// * +// * @param realm the {@link org.asynchttpclient.Realm} +// * @return a {@link be.wegenenverkeer.rest.RestClient.Builder} +// */ +// public RestClient.Builder setRealm(Realm realm) { +// configBuilder.setRealm(realm); +// return (U)this; +// } + + /** + * Set the {@link java.util.concurrent.ExecutorService} an {@link org.asynchttpclient.AsyncHttpClient} uses for handling + * asynchronous response. + *

+ * + * @param threadFactory the {@code threadFactory} an {@link org.asynchttpclient.AsyncHttpClient} use for handling + * asynchronous response. + * @return a {@link Builder} + */ + public U setThreadFactory(ThreadFactory threadFactory) { + configBuilder.setThreadFactory(threadFactory); + return (U)this; + } + + /** + * Set the number of time a request will be retried when an {@link java.io.IOException} occurs because of a Network exception. + * + * @param maxRequestRetry the number of time a request will be retried + * @return (U)this + */ + public U setMaxRequestRetry(int maxRequestRetry) { + configBuilder.setMaxRequestRetry(maxRequestRetry); + return (U)this; + } + +// public RestClient.Builder setTimeConverter(TimeConverter timeConverter) { +// configBuilder.setTimeConverter(timeConverter); +// return (U)this; +// } + + + //TODO -- check https://github.com/AsyncHttpClient/async-http-client/issues/622 : is there a replacement for hostnameverifier?? +// /** +// * Set the {@link javax.net.ssl.HostnameVerifier} +// * +// * @param hostnameVerifier {@link javax.net.ssl.HostnameVerifier} +// * @return (U)this +// */ +// public U setHostnameVerifier(HostnameVerifier hostnameVerifier) { +// configBuilder.setHostnameVerifier(hostnameVerifier); +// return (U)this; +// } + +// /** +// * Set an instance of {@link org.asynchttpclient.ProxyServerSelector} used by an {@link org.asynchttpclient.AsyncHttpClient} +// * +// * @param proxyServerSelector instance of {@link org.asynchttpclient.ProxyServerSelector} +// * @return a {@link be.wegenenverkeer.rest.RestClient.Builder} +// */ +// public RestClient.Builder setProxyServerSelector(ProxyServerSelector proxyServerSelector) { +// configBuilder.setProxyServerSelector(proxyServerSelector); +// return (U)this; +// } + +// /** +// * Remove an {@link org.asynchttpclient.filter.RequestFilter} that will be invoked before {@link org.asynchttpclient.AsyncHttpClient#executeObservably(org.asynchttpclient.Request)} +// * +// * @param requestFilter {@link org.asynchttpclient.filter.RequestFilter} +// * @return (U)this +// */ +// public RestClient.Builder removeRequestFilter(RequestFilter requestFilter) { +// configBuilder.removeRequestFilter(requestFilter); +// return (U)this; +// } + + public U setEnabledProtocols(String[] enabledProtocols) { + configBuilder.setEnabledProtocols(enabledProtocols); + return (U)this; + } + +// /** +// * Set an instance of {@link org.asynchttpclient.ProxyServer} used by an {@link org.asynchttpclient.AsyncHttpClient} +// * +// * @param proxyServer instance of {@link org.asynchttpclient.ProxyServer} +// * @return a {@link be.wegenenverkeer.rest.RestClient.Builder} +// */ +// public RestClient.Builder setProxyServer(ProxyServer proxyServer) { +// configBuilder.setProxyServer(proxyServer); +// return (U)this; +// } + + //TODO -- seems to be removed?? +// /** +// * Configures this AHC instance to use relative URIs instead of absolute ones when talking with a SSL proxy or WebSocket proxy. +// * +// * @param useRelativeURIsWithConnectProxies use relative URIs with connect proxies +// * @return (U)this +// * @since 1.8.13 +// */ +// public U setUseRelativeURIsWithConnectProxies(boolean useRelativeURIsWithConnectProxies) { +// configBuilder. setUseRelativeURIsWithConnectProxies(useRelativeURIsWithConnectProxies); +// return (U)this; +// } + +// /** +// * Set the maximum number of connections per hosts an {@link org.asynchttpclient.AsyncHttpClient} can handle. +// * +// * @param maxConnectionsPerHost the maximum number of connections per host an {@link org.asynchttpclient.AsyncHttpClient} can handle. +// * @return a {@link Builder} +// */ +// public U setMaxConnectionsPerHost(int maxConnectionsPerHost) { +// configBuilder.setMaxConnectionsPerHost(maxConnectionsPerHost); +// return (U)this; +// } + + public U setEnabledCipherSuites(String[] enabledCipherSuites) { + configBuilder.setEnabledCipherSuites(enabledCipherSuites); + return (U)this; + } + + //TODO -- seems to be removed?? +// /** +// * Set whether connections pooling is enabled. +// *

+// *

Default is set to true

+// * +// * @param allowPoolingSslConnections true if enabled +// * @return (U)this +// */ +// public U setAllowPoolingSslConnections(boolean allowPoolingSslConnections) { +// configBuilder.setKConnections(allowPoolingSslConnections); +// return (U)this; +// } + +// /** +// * Remove an {@link org.asynchttpclient.filter.ResponseFilter} that will be invoked as soon as the response is +// * received, and before {@link org.asynchttpclient.AsyncHandler#onStatusReceived(org.asynchttpclient.HttpResponseStatus)}. +// * +// * @param responseFilter an {@link org.asynchttpclient.filter.ResponseFilter} +// * @return (U)this +// */ +// public RestClient.Builder removeResponseFilter(ResponseFilter responseFilter) { +// configBuilder.removeResponseFilter(responseFilter); +// return (U)this; +// } + + /** + * Sets whether AHC should use the default http.proxy* system properties + * to obtain proxy information. This differs from {@link #setUseProxySelector(boolean)} + * in that AsyncHttpClient will use its own logic to handle the system properties, + * potentially supporting other protocols that the the JDK ProxySelector doesn't. + *

+ * If useProxyProperties is set to true but {@link #setUseProxySelector(boolean)} + * was also set to true, the latter is preferred. + *

+ * See http://download.oracle.com/javase/1.4.2/docs/guide/net/properties.html + * + * @param useProxyProperties whether AHC should use the default http.proxy* system properties + */ + public U setUseProxyProperties(boolean useProxyProperties) { + configBuilder.setUseProxyProperties(useProxyProperties); + return (U)this; + } + + /** + * Sets whether AHC should use the default JDK ProxySelector to select a proxy server. + *

+ * See http://docs.oracle.com/javase/7/docs/api/java/net/ProxySelector.html + * + * @param useProxySelector whether AHC should use the default JDK ProxySelector to select a proxy server. + */ + public U setUseProxySelector(boolean useProxySelector) { + configBuilder.setUseProxySelector(useProxySelector); + return (U)this; + } + +// /** +// * Add an {@link org.asynchttpclient.filter.ResponseFilter} that will be invoked as soon as the response is +// * received, and before {@link org.asynchttpclient.AsyncHandler#onStatusReceived(org.asynchttpclient.HttpResponseStatus)}. +// * +// * @param responseFilter an {@link org.asynchttpclient.filter.ResponseFilter} +// * @return (U)this +// */ +// public RestClient.Builder addResponseFilter(ResponseFilter responseFilter) { +// configBuilder.addResponseFilter(responseFilter); +// return (U)this; +// } + + /** + * Set the maximum number of HTTP redirect + * + * @param maxRedirects the maximum number of HTTP redirect + * @return a {@link Builder} + */ + public U setMaxRedirects(int maxRedirects) { + configBuilder.setMaxRedirects(maxRedirects); + return (U)this; + } + + //@Deprecated "Use setUserInsecureTrustaManager" + public U setAcceptAnyCertificate(boolean acceptAnyCertificate) { + configBuilder.setUseInsecureTrustManager(acceptAnyCertificate); + return (U)this; + } + + public U setUseInsecureTrustManager(boolean useInsecureTrustManager) { + configBuilder.setUseInsecureTrustManager(useInsecureTrustManager); + return (U)this; + } + + /** + * Configures this AHC instance to be strict in it's handling of 302 redirects + * in a POST/Redirect/GET situation. + * + * @param strict302Handling strict handling + * @return (U)this + * @since 1.7.2 + */ + public U setStrict302Handling(boolean strict302Handling) { + configBuilder.setStrict302Handling(strict302Handling); + return (U)this; + } + + /** + * Set the maximum time in millisecond connection can be added to the pool for further reuse + *

+ *

Default is -1 (no TTL set)

+ * + * @param connectionTTL the maximum time in millisecond connection can be added to the pool for further reuse + * @return a {@link Builder} + */ + public U setConnectionTTL(int connectionTTL) { + //TODO deprecate and change to camelcase + configBuilder.setConnectionTtl(connectionTTL); + return (U)this; + } + + /** + * Set the USER_AGENT header value + * + * @param userAgent the USER_AGENT header value + * @return a {@link Builder} + */ + public U setUserAgent(String userAgent) { + configBuilder.setUserAgent(userAgent); + return (U)this; + } + + /** + * Set to true to enable HTTP redirect + * + * @param followRedirect@return a {@link Builder} + */ + public U setFollowRedirect(boolean followRedirect) { + configBuilder.setFollowRedirect(followRedirect); + return (U)this; + } + + +// /** +// * Add an {@link org.asynchttpclient.filter.RequestFilter} that will be invoked before {@link org.asynchttpclient.AsyncHttpClient#executeObservably(org.asynchttpclient.Request)} +// * +// * @param requestFilter {@link org.asynchttpclient.filter.RequestFilter} +// * @return (U)this +// */ +// public RestClient.Builder addRequestFilter(RequestFilter requestFilter) { +// configBuilder.addRequestFilter(requestFilter); +// return (U)this; +// } + +// /** +// * Add an {@link org.asynchttpclient.filter.IOExceptionFilter} that will be invoked when an {@link java.io.IOException} +// * occurs during the download/upload operations. +// * +// * @param ioExceptionFilter an {@link org.asynchttpclient.filter.ResponseFilter} +// * @return (U)this +// */ +// public RestClient.Builder addIOExceptionFilter(IOExceptionFilter ioExceptionFilter) { +// configBuilder.addIOExceptionFilter(ioExceptionFilter); +// return (U)this; +// } + + /** + * Disable automatic url escaping + * + * @param disableUrlEncodingForBoundedRequests disables the url encoding if set to true + * @return (U)this Builder + * @deprecated Use setDisableUrlEncodingForBoundRequests + */ + @Deprecated + public U setDisableUrlEncodingForBoundedRequests(boolean disableUrlEncodingForBoundedRequests) { + configBuilder.setDisableUrlEncodingForBoundRequests(disableUrlEncodingForBoundedRequests); + return (U)this; + } + + /** + * Disable automatic url escaping + * + * @param disableUrlEncodingForBoundedRequests disables the url encoding if set to true + * @return (U)this Builder + */ + public U setDisableUrlEncodingForBoundRequests(boolean disableUrlEncodingForBoundedRequests) { + configBuilder.setDisableUrlEncodingForBoundRequests(disableUrlEncodingForBoundedRequests); + return (U)this; + } + + /** + * Set the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} waits until the response is completed. + * + * @param requestTimeout the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} waits until the response is completed. + * @return a {@link Builder} + */ + public U setRequestTimeout(int requestTimeout) { + configBuilder.setRequestTimeout(requestTimeout); + return (U)this; + } + + /** + * Set the {@link io.netty.handler.ssl.SslContext} for secure connection. + * + * @param sslContext the SSLContext for secure connection + * @return a {@link Builder} + */ + public U setSslContext(SslContext sslContext) { + //TODO Can we hide this context behind javax.net.ssl interface (as before)?? + configBuilder.setSslContext(sslContext); + return (U)this; + } + + /** + * Enforce HTTP compression. + * + * @param compressionEnforced true if compression is enforced + * @return a {@link Builder} + */ + public U setCompressionEnforced(boolean compressionEnforced) { + configBuilder.setCompressionEnforced(compressionEnforced); + return (U)this; + } + + /** + * Set the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} will keep connection + * idle in pool. + *

+ *

Default is 60000 millis (1 min.)

+ * + * @param pooledConnectionIdleTimeout@return a {@link Builder} + */ + public U setPooledConnectionIdleTimeout(int pooledConnectionIdleTimeout) { + configBuilder.setPooledConnectionIdleTimeout(pooledConnectionIdleTimeout); + return (U)this; + } + +// /** +// * Remove an {@link org.asynchttpclient.filter.IOExceptionFilter} tthat will be invoked when an {@link java.io.IOException} +// * occurs during the download/upload operations. +// * +// * @param ioExceptionFilter an {@link org.asynchttpclient.filter.ResponseFilter} +// * @return (U)this +// */ +// public RestClient.Builder removeIOExceptionFilter(IOExceptionFilter ioExceptionFilter) { +// configBuilder.removeIOExceptionFilter(ioExceptionFilter); +// return (U)this; +// } + + /** + * Set the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} can stay idle. + * + * @param readTimeout the maximum time in millisecond an {@code RestClient} can stay idle. + * @return a {@link Builder} + */ + public U setReadTimeout(int readTimeout) { + configBuilder.setReadTimeout(readTimeout); + return (U)this; + } + + public U setAwsEndPoint(AwsService service, AwsRegion region) { + return setAwsEndPoint(service, region, AwsServiceEndPoint.defaultHostFor(service, region)); + } + + public U setAwsEndPoint(AwsService service, AwsRegion region, String domain) { + if (service == null || region == null) { + throw new IllegalArgumentException("No null arguments allowed"); + } + this.awsServiceEndPoint = new AwsServiceEndPoint(service, region, domain); + logger.info("Overwriting Base URL to " + this.awsServiceEndPoint.endPointUrl()); + this.setBaseUrl(this.awsServiceEndPoint.endPointUrl()); + this.isAws = true; + return (U)this; + } + + public U setAwsCredentialsProvider(AwsCredentialsProvider provider) { + this.awsCredentialsProvider = provider; + return (U)this; + } + + public U logHeaders(List headerNames) { + this.headersToLog = new ArrayList<>(headerNames); + return (U)this; + } + + public U logFormParams(List formParameterNames) { + this.formParmsToLog = new ArrayList<>(formParameterNames); + return (U)this; + } + +} + + diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java similarity index 99% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java index 2d52838..6cd9f22 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java +++ b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java @@ -106,7 +106,7 @@ public String getBodyEncoding() { return request.getCharset().name(); } - Request unwrap() { + public Request unwrap() { return this.request; } diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestBuilder.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestBuilder.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestBuilder.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestBuilder.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestLogFormatter.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestLogFormatter.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestLogFormatter.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestLogFormatter.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java similarity index 99% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java index 82a9855..93930d0 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java +++ b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java @@ -1,6 +1,5 @@ package be.wegenenverkeer.rxhttp; -import io.netty.buffer.ByteBuf; import io.netty.handler.codec.http.HttpHeaders; import org.asynchttpclient.Response; import java.nio.charset.Charset; diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/DefaultClientRequestLogFormatter.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/DefaultClientRequestLogFormatter.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/DefaultClientRequestLogFormatter.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/DefaultClientRequestLogFormatter.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/HTTPStatusCode.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/HTTPStatusCode.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/HTTPStatusCode.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/HTTPStatusCode.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpClientError.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpClientError.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpClientError.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpClientError.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpError.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpError.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpError.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpError.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpServerError.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpServerError.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpServerError.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpServerError.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java similarity index 99% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java index 5d792d7..c188413 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java +++ b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java @@ -15,6 +15,7 @@ * * Created by Karel Maesen, Geovise BVBA on 18/12/14. */ +@Deprecated abstract public class MutableResponseProcessor { private int statusCode; diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RequestSigner.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RequestSigner.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/RequestSigner.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/RequestSigner.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RestClientConfig.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RestClientConfig.java new file mode 100644 index 0000000..cf3059d --- /dev/null +++ b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RestClientConfig.java @@ -0,0 +1,63 @@ +package be.wegenenverkeer.rxhttp; + +/** + * Created by Karel Maesen, Geovise BVBA on 2019-07-12. + */ +public class RestClientConfig { + + private String baseUrl = ""; + private String Accept = "application/json"; + + private boolean throttling = false; + private int throttlingMaxWait = 0; + private int maxConnections = -1; + + public void enableThrottling() { + this.throttling = true; + } + + public void setThrottlingMaxWait(int throttlingMaxWait) { + this.throttlingMaxWait = throttlingMaxWait; + } + + public void setMaxConnections(int maxConn) { + this.maxConnections = maxConn; + } + + public boolean isThrottling() { + return throttling; + } + + public int getThrottlingMaxWait() { + return throttlingMaxWait; + } + + public int getMaxConnections() { + return maxConnections; + } + + void setBaseUrl(String baseUrl) { + this.baseUrl = chopLastForwardSlash(baseUrl); + } + + String getBaseUrl() { + return baseUrl; + } + + String getAccept() { + return Accept; + } + + void setAccept(String accept) { + Accept = accept; + } + + private static String chopLastForwardSlash(String url) { + if (url.charAt(url.length() - 1) == '/') { + url = url.substring(0, url.length() - 1); + } + return url; + } + +} + diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java new file mode 100644 index 0000000..34373fb --- /dev/null +++ b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java @@ -0,0 +1,87 @@ +package be.wegenenverkeer.rxhttp; + +import org.asynchttpclient.AsyncHttpClient; +import org.reactivestreams.Publisher; + +import java.nio.charset.Charset; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; + +/** + * Created by Karel Maesen, Geovise BVBA on 2019-07-12. + */ +public interface RxHttpClient { + CompletableFuture execute(ClientRequest request, Function transformer); + + /** + * Executes a request and returns an Observable for the complete response. + *

+ * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made + * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. + *

+ * + * @param request the request to send + * @param transformer a function that transforms the {@link ServerResponse} to a value of F + * @param the type of return value + * @return An Observable that returns the transformed server response. + */ + Publisher executeToCompletion(ClientRequest request, Function transformer); + + /** + * Returns a "cold" Observable for a stream of {@link ServerResponseElement}s. + *

+ * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made + * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. + * + * @param request the request to send + * @return a cold observable of ServerResponseElements + */ + Publisher executeObservably(ClientRequest request); + + Publisher executeAndDechunk(ClientRequest request, String separator); + + /** + * Returns a "cold" Observable for a stream of messages. + *

+ * All ServerResponseElements are filtered out, ResponseBodyParts are turned into Strings in + * the specified charset, and the chunks are combined and split at the separator characters. + *

+ * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made + * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. + * + * @param request the request to send + * @param separator the separator + * @param charset the character set of the messages + * @return a cold Flowable of messages (Strings in the specified Charset) + */ + Publisher executeAndDechunk(ClientRequest request, String separator, Charset charset); + + /** + * Returns a "cold" Observable for a stream of {@code T}. + *

+ * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made + * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. + * + * @param request the request to send + * @param transform the function that transforms the response body (chunks) into objects of type F + * @param return type of the transform + * @return a cold observable of ServerResponseElements + * + */ + Publisher executeObservably(ClientRequest request, Function transform); + + String getBaseUrl(); + + String getAccept(); + + List getRequestSigners(); + + void close(); + + ClientRequestBuilder requestBuilder(); + + String toLogMessage(ClientRequest request); + + AsyncHttpClient inner(); +} diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponse.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponse.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponse.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponse.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPart.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPart.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPart.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPart.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPartImpl.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPartImpl.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPartImpl.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPartImpl.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseElement.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseElement.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseElement.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseElement.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeaders.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeaders.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeaders.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeaders.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java similarity index 93% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java index 03eee7c..fbcd9b6 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java +++ b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java @@ -9,7 +9,7 @@ *

* Created by Karel Maesen, Geovise BVBA on 18/12/14. */ -class ServerResponseHeadersImpl implements ServerResponseHeaders { +public class ServerResponseHeadersImpl implements ServerResponseHeaders { Map> headers = new HashMap<>(); diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseStatus.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseStatus.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseStatus.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseStatus.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentials.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentials.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentials.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentials.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentialsProvider.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentialsProvider.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentialsProvider.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentialsProvider.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsRegion.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsRegion.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsRegion.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsRegion.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsService.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsService.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsService.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsService.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsServiceEndPoint.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsServiceEndPoint.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsServiceEndPoint.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsServiceEndPoint.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsSignature4Signer.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsSignature4Signer.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsSignature4Signer.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsSignature4Signer.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/ConstantAwsCredentialProvider.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/ConstantAwsCredentialProvider.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/ConstantAwsCredentialProvider.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/ConstantAwsCredentialProvider.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/DefaultEnvironment.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/DefaultEnvironment.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/DefaultEnvironment.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/DefaultEnvironment.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/Environment.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/Environment.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/Environment.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/Environment.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/EnvironmentCredentialsProvider.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/EnvironmentCredentialsProvider.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/EnvironmentCredentialsProvider.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/EnvironmentCredentialsProvider.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/InstanceCredentialsProvider.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/InstanceCredentialsProvider.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/InstanceCredentialsProvider.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/InstanceCredentialsProvider.java diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/UrlEncoder.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/UrlEncoder.java similarity index 100% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/UrlEncoder.java rename to modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/UrlEncoder.java diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.authz b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.authz new file mode 100755 index 0000000..ac05e35 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=54afcaaf45b331f81cd2edb974f7b824ff4dd594cbbaa945ed636b48477368ed \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.creq b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.creq new file mode 100755 index 0000000..57e0862 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.creq @@ -0,0 +1,9 @@ +POST +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +zoo:foobar,zoobar,zoobar + +date;host;zoo +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.req b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.req new file mode 100755 index 0000000..eb3a429 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.req @@ -0,0 +1,7 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +ZOO:zoobar +zoo:foobar +zoo:zoobar + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sreq b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sreq new file mode 100755 index 0000000..5c464f3 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sreq @@ -0,0 +1,8 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +ZOO:zoobar +zoo:foobar +zoo:zoobar +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=54afcaaf45b331f81cd2edb974f7b824ff4dd594cbbaa945ed636b48477368ed + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sts b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sts new file mode 100755 index 0000000..7b11b51 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +3c52f0eaae2b61329c0a332e3fa15842a37bc5812cf4d80eb64784308850e313 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.authz b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.authz new file mode 100755 index 0000000..c80262a --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;p, Signature=d2973954263943b11624a11d1c963ca81fb274169c7868b2858c04f083199e3d \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.creq b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.creq new file mode 100755 index 0000000..9b61ef5 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.creq @@ -0,0 +1,9 @@ +POST +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +p:a,a,p,z + +date;host;p +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.req b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.req new file mode 100755 index 0000000..ea30500 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.req @@ -0,0 +1,8 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +p:z +p:a +p:p +p:a + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sreq b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sreq new file mode 100755 index 0000000..536ab04 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sreq @@ -0,0 +1,9 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +p:z +p:a +p:p +p:a +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;p, Signature=d2973954263943b11624a11d1c963ca81fb274169c7868b2858c04f083199e3d + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sts b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sts new file mode 100755 index 0000000..d80190a --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +94c0389fefe0988cbbedc8606f0ca0b485b48da010d09fc844b45b697c8924fe \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.authz b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.authz new file mode 100755 index 0000000..2d870cc --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;p, Signature=debf546796015d6f6ded8626f5ce98597c33b47b9164cf6b17b4642036fcb592 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.creq b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.creq new file mode 100755 index 0000000..43b4a85 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.creq @@ -0,0 +1,9 @@ +POST +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +p:phfft + +date;host;p +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.req b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.req new file mode 100755 index 0000000..e148363 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.req @@ -0,0 +1,5 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +p: phfft + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sreq b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sreq new file mode 100755 index 0000000..ab33a91 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sreq @@ -0,0 +1,6 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +p: phfft +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;p, Signature=debf546796015d6f6ded8626f5ce98597c33b47b9164cf6b17b4642036fcb592 + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sts b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sts new file mode 100755 index 0000000..7b7ead8 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +dddd1902add08da1ac94782b05f9278c08dc7468db178a84f8950d93b30b1f35 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.authz b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.authz new file mode 100755 index 0000000..06bd813 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.creq b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.creq new file mode 100755 index 0000000..8519923 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.creq @@ -0,0 +1,8 @@ +GET +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.req b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.req new file mode 100755 index 0000000..dab95bb --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.req @@ -0,0 +1,4 @@ +GET /foo/bar/../.. http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sreq b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sreq new file mode 100755 index 0000000..b0d1c56 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sreq @@ -0,0 +1,5 @@ +GET /foo/bar/../.. http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sts b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sts new file mode 100755 index 0000000..c7bcc67 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative.authz b/modules/core/src/test/resources/aws4_testsuite/get-relative.authz new file mode 100755 index 0000000..06bd813 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-relative.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative.creq b/modules/core/src/test/resources/aws4_testsuite/get-relative.creq new file mode 100755 index 0000000..8519923 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-relative.creq @@ -0,0 +1,8 @@ +GET +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative.req b/modules/core/src/test/resources/aws4_testsuite/get-relative.req new file mode 100755 index 0000000..18344ee --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-relative.req @@ -0,0 +1,4 @@ +GET /foo/.. http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative.sreq b/modules/core/src/test/resources/aws4_testsuite/get-relative.sreq new file mode 100755 index 0000000..2fc7620 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-relative.sreq @@ -0,0 +1,5 @@ +GET /foo/.. http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative.sts b/modules/core/src/test/resources/aws4_testsuite/get-relative.sts new file mode 100755 index 0000000..c7bcc67 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-relative.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.authz b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.authz new file mode 100755 index 0000000..06bd813 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.creq b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.creq new file mode 100755 index 0000000..8519923 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.creq @@ -0,0 +1,8 @@ +GET +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.req b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.req new file mode 100755 index 0000000..00ffac6 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.req @@ -0,0 +1,4 @@ +GET /./ http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sreq b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sreq new file mode 100755 index 0000000..4b0e285 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sreq @@ -0,0 +1,5 @@ +GET /./ http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sts b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sts new file mode 100755 index 0000000..c7bcc67 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.authz b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.authz new file mode 100755 index 0000000..ffa78cf --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=910e4d6c9abafaf87898e1eb4c929135782ea25bb0279703146455745391e63a \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.creq b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.creq new file mode 100755 index 0000000..280cc1e --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.creq @@ -0,0 +1,8 @@ +GET +/foo + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.req b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.req new file mode 100755 index 0000000..0953f61 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.req @@ -0,0 +1,4 @@ +GET /./foo http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sreq b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sreq new file mode 100755 index 0000000..aae53b3 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sreq @@ -0,0 +1,5 @@ +GET /./foo http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=910e4d6c9abafaf87898e1eb4c929135782ea25bb0279703146455745391e63a + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sts b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sts new file mode 100755 index 0000000..0c3394b --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +8021a97572ee460f87ca67f4e8c0db763216d84715f5424a843a5312a3321e2d \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash.authz b/modules/core/src/test/resources/aws4_testsuite/get-slash.authz new file mode 100755 index 0000000..06bd813 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash.creq b/modules/core/src/test/resources/aws4_testsuite/get-slash.creq new file mode 100755 index 0000000..8519923 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash.creq @@ -0,0 +1,8 @@ +GET +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash.req b/modules/core/src/test/resources/aws4_testsuite/get-slash.req new file mode 100755 index 0000000..2dcd49c --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash.req @@ -0,0 +1,4 @@ +GET // http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash.sreq b/modules/core/src/test/resources/aws4_testsuite/get-slash.sreq new file mode 100755 index 0000000..85dfc71 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash.sreq @@ -0,0 +1,5 @@ +GET // http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash.sts b/modules/core/src/test/resources/aws4_testsuite/get-slash.sts new file mode 100755 index 0000000..c7bcc67 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slash.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slashes.authz b/modules/core/src/test/resources/aws4_testsuite/get-slashes.authz new file mode 100755 index 0000000..9c720f3 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slashes.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b00392262853cfe3201e47ccf945601079e9b8a7f51ee4c3d9ee4f187aa9bf19 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slashes.creq b/modules/core/src/test/resources/aws4_testsuite/get-slashes.creq new file mode 100755 index 0000000..759b0c3 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slashes.creq @@ -0,0 +1,8 @@ +GET +/foo/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slashes.req b/modules/core/src/test/resources/aws4_testsuite/get-slashes.req new file mode 100755 index 0000000..e326c43 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slashes.req @@ -0,0 +1,4 @@ +GET //foo// http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slashes.sreq b/modules/core/src/test/resources/aws4_testsuite/get-slashes.sreq new file mode 100755 index 0000000..f2c5eef --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slashes.sreq @@ -0,0 +1,5 @@ +GET //foo// http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b00392262853cfe3201e47ccf945601079e9b8a7f51ee4c3d9ee4f187aa9bf19 + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slashes.sts b/modules/core/src/test/resources/aws4_testsuite/get-slashes.sts new file mode 100755 index 0000000..e6c6f14 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-slashes.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +6bb4476ee8745730c9cb79f33a0c70baa6d8af29c0077fa12e4e8f1dd17e7098 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-space.authz b/modules/core/src/test/resources/aws4_testsuite/get-space.authz new file mode 100755 index 0000000..4f8ec5e --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-space.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=f309cfbd10197a230c42dd17dbf5cca8a0722564cb40a872d25623cfa758e374 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-space.creq b/modules/core/src/test/resources/aws4_testsuite/get-space.creq new file mode 100755 index 0000000..e34ff1a --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-space.creq @@ -0,0 +1,8 @@ +GET +/%20/foo + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-space.req b/modules/core/src/test/resources/aws4_testsuite/get-space.req new file mode 100755 index 0000000..0c64446 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-space.req @@ -0,0 +1,4 @@ +GET /%20/foo http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-space.sreq b/modules/core/src/test/resources/aws4_testsuite/get-space.sreq new file mode 100755 index 0000000..3fde5d2 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-space.sreq @@ -0,0 +1,5 @@ +GET /%20/foo http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=f309cfbd10197a230c42dd17dbf5cca8a0722564cb40a872d25623cfa758e374 + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-space.sts b/modules/core/src/test/resources/aws4_testsuite/get-space.sts new file mode 100755 index 0000000..48b7200 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-space.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +69c45fb9fe3fd76442b5086e50b2e9fec8298358da957b293ef26e506fdfb54b \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.authz b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.authz new file mode 100755 index 0000000..99d2016 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=830cc36d03f0f84e6ee4953fbe701c1c8b71a0372c63af9255aa364dd183281e \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.creq b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.creq new file mode 100755 index 0000000..a0c0c2b --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.creq @@ -0,0 +1,8 @@ +GET +/-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.req b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.req new file mode 100755 index 0000000..d88a5d7 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.req @@ -0,0 +1,4 @@ +GET /-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sreq b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sreq new file mode 100755 index 0000000..8e9280b --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sreq @@ -0,0 +1,5 @@ +GET /-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=830cc36d03f0f84e6ee4953fbe701c1c8b71a0372c63af9255aa364dd183281e + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sts b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sts new file mode 100755 index 0000000..c02109b --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +df63ee3247c0356c696a3b21f8d8490b01fa9cd5bc6550ef5ef5f4636b7b8901 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-utf8.authz b/modules/core/src/test/resources/aws4_testsuite/get-utf8.authz new file mode 100755 index 0000000..a8b8492 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-utf8.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=8d6634c189aa8c75c2e51e106b6b5121bed103fdb351f7d7d4381c738823af74 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-utf8.creq b/modules/core/src/test/resources/aws4_testsuite/get-utf8.creq new file mode 100755 index 0000000..65946cb --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-utf8.creq @@ -0,0 +1,8 @@ +GET +/%E1%88%B4 + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-utf8.req b/modules/core/src/test/resources/aws4_testsuite/get-utf8.req new file mode 100755 index 0000000..83291e8 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-utf8.req @@ -0,0 +1,4 @@ +GET /%E1%88%B4 http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-utf8.sreq b/modules/core/src/test/resources/aws4_testsuite/get-utf8.sreq new file mode 100755 index 0000000..1d69c23 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-utf8.sreq @@ -0,0 +1,5 @@ +GET /%E1%88%B4 http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=8d6634c189aa8c75c2e51e106b6b5121bed103fdb351f7d7d4381c738823af74 + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-utf8.sts b/modules/core/src/test/resources/aws4_testsuite/get-utf8.sts new file mode 100755 index 0000000..63871e5 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-utf8.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +27ba31df5dbc6e063d8f87d62eb07143f7f271c5330a917840586ac1c85b6f6b \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.authz new file mode 100755 index 0000000..cb7a1cc --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=56c054473fd260c13e4e7393eb203662195f5d4a1fada5314b8b52b23f985e9f \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.creq new file mode 100755 index 0000000..1efbecf --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.creq @@ -0,0 +1,8 @@ +GET +/ +foo=bar +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.req new file mode 100755 index 0000000..fac3491 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.req @@ -0,0 +1,4 @@ +GET /?foo=bar http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sreq new file mode 100755 index 0000000..71d5463 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sreq @@ -0,0 +1,5 @@ +GET /?foo=bar http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=56c054473fd260c13e4e7393eb203662195f5d4a1fada5314b8b52b23f985e9f + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sts new file mode 100755 index 0000000..785c7e5 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +0846c2945b0832deb7a463c66af5c4f8bd54ec28c438e67a214445b157c9ddf8 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.authz new file mode 100755 index 0000000..10fe960 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=be7148d34ebccdc6423b19085378aa0bee970bdc61d144bd1a8c48c33079ab09 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.creq new file mode 100755 index 0000000..f1e99d1 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.creq @@ -0,0 +1,8 @@ +GET +/ +foo=Zoo&foo=aha +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.req new file mode 100755 index 0000000..d5e81df --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.req @@ -0,0 +1,4 @@ +GET /?foo=Zoo&foo=aha http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sreq new file mode 100755 index 0000000..a438d93 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sreq @@ -0,0 +1,5 @@ +GET /?foo=Zoo&foo=aha http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=be7148d34ebccdc6423b19085378aa0bee970bdc61d144bd1a8c48c33079ab09 + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sts new file mode 100755 index 0000000..4d255cc --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +e25f777ba161a0f1baf778a87faf057187cf5987f17953320e3ca399feb5f00d \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.authz new file mode 100755 index 0000000..bc5463e --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.creq new file mode 100755 index 0000000..46b1c0f --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.creq @@ -0,0 +1,8 @@ +GET +/ +a=foo&b=foo +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.req new file mode 100755 index 0000000..f1b75b1 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.req @@ -0,0 +1,4 @@ +GET /?a=foo&b=foo http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sreq new file mode 100755 index 0000000..7cb2519 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sreq @@ -0,0 +1,5 @@ +GET /?a=foo&b=foo http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sts new file mode 100755 index 0000000..e791351 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +2f23d14fe13caebf6dfda346285c6d9c14f49eaca8f5ec55c627dd7404f7a727 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.authz new file mode 100755 index 0000000..9b96017 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=feb926e49e382bec75c9d7dcb2a1b6dc8aa50ca43c25d2bc51143768c0875acc \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.creq new file mode 100755 index 0000000..3c0d516 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.creq @@ -0,0 +1,8 @@ +GET +/ +foo=a&foo=b +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.req new file mode 100755 index 0000000..004f153 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.req @@ -0,0 +1,4 @@ +GET /?foo=b&foo=a http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sreq new file mode 100755 index 0000000..61bd549 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sreq @@ -0,0 +1,5 @@ +GET /?foo=b&foo=a http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=feb926e49e382bec75c9d7dcb2a1b6dc8aa50ca43c25d2bc51143768c0875acc + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sts new file mode 100755 index 0000000..95becb2 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +33dffc220e89131f8f6157a35c40903daa658608d9129ff9489e5cf5bbd9b11b \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.authz new file mode 100755 index 0000000..bc28668 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=f1498ddb4d6dae767d97c466fb92f1b59a2c71ca29ac954692663f9db03426fb \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.creq new file mode 100755 index 0000000..4a43670 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.creq @@ -0,0 +1,8 @@ +GET +/ +-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.req new file mode 100755 index 0000000..72f6173 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.req @@ -0,0 +1,4 @@ +GET /?-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sreq new file mode 100755 index 0000000..a18d653 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sreq @@ -0,0 +1,5 @@ +GET /?-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=f1498ddb4d6dae767d97c466fb92f1b59a2c71ca29ac954692663f9db03426fb + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sts new file mode 100755 index 0000000..b454387 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +d2578f3156d4c9d180713d1ff20601d8a3eed0dd35447d24603d7d67414bd6b5 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.authz new file mode 100755 index 0000000..06bd813 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.creq new file mode 100755 index 0000000..8519923 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.creq @@ -0,0 +1,8 @@ +GET +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.req new file mode 100755 index 0000000..77b339a --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.req @@ -0,0 +1,4 @@ +GET / http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sreq new file mode 100755 index 0000000..bd1f8f2 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sreq @@ -0,0 +1,5 @@ +GET / http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sts new file mode 100755 index 0000000..c7bcc67 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.authz new file mode 100755 index 0000000..8e925e3 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=6fb359e9a05394cc7074e0feb42573a2601abc0c869a953e8c5c12e4e01f1a8c \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.creq new file mode 100755 index 0000000..9e4be3c --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.creq @@ -0,0 +1,8 @@ +GET +/ +%E1%88%B4=bar +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.req new file mode 100755 index 0000000..581e335 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.req @@ -0,0 +1,4 @@ +GET /?ሴ=bar http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sreq new file mode 100755 index 0000000..4f108da --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sreq @@ -0,0 +1,5 @@ +GET /?ሴ=bar http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=6fb359e9a05394cc7074e0feb42573a2601abc0c869a953e8c5c12e4e01f1a8c + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sts new file mode 100755 index 0000000..d14eedf --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +de5065ff39c131e6c2e2bd19cd9345a794bf3b561eab20b8d97b2093fc2a979e \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.authz new file mode 100755 index 0000000..06bd813 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.creq new file mode 100755 index 0000000..8519923 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.creq @@ -0,0 +1,8 @@ +GET +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.req new file mode 100755 index 0000000..77b339a --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.req @@ -0,0 +1,4 @@ +GET / http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sreq new file mode 100755 index 0000000..bd1f8f2 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sreq @@ -0,0 +1,5 @@ +GET / http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 + diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sts new file mode 100755 index 0000000..c7bcc67 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.authz b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.authz new file mode 100755 index 0000000..a6a7cbb --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.creq b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.creq new file mode 100755 index 0000000..a1c8480 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.creq @@ -0,0 +1,8 @@ +POST +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.req b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.req new file mode 100755 index 0000000..67d74a3 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.req @@ -0,0 +1,4 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sreq b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sreq new file mode 100755 index 0000000..97875f9 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sreq @@ -0,0 +1,5 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726 + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sts b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sts new file mode 100755 index 0000000..30fb98a --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +05da62cee468d24ae84faff3c39f1b85540de60243c1bcaace39c0a2acc7b2c4 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.authz b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.authz new file mode 100755 index 0000000..fdcbdd9 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=b7a95a52518abbca0964a999a880429ab734f35ebbf1235bd79a5de87756dc4a \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.creq b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.creq new file mode 100755 index 0000000..7cea8ea --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.creq @@ -0,0 +1,9 @@ +POST +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +zoo:zoobar + +date;host;zoo +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.req b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.req new file mode 100755 index 0000000..61c73de --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.req @@ -0,0 +1,5 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +ZOO:zoobar + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sreq b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sreq new file mode 100755 index 0000000..a645b45 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sreq @@ -0,0 +1,6 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +ZOO:zoobar +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=b7a95a52518abbca0964a999a880429ab734f35ebbf1235bd79a5de87756dc4a + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sts b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sts new file mode 100755 index 0000000..3cf1dd7 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +34e1bddeb99e76ee01d63b5e28656111e210529efeec6cdfd46a48e4c734545d \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.authz b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.authz new file mode 100755 index 0000000..651c954 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=273313af9d0c265c531e11db70bbd653f3ba074c1009239e8559d3987039cad7 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.creq b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.creq new file mode 100755 index 0000000..e97491d --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.creq @@ -0,0 +1,9 @@ +POST +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +zoo:ZOOBAR + +date;host;zoo +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.req b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.req new file mode 100755 index 0000000..f687230 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.req @@ -0,0 +1,5 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +zoo:ZOOBAR + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sreq b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sreq new file mode 100755 index 0000000..5f95618 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sreq @@ -0,0 +1,6 @@ +POST / http/1.1 +DATE:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com +zoo:ZOOBAR +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=273313af9d0c265c531e11db70bbd653f3ba074c1009239e8559d3987039cad7 + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sts b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sts new file mode 100755 index 0000000..e67301c --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +3aae6d8274b8c03e2cc96fc7d6bda4b9bd7a0a184309344470b2c96953e124aa \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.authz b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.authz new file mode 100755 index 0000000..acfa0fe --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.creq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.creq new file mode 100755 index 0000000..f46634d --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.creq @@ -0,0 +1,8 @@ +POST +/ +foo=bar +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.req b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.req new file mode 100755 index 0000000..1351de5 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.req @@ -0,0 +1,4 @@ +POST /?foo=bar http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sreq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sreq new file mode 100755 index 0000000..662dd6b --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sreq @@ -0,0 +1,5 @@ +POST /?foo=bar http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92 + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sts b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sts new file mode 100755 index 0000000..fddcbb7 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +cd4f39132d8e60bb388831d734230460872b564871c47f5de62e62d1a68dbe1e \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.authz b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.authz new file mode 100755 index 0000000..e97bdaa --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=28675d93ac1d686ab9988d6617661da4dffe7ba848a2285cb75eac6512e861f9 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.creq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.creq new file mode 100755 index 0000000..48b903f --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.creq @@ -0,0 +1,8 @@ +POST +/ +%20=%2F%2C%3F%3E%3C%60%22%3B%3A%5C%7C%5D%5B%7B%7D&%40%23%24%25%5E= +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.req b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.req new file mode 100755 index 0000000..1821438 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.req @@ -0,0 +1,4 @@ +POST /?@#$%^&+=/,?><`";:\|][{} =@#$%^&+=/,?><`";:\|][{} http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sreq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sreq new file mode 100755 index 0000000..0b53fd7 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sreq @@ -0,0 +1,5 @@ +POST /?@#$%^&+=/,?><`";:\|][{} =@#$%^&+=/,?><`";:\|][{} http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=28675d93ac1d686ab9988d6617661da4dffe7ba848a2285cb75eac6512e861f9 + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sts b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sts new file mode 100755 index 0000000..0df239b --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +eb3f16b23b20c91e1b5d6f3cd1c1f8c32a6ddcae6024e44bcfa980fbf8561f6c \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.authz b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.authz new file mode 100755 index 0000000..59ccfcb --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b7eb653abe5f846e7eee4d1dba33b15419dc424aaf215d49b1240732b10cc4ca \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.creq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.creq new file mode 100755 index 0000000..0cb49e5 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.creq @@ -0,0 +1,8 @@ +POST +/ +f= +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.req b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.req new file mode 100755 index 0000000..fca4e4a --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.req @@ -0,0 +1,4 @@ +POST /?f oo=b ar http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sreq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sreq new file mode 100755 index 0000000..f9d2f73 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sreq @@ -0,0 +1,5 @@ +POST /?f oo=b ar http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b7eb653abe5f846e7eee4d1dba33b15419dc424aaf215d49b1240732b10cc4ca + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sts b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sts new file mode 100755 index 0000000..bff0d26 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +0d5f8ed88e9cd0a2a093e1719fff945e3718d30a6b240b9de994cdf9442c89f5 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.authz b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.authz new file mode 100755 index 0000000..acfa0fe --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.creq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.creq new file mode 100755 index 0000000..f46634d --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.creq @@ -0,0 +1,8 @@ +POST +/ +foo=bar +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.req b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.req new file mode 100755 index 0000000..1351de5 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.req @@ -0,0 +1,4 @@ +POST /?foo=bar http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sreq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sreq new file mode 100755 index 0000000..662dd6b --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sreq @@ -0,0 +1,5 @@ +POST /?foo=bar http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92 + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sts b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sts new file mode 100755 index 0000000..fddcbb7 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +cd4f39132d8e60bb388831d734230460872b564871c47f5de62e62d1a68dbe1e \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.authz b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.authz new file mode 100755 index 0000000..a6a7cbb --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.creq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.creq new file mode 100755 index 0000000..a1c8480 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.creq @@ -0,0 +1,8 @@ +POST +/ + +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +date;host +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.req b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.req new file mode 100755 index 0000000..b072b83 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.req @@ -0,0 +1,4 @@ +POST / http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sreq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sreq new file mode 100755 index 0000000..f2f199a --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sreq @@ -0,0 +1,5 @@ +POST / http/1.1 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726 + diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sts b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sts new file mode 100755 index 0000000..30fb98a --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +05da62cee468d24ae84faff3c39f1b85540de60243c1bcaace39c0a2acc7b2c4 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.authz b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.authz new file mode 100755 index 0000000..438b01c --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=b105eb10c6d318d2294de9d49dd8b031b55e3c3fe139f2e637da70511e9e7b71 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.creq b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.creq new file mode 100755 index 0000000..56a9b26 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.creq @@ -0,0 +1,9 @@ +POST +/ + +content-type:application/x-www-form-urlencoded; charset=utf8 +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +content-type;date;host +3ba8907e7a252327488df390ed517c45b96dead033600219bdca7107d1d3f88a \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.req b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.req new file mode 100755 index 0000000..b537b64 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.req @@ -0,0 +1,6 @@ +POST / http/1.1 +Content-Type:application/x-www-form-urlencoded; charset=utf8 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + +foo=bar \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sreq b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sreq new file mode 100755 index 0000000..4c351dd --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sreq @@ -0,0 +1,7 @@ +POST / http/1.1 +Content-Type:application/x-www-form-urlencoded; charset=utf8 +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=b105eb10c6d318d2294de9d49dd8b031b55e3c3fe139f2e637da70511e9e7b71 + +foo=bar \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sts b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sts new file mode 100755 index 0000000..df165ed --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +c4115f9e54b5cecf192b1eaa23b8e88ed8dc5391bd4fde7b3fff3d9c9fe0af1f \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.authz b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.authz new file mode 100755 index 0000000..73b6478 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.authz @@ -0,0 +1 @@ +AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=5a15b22cf462f047318703b92e6f4f38884e4a7ab7b1d6426ca46a8bd1c26cbc \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.creq b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.creq new file mode 100755 index 0000000..e4c5127 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.creq @@ -0,0 +1,9 @@ +POST +/ + +content-type:application/x-www-form-urlencoded +date:Mon, 09 Sep 2011 23:36:00 GMT +host:host.foo.com + +content-type;date;host +3ba8907e7a252327488df390ed517c45b96dead033600219bdca7107d1d3f88a \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.req b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.req new file mode 100755 index 0000000..fd58d79 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.req @@ -0,0 +1,6 @@ +POST / http/1.1 +Content-Type:application/x-www-form-urlencoded +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com + +foo=bar \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sreq b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sreq new file mode 100755 index 0000000..3c66800 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sreq @@ -0,0 +1,7 @@ +POST / http/1.1 +Content-Type:application/x-www-form-urlencoded +Date:Mon, 09 Sep 2011 23:36:00 GMT +Host:host.foo.com +Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=5a15b22cf462f047318703b92e6f4f38884e4a7ab7b1d6426ca46a8bd1c26cbc + +foo=bar \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sts b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sts new file mode 100755 index 0000000..b6661a3 --- /dev/null +++ b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sts @@ -0,0 +1,4 @@ +AWS4-HMAC-SHA256 +20110909T233600Z +20110909/us-east-1/host/aws4_request +4c5c6e4b52fb5fb947a8733982a8a5a61b14f04345cbfe6e739236c76dd48f74 \ No newline at end of file diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CollectingSubscriber.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CollectingSubscriber.java deleted file mode 100644 index e86f857..0000000 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CollectingSubscriber.java +++ /dev/null @@ -1,107 +0,0 @@ -package be.wegenenverkeer.rxhttp; - -import io.reactivex.subscribers.DefaultSubscriber; -import io.reactivex.subscribers.ResourceSubscriber; -import org.reactivestreams.Subscriber; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Flow; -import java.util.concurrent.Future; -import java.util.function.Function; - -/** - * A {@link Subscriber} that collects all parts of a response body, after transformation, into a List. - * - *

CollectingSubscribers are definitely not thread-safe

- * - * @param the Type to which each response body part is transformed to. - * - * Created by Karel Maesen, Geovise BVBA on 19/12/14. - */ -public class CollectingSubscriber extends DefaultSubscriber { - - - final private CompletableFuture> cfuture = new CompletableFuture<>(); - final private List accumulator = new ArrayList<>(); - - final private MutableResponseProcessor processor; - - /** - * Constructs an instance that transforms each chunk into a value of T - * - * @param transformPart the function that transforms the bytes of each response part into an object of type {@code T} - */ - public CollectingSubscriber(Function transformPart){ - processor = new MutableResponseProcessor() { - @Override - void processPart(byte[] bytes) { - try { - accumulator.add(transformPart.apply(bytes)); - } catch(Throwable t) { - cfuture.completeExceptionally(t); - } - } - }; - } - - /** - * Notifies the Observer that the {@code Observable} has finished sending push-based notifications. - *

- * The {@code Observable} will not call this method if it calls {@link #onError}. - */ - @Override - public void onComplete() { - cfuture.complete(Collections.unmodifiableList(accumulator)); - } - - /** - * Notifies the Observer that the {@code Observable} has experienced an error condition. - *

- * If the {@code Observable} calls this method, it will not thereafter call {@link #onNext} or - * {@link #onComplete}. - * - * @param e the exception encountered by the Observable - */ - @Override - public void onError(Throwable e) { - cfuture.completeExceptionally(e); - } - - /** - * Provides the Observer with a new item to observe. - *

- * The {@code Observable} may call this method 0 or more times. - *

- * The {@code Observable} will not call this method again after it calls either {@link #onComplete} or - * {@link #onError}. - * - * @param serverResponseElement the item emitted by the Observable - */ - @Override - public void onNext(ServerResponseElement serverResponseElement) { - processor.process(serverResponseElement); - } - - /** - * Unsubscribes from the observer and returns the items already received. - * - * @return the items already received. - */ - public List collectImmediately(){ - this.cancel(); - return new ArrayList<>(accumulator); - } - - /** - * Returns the future list of response parts, after transformation - * - * @return the future list of response parts, after transformation - */ - public Future> collect() { - return cfuture; - } - -} diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java deleted file mode 100644 index 806337c..0000000 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java +++ /dev/null @@ -1,928 +0,0 @@ -package be.wegenenverkeer.rxhttp; - -import be.wegenenverkeer.rxhttp.aws.*; -import io.netty.handler.ssl.SslContext; -import io.reactivex.BackpressureStrategy; -import io.reactivex.Flowable; -import io.reactivex.Observable; -import io.reactivex.subjects.AsyncSubject; -import io.reactivex.subjects.BehaviorSubject; -import org.asynchttpclient.AsyncHttpClient; -import org.asynchttpclient.DefaultAsyncHttpClientConfig; -import org.asynchttpclient.filter.RequestFilter; -import org.asynchttpclient.filter.ThrottleRequestFilter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.nio.charset.Charset; -import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ThreadFactory; -import java.util.function.Function; - -import static org.asynchttpclient.Dsl.asyncHttpClient; - -/** - * A Reactive HTTP Client - * Created by Karel Maesen, Geovise BVBA on 05/12/14. - */ -public class RxHttpClient { - - final private static Logger logger = LoggerFactory.getLogger(RxHttpClient.class); - final private static Charset UTF8 = Charset.forName("UTF8"); - - final private AsyncHttpClient innerClient; - final private RestClientConfig config; - final private List requestSigners; - final private ClientRequestLogFormatter logFormatter; - - protected RxHttpClient(AsyncHttpClient innerClient, RestClientConfig config, ClientRequestLogFormatter logFmt, RequestSigner... requestSigners) { - this.innerClient = innerClient; - this.config = config; - this.requestSigners = List.of(requestSigners); - this.logFormatter = logFmt; - } - - /** - * * Executes a request and returns an Observable for the complete response. - */ - public CompletableFuture execute(ClientRequest request, Function transformer) { - logger.info("Sending Request: " + toLogMessage(request)); - //Note: we don't use Observable.toBlocking().toFuture() - //because we need a CompletableFuture so that interop with Scala is possible - final CompletableFuture future = new CompletableFuture<>(); - - return innerClient.executeRequest(request.unwrap()).toCompletableFuture() - .thenApply( ServerResponse::wrap ) - .thenApply( transformer ); - } - - /** - * Executes a request and returns an Observable for the complete response. - *

- * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made - * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. - *

- * - * @param request the request to send - * @param transformer a function that transforms the {@link ServerResponse} to a value of F - * @param the type of return value - * @return An Observable that returns the transformed server response. - */ - public Observable executeToCompletion(ClientRequest request, Function transformer) { - return Observable.defer(() -> { - logger.info("Sending Request: " + toLogMessage(request)); - AsyncSubject subject = AsyncSubject.create(); - innerClient.executeRequest(request.unwrap(), new AsyncCompletionHandlerWrapper<>(subject, transformer)); - return subject; - }); - } - - /** - * Returns a "cold" Observable for a stream of {@link ServerResponseElement}s. - *

- * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made - * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. - * - * @param request the request to send - * @return a cold observable of ServerResponseElements - * @see Observable#defer - */ - public Observable executeObservably(ClientRequest request) { - return Observable.defer(() -> { - BehaviorSubject subject = BehaviorSubject.create(); - innerClient.executeRequest(request.unwrap(), new AsyncHandlerWrapper(subject)); - - return subject; - }); - } - - /** - * Returns a "cold" Observable for a stream of messages. - *

- * All ServerResponseElements are filtered out, ResponseBodyParts are turned into (UTF8) Strings, - * and the chunks are combined and split at the specified separator characters. - *

- * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made - * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. - * - * @param request the request to send - * @param separator the separator - * @return a cold Flowable of messages (UTF8 Strings) - - */ - public Flowable executeAndDechunk(ClientRequest request, String separator) { - return executeAndDechunk(request, separator, Charset.forName("UTF8")); - } - - /** - * Returns a "cold" Observable for a stream of messages. - *

- * All ServerResponseElements are filtered out, ResponseBodyParts are turned into Strings in - * the specified charset, and the chunks are combined and split at the separator characters. - *

- * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made - * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. - * - * @param request the request to send - * @param separator the separator - * @param charset the character set of the messages - * @return a cold Flowable of messages (Strings in the specified Charset) - */ - public Flowable executeAndDechunk(ClientRequest request, String separator, Charset charset) { - return executeObservably(request) - .filter(sre -> sre instanceof ServerResponseBodyPart) - .map( sre -> new String(((ServerResponseBodyPart)sre).getBodyPartBytes(), charset)) - .toFlowable(BackpressureStrategy.BUFFER) - .lift(new Dechunker(separator)); - } - - - /** - * Returns a "cold" Observable for a stream of {@code T}. - *

- * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made - * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. - * - * @param request the request to send - * @param transform the function that transforms the response body (chunks) into objects of type F - * @param return type of the transform - * @return a cold observable of ServerResponseElements - * @see Observable#defer - */ - public Observable executeObservably(ClientRequest request, Function transform) { - return executeObservably(request) - .filter(el -> el.match(e -> false, e -> false, e -> true, e -> true)) - .map(el -> el.match( - e -> null, //won't happen, is filtered - e -> null, //won't happen, is filtered - e -> transform.apply(e.getBodyPartBytes()), - e -> transform.apply(e.getResponseBodyAsBytes()))); - } - - /** - * Returns the base URL that this client connects to. - * - * @return the base URL that this client connects to. - */ - public String getBaseUrl() { - return this.config.getBaseUrl(); - } - - /** - * Returns the configured default ACCEPT header for requests created using this instance's - * {@code ClientRequestBuilder}s. - * - * @return the configured default ACCEPT header for requests created using this instance's {@code ClientRequestBuilder}s. - */ - public String getAccept() { - return config.getAccept(); - } - - public List getRequestSigners() { - return requestSigners; - } - - /** - * Closes the underlying connection - */ - public void close() { - try { - this.innerClient.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Returns a new {@code ClientRequestBuilder}. - * - * @return a new {@code ClientRequestBuilder}. - */ - public ClientRequestBuilder requestBuilder() { - return new ClientRequestBuilder(this); - } - - protected String toLogMessage(ClientRequest request) { - return this.logFormatter.toLogMessage(request); - } - - - AsyncHttpClient inner() { - return this.innerClient; - } - - - private static class RestClientConfig { - - private String baseUrl = ""; - private String Accept = "application/json"; - - private boolean throttling = false; - private int throttlingMaxWait = 0; - private int maxConnections = -1; - - public void enableThrottling() { - this.throttling = true; - } - - public void setThrottlingMaxWait(int throttlingMaxWait) { - this.throttlingMaxWait = throttlingMaxWait; - } - - public void setMaxConnections(int maxConn) { - this.maxConnections = maxConn; - } - - public boolean isThrottling() { - return throttling; - } - - public int getThrottlingMaxWait() { - return throttlingMaxWait; - } - - public int getMaxConnections() { - return maxConnections; - } - - void setBaseUrl(String baseUrl) { - this.baseUrl = chopLastForwardSlash(baseUrl); - } - - String getBaseUrl() { - return baseUrl; - } - - String getAccept() { - return Accept; - } - - void setAccept(String accept) { - Accept = accept; - } - - private static String chopLastForwardSlash(String url) { - if (url.charAt(url.length() - 1) == '/') { - url = url.substring(0, url.length() - 1); - } - return url; - } - - } - - - /** - * A Builder for {@code RxHttpClient} builders. - */ - static public class Builder { - - final private static Logger logger = LoggerFactory.getLogger(RxHttpClient.class); - - private DefaultAsyncHttpClientConfig.Builder configBuilder = new DefaultAsyncHttpClientConfig.Builder(); - final private RestClientConfig rcConfig = new RestClientConfig(); - - private boolean isAws = false; - private AwsServiceEndPoint awsServiceEndPoint; - private AwsCredentialsProvider awsCredentialsProvider; - private List requestSigners = new LinkedList<>(); - private List headersToLog = new ArrayList<>(); - private ArrayList formParmsToLog = new ArrayList<>(); - - public RxHttpClient build() { - addRestClientConfigsToConfigBuilder(); - DefaultAsyncHttpClientConfig config = configBuilder.build(); - - BuildValidation validation = validate(config); - - validation.logWarnings(); - if (validation.hasErrors()) { - throw new IllegalStateException(validation.getErrorMessage()); - } - - if (isAws && awsCredentialsProvider == null) { - throw new IllegalStateException("Aws endpoint specified, but no CredentialsProvider set."); - } - - AsyncHttpClient innerClient = asyncHttpClient(config); - - if (isAws) { - requestSigners.add(new AwsSignature4Signer(this.awsServiceEndPoint, this.awsCredentialsProvider)); - } - - ClientRequestLogFormatter logFmt = new DefaultClientRequestLogFormatter(headersToLog, formParmsToLog); - - return new RxHttpClient(innerClient, rcConfig, logFmt, requestSigners.toArray(new RequestSigner[0])); - } - - /** - * Perform additional configBuilder build steps based on rcConfig settings - */ - private void addRestClientConfigsToConfigBuilder() { - if (rcConfig.getMaxConnections() > 0) { - configBuilder.setMaxConnections(rcConfig.getMaxConnections()); - } - if (rcConfig.getMaxConnections() > 0 && rcConfig.isThrottling() && rcConfig.getThrottlingMaxWait() > 0) { - addThrottling(rcConfig.getMaxConnections(), rcConfig.getThrottlingMaxWait()); - } - } - - - private void addThrottling(int maxConnections, int maxWait) { - RequestFilter filter = new ThrottleRequestFilter(maxConnections, maxWait); - configBuilder.addRequestFilter(filter); - } - - public RxHttpClient.Builder addRequestSigner(RequestSigner requestSigner) { - if (requestSigner == null) { - throw new IllegalArgumentException("No null argument allowed"); - } - this.requestSigners.add(requestSigner); - return this; - } - - /** - * Sets the default Accept request-header for requests built using this instance. - * - * @param acceptHeaderValue the Media-range and accept-params to use as value for the Accept request-header field - * @return this Builder - * @see W3C HTTP 1.1 specs. - */ - public RxHttpClient.Builder setAccept(String acceptHeaderValue) { - rcConfig.setAccept(acceptHeaderValue); - return this; - } - - /** - * Sets the base URL for this client. - *

- *

The base url will be prepended to any relative URL path specified in the {@code RequestBuilder}

- * - * @param url the base URL for this instance - * @return this.Builder - */ - public RxHttpClient.Builder setBaseUrl(String url) { - if (this.isAws) throw new IllegalStateException("Not allowed to set Base URL on AWS EndPoint"); - rcConfig.setBaseUrl(url); - return this; - } - - /** - * Validates the Builder (used before building the client) - * - * @param config the AsyncHttpClient config object - * @return a {@code BuildValidation} containing all Errors and Warnings - */ - private BuildValidation validate(DefaultAsyncHttpClientConfig config) { - BuildValidation bv = new BuildValidation(); - - if (rcConfig.baseUrl.isEmpty()) { - bv.addError("No baseURL is set"); - } - - try { - new URL(rcConfig.baseUrl); - } catch (MalformedURLException e) { - bv.addError("Malformed URL: " + e.getMessage()); - } - - String messagePrefix = "RxHttpClient for " + rcConfig.baseUrl; - - if (!config.isKeepAlive()) { - bv.addWarning(messagePrefix + " has ChannelPool (KeepAlive) support disabled!"); - } - - if (config.getMaxConnections() < 0 && rcConfig.isThrottling()) { - bv.addError("Configured throttling, but no max. Connections set"); - } - - if (rcConfig.isThrottling() && rcConfig.getThrottlingMaxWait() <= 0) { - bv.addError("Configured throttling, but timeout is set to " + rcConfig.getThrottlingMaxWait()); - } - - if (config.getMaxConnections() < 0) { - bv.addWarning(messagePrefix + " has no maximum connections set!"); - } - - if (config.getConnectionTtl() < 0 && config.getPooledConnectionIdleTimeout() < 0) { - bv.addWarning(messagePrefix + " has no connection TTL or pool idle timeout set!"); - } - - return bv; - } - - - /** - * Set the maximum number of connections an {@link org.asynchttpclient.AsyncHttpClient} can handle. - * - * @param maxConnections the maximum number of connections an {@link org.asynchttpclient.AsyncHttpClient} can handle. - * @return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setMaxConnections(int maxConnections) { - //we set this setting first on the rcConfig object, because we need this information together with the other throttling settings - // to properly configure the RequestThrottler - rcConfig.setMaxConnections(maxConnections); - return this; - } - - /** - * Set true if connection can be pooled by a ChannelPool. Default is true. - * - * @param allowPoolingConnections true if connection can be pooled by a ChannelPool - * @return a {@link RxHttpClient.Builder} - * @deprecated Use setKeepAlive(boolean) instead - */ - @Deprecated - public RxHttpClient.Builder setAllowPoolingConnections(boolean allowPoolingConnections) { - configBuilder.setKeepAlive(allowPoolingConnections); - return this; - } - - /** - * Set true if connection can be pooled by a ChannelPool. Default is true. - * - * @param keepAlive true if connection can be pooled by a ChannelPool - * @return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setKeepAlive(boolean keepAlive) { - configBuilder.setKeepAlive(keepAlive); - return this; - } - - /** - * Throttles requests by blocking until connections in the pool become available, waiting for - * the response to arrives before executing the next request. - * - * @param maxWait timeout in millisceconds - * @return this Builder - */ - public RxHttpClient.Builder setThrottling(int maxWait) { - rcConfig.enableThrottling(); - rcConfig.setThrottlingMaxWait(maxWait); - return this; - } - - /** - * Set the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} can wait when connecting to a remote host - * - * @param connectTimeOut the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} can wait when connecting to a remote host - * @return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setConnectTimeout(int connectTimeOut) { - configBuilder.setConnectTimeout(connectTimeOut); - return this; - } - -// /** -// * Set the {@link org.asynchttpclient.Realm} that will be used for all requests. -// * -// * @param realm the {@link org.asynchttpclient.Realm} -// * @return a {@link be.wegenenverkeer.rest.RestClient.Builder} -// */ -// public RestClient.Builder setRealm(Realm realm) { -// configBuilder.setRealm(realm); -// return this; -// } - - /** - * Set the {@link java.util.concurrent.ExecutorService} an {@link org.asynchttpclient.AsyncHttpClient} uses for handling - * asynchronous response. - *

- * - * @param threadFactory the {@code threadFactory} an {@link org.asynchttpclient.AsyncHttpClient} use for handling - * asynchronous response. - * @return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setThreadFactory(ThreadFactory threadFactory) { - configBuilder.setThreadFactory(threadFactory); - return this; - } - - /** - * Set the number of time a request will be retried when an {@link java.io.IOException} occurs because of a Network exception. - * - * @param maxRequestRetry the number of time a request will be retried - * @return this - */ - public RxHttpClient.Builder setMaxRequestRetry(int maxRequestRetry) { - configBuilder.setMaxRequestRetry(maxRequestRetry); - return this; - } - -// public RestClient.Builder setTimeConverter(TimeConverter timeConverter) { -// configBuilder.setTimeConverter(timeConverter); -// return this; -// } - - - //TODO -- check https://github.com/AsyncHttpClient/async-http-client/issues/622 : is there a replacement for hostnameverifier?? -// /** -// * Set the {@link javax.net.ssl.HostnameVerifier} -// * -// * @param hostnameVerifier {@link javax.net.ssl.HostnameVerifier} -// * @return this -// */ -// public RxHttpClient.Builder setHostnameVerifier(HostnameVerifier hostnameVerifier) { -// configBuilder.setHostnameVerifier(hostnameVerifier); -// return this; -// } - -// /** -// * Set an instance of {@link org.asynchttpclient.ProxyServerSelector} used by an {@link org.asynchttpclient.AsyncHttpClient} -// * -// * @param proxyServerSelector instance of {@link org.asynchttpclient.ProxyServerSelector} -// * @return a {@link be.wegenenverkeer.rest.RestClient.Builder} -// */ -// public RestClient.Builder setProxyServerSelector(ProxyServerSelector proxyServerSelector) { -// configBuilder.setProxyServerSelector(proxyServerSelector); -// return this; -// } - -// /** -// * Remove an {@link org.asynchttpclient.filter.RequestFilter} that will be invoked before {@link org.asynchttpclient.AsyncHttpClient#executeObservably(org.asynchttpclient.Request)} -// * -// * @param requestFilter {@link org.asynchttpclient.filter.RequestFilter} -// * @return this -// */ -// public RestClient.Builder removeRequestFilter(RequestFilter requestFilter) { -// configBuilder.removeRequestFilter(requestFilter); -// return this; -// } - - public RxHttpClient.Builder setEnabledProtocols(String[] enabledProtocols) { - configBuilder.setEnabledProtocols(enabledProtocols); - return this; - } - -// /** -// * Set an instance of {@link org.asynchttpclient.ProxyServer} used by an {@link org.asynchttpclient.AsyncHttpClient} -// * -// * @param proxyServer instance of {@link org.asynchttpclient.ProxyServer} -// * @return a {@link be.wegenenverkeer.rest.RestClient.Builder} -// */ -// public RestClient.Builder setProxyServer(ProxyServer proxyServer) { -// configBuilder.setProxyServer(proxyServer); -// return this; -// } - - //TODO -- seems to be removed?? -// /** -// * Configures this AHC instance to use relative URIs instead of absolute ones when talking with a SSL proxy or WebSocket proxy. -// * -// * @param useRelativeURIsWithConnectProxies use relative URIs with connect proxies -// * @return this -// * @since 1.8.13 -// */ -// public RxHttpClient.Builder setUseRelativeURIsWithConnectProxies(boolean useRelativeURIsWithConnectProxies) { -// configBuilder. setUseRelativeURIsWithConnectProxies(useRelativeURIsWithConnectProxies); -// return this; -// } - -// /** -// * Set the maximum number of connections per hosts an {@link org.asynchttpclient.AsyncHttpClient} can handle. -// * -// * @param maxConnectionsPerHost the maximum number of connections per host an {@link org.asynchttpclient.AsyncHttpClient} can handle. -// * @return a {@link RxHttpClient.Builder} -// */ -// public RxHttpClient.Builder setMaxConnectionsPerHost(int maxConnectionsPerHost) { -// configBuilder.setMaxConnectionsPerHost(maxConnectionsPerHost); -// return this; -// } - - public RxHttpClient.Builder setEnabledCipherSuites(String[] enabledCipherSuites) { - configBuilder.setEnabledCipherSuites(enabledCipherSuites); - return this; - } - - //TODO -- seems to be removed?? -// /** -// * Set whether connections pooling is enabled. -// *

-// *

Default is set to true

-// * -// * @param allowPoolingSslConnections true if enabled -// * @return this -// */ -// public RxHttpClient.Builder setAllowPoolingSslConnections(boolean allowPoolingSslConnections) { -// configBuilder.setKConnections(allowPoolingSslConnections); -// return this; -// } - -// /** -// * Remove an {@link org.asynchttpclient.filter.ResponseFilter} that will be invoked as soon as the response is -// * received, and before {@link org.asynchttpclient.AsyncHandler#onStatusReceived(org.asynchttpclient.HttpResponseStatus)}. -// * -// * @param responseFilter an {@link org.asynchttpclient.filter.ResponseFilter} -// * @return this -// */ -// public RestClient.Builder removeResponseFilter(ResponseFilter responseFilter) { -// configBuilder.removeResponseFilter(responseFilter); -// return this; -// } - - /** - * Sets whether AHC should use the default http.proxy* system properties - * to obtain proxy information. This differs from {@link #setUseProxySelector(boolean)} - * in that AsyncHttpClient will use its own logic to handle the system properties, - * potentially supporting other protocols that the the JDK ProxySelector doesn't. - *

- * If useProxyProperties is set to true but {@link #setUseProxySelector(boolean)} - * was also set to true, the latter is preferred. - *

- * See http://download.oracle.com/javase/1.4.2/docs/guide/net/properties.html - * - * @param useProxyProperties whether AHC should use the default http.proxy* system properties - */ - public RxHttpClient.Builder setUseProxyProperties(boolean useProxyProperties) { - configBuilder.setUseProxyProperties(useProxyProperties); - return this; - } - - /** - * Sets whether AHC should use the default JDK ProxySelector to select a proxy server. - *

- * See http://docs.oracle.com/javase/7/docs/api/java/net/ProxySelector.html - * - * @param useProxySelector whether AHC should use the default JDK ProxySelector to select a proxy server. - */ - public RxHttpClient.Builder setUseProxySelector(boolean useProxySelector) { - configBuilder.setUseProxySelector(useProxySelector); - return this; - } - -// /** -// * Add an {@link org.asynchttpclient.filter.ResponseFilter} that will be invoked as soon as the response is -// * received, and before {@link org.asynchttpclient.AsyncHandler#onStatusReceived(org.asynchttpclient.HttpResponseStatus)}. -// * -// * @param responseFilter an {@link org.asynchttpclient.filter.ResponseFilter} -// * @return this -// */ -// public RestClient.Builder addResponseFilter(ResponseFilter responseFilter) { -// configBuilder.addResponseFilter(responseFilter); -// return this; -// } - - /** - * Set the maximum number of HTTP redirect - * - * @param maxRedirects the maximum number of HTTP redirect - * @return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setMaxRedirects(int maxRedirects) { - configBuilder.setMaxRedirects(maxRedirects); - return this; - } - - //@Deprecated "Use setUserInsecureTrustaManager" - public RxHttpClient.Builder setAcceptAnyCertificate(boolean acceptAnyCertificate) { - configBuilder.setUseInsecureTrustManager(acceptAnyCertificate); - return this; - } - - public RxHttpClient.Builder setUseInsecureTrustManager(boolean useInsecureTrustManager) { - configBuilder.setUseInsecureTrustManager(useInsecureTrustManager); - return this; - } - - /** - * Configures this AHC instance to be strict in it's handling of 302 redirects - * in a POST/Redirect/GET situation. - * - * @param strict302Handling strict handling - * @return this - * @since 1.7.2 - */ - public RxHttpClient.Builder setStrict302Handling(boolean strict302Handling) { - configBuilder.setStrict302Handling(strict302Handling); - return this; - } - - /** - * Set the maximum time in millisecond connection can be added to the pool for further reuse - *

- *

Default is -1 (no TTL set)

- * - * @param connectionTTL the maximum time in millisecond connection can be added to the pool for further reuse - * @return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setConnectionTTL(int connectionTTL) { - //TODO deprecate and change to camelcase - configBuilder.setConnectionTtl(connectionTTL); - return this; - } - - /** - * Set the USER_AGENT header value - * - * @param userAgent the USER_AGENT header value - * @return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setUserAgent(String userAgent) { - configBuilder.setUserAgent(userAgent); - return this; - } - - /** - * Set to true to enable HTTP redirect - * - * @param followRedirect@return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setFollowRedirect(boolean followRedirect) { - configBuilder.setFollowRedirect(followRedirect); - return this; - } - - -// /** -// * Add an {@link org.asynchttpclient.filter.RequestFilter} that will be invoked before {@link org.asynchttpclient.AsyncHttpClient#executeObservably(org.asynchttpclient.Request)} -// * -// * @param requestFilter {@link org.asynchttpclient.filter.RequestFilter} -// * @return this -// */ -// public RestClient.Builder addRequestFilter(RequestFilter requestFilter) { -// configBuilder.addRequestFilter(requestFilter); -// return this; -// } - -// /** -// * Add an {@link org.asynchttpclient.filter.IOExceptionFilter} that will be invoked when an {@link java.io.IOException} -// * occurs during the download/upload operations. -// * -// * @param ioExceptionFilter an {@link org.asynchttpclient.filter.ResponseFilter} -// * @return this -// */ -// public RestClient.Builder addIOExceptionFilter(IOExceptionFilter ioExceptionFilter) { -// configBuilder.addIOExceptionFilter(ioExceptionFilter); -// return this; -// } - - /** - * Disable automatic url escaping - * - * @param disableUrlEncodingForBoundedRequests disables the url encoding if set to true - * @return this Builder - * @deprecated Use setDisableUrlEncodingForBoundRequests - */ - @Deprecated - public RxHttpClient.Builder setDisableUrlEncodingForBoundedRequests(boolean disableUrlEncodingForBoundedRequests) { - configBuilder.setDisableUrlEncodingForBoundRequests(disableUrlEncodingForBoundedRequests); - return this; - } - - /** - * Disable automatic url escaping - * - * @param disableUrlEncodingForBoundedRequests disables the url encoding if set to true - * @return this Builder - */ - public RxHttpClient.Builder setDisableUrlEncodingForBoundRequests(boolean disableUrlEncodingForBoundedRequests) { - configBuilder.setDisableUrlEncodingForBoundRequests(disableUrlEncodingForBoundedRequests); - return this; - } - - /** - * Set the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} waits until the response is completed. - * - * @param requestTimeout the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} waits until the response is completed. - * @return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setRequestTimeout(int requestTimeout) { - configBuilder.setRequestTimeout(requestTimeout); - return this; - } - - /** - * Set the {@link io.netty.handler.ssl.SslContext} for secure connection. - * - * @param sslContext the SSLContext for secure connection - * @return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setSslContext(SslContext sslContext) { - //TODO Can we hide this context behind javax.net.ssl interface (as before)?? - configBuilder.setSslContext(sslContext); - return this; - } - - /** - * Enforce HTTP compression. - * - * @param compressionEnforced true if compression is enforced - * @return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setCompressionEnforced(boolean compressionEnforced) { - configBuilder.setCompressionEnforced(compressionEnforced); - return this; - } - - /** - * Set the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} will keep connection - * idle in pool. - *

- *

Default is 60000 millis (1 min.)

- * - * @param pooledConnectionIdleTimeout@return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setPooledConnectionIdleTimeout(int pooledConnectionIdleTimeout) { - configBuilder.setPooledConnectionIdleTimeout(pooledConnectionIdleTimeout); - return this; - } - -// /** -// * Remove an {@link org.asynchttpclient.filter.IOExceptionFilter} tthat will be invoked when an {@link java.io.IOException} -// * occurs during the download/upload operations. -// * -// * @param ioExceptionFilter an {@link org.asynchttpclient.filter.ResponseFilter} -// * @return this -// */ -// public RestClient.Builder removeIOExceptionFilter(IOExceptionFilter ioExceptionFilter) { -// configBuilder.removeIOExceptionFilter(ioExceptionFilter); -// return this; -// } - - /** - * Set the maximum time in millisecond an {@link org.asynchttpclient.AsyncHttpClient} can stay idle. - * - * @param readTimeout the maximum time in millisecond an {@code RestClient} can stay idle. - * @return a {@link RxHttpClient.Builder} - */ - public RxHttpClient.Builder setReadTimeout(int readTimeout) { - configBuilder.setReadTimeout(readTimeout); - return this; - } - - public Builder setAwsEndPoint(AwsService service, AwsRegion region) { - return setAwsEndPoint(service, region, AwsServiceEndPoint.defaultHostFor(service, region)); - } - - public Builder setAwsEndPoint(AwsService service, AwsRegion region, String domain) { - if (service == null || region == null) { - throw new IllegalArgumentException("No null arguments allowed"); - } - this.awsServiceEndPoint = new AwsServiceEndPoint(service, region, domain); - logger.info("Overwriting Base URL to " + this.awsServiceEndPoint.endPointUrl()); - this.setBaseUrl(this.awsServiceEndPoint.endPointUrl()); - this.isAws = true; - return this; - } - - public Builder setAwsCredentialsProvider(AwsCredentialsProvider provider) { - this.awsCredentialsProvider = provider; - return this; - } - - public Builder logHeaders(List headerNames) { - this.headersToLog = new ArrayList<>(headerNames); - return this; - } - - public Builder logFormParams(List formParameterNames) { - this.formParmsToLog = new ArrayList<>(formParameterNames); - return this; - } - - } - - static private class BuildValidation { - List errors = new ArrayList<>(); - List warnings = new ArrayList<>(); - - void addError(String errMsg) { - errors.add(errMsg); - } - - void addWarning(String warningMsg) { - warnings.add(warningMsg); - } - - String getErrorMessage() { - StringBuilder builder = new StringBuilder(); - for (String msg : errors) { - builder.append(msg).append("\n"); - } - return chop(builder.toString()); - } - - boolean hasWarnings() { - return !warnings.isEmpty(); - } - - boolean hasErrors() { - return !errors.isEmpty(); - } - - void logWarnings() { - for (String msg : warnings) { - Builder.logger.warn(msg); - } - } - - private String chop(String s) { - if (s == null || s.isEmpty()) return s; - return s.substring(0, s.length() - 1); - } - - } - -} diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncCompletionHandlerWrapper.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncCompletionHandlerWrapper.java similarity index 84% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncCompletionHandlerWrapper.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncCompletionHandlerWrapper.java index 7816eb8..e712a94 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncCompletionHandlerWrapper.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncCompletionHandlerWrapper.java @@ -1,6 +1,8 @@ -package be.wegenenverkeer.rxhttp; +package be.wegenenverkeer.rxhttp.rxjava; +import be.wegenenverkeer.rxhttp.ServerResponse; import io.reactivex.exceptions.ProtocolViolationException; +import io.reactivex.processors.AsyncProcessor; import io.reactivex.subjects.AsyncSubject; import org.asynchttpclient.AsyncCompletionHandler; import org.asynchttpclient.Response; @@ -9,7 +11,7 @@ import java.util.function.Function; -import static be.wegenenverkeer.rxhttp.CompleteResponseHandler.withCompleteResponse; +import static be.wegenenverkeer.rxhttp.rxjava.CompleteResponseHandler.withCompleteResponse; import static be.wegenenverkeer.rxhttp.ServerResponse.wrap; /** @@ -21,7 +23,7 @@ class AsyncCompletionHandlerWrapper extends AsyncCompletionHandler { final private static Logger logger = LoggerFactory.getLogger(AsyncCompletionHandlerWrapper.class); - final private AsyncSubject subject; + final private AsyncProcessor subject; final private Function handler; @@ -31,7 +33,7 @@ class AsyncCompletionHandlerWrapper extends AsyncCompletionHandler { * @param subject the subject that receives the ServerResponse, after transformation * @param transform the transformation function */ - AsyncCompletionHandlerWrapper(AsyncSubject subject, Function transform) { + AsyncCompletionHandlerWrapper(AsyncProcessor subject, Function transform) { if (subject == null || transform == null) throw new IllegalArgumentException(); this.subject = subject; this.handler = transform; diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncHandlerWrapper.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncHandlerWrapper.java similarity index 92% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncHandlerWrapper.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncHandlerWrapper.java index 99a5b1d..731c847 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/AsyncHandlerWrapper.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncHandlerWrapper.java @@ -1,19 +1,15 @@ -package be.wegenenverkeer.rxhttp; +package be.wegenenverkeer.rxhttp.rxjava; +import be.wegenenverkeer.rxhttp.*; import io.netty.handler.codec.http.HttpHeaders; -import io.reactivex.Flowable; -import io.reactivex.Observable; -import io.reactivex.ObservableSource; +import io.reactivex.processors.BehaviorProcessor; import io.reactivex.subjects.BehaviorSubject; import org.asynchttpclient.AsyncHandler; import org.asynchttpclient.HttpResponseBodyPart; import org.asynchttpclient.HttpResponseStatus; -import org.asynchttpclient.handler.StreamedAsyncHandler; -import org.reactivestreams.Publisher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import java.io.UnsupportedEncodingException; import java.util.Optional; @@ -29,14 +25,14 @@ class AsyncHandlerWrapper implements AsyncHandler { // See also this message: https://groups.google.com/forum/#!searchin/asynchttpclient/streamedasynchandler%7Csort:date/asynchttpclient/h5E98f50Zco/b6fgEtTbAQAJ final private static Logger logger = LoggerFactory.getLogger(AsyncHandlerWrapper.class); - final private BehaviorSubject subject; + final private BehaviorProcessor subject; /** * Constructs an instance. * * @param subject BehaviorSubject wrapped by this instance */ - AsyncHandlerWrapper(BehaviorSubject subject) { + AsyncHandlerWrapper(BehaviorProcessor subject) { this.subject = subject; } @@ -59,7 +55,7 @@ public void onThrowable(Throwable t) { */ @Override public State onBodyPartReceived(HttpResponseBodyPart bodyPart) { - if(!subject.hasObservers()) { + if(!subject.hasSubscribers()) { trace("No observers: Aborting."); //bodyPart.markUnderlyingConnectionAsToBeClosed(); onCompleted(); //send the uncompleted message diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CompleteResponseHandler.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/CompleteResponseHandler.java similarity index 82% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/CompleteResponseHandler.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/CompleteResponseHandler.java index ca4717f..c55ece9 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CompleteResponseHandler.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/CompleteResponseHandler.java @@ -1,5 +1,8 @@ -package be.wegenenverkeer.rxhttp; +package be.wegenenverkeer.rxhttp.rxjava; +import be.wegenenverkeer.rxhttp.HttpClientError; +import be.wegenenverkeer.rxhttp.HttpServerError; +import be.wegenenverkeer.rxhttp.ServerResponse; import org.asynchttpclient.Response; import java.util.function.Consumer; diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Dechunker.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/Dechunker.java similarity index 98% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/Dechunker.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/Dechunker.java index 6cacfd1..e06fe26 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Dechunker.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/Dechunker.java @@ -1,4 +1,4 @@ -package be.wegenenverkeer.rxhttp; +package be.wegenenverkeer.rxhttp.rxjava; import io.reactivex.FlowableOperator; import io.reactivex.FlowableSubscriber; diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/FlowableBodyGenerator.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/FlowableBodyGenerator.java similarity index 97% rename from modules/java/src/main/java/be/wegenenverkeer/rxhttp/FlowableBodyGenerator.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/FlowableBodyGenerator.java index b3a5da3..9327fe4 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/FlowableBodyGenerator.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/FlowableBodyGenerator.java @@ -1,9 +1,7 @@ -package be.wegenenverkeer.rxhttp; +package be.wegenenverkeer.rxhttp.rxjava; import io.netty.buffer.ByteBuf; import io.reactivex.Flowable; -import io.reactivex.Observable; -import io.reactivex.observers.DisposableObserver; import org.asynchttpclient.request.body.Body; import org.asynchttpclient.request.body.generator.BodyGenerator; import org.reactivestreams.Subscriber; diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java new file mode 100644 index 0000000..15e78ef --- /dev/null +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java @@ -0,0 +1,164 @@ +package be.wegenenverkeer.rxhttp.rxjava; + +import be.wegenenverkeer.rxhttp.*; +import io.reactivex.Flowable; +import io.reactivex.Observable; +import io.reactivex.processors.AsyncProcessor; +import io.reactivex.processors.BehaviorProcessor; +import org.asynchttpclient.AsyncHttpClient; +import org.reactivestreams.Publisher; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.nio.charset.Charset; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; + +/** + * A Reactive HTTP Client + * Created by Karel Maesen, Geovise BVBA on 05/12/14. + */ +public class RxJavaHttpClient extends BaseRxHttpClient implements RxHttpClient { + + final private static Logger logger = LoggerFactory.getLogger(RxHttpClient.class); + final private static Charset UTF8 = Charset.forName("UTF8"); + + + protected RxJavaHttpClient(AsyncHttpClient innerClient, RestClientConfig config, ClientRequestLogFormatter logFmt, RequestSigner... requestSigners) { + super(innerClient, config, logFmt, requestSigners); + } + + /** + * * Executes a request and returns an Observable for the complete response. + */ + public CompletableFuture execute(ClientRequest request, Function transformer) { + logger.info("Sending Request: " + toLogMessage(request)); + //Note: we don't use Observable.toBlocking().toFuture() + //because we need a CompletableFuture so that interop with Scala is possible + final CompletableFuture future = new CompletableFuture<>(); + + return inner().executeRequest(request.unwrap()).toCompletableFuture() + .thenApply( ServerResponse::wrap ) + .thenApply( transformer ); + } + + /** + * Executes a request and returns an Observable for the complete response. + *

+ * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made + * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. + *

+ * + * @param request the request to send + * @param transformer a function that transforms the {@link ServerResponse} to a value of F + * @param the type of return value + * @return An Observable that returns the transformed server response. + */ + public Flowable executeToCompletion(ClientRequest request, Function transformer) { + return Flowable.defer(() -> { + logger.info("Sending Request: " + toLogMessage(request)); + AsyncProcessor subject = AsyncProcessor.create(); + inner().executeRequest(request.unwrap(), new AsyncCompletionHandlerWrapper<>(subject, transformer)); + return subject; + }); + } + + /** + * Returns a "cold" Observable for a stream of {@link ServerResponseElement}s. + *

+ * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made + * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. + * + * @param request the request to send + * @return a cold observable of ServerResponseElements + * @see Observable#defer + */ + public Flowable executeObservably(ClientRequest request) { + return Flowable.defer(() -> { + BehaviorProcessor subject = BehaviorProcessor.create(); + inner().executeRequest(request.unwrap(), new AsyncHandlerWrapper(subject)); + return subject; + }); + } + + /** + * Returns a "cold" Observable for a stream of messages. + *

+ * All ServerResponseElements are filtered out, ResponseBodyParts are turned into (UTF8) Strings, + * and the chunks are combined and split at the specified separator characters. + *

+ * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made + * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. + * + * @param request the request to send + * @param separator the separator + * @return a cold Flowable of messages (UTF8 Strings) + + */ + public Flowable executeAndDechunk(ClientRequest request, String separator) { + return executeAndDechunk(request, separator, Charset.forName("UTF8")); + } + + /** + * Returns a "cold" Observable for a stream of messages. + *

+ * All ServerResponseElements are filtered out, ResponseBodyParts are turned into Strings in + * the specified charset, and the chunks are combined and split at the separator characters. + *

+ * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made + * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. + * + * @param request the request to send + * @param separator the separator + * @param charset the character set of the messages + * @return a cold Flowable of messages (Strings in the specified Charset) + */ + public Flowable executeAndDechunk(ClientRequest request, String separator, Charset charset) { + return executeObservably(request) + .filter(sre -> sre instanceof ServerResponseBodyPart) + .map( sre -> new String(((ServerResponseBodyPart)sre).getBodyPartBytes(), charset)) + .lift(new Dechunker(separator)); + } + + + /** + * Returns a "cold" Observable for a stream of {@code T}. + *

+ * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made + * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. + * + * @param request the request to send + * @param transform the function that transforms the response body (chunks) into objects of type F + * @param return type of the transform + * @return a cold observable of ServerResponseElements + * @see Observable#defer + */ + public Flowable executeObservably(ClientRequest request, Function transform) { + return executeObservably(request) + .filter(el -> el.match(e -> false, e -> false, e -> true, e -> true)) + .map(el -> el.match( + e -> null, //won't happen, is filtered + e -> null, //won't happen, is filtered + e -> transform.apply(e.getBodyPartBytes()), + e -> transform.apply(e.getResponseBodyAsBytes()))); + } + + + /** + * A Builder for {@code RxHttpClient} builders. + */ + static public class Builder extends be.wegenenverkeer.rxhttp.Builder{ + + @Override + public RxJavaHttpClient build(){ + return super.build(); + } + + @Override + protected RxJavaHttpClient createClient(AsyncHttpClient innerClient, RestClientConfig rcConfig, ClientRequestLogFormatter logFmt, RequestSigner... signers) { + return new RxJavaHttpClient(innerClient, rcConfig, logFmt, requestSigners.toArray(new RequestSigner[0])); + } + + } + +} diff --git a/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java b/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java index 56849fd..31713c8 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java +++ b/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java @@ -1,6 +1,6 @@ package be.wegenenverkeer; -import be.wegenenverkeer.rxhttp.Dechunker; +import be.wegenenverkeer.rxhttp.rxjava.Dechunker; import io.reactivex.Flowable; import io.reactivex.subscribers.TestSubscriber; import org.junit.Test; diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java index 616e847..d24bb9c 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java @@ -1,8 +1,11 @@ package be.wegenenverkeer.designtests; -import be.wegenenverkeer.rxhttp.*; -import io.reactivex.Observable; -import io.reactivex.observers.TestObserver; +import be.wegenenverkeer.rxhttp.ClientRequest; +import be.wegenenverkeer.rxhttp.HttpClientError; +import be.wegenenverkeer.rxhttp.HttpServerError; +import be.wegenenverkeer.rxhttp.ServerResponse; +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; +import io.reactivex.Flowable; import io.reactivex.subscribers.TestSubscriber; import org.junit.Test; @@ -43,12 +46,12 @@ public void GETObservably() { .addQueryParam("q", "test") .build(); - Observable observable = client.executeObservably(request, bytes -> new String(bytes, Charset.forName("UTF8"))); + Flowable observable = client.executeObservably(request, bytes -> new String(bytes, Charset.forName("UTF8"))); // String out = observable.blockingFirst(); // - TestObserver sub = new TestObserver<>(); + TestSubscriber sub = new TestSubscriber<>(); observable.subscribe(sub); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -80,10 +83,10 @@ public void GETHappyPath() { .addQueryParam("q", "test") .build(); - Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestObserver sub = new TestObserver<>(); + TestSubscriber sub = new TestSubscriber<>(); observable.subscribe(sub); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -120,10 +123,10 @@ public void testCharsetEncodingDefaultsToUTF8() { .addQueryParam("q", "test") .build(); - Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestObserver sub = new TestObserver<>(); + TestSubscriber sub = new TestSubscriber<>(); observable.subscribe(sub); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -157,10 +160,10 @@ public void testCharsetEncodingInContentType() { .addQueryParam("q", "test") .build(); - Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestObserver sub = new TestObserver<>(); + TestSubscriber sub = new TestSubscriber<>(); observable.subscribe(sub); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -209,9 +212,9 @@ public void testHttp4xxResponseOnGET() { //set up use case String path = "/contacts"; ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase(path).build(); - Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestObserver sub = new TestObserver<>(); + TestSubscriber sub = new TestSubscriber<>(); observable.subscribe(sub); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -239,8 +242,8 @@ public void testHttp5xxResponseOnGET(){ .setUrlRelativetoBase(path) .build(); - Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestObserver testsubscriber = new TestObserver<>(); + Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + TestSubscriber testsubscriber = new TestSubscriber<>(); observable.subscribe(testsubscriber); testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -264,7 +267,7 @@ public void testConnectionTimeOut(){ .withStatus(200))); //set up client with very low connection time-out values - RxHttpClient client = new RxHttpClient.Builder() + RxJavaHttpClient client = new RxJavaHttpClient.Builder() .setRequestTimeout(100) .setMaxConnections(1) .setAccept("application/json") @@ -274,9 +277,9 @@ public void testConnectionTimeOut(){ //set up use case String path = "/contacts"; ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase(path).build(); - Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestObserver testsubscriber = new TestObserver<>(); + TestSubscriber testsubscriber = new TestSubscriber<>(); observable.subscribe(testsubscriber); testsubscriber.awaitDone(1000, TimeUnit.MILLISECONDS); diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java index 0d216f1..de2705f 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java @@ -3,8 +3,10 @@ import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.ServerResponse; import com.jayway.jsonpath.JsonPath; +import io.reactivex.Flowable; import io.reactivex.Observable; import io.reactivex.observers.TestObserver; +import io.reactivex.subscribers.TestSubscriber; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,7 +56,7 @@ public void demonstrateComposableObservable() { .addQueryParam("q", "test") .build(); - Function> followLink = (String contactUrl) -> { + Function> followLink = (String contactUrl) -> { LOGGER.info("Following contactURL:" + contactUrl); ClientRequest followUp = client.requestBuilder() .setMethod("GET") @@ -68,17 +70,17 @@ public void demonstrateComposableObservable() { //Here we use concatMap rather than flatMap because this serializes the requests such that requests are //made one after the other, and not interleaved. See: http://reactivex.io/documentation/operators/flatmap.html - Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody) + Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody) .flatMap(body -> { List l = JsonPath.read(body, "$.contacts"); LOGGER.info("Retrieved contact list"); - return Observable.fromIterable(l); + return Flowable.fromIterable(l); }).concatMap(followLink::apply); LOGGER.info("Observable created"); //verify behaviour - TestObserver sub = new TestObserver<>(); + TestSubscriber sub = new TestSubscriber<>(); LOGGER.info("Subscribing to Observer"); observable.subscribe(sub); diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java index b020b5b..913ff42 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java @@ -1,8 +1,10 @@ package be.wegenenverkeer.designtests; import be.wegenenverkeer.rxhttp.*; +import io.reactivex.Flowable; import io.reactivex.Observable; import io.reactivex.observers.TestObserver; +import io.reactivex.subscribers.TestSubscriber; import org.junit.Test; import java.util.Optional; @@ -41,10 +43,10 @@ public void GETHappyPath(){ //.addQueryParam("q", "test") .build(); - Observable observable = client.executeObservably(request); + Flowable observable = client.executeObservably(request); - TestObserver sub = new TestObserver<>(); + TestSubscriber sub = new TestSubscriber<>(); observable.subscribe(sub); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.HOURS); @@ -77,10 +79,10 @@ public void testHttp4xxResponseOnGET() { //set up use case String path = "/contacts"; ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase(path).build(); - Observable observable = client.executeObservably(request); + Flowable observable = client.executeObservably(request); - TestObserver testsubscriber = new TestObserver<>(); + TestSubscriber testsubscriber = new TestSubscriber<>(); observable.subscribe(testsubscriber); testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -109,10 +111,10 @@ public void testHttp5xxResponseOnGET() { .build(); - Observable observable = client.executeObservably(request); + Flowable observable = client.executeObservably(request); - TestObserver testsubscriber = new TestObserver<>(); + TestSubscriber testsubscriber = new TestSubscriber<>(); observable.subscribe(testsubscriber); testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -138,10 +140,10 @@ public void testConnectionTimeOut() { //set up use case String path = "/contacts"; ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase(path).build(); - Observable observable = client.executeObservably(request); + Flowable observable = client.executeObservably(request); - TestObserver testsubscriber = new TestObserver<>(); + TestSubscriber testsubscriber = new TestSubscriber<>(); observable.subscribe(testsubscriber); testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java index 4a4b6ce..51ca07b 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java @@ -3,8 +3,10 @@ import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.HttpClientError; import be.wegenenverkeer.rxhttp.ServerResponse; +import io.reactivex.Flowable; import io.reactivex.Observable; import io.reactivex.observers.TestObserver; +import io.reactivex.subscribers.TestSubscriber; import org.junit.Test; import java.util.concurrent.TimeUnit; @@ -46,7 +48,7 @@ public void POSTHappyPath() { .setUrlRelativetoBase(path) .build(); - Observable observable = + Flowable observable = client.executeToCompletion(request, resp -> resp.getHeader("Location").get()) .flatMap(url -> client.executeToCompletion( @@ -56,7 +58,7 @@ public void POSTHappyPath() { ); - TestObserver sub = new TestObserver<>(); + TestSubscriber sub = new TestSubscriber<>(); observable.subscribe(sub); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -84,9 +86,9 @@ public void POSTFailure() { .setUrlRelativetoBase(path) .build(); - Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestObserver sub = new TestObserver<>(); + TestSubscriber sub = new TestSubscriber<>(); observable.subscribe(sub); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java index 34dc1b2..3e56a86 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java @@ -2,11 +2,8 @@ import be.wegenenverkeer.rxhttp.ClientRequest; import io.reactivex.Flowable; -import io.reactivex.Observable; -import io.reactivex.observers.TestObserver; import io.reactivex.subscribers.TestSubscriber; import org.junit.Test; -import org.reactivestreams.Subscription; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java index e7d9c8f..3fd1116 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java @@ -1,6 +1,7 @@ package be.wegenenverkeer.designtests; import be.wegenenverkeer.rxhttp.RxHttpClient; +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.client.WireMock; import com.github.tomakehurst.wiremock.core.Options; @@ -27,7 +28,7 @@ abstract public class UsingWireMock { static int port = 8089; - static RxHttpClient client; + static RxJavaHttpClient client; @Rule public WireMockRule wireMockRule = new WireMockRule(options().port(port).useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.BODY_FILE)); @@ -35,7 +36,7 @@ abstract public class UsingWireMock { @BeforeClass public static void setUpAndStartServer() { - client = new RxHttpClient.Builder() + client = new RxJavaHttpClient.Builder() .setRequestTimeout(REQUEST_TIME_OUT) .setMaxConnections(3) .setAccept("application/json") @@ -43,10 +44,4 @@ public static void setUpAndStartServer() { .build(); } - @SuppressWarnings("unchecked") - public List items(V... v) { - return Arrays.asList(v); - } - - } diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/FlowableBodyGeneratorTest.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/FlowableBodyGeneratorTest.java index eb402fc..e0010fd 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/FlowableBodyGeneratorTest.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/FlowableBodyGeneratorTest.java @@ -1,6 +1,7 @@ package be.wegenenverkeer.rxhttp; +import be.wegenenverkeer.rxhttp.rxjava.FlowableBodyGenerator; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.reactivex.Flowable; diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestBuilder.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestBuilder.java index 0ebb18a..0f366f6 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestBuilder.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestBuilder.java @@ -1,5 +1,6 @@ package be.wegenenverkeer.rxhttp; +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; import org.junit.Assert; import org.junit.Test; @@ -11,14 +12,14 @@ public class TestBuilder { @Test(expected = IllegalStateException.class) public void testBuilderThrowsIllegalArgumentExceptionOnMissingBaseUrl(){ - new RxHttpClient.Builder().build(); + new RxJavaHttpClient.Builder().build(); } @Test public void testRequestSignersAreAdded(){ RequestSigner requestSigner = clientRequest -> {}; - RxHttpClient client = new RxHttpClient.Builder().setBaseUrl("http://foo.com").addRequestSigner(requestSigner).build(); + RxHttpClient client = new RxJavaHttpClient.Builder().setBaseUrl("http://foo.com").addRequestSigner(requestSigner).build(); Assert.assertTrue(client.getRequestSigners().contains(requestSigner)); } } diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestLoggerConf.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestLoggerConf.java index e94c679..e2533ad 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestLoggerConf.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestLoggerConf.java @@ -1,5 +1,6 @@ package be.wegenenverkeer.rxhttp; +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; import org.junit.Test; import java.util.Arrays; @@ -15,7 +16,7 @@ public class TestLoggerConf { @Test public void testLoggerConfDefault(){ - client = new RxHttpClient.Builder().setBaseUrl("http://foo.com").build(); + client = new RxJavaHttpClient.Builder().setBaseUrl("http://foo.com").build(); try { ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase("/test").build(); assertEquals("GET http://foo.com/test", client.toLogMessage(request)); @@ -26,7 +27,7 @@ public void testLoggerConfDefault(){ @Test public void testLoggerConfWithHeader(){ - client = new RxHttpClient.Builder() + client = new RxJavaHttpClient.Builder() .setBaseUrl("http://foo.com") .logHeaders(Arrays.asList("Test-Header")) .build(); @@ -45,7 +46,7 @@ public void testLoggerConfWithHeader(){ @Test public void testLoggerConfWithHeaderIsCaseInsentivie(){ - client = new RxHttpClient.Builder() + client = new RxJavaHttpClient.Builder() .setBaseUrl("http://foo.com") .logHeaders(Arrays.asList("Test-Header")) .build(); @@ -64,7 +65,7 @@ public void testLoggerConfWithHeaderIsCaseInsentivie(){ @Test public void testLoggerConfWithFParamIsCaseInsensitive(){ - client = new RxHttpClient.Builder() + client = new RxJavaHttpClient.Builder() .setBaseUrl("http://foo.com") .logFormParams(Arrays.asList("TestParam")) .build(); @@ -84,7 +85,7 @@ public void testLoggerConfWithFParamIsCaseInsensitive(){ @Test public void testLoggerConfWithFormParam(){ - client = new RxHttpClient.Builder() + client = new RxJavaHttpClient.Builder() .setBaseUrl("http://foo.com") .logFormParams(Arrays.asList("TestParam")) .build(); diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestCase.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestCase.java index b81c05f..0e77a0a 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestCase.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestCase.java @@ -4,9 +4,6 @@ import be.wegenenverkeer.rxhttp.ClientRequestBuilder; import be.wegenenverkeer.rxhttp.RxHttpClient; -import java.util.List; -import java.util.Map; - /** * A Test case in the AWS Request Signing Test Suite * Created by Karel Maesen, Geovise BVBA on 06/06/16. diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestSuite.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestSuite.java index 4af5877..e8f97f6 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestSuite.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestSuite.java @@ -1,6 +1,7 @@ package be.wegenenverkeer.rxhttp.aws; import be.wegenenverkeer.rxhttp.RxHttpClient; +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; import com.google.common.io.Files; import java.io.File; @@ -23,7 +24,7 @@ public class Aws4TestSuite implements Iterable { Aws4TestSuite(File sourceDir) { - this.client = new RxHttpClient.Builder() + this.client = new RxJavaHttpClient.Builder() .setRequestTimeout(6000) .setMaxConnections(3) .setBaseUrl("http://localhost/") diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestClientRequest.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestClientRequest.java index 13e18ac..b52481b 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestClientRequest.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestClientRequest.java @@ -2,6 +2,7 @@ import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.RxHttpClient; +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; import org.junit.Test; import java.util.Collections; @@ -13,7 +14,7 @@ */ public class TestClientRequest { - private RxHttpClient client = new RxHttpClient + private RxHttpClient client = new RxJavaHttpClient .Builder() .setBaseUrl("http://foo.com") .setMaxConnections(1) diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java index 7fd5925..303ff17 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java @@ -3,13 +3,14 @@ import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.RxHttpClient; import be.wegenenverkeer.rxhttp.ServerResponse; +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; +import io.reactivex.Flowable; import io.reactivex.Observable; import io.reactivex.observers.TestObserver; +import io.reactivex.subscribers.TestSubscriber; import org.junit.Ignore; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; import java.util.concurrent.TimeUnit; /** @@ -22,7 +23,7 @@ public class TestS3ApiCall { public void testS3ApiCall(){ AwsCredentialsProvider provider = new EnvironmentCredentialsProvider(); - RxHttpClient client = new RxHttpClient.Builder() + RxJavaHttpClient client = new RxJavaHttpClient.Builder() .setRequestTimeout(6000) .setMaxConnections(3) .setAwsEndPoint(AwsService.S3, AwsRegion.EU_WEST) @@ -37,9 +38,9 @@ public void testS3ApiCall(){ .addHeader("x-amz-content-sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") .build(); - Observable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestObserver sub = new TestObserver<>(); + TestSubscriber sub = new TestSubscriber<>(); observable.subscribe(sub); sub.awaitDone(6000, TimeUnit.MILLISECONDS); From 5d1b532bafa1d4a4d0ad10d67d23fb6417810f40 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Fri, 12 Jul 2019 23:26:58 +0200 Subject: [PATCH 04/30] Removes obsolete scala module --- build.sbt | 7 +- .../rxhttp/scala/ImplicitConversions.scala | 76 --------- .../wegenenverkeer/rxhttp/scala/package.scala | 10 -- .../designtests/RxHTTPClientGetSpecs.scala | 154 ------------------ 4 files changed, 1 insertion(+), 246 deletions(-) delete mode 100644 modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/ImplicitConversions.scala delete mode 100644 modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/package.scala delete mode 100644 modules/scala/src/test/scala/be/wegenenverkeer/designtests/RxHTTPClientGetSpecs.scala diff --git a/build.sbt b/build.sbt index cbebf01..7cfb38b 100644 --- a/build.sbt +++ b/build.sbt @@ -104,18 +104,13 @@ lazy val rxJavaModule = (project in file("modules/java")).settings( extraJavaSettings ) dependsOn coreModule -lazy val scalaModule = (project in file("modules/scala")).settings( - name := "RxHttpClient-scala", - moduleSettings, - libraryDependencies ++= scalaDependencies -) dependsOn coreModule lazy val main = (project in file(".")) .settings( moduleSettings ++ disablePublishingRoot, name := "RxHttpClient" ) - .aggregate(coreModule, rxJavaModule, scalaModule) + .aggregate(coreModule, rxJavaModule) lazy val pomInfo = https://github.com/WegenenVerkeer/atomium diff --git a/modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/ImplicitConversions.scala b/modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/ImplicitConversions.scala deleted file mode 100644 index 207f137..0000000 --- a/modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/ImplicitConversions.scala +++ /dev/null @@ -1,76 +0,0 @@ -package be.wegenenverkeer.rxhttp.scala - -import java.nio.charset.Charset -import java.util.concurrent.CompletionStage -import java.util.function.BiConsumer - -import be.wegenenverkeer.rxhttp.{ClientRequest, ServerResponse, ServerResponseElement, RxHttpClient => JRxHttpClient} -import io.reactivex.BackpressureStrategy -import org.reactivestreams.Publisher - -import scala.concurrent.{Future, Promise} -import scala.util.{Failure, Success} - - -class RxHttpClient(val inner: JRxHttpClient) { - - import java.util.function.{ Function ⇒ JFunction} - - private def toJavaFunction[A, B](f: A => B) : JFunction[A,B]= (a: A) => f(a) - - private def fromJavaFuture[B](jfuture: CompletionStage[B]) : Future[B] = { - val p = Promise[B]() - - val consumer = new BiConsumer[B, Throwable] { - override def accept(v: B, t: Throwable): Unit = - if (t == null) p.complete(Success(v)) - else p.complete(Failure(t)) - } - - jfuture.whenComplete( consumer ) - p.future - } - - def close() : Unit = this.inner.close() - - def execute[T](req: ClientRequest, transform: ServerResponse => T) : Future[T] = - fromJavaFuture(inner.execute[T](req, toJavaFunction(transform))) - - def executeObservably[T](req: ClientRequest, transform : Array[Byte] => T) : Publisher[T] = - inner.executeObservably(req, toJavaFunction(transform)).toFlowable(BackpressureStrategy.BUFFER) - - - def executeObservably(req: ClientRequest) : Publisher[ServerResponseElement] = - inner.executeObservably(req).toFlowable(BackpressureStrategy.BUFFER) - - - def executeToCompletion[T](req: ClientRequest, transform: Function[ServerResponse,T]): Publisher[T] = - inner.executeToCompletion(req, toJavaFunction(transform)).toFlowable(BackpressureStrategy.BUFFER) - - def executeAndDechunk[String](req: ClientRequest, separator: String, charset : Charset = Charset.forName("UTF8")): Publisher[String] = - inner.executeAndDechunk(req, separator.asInstanceOf[java.lang.String], charset).map( _ .asInstanceOf[String]) - -} - - -/** - * Implicit conversion of RxHttpClient which adds methods that return Reactive Stream Publishers. - * - * Created by Karel Maesen, Geovise BVBA on 22/12/14. - */ -object ImplicitConversions { - - - trait JavaClientWrapper { - val inner: JRxHttpClient - def asScala : RxHttpClient = new RxHttpClient(inner) - } - - - implicit def wrap( c : JRxHttpClient) : JavaClientWrapper = new JavaClientWrapper{ - val inner : JRxHttpClient = c - } - - implicit def unwrap(client: RxHttpClient) : JRxHttpClient = client.inner - -} \ No newline at end of file diff --git a/modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/package.scala b/modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/package.scala deleted file mode 100644 index 1c52d29..0000000 --- a/modules/scala/src/main/scala/be/wegenenverkeer/rxhttp/scala/package.scala +++ /dev/null @@ -1,10 +0,0 @@ -package be.wegenenverkeer.rxhttp - -/** - * This package adapts the Java RxHttpClient so that it returns rxScala Observables. - * - * Created by Karel Maesen, Geovise BVBA on 23/12/14. - */ -package object scala { - -} diff --git a/modules/scala/src/test/scala/be/wegenenverkeer/designtests/RxHTTPClientGetSpecs.scala b/modules/scala/src/test/scala/be/wegenenverkeer/designtests/RxHTTPClientGetSpecs.scala deleted file mode 100644 index 2f2279e..0000000 --- a/modules/scala/src/test/scala/be/wegenenverkeer/designtests/RxHTTPClientGetSpecs.scala +++ /dev/null @@ -1,154 +0,0 @@ -package be.wegenenverkeer.designtests - - -import be.wegenenverkeer.rxhttp.scala.ImplicitConversions._ -import be.wegenenverkeer.rxhttp.{ClientRequest, RxHttpClient, ServerResponse} -import com.github.tomakehurst.wiremock.WireMockServer -import com.github.tomakehurst.wiremock.client.WireMock._ -import com.github.tomakehurst.wiremock.core.Options -import com.github.tomakehurst.wiremock.core.WireMockConfiguration._ -import io.reactivex.Flowable -import io.reactivex.subscribers.TestSubscriber -import org.specs2.mutable.{After, Specification} - -import scala.concurrent.{Await, Future} - - - -/** - * Created by Karel Maesen, Geovise BVBA on 22/12/14. - */ - - -class RxHTTPClientGetSpecs extends Specification { - - import scala.concurrent.duration._ - sequential - - "The GET request " should { - - "return a Flowable with executeObservably" in new UsingMockServer { - val expectBody: String = "{ 'contacts': [1,2,3] }" - - stubFor(get(urlPathEqualTo("/contacts")) - .withQueryParam("q", com.github.tomakehurst.wiremock.client.WireMock.equalTo("test")) - .withHeader("Accept", com.github.tomakehurst.wiremock.client.WireMock.equalTo("application/json")) - .willReturn(aResponse.withFixedDelay(REQUEST_TIME_OUT / 3) - .withStatus(200).withHeader("Content-Type", "application/json") - .withBody(expectBody))) - - - val req: ClientRequest = client.requestBuilder() - .setMethod("GET") - .setUrlRelativetoBase("/contacts") - .addQueryParam("q", "test") - .build() - - val observable: Flowable[String] = Flowable.fromPublisher(client.executeObservably(req, (bytes: Array[Byte]) => new String(bytes))) - val response = observable.blockingLast() - response must_== expectBody - } - - - "return scala Future with execute" in new UsingMockServer { - - val expectBody: String = "{ 'contacts': [1,2,3] }" - - stubFor(get(urlPathEqualTo("/contacts")) - .withQueryParam("q", com.github.tomakehurst.wiremock.client.WireMock.equalTo("test")) - .withHeader("Accept", com.github.tomakehurst.wiremock.client.WireMock.equalTo("application/json")) - .willReturn(aResponse.withFixedDelay(20) - .withStatus(200).withHeader("Content-Type", "application/json") - .withBody(expectBody))) - - - val req: ClientRequest = client.requestBuilder() - .setMethod("GET") - .setUrlRelativetoBase("/contacts") - .addQueryParam("q", "test") - .build() - - val future : Future[String] = client.execute(req, (resp: ServerResponse) => resp.getResponseBody) - - val response = Await.result(future, 2.seconds) - - response must_== expectBody - } - - "return scala Future with executeCompletely" in new UsingMockServer { - - val expectBody: String = "{ 'contacts': [1,2,3] }" - - stubFor(get(urlPathEqualTo("/contacts")) - .withQueryParam("q", com.github.tomakehurst.wiremock.client.WireMock.equalTo("test")) - .withHeader("Accept", com.github.tomakehurst.wiremock.client.WireMock.equalTo("application/json")) - .willReturn(aResponse.withFixedDelay(20) - .withStatus(200).withHeader("Content-Type", "application/json") - .withBody(expectBody))) - - - val req: ClientRequest = client.requestBuilder() - .setMethod("GET") - .setUrlRelativetoBase("/contacts") - .addQueryParam("q", "test") - .build() - - - val observable: Flowable[String] = Flowable.fromPublisher(client.executeToCompletion(req, (resp: ServerResponse) => resp.getResponseBody)) - - val response = observable.blockingLast() - - response must_== expectBody - } - - "return delimited evens (Strings)" in new UsingMockServer { - stubFor(get(urlPathEqualTo("/sse")) - .willReturn( - aResponse - .withBodyFile("sse-output.txt") - .withChunkedDribbleDelay(50, 30))) - - val request: ClientRequest = client.requestBuilder.setMethod("GET").setUrlRelativetoBase("/sse").build - - val observable = Flowable.fromPublisher(client.executeAndDechunk(request, "\n")) - - val testSub : TestSubscriber[String] = new TestSubscriber[String] - observable.subscribe(testSub) - - testSub.awaitDone(1, SECONDS) - - testSub.assertValueCount(10) - - } - } - -} - - - -trait UsingMockServer extends After { - - - val REQUEST_TIME_OUT = 5000 - - //we take a different port then in java-client module, because tests unfortunately continue to overlap with java client module - val port: Int = 8088 - - val client = new RxHttpClient.Builder() - .setRequestTimeout(REQUEST_TIME_OUT) - .setMaxConnections(10) - .setAccept("application/json") - .setBaseUrl("http://localhost:" + port) - .build.asScala - - import com.github.tomakehurst.wiremock.client.WireMock._ - - val server = new WireMockServer(wireMockConfig.port(port).useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.BODY_FILE)) - server.start() - - configureFor("localhost", port) - - def after = { - server.shutdown(); Thread.sleep(1000) - } -} \ No newline at end of file From 188dfa3e4e017c58cf107167b36b6d9d29dad735 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sat, 13 Jul 2019 16:56:52 +0200 Subject: [PATCH 05/30] Modernizes test code --- .../rxhttp/BaseRxHttpClient.java | 6 +- .../wegenenverkeer/rxhttp/RxHttpClient.java | 2 + .../rxhttp/rxjava/RxJavaHttpClient.java | 1 + .../designtests/RxHttpClientDesignTests.java | 55 +++++-------------- .../RxHttpClientMultipleRequests.java | 14 ++--- ...ClientObservableOfServerElementsTests.java | 21 +++---- .../designtests/RxHttpClientPostTests.java | 10 ++-- .../RxHttpClientTestChunkedResponse.java | 14 +++-- 8 files changed, 48 insertions(+), 75 deletions(-) diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java index a0e77fc..8c49f82 100644 --- a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java +++ b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java @@ -126,6 +126,8 @@ public AsyncHttpClient inner() { return this.innerClient; } - - + @Override + public int getMaxConnections() { + return this.innerClient.getConfig().getMaxConnections(); + } } diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java index 34373fb..0d8a37c 100644 --- a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java +++ b/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java @@ -84,4 +84,6 @@ public interface RxHttpClient { String toLogMessage(ClientRequest request); AsyncHttpClient inner(); + + int getMaxConnections(); } diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java index 15e78ef..a35a18d 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java @@ -3,6 +3,7 @@ import be.wegenenverkeer.rxhttp.*; import io.reactivex.Flowable; import io.reactivex.Observable; +import io.reactivex.Single; import io.reactivex.processors.AsyncProcessor; import io.reactivex.processors.BehaviorProcessor; import org.asynchttpclient.AsyncHttpClient; diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java index d24bb9c..6718b86 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java @@ -46,21 +46,12 @@ public void GETObservably() { .addQueryParam("q", "test") .build(); - Flowable observable = client.executeObservably(request, bytes -> new String(bytes, Charset.forName("UTF8"))); - - -// String out = observable.blockingFirst(); -// - TestSubscriber sub = new TestSubscriber<>(); - observable.subscribe(sub); + Flowable flowable = client.executeObservably(request, bytes -> new String(bytes, Charset.forName("UTF8"))); + TestSubscriber sub = flowable.test(); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); sub.assertNoErrors(); - sub.assertValues(expectBody); - - - } @Test @@ -83,19 +74,12 @@ public void GETHappyPath() { .addQueryParam("q", "test") .build(); - Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - - - TestSubscriber sub = new TestSubscriber<>(); - observable.subscribe(sub); + Flowable flowable = client.executeToCompletion(request, ServerResponse::getResponseBody); + TestSubscriber sub = flowable.test(); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); sub.assertNoErrors(); - sub.assertValues(expectBody); - - - } /** @@ -123,15 +107,12 @@ public void testCharsetEncodingDefaultsToUTF8() { .addQueryParam("q", "test") .build(); - Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + Flowable flowable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber sub = new TestSubscriber<>(); - observable.subscribe(sub); - + TestSubscriber sub = flowable.test(); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); sub.assertNoErrors(); - sub.assertValues(expectBody); } @@ -160,12 +141,8 @@ public void testCharsetEncodingInContentType() { .addQueryParam("q", "test") .build(); - Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - - - TestSubscriber sub = new TestSubscriber<>(); - observable.subscribe(sub); - + Flowable flowable = client.executeToCompletion(request, ServerResponse::getResponseBody); + TestSubscriber sub = flowable.test(); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); sub.assertNoErrors(); @@ -212,13 +189,11 @@ public void testHttp4xxResponseOnGET() { //set up use case String path = "/contacts"; ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase(path).build(); - Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + Flowable flowable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber sub = new TestSubscriber<>(); - observable.subscribe(sub); + TestSubscriber sub = flowable.test(); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); - sub.assertError( t -> { if(t instanceof HttpClientError) { return ((HttpClientError)t).getStatusCode() == 404; @@ -242,9 +217,8 @@ public void testHttp5xxResponseOnGET(){ .setUrlRelativetoBase(path) .build(); - Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber testsubscriber = new TestSubscriber<>(); - observable.subscribe(testsubscriber); + Flowable flowable = client.executeToCompletion(request, ServerResponse::getResponseBody); + TestSubscriber testsubscriber = flowable.test(); testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -277,10 +251,9 @@ public void testConnectionTimeOut(){ //set up use case String path = "/contacts"; ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase(path).build(); - Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + Flowable flowable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber testsubscriber = new TestSubscriber<>(); - observable.subscribe(testsubscriber); + TestSubscriber testsubscriber = flowable.test(); testsubscriber.awaitDone(1000, TimeUnit.MILLISECONDS); diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java index de2705f..616fdbc 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java @@ -6,6 +6,7 @@ import io.reactivex.Flowable; import io.reactivex.Observable; import io.reactivex.observers.TestObserver; +import io.reactivex.schedulers.Schedulers; import io.reactivex.subscribers.TestSubscriber; import org.junit.Test; import org.slf4j.Logger; @@ -16,6 +17,7 @@ import java.util.function.Function; import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static java.lang.String.format; /** * Created by Karel Maesen, Geovise BVBA on 27/11/15. @@ -66,24 +68,22 @@ public void demonstrateComposableObservable() { .doAfterTerminate(() -> LOGGER.info("ContactUrl " + contactUrl + " retrieved")); }; - LOGGER.info("Creating Observable..."); - //Here we use concatMap rather than flatMap because this serializes the requests such that requests are //made one after the other, and not interleaved. See: http://reactivex.io/documentation/operators/flatmap.html - Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody) + Flowable flowable = client.executeToCompletion(request, ServerResponse::getResponseBody) .flatMap(body -> { List l = JsonPath.read(body, "$.contacts"); LOGGER.info("Retrieved contact list"); return Flowable.fromIterable(l); }).concatMap(followLink::apply); + // or use .flatMap(followLink::apply, client.getMaxConnections()) + //this will also limit the number of concurrent class to the same number (provided no + // other threads initiate requests using the same client) LOGGER.info("Observable created"); //verify behaviour - TestSubscriber sub = new TestSubscriber<>(); - - LOGGER.info("Subscribing to Observer"); - observable.subscribe(sub); + TestSubscriber sub = flowable.test(); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java index 913ff42..bb9aaee 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java @@ -43,18 +43,16 @@ public void GETHappyPath(){ //.addQueryParam("q", "test") .build(); - Flowable observable = client.executeObservably(request); + Flowable flowable = client.executeObservably(request); - TestSubscriber sub = new TestSubscriber<>(); - observable.subscribe(sub); + TestSubscriber sub = flowable.test(); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.HOURS); sub.assertNoErrors(); sub.assertComplete(); //we must receive at least 1 body part - sub.values().stream().forEach( t -> System.out.println(t)); assertTrue( sub.values().stream().filter(t -> t instanceof ServerResponseBodyPart).count() > 0); for (ServerResponseElement el : sub.values()) { @@ -79,11 +77,10 @@ public void testHttp4xxResponseOnGET() { //set up use case String path = "/contacts"; ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase(path).build(); - Flowable observable = client.executeObservably(request); + Flowable flowable = client.executeObservably(request); - TestSubscriber testsubscriber = new TestSubscriber<>(); - observable.subscribe(testsubscriber); + TestSubscriber testsubscriber = flowable.test(); testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -111,11 +108,10 @@ public void testHttp5xxResponseOnGET() { .build(); - Flowable observable = client.executeObservably(request); + Flowable flowable = client.executeObservably(request); - TestSubscriber testsubscriber = new TestSubscriber<>(); - observable.subscribe(testsubscriber); + TestSubscriber testsubscriber = flowable.test(); testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); @@ -140,11 +136,10 @@ public void testConnectionTimeOut() { //set up use case String path = "/contacts"; ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase(path).build(); - Flowable observable = client.executeObservably(request); + Flowable flowable = client.executeObservably(request); - TestSubscriber testsubscriber = new TestSubscriber<>(); - observable.subscribe(testsubscriber); + TestSubscriber testsubscriber = flowable.test(); testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java index 51ca07b..22e6b64 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java @@ -48,7 +48,7 @@ public void POSTHappyPath() { .setUrlRelativetoBase(path) .build(); - Flowable observable = + Flowable flowable = client.executeToCompletion(request, resp -> resp.getHeader("Location").get()) .flatMap(url -> client.executeToCompletion( @@ -58,8 +58,7 @@ public void POSTHappyPath() { ); - TestSubscriber sub = new TestSubscriber<>(); - observable.subscribe(sub); + TestSubscriber sub = flowable.test(); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); sub.assertNoErrors(); @@ -86,10 +85,9 @@ public void POSTFailure() { .setUrlRelativetoBase(path) .build(); - Flowable observable = client.executeToCompletion(request, ServerResponse::getResponseBody); + Flowable flowable = client.executeToCompletion(request, ServerResponse::getResponseBody); - TestSubscriber sub = new TestSubscriber<>(); - observable.subscribe(sub); + TestSubscriber sub = flowable.test(); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java index 3e56a86..91a5a4a 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java @@ -10,6 +10,7 @@ import java.util.concurrent.TimeoutException; import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static org.junit.Assert.assertTrue; /** * Tests that demonstrate processing a long and slow chunked response. @@ -37,9 +38,9 @@ public void testChunkedTransfer(){ .setUrlRelativetoBase("/sse") .build(); - Flowable observable = client.executeAndDechunk(request, "\n"); - TestSubscriber subscriber = new TestSubscriber<>(); - observable.subscribe(subscriber); + Flowable flowable = client.executeAndDechunk(request, "\n"); + + TestSubscriber subscriber = flowable.test(); subscriber.awaitDone(120, TimeUnit.MILLISECONDS); subscriber.assertValueCount(10); @@ -63,15 +64,16 @@ public void testCancellation() throws InterruptedException, ExecutionException, .setMethod("GET") .setUrlRelativetoBase("/sse") .build(); - Flowable observable = client.executeAndDechunk(request, "\n"); + Flowable flowable = client.executeAndDechunk(request, "\n"); - TestSubscriber subscriber = new TestSubscriber<>(); - observable.subscribe(subscriber); + TestSubscriber subscriber = flowable.test(); Thread.sleep(50); subscriber.cancel(); + assertTrue(subscriber.isCancelled()); subscriber.assertValueCount(0); + } //TODO verify that cancellation works properly From decd71f01c317af6f5afccaf6ca2a1acdf9734fc Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sat, 18 Apr 2020 13:19:25 +0200 Subject: [PATCH 06/30] Refactoring to new RxJava3 package structure --- build.sbt | 36 +++++++++---------- .../rxjava/AsyncCompletionHandlerWrapper.java | 6 ++-- .../rxhttp/rxjava/AsyncHandlerWrapper.java | 12 +++---- .../rxhttp/rxjava/Dechunker.java | 8 ++--- .../rxhttp/rxjava/FlowableBodyGenerator.java | 2 +- .../rxhttp/rxjava/RxJavaHttpClient.java | 10 +++--- .../be/wegenenverkeer/DechunkersTest.java | 4 +-- .../designtests/RxHttpClientDesignTests.java | 4 +-- .../RxHttpClientMultipleRequests.java | 7 ++-- ...ClientObservableOfServerElementsTests.java | 9 ++--- .../designtests/RxHttpClientPostTests.java | 6 ++-- .../RxHttpClientTestChunkedResponse.java | 8 ++--- .../designtests/UsingWireMock.java | 9 ----- .../rxhttp/FlowableBodyGeneratorTest.java | 4 +-- .../rxhttp/aws/TestS3ApiCall.java | 6 ++-- project/build.properties | 2 +- project/plugins.sbt | 2 +- 17 files changed, 53 insertions(+), 82 deletions(-) diff --git a/build.sbt b/build.sbt index 7cfb38b..cedabdf 100644 --- a/build.sbt +++ b/build.sbt @@ -12,30 +12,30 @@ val ScalaBuildOptions = Seq("-unchecked", "-language:postfixOps") -val asyncClient = "org.asynchttpclient" % "async-http-client" % "2.10.1" +val asyncClient = "org.asynchttpclient" % "async-http-client" % "2.12.1" -val rxStreamsVersion = "1.0.2" -val rxJavaVersion = "3.0.0-RC1" +//val rxStreamsVersion = "1.0.2" +val rxJavaVersion = "3.0.1" -val slf4j = "org.slf4j" % "slf4j-api" % "1.7.25" +val slf4j = "org.slf4j" % "slf4j-api" % "1.7.30" val commonsCodec = "commons-codec" % "commons-codec" % "1.10" -val json = "com.fasterxml.jackson.core" % "jackson-databind" % "2.9.8" % "provided" -val rx = "org.reactivestreams" % "reactive-streams" % rxStreamsVersion -val rxFlow = "org.reactivestreams" % "reactive-streams-flow-adapters" % rxStreamsVersion +val json = "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "provided" +//val rx = "org.reactivestreams" % "reactive-streams" % rxStreamsVersion +//val rxFlow = "org.reactivestreams" % "reactive-streams-flow-adapters" % rxStreamsVersion val rxJava = "io.reactivex.rxjava3" % "rxjava" % rxJavaVersion -val junit = "junit" % "junit" % "4.11" % "test" -val specs2 = "org.specs2" %% "specs2-core" % "4.6.0" % "test" -val slf4jSimple = "org.slf4j" % "slf4j-simple" % "1.7.6" % "test" -val wiremock = "com.github.tomakehurst" % "wiremock-jre8" % "2.23.2" % "test" +val specs2 = "org.specs2" %% "specs2-core" % "4.9.3" % "test" +val slf4jSimple = "org.slf4j" % "slf4j-simple" % "1.7.30" % "test" +val wiremock = "com.github.tomakehurst" % "wiremock-jre8" % "2.26.3" % "test" val junitInterface = "com.novocode" % "junit-interface" % "0.11" % Test -val jsonPath = "com.jayway.jsonpath" % "json-path" % "1.2.0" % "test" +val jsonPath = "com.jayway.jsonpath" % "json-path" % "2.4.0" % "test" + + val commonDependencies = Seq( asyncClient, slf4j, - rx, - rxFlow, - +// rx, +// rxFlow, commonsCodec, json ) @@ -44,14 +44,13 @@ val rxJavaDependencies = Seq( rxJava ) -val javaDependencies = commonDependencies ++ Seq(slf4jSimple, junitInterface) +val javaDependencies = commonDependencies ++ Seq(slf4jSimple) val scalaDependencies = commonDependencies ++ Seq( specs2 ) val mainTestDependencies = Seq( - junit, slf4jSimple, wiremock, junitInterface, @@ -79,6 +78,7 @@ lazy val moduleSettings = lazy val extraJavaSettings = Seq( crossPaths := false, autoScalaLibrary := false, + libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, //Test / parallelExecution := false, // javacOptions ++= Seq("-Xlint:deprecation"), testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v") @@ -107,7 +107,7 @@ lazy val rxJavaModule = (project in file("modules/java")).settings( lazy val main = (project in file(".")) .settings( - moduleSettings ++ disablePublishingRoot, + moduleSettings ++ disablePublishingRoot ++ extraJavaSettings, name := "RxHttpClient" ) .aggregate(coreModule, rxJavaModule) diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncCompletionHandlerWrapper.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncCompletionHandlerWrapper.java index e712a94..9ab69bc 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncCompletionHandlerWrapper.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncCompletionHandlerWrapper.java @@ -1,9 +1,9 @@ package be.wegenenverkeer.rxhttp.rxjava; import be.wegenenverkeer.rxhttp.ServerResponse; -import io.reactivex.exceptions.ProtocolViolationException; -import io.reactivex.processors.AsyncProcessor; -import io.reactivex.subjects.AsyncSubject; +import io.reactivex.rxjava3.exceptions.ProtocolViolationException; +import io.reactivex.rxjava3.processors.AsyncProcessor; +import io.reactivex.rxjava3.subjects.AsyncSubject; import org.asynchttpclient.AsyncCompletionHandler; import org.asynchttpclient.Response; import org.slf4j.Logger; diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncHandlerWrapper.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncHandlerWrapper.java index 731c847..a4b1e23 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncHandlerWrapper.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncHandlerWrapper.java @@ -2,15 +2,15 @@ import be.wegenenverkeer.rxhttp.*; import io.netty.handler.codec.http.HttpHeaders; -import io.reactivex.processors.BehaviorProcessor; -import io.reactivex.subjects.BehaviorSubject; +import io.reactivex.rxjava3.processors.BehaviorProcessor; +import io.reactivex.rxjava3.subjects.BehaviorSubject; import org.asynchttpclient.AsyncHandler; import org.asynchttpclient.HttpResponseBodyPart; import org.asynchttpclient.HttpResponseStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.util.Optional; /** @@ -67,11 +67,7 @@ public State onBodyPartReceived(HttpResponseBodyPart bodyPart) { } private String toUtf8String(ServerResponseBodyPart bodyPart) { - try { - return new String(bodyPart.getBodyPartBytes(), "UTF8"); - } catch (UnsupportedEncodingException e) { - return "<<< binary body part >>>"; - } + return new String(bodyPart.getBodyPartBytes(), StandardCharsets.UTF_8); } //we don't check for hasObservers in the onStatusReceived() and onHeadersReceived(). This guarantees that diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/Dechunker.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/Dechunker.java index e06fe26..4067c95 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/Dechunker.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/Dechunker.java @@ -1,11 +1,7 @@ package be.wegenenverkeer.rxhttp.rxjava; -import io.reactivex.FlowableOperator; -import io.reactivex.FlowableSubscriber; -import io.reactivex.ObservableOperator; -import io.reactivex.Observer; -import io.reactivex.subscribers.DefaultSubscriber; -import io.reactivex.subscribers.DisposableSubscriber; +import io.reactivex.rxjava3.core.FlowableOperator; +import io.reactivex.rxjava3.core.FlowableSubscriber; import org.reactivestreams.Subscriber; import org.reactivestreams.Subscription; diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/FlowableBodyGenerator.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/FlowableBodyGenerator.java index 9327fe4..8a4d3d9 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/FlowableBodyGenerator.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/FlowableBodyGenerator.java @@ -1,7 +1,7 @@ package be.wegenenverkeer.rxhttp.rxjava; import io.netty.buffer.ByteBuf; -import io.reactivex.Flowable; +import io.reactivex.rxjava3.core.Flowable; import org.asynchttpclient.request.body.Body; import org.asynchttpclient.request.body.generator.BodyGenerator; import org.reactivestreams.Subscriber; diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java index a35a18d..cef5147 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java @@ -1,11 +1,11 @@ package be.wegenenverkeer.rxhttp.rxjava; import be.wegenenverkeer.rxhttp.*; -import io.reactivex.Flowable; -import io.reactivex.Observable; -import io.reactivex.Single; -import io.reactivex.processors.AsyncProcessor; -import io.reactivex.processors.BehaviorProcessor; + +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.core.Observable; +import io.reactivex.rxjava3.processors.AsyncProcessor; +import io.reactivex.rxjava3.processors.BehaviorProcessor; import org.asynchttpclient.AsyncHttpClient; import org.reactivestreams.Publisher; import org.slf4j.Logger; diff --git a/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java b/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java index 31713c8..6f44d24 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java +++ b/modules/java/src/test/java/be/wegenenverkeer/DechunkersTest.java @@ -1,8 +1,8 @@ package be.wegenenverkeer; import be.wegenenverkeer.rxhttp.rxjava.Dechunker; -import io.reactivex.Flowable; -import io.reactivex.subscribers.TestSubscriber; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.subscribers.TestSubscriber; import org.junit.Test; import java.nio.charset.Charset; diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java index 6718b86..5e9b096 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java @@ -5,8 +5,8 @@ import be.wegenenverkeer.rxhttp.HttpServerError; import be.wegenenverkeer.rxhttp.ServerResponse; import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; -import io.reactivex.Flowable; -import io.reactivex.subscribers.TestSubscriber; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.subscribers.TestSubscriber; import org.junit.Test; import java.nio.charset.Charset; diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java index 616fdbc..aad2cee 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java @@ -3,11 +3,8 @@ import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.ServerResponse; import com.jayway.jsonpath.JsonPath; -import io.reactivex.Flowable; -import io.reactivex.Observable; -import io.reactivex.observers.TestObserver; -import io.reactivex.schedulers.Schedulers; -import io.reactivex.subscribers.TestSubscriber; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.subscribers.TestSubscriber; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java index bb9aaee..b7c05ae 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java @@ -1,10 +1,8 @@ package be.wegenenverkeer.designtests; import be.wegenenverkeer.rxhttp.*; -import io.reactivex.Flowable; -import io.reactivex.Observable; -import io.reactivex.observers.TestObserver; -import io.reactivex.subscribers.TestSubscriber; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.subscribers.TestSubscriber; import org.junit.Test; import java.util.Optional; @@ -97,8 +95,7 @@ public void testHttp5xxResponseOnGET() { //set up stub stubFor(get(urlEqualTo("/contacts")) .withHeader("Accept", equalTo("application/json")) - .willReturn(aResponse().withFixedDelay(20) - .withStatus(500))); + .willReturn(aResponse().withStatus(500))); //set up use case String path = "/contacts"; diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java index 22e6b64..0ec68f0 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java @@ -3,10 +3,8 @@ import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.HttpClientError; import be.wegenenverkeer.rxhttp.ServerResponse; -import io.reactivex.Flowable; -import io.reactivex.Observable; -import io.reactivex.observers.TestObserver; -import io.reactivex.subscribers.TestSubscriber; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.subscribers.TestSubscriber; import org.junit.Test; import java.util.concurrent.TimeUnit; diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java index 91a5a4a..e40275f 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java @@ -1,13 +1,11 @@ package be.wegenenverkeer.designtests; import be.wegenenverkeer.rxhttp.ClientRequest; -import io.reactivex.Flowable; -import io.reactivex.subscribers.TestSubscriber; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.subscribers.TestSubscriber; import org.junit.Test; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static org.junit.Assert.assertTrue; @@ -51,7 +49,7 @@ public void testChunkedTransfer(){ @Test - public void testCancellation() throws InterruptedException, ExecutionException, TimeoutException { + public void testCancellation() throws InterruptedException { stubFor( get(urlPathEqualTo("/sse")) .willReturn(aResponse() diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java index 3fd1116..5555e38 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java @@ -1,20 +1,11 @@ package be.wegenenverkeer.designtests; -import be.wegenenverkeer.rxhttp.RxHttpClient; import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; -import com.github.tomakehurst.wiremock.WireMockServer; -import com.github.tomakehurst.wiremock.client.WireMock; import com.github.tomakehurst.wiremock.core.Options; import com.github.tomakehurst.wiremock.junit.WireMockRule; -import org.junit.AfterClass; -import org.junit.Before; import org.junit.BeforeClass; import org.junit.Rule; -import java.util.Arrays; -import java.util.List; - -import static com.github.tomakehurst.wiremock.client.WireMock.configureFor; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; /** diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/FlowableBodyGeneratorTest.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/FlowableBodyGeneratorTest.java index e0010fd..b36ea80 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/FlowableBodyGeneratorTest.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/FlowableBodyGeneratorTest.java @@ -4,8 +4,8 @@ import be.wegenenverkeer.rxhttp.rxjava.FlowableBodyGenerator; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import io.reactivex.Flowable; -import io.reactivex.schedulers.Schedulers; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.schedulers.Schedulers; import org.asynchttpclient.request.body.Body; import org.junit.Test; diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java index 303ff17..6f9486c 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java @@ -4,10 +4,8 @@ import be.wegenenverkeer.rxhttp.RxHttpClient; import be.wegenenverkeer.rxhttp.ServerResponse; import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; -import io.reactivex.Flowable; -import io.reactivex.Observable; -import io.reactivex.observers.TestObserver; -import io.reactivex.subscribers.TestSubscriber; +import io.reactivex.rxjava3.core.Flowable; +import io.reactivex.rxjava3.subscribers.TestSubscriber; import org.junit.Ignore; import org.junit.Test; diff --git a/project/build.properties b/project/build.properties index 72f9028..797e7cc 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.2.7 +sbt.version=1.3.10 diff --git a/project/plugins.sbt b/project/plugins.sbt index 191d241..49575d7 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ resolvers ++= Seq( - "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" + "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/" ) addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2") From 9d8d7b7c0170482ad1dce843055c8dc1cf0adadc Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sat, 18 Apr 2020 14:19:04 +0200 Subject: [PATCH 07/30] Cleanup test code (formatting, imports) --- .../designtests/RxHttpClientDesignTests.java | 20 ++++++++--------- .../RxHttpClientMultipleRequests.java | 8 ++----- ...ClientObservableOfServerElementsTests.java | 19 ++++++++-------- .../RxHttpClientTestChunkedResponse.java | 16 ++++++-------- .../designtests/UsingWireMock.java | 12 +++++++--- .../be/wegenenverkeer/rxhttp/TestBuilder.java | 7 +++--- .../wegenenverkeer/rxhttp/TestLoggerConf.java | 10 ++++----- .../rxhttp/aws/Aws4TestCase.java | 20 ++++++++--------- .../be/wegenenverkeer/rxhttp/aws/Fixture.java | 11 +++++----- .../rxhttp/aws/TestAllAws4SuiteCases.java | 22 +++++++++---------- .../aws/TestInstanceCredentialsProvider.java | 22 +++++++++---------- .../rxhttp/aws/TestS3ApiCall.java | 3 +-- .../rxhttp/aws/TestUrlEncodedUrls.java | 18 +++++++-------- 13 files changed, 91 insertions(+), 97 deletions(-) diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java index 5e9b096..4895fb8 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java @@ -23,7 +23,7 @@ * Behavior Unit test * Created by Karel Maesen, Geovise BVBA on 06/12/14. */ -public class RxHttpClientDesignTests extends UsingWireMock{ +public class RxHttpClientDesignTests extends UsingWireMock { @Test @@ -150,7 +150,7 @@ public void testCharsetEncodingInContentType() { sub.assertValues(expectBody); fail("Expecting wrongly parsed body"); } catch (AssertionError exp) { - // failure expected + // failure expected } @@ -194,16 +194,16 @@ public void testHttp4xxResponseOnGET() { TestSubscriber sub = flowable.test(); sub.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); - sub.assertError( t -> { - if(t instanceof HttpClientError) { - return ((HttpClientError)t).getStatusCode() == 404; + sub.assertError(t -> { + if (t instanceof HttpClientError) { + return ((HttpClientError) t).getStatusCode() == 404; } return false; }); } @Test - public void testHttp5xxResponseOnGET(){ + public void testHttp5xxResponseOnGET() { //set up stub stubFor(get(urlEqualTo("/contacts")) .withHeader("Accept", equalTo("application/json")) @@ -222,9 +222,9 @@ public void testHttp5xxResponseOnGET(){ testsubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); - testsubscriber.assertError( t -> { - if(t instanceof HttpServerError) { - return ((HttpServerError)t).getStatusCode() == 500; + testsubscriber.assertError(t -> { + if (t instanceof HttpServerError) { + return ((HttpServerError) t).getStatusCode() == 500; } return false; }); @@ -233,7 +233,7 @@ public void testHttp5xxResponseOnGET(){ @Test - public void testConnectionTimeOut(){ + public void testConnectionTimeOut() { //set up stub stubFor(get(urlEqualTo("/contacts")) .withHeader("Accept", equalTo("application/json")) diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java index aad2cee..c1c033c 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java @@ -14,12 +14,11 @@ import java.util.function.Function; import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static java.lang.String.format; /** * Created by Karel Maesen, Geovise BVBA on 27/11/15. */ -public class RxHttpClientMultipleRequests extends UsingWireMock{ +public class RxHttpClientMultipleRequests extends UsingWireMock { private static Logger LOGGER = LoggerFactory.getLogger(RxHttpClientMultipleRequests.class); @@ -43,11 +42,9 @@ public void demonstrateComposableObservable() { stubFor(get(urlPathEqualTo("/contacts/7")).withHeader("Accept", equalTo("application/json")).willReturn(aResponse().withStatus(200).withBody("SEVEN"))); - //use case - String path = "/contacts"; ClientRequest request = client.requestBuilder() .setMethod("GET") @@ -55,7 +52,7 @@ public void demonstrateComposableObservable() { .addQueryParam("q", "test") .build(); - Function> followLink = (String contactUrl) -> { + Function> followLink = (String contactUrl) -> { LOGGER.info("Following contactURL:" + contactUrl); ClientRequest followUp = client.requestBuilder() .setMethod("GET") @@ -90,5 +87,4 @@ public void demonstrateComposableObservable() { } - } diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java index b7c05ae..e0fe519 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java @@ -19,18 +19,18 @@ public class RxHttpClientObservableOfServerElementsTests extends UsingWireMock { @Test - public void GETHappyPath(){ + public void GETHappyPath() { //set up stub String expectBody = "{ 'contacts': [1,2,3] }"; stubFor(get(urlPathEqualTo("/contacts")) - //.withQueryParam("q", equalTo("test")) - .withHeader("Accept", equalTo("application/json")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "application/json") + //.withQueryParam("q", equalTo("test")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") // .withBodyFile("sse-output.txt") - .withBody(expectBody) - ) + .withBody(expectBody) + ) ); //set up use case @@ -51,7 +51,7 @@ public void GETHappyPath(){ sub.assertComplete(); //we must receive at least 1 body part - assertTrue( sub.values().stream().filter(t -> t instanceof ServerResponseBodyPart).count() > 0); + assertTrue(sub.values().stream().filter(t -> t instanceof ServerResponseBodyPart).count() > 0); for (ServerResponseElement el : sub.values()) { if (el instanceof ServerResponseStatus) { @@ -143,7 +143,6 @@ public void testConnectionTimeOut() { testsubscriber.assertError(TimeoutException.class); - } } \ No newline at end of file diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java index e40275f..70c102a 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java @@ -12,24 +12,24 @@ /** * Tests that demonstrate processing a long and slow chunked response. - * + *

* Notice that these tests require running the node server.js test server.That is why they are checked-in as @ignored - * + *

* Created by Karel Maesen, Geovise BVBA on 18/12/14. */ -public class RxHttpClientTestChunkedResponse extends UsingWireMock{ +public class RxHttpClientTestChunkedResponse extends UsingWireMock { @Test - public void testChunkedTransfer(){ + public void testChunkedTransfer() { stubFor( get(urlPathEqualTo("/sse")) .willReturn(aResponse() - .withBodyFile("sse-output.txt") - .withChunkedDribbleDelay(50, 30) + .withBodyFile("sse-output.txt") + .withChunkedDribbleDelay(50, 30) ) - ); + ); ClientRequest request = client.requestBuilder() .setMethod("GET") @@ -46,8 +46,6 @@ public void testChunkedTransfer(){ } - - @Test public void testCancellation() throws InterruptedException { stubFor( diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java index 5555e38..8f98a71 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java @@ -3,6 +3,7 @@ import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; import com.github.tomakehurst.wiremock.core.Options; import com.github.tomakehurst.wiremock.junit.WireMockRule; +import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Rule; @@ -16,13 +17,14 @@ abstract public class UsingWireMock { static final int REQUEST_TIME_OUT = 5000; static final int DEFAULT_TIME_OUT = REQUEST_TIME_OUT * 5; - static int port = 8089; - static RxJavaHttpClient client; @Rule - public WireMockRule wireMockRule = new WireMockRule(options().port(port).useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.BODY_FILE)); + public WireMockRule wireMockRule = new WireMockRule(options() + .port(port) + .useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.BODY_FILE) + ); @BeforeClass public static void setUpAndStartServer() { @@ -35,4 +37,8 @@ public static void setUpAndStartServer() { .build(); } + @AfterClass + public static void stopServer() { + client.close(); + } } diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestBuilder.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestBuilder.java index 0f366f6..7d6875b 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestBuilder.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestBuilder.java @@ -11,13 +11,14 @@ public class TestBuilder { @Test(expected = IllegalStateException.class) - public void testBuilderThrowsIllegalArgumentExceptionOnMissingBaseUrl(){ + public void testBuilderThrowsIllegalArgumentExceptionOnMissingBaseUrl() { new RxJavaHttpClient.Builder().build(); } @Test - public void testRequestSignersAreAdded(){ - RequestSigner requestSigner = clientRequest -> {}; + public void testRequestSignersAreAdded() { + RequestSigner requestSigner = clientRequest -> { + }; RxHttpClient client = new RxJavaHttpClient.Builder().setBaseUrl("http://foo.com").addRequestSigner(requestSigner).build(); Assert.assertTrue(client.getRequestSigners().contains(requestSigner)); diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestLoggerConf.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestLoggerConf.java index e2533ad..19bf035 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestLoggerConf.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/TestLoggerConf.java @@ -15,7 +15,7 @@ public class TestLoggerConf { private RxHttpClient client = null; @Test - public void testLoggerConfDefault(){ + public void testLoggerConfDefault() { client = new RxJavaHttpClient.Builder().setBaseUrl("http://foo.com").build(); try { ClientRequest request = client.requestBuilder().setMethod("GET").setUrlRelativetoBase("/test").build(); @@ -26,7 +26,7 @@ public void testLoggerConfDefault(){ } @Test - public void testLoggerConfWithHeader(){ + public void testLoggerConfWithHeader() { client = new RxJavaHttpClient.Builder() .setBaseUrl("http://foo.com") .logHeaders(Arrays.asList("Test-Header")) @@ -45,7 +45,7 @@ public void testLoggerConfWithHeader(){ } @Test - public void testLoggerConfWithHeaderIsCaseInsentivie(){ + public void testLoggerConfWithHeaderIsCaseInsentivie() { client = new RxJavaHttpClient.Builder() .setBaseUrl("http://foo.com") .logHeaders(Arrays.asList("Test-Header")) @@ -64,7 +64,7 @@ public void testLoggerConfWithHeaderIsCaseInsentivie(){ } @Test - public void testLoggerConfWithFParamIsCaseInsensitive(){ + public void testLoggerConfWithFParamIsCaseInsensitive() { client = new RxJavaHttpClient.Builder() .setBaseUrl("http://foo.com") .logFormParams(Arrays.asList("TestParam")) @@ -84,7 +84,7 @@ public void testLoggerConfWithFParamIsCaseInsensitive(){ } @Test - public void testLoggerConfWithFormParam(){ + public void testLoggerConfWithFormParam() { client = new RxJavaHttpClient.Builder() .setBaseUrl("http://foo.com") .logFormParams(Arrays.asList("TestParam")) diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestCase.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestCase.java index 0e77a0a..63f5ded 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestCase.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Aws4TestCase.java @@ -15,32 +15,26 @@ class Aws4TestCase { private ClientRequestBuilder builder; private ClientRequest request; - ClientRequest getRequest() { - if (this.request == null) { - this.request = builder.build(); - } - return this.request; - } - Aws4TestCase(RxHttpClient client) { this.client = client; this.builder = client.requestBuilder(); } - void setName(String name) { - this.name = name; + ClientRequest getRequest() { + if (this.request == null) { + this.request = builder.build(); + } + return this.request; } void setMethod(String method) { this.builder.setMethod(method); } - void addHeader(String key, String val) { this.builder.addHeader(key, val); } - void setBody(String body) { this.builder.setBody(body); } @@ -49,6 +43,10 @@ String getName() { return name; } + void setName(String name) { + this.name = name; + } + void setUri(String uri) { this.builder.setUrlRelativetoBase(uri); } diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Fixture.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Fixture.java index 886fc4c..965f088 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Fixture.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/Fixture.java @@ -4,23 +4,22 @@ import com.google.common.io.Files; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.net.URL; import java.nio.charset.Charset; /** * AWS Request signing test suite fixture - * + *

* Created by Karel Maesen, Geovise BVBA on 09/06/16. */ class Fixture { static Aws4TestSuite testSuite; + static String dateStamp = "20110909T233600Z"; static private File sourceDirectory; static private AwsCredentialsProvider provider = new ConstantAwsCredentialProvider("AKIDEXAMPLE", "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY"); - static String dateStamp = "20110909T233600Z"; static { URL url = Thread.currentThread().getContextClassLoader().getResource("aws4_testsuite"); @@ -33,10 +32,10 @@ static AwsSignature4Signer signer() { } static AwsSignature4Signer signer(boolean doubleEncode) { - return new AwsSignature4Signer( AwsServiceEndPoint.defaultFor(AwsService.HOST, AwsRegion.US_EAST), provider, doubleEncode); + return new AwsSignature4Signer(AwsServiceEndPoint.defaultFor(AwsService.HOST, AwsRegion.US_EAST), provider, doubleEncode); } - public static Aws4TestSuite testSuite(){ + public static Aws4TestSuite testSuite() { return testSuite; } @@ -60,7 +59,7 @@ public static String getSignedRequest(String name) { static private String getExpected(String name, String ext) { File creq = new File(sourceDirectory, name + ext); CharSource cs = Files.asCharSource(creq, Charset.forName("UTF-8")); - try{ + try { return cs.read().replaceAll("\\r", ""); } catch (IOException e) { e.printStackTrace(); diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestAllAws4SuiteCases.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestAllAws4SuiteCases.java index 1b0b961..e9d5d89 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestAllAws4SuiteCases.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestAllAws4SuiteCases.java @@ -6,13 +6,23 @@ /** * Runs Amazon's AWS V4 request signing Test Suite - * + *

* Created by Karel Maesen, Geovise BVBA on 06/06/16. */ public class TestAllAws4SuiteCases { AwsSignature4Signer signer = Fixture.signer(); + private static void test(boolean print, Aws4TestCase tc, String expected, String received) { + if (print) { + System.out.println("Test case: " + tc); + System.out.println("========================================"); + System.out.println("Test case received: " + received); + System.out.println("Test case expected: " + expected); + } + assertEquals("Error for " + tc.getName(), expected, received); + } + @Test public void testCanonicalRequests() { for (Aws4TestCase tc : Fixture.testSuite) { @@ -41,14 +51,4 @@ public void testAuthorizationHeader() { } } - private static void test(boolean print, Aws4TestCase tc, String expected, String received) { - if (print) { - System.out.println("Test case: " + tc); - System.out.println("========================================"); - System.out.println("Test case received: " + received); - System.out.println("Test case expected: " + expected); - } - assertEquals("Error for " + tc.getName(), expected, received); - } - } \ No newline at end of file diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestInstanceCredentialsProvider.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestInstanceCredentialsProvider.java index 19bb65c..555ec4f 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestInstanceCredentialsProvider.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestInstanceCredentialsProvider.java @@ -12,8 +12,18 @@ */ public class TestInstanceCredentialsProvider { + String responseText = "{\n" + + " \"Code\" : \"Success\",\n" + + " \"LastUpdated\" : \"2017-02-07T16:22:45Z\",\n" + + " \"Type\" : \"AWS-HMAC\",\n" + + " \"AccessKeyId\" : \"ACCESSKEY\",\n" + + " \"SecretAccessKey\" : \"VERYVERYSECRET\",\n" + + " \"Token\" : \"thisisatoken=\",\n" + + " \"Expiration\" : \"2017-02-07T22:41:36Z\"\n" + + "}"; + @Test - public void testParse(){ + public void testParse() { InstanceCredentialsProvider.Parser parser = new InstanceCredentialsProvider.Parser(); @@ -25,14 +35,4 @@ public void testParse(){ assertEquals(OffsetDateTime.of(2017, 2, 7, 22, 41, 36, 0, ZoneOffset.UTC), parser.expiration); } - - String responseText = "{\n" + - " \"Code\" : \"Success\",\n" + - " \"LastUpdated\" : \"2017-02-07T16:22:45Z\",\n" + - " \"Type\" : \"AWS-HMAC\",\n" + - " \"AccessKeyId\" : \"ACCESSKEY\",\n" + - " \"SecretAccessKey\" : \"VERYVERYSECRET\",\n" + - " \"Token\" : \"thisisatoken=\",\n" + - " \"Expiration\" : \"2017-02-07T22:41:36Z\"\n" + - "}"; } diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java index 6f9486c..75ef9cf 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestS3ApiCall.java @@ -1,7 +1,6 @@ package be.wegenenverkeer.rxhttp.aws; import be.wegenenverkeer.rxhttp.ClientRequest; -import be.wegenenverkeer.rxhttp.RxHttpClient; import be.wegenenverkeer.rxhttp.ServerResponse; import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; import io.reactivex.rxjava3.core.Flowable; @@ -18,7 +17,7 @@ public class TestS3ApiCall { @Ignore("Only run when we have correct environment set up") @Test - public void testS3ApiCall(){ + public void testS3ApiCall() { AwsCredentialsProvider provider = new EnvironmentCredentialsProvider(); RxJavaHttpClient client = new RxJavaHttpClient.Builder() diff --git a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestUrlEncodedUrls.java b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestUrlEncodedUrls.java index e7d9610..243b3b1 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestUrlEncodedUrls.java +++ b/modules/java/src/test/java/be/wegenenverkeer/rxhttp/aws/TestUrlEncodedUrls.java @@ -1,7 +1,6 @@ package be.wegenenverkeer.rxhttp.aws; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -13,20 +12,13 @@ public class TestUrlEncodedUrls { AwsSignature4Signer signer = Fixture.signer(true); Aws4TestSuite suite = new Aws4TestSuite(); + String expectedCReq = "PUT\n/dc-prx/sad-schadedossier/dc%253A%252F%252Fsad-schadedossier%252F693%252FSV-17-214-00005\n\n\n\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; @Before public void setup() { suite.addTestCase("PUT", "/dc-prx/sad-schadedossier/dc%3A%2F%2Fsad-schadedossier%2F693%2FSV-17-214-00005", null, null, null); } - @Test - public void testCanonicalRequests() { - for (Aws4TestCase tc : suite) { - String creq = signer.canonicalRequest(tc.getRequest()); - assertEquals(expectedCReq, creq); - } - } - // @Test // public void testStringToSign() { // for (Aws4TestCase tc : Fixture.testSuite) { @@ -35,5 +27,11 @@ public void testCanonicalRequests() { // } // } - String expectedCReq = "PUT\n/dc-prx/sad-schadedossier/dc%253A%252F%252Fsad-schadedossier%252F693%252FSV-17-214-00005\n\n\n\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; + @Test + public void testCanonicalRequests() { + for (Aws4TestCase tc : suite) { + String creq = signer.canonicalRequest(tc.getRequest()); + assertEquals(expectedCReq, creq); + } + } } From fe8334e4a018ae6f09bf86326f0f09dfe9540621 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sat, 18 Apr 2020 14:23:35 +0200 Subject: [PATCH 08/30] Reformat code, optimize imports --- .../rxjava/AsyncCompletionHandlerWrapper.java | 2 +- .../rxhttp/rxjava/AsyncHandlerWrapper.java | 24 ++++++------- .../rxjava/CompleteResponseHandler.java | 5 ++- .../rxhttp/rxjava/Dechunker.java | 20 ++++------- .../rxhttp/rxjava/FlowableBodyGenerator.java | 6 ++-- .../rxhttp/rxjava/RxJavaHttpClient.java | 36 +++++++++---------- 6 files changed, 42 insertions(+), 51 deletions(-) diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncCompletionHandlerWrapper.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncCompletionHandlerWrapper.java index 9ab69bc..93479ce 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncCompletionHandlerWrapper.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncCompletionHandlerWrapper.java @@ -11,8 +11,8 @@ import java.util.function.Function; -import static be.wegenenverkeer.rxhttp.rxjava.CompleteResponseHandler.withCompleteResponse; import static be.wegenenverkeer.rxhttp.ServerResponse.wrap; +import static be.wegenenverkeer.rxhttp.rxjava.CompleteResponseHandler.withCompleteResponse; /** * A {@link AsyncCompletionHandler} that pushes received items to a specified {@link AsyncSubject} diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncHandlerWrapper.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncHandlerWrapper.java index a4b1e23..eb13254 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncHandlerWrapper.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/AsyncHandlerWrapper.java @@ -36,6 +36,12 @@ class AsyncHandlerWrapper implements AsyncHandler { this.subject = subject; } + private static void trace(String msg) { + if (logger.isTraceEnabled()) { + logger.trace(msg); + } + } + /** * Invoked when an unexpected exception occurs during the processing of the response. The exception may have been * produced by implementation of onXXXReceived method invocation. @@ -55,7 +61,7 @@ public void onThrowable(Throwable t) { */ @Override public State onBodyPartReceived(HttpResponseBodyPart bodyPart) { - if(!subject.hasSubscribers()) { + if (!subject.hasSubscribers()) { trace("No observers: Aborting."); //bodyPart.markUnderlyingConnectionAsToBeClosed(); onCompleted(); //send the uncompleted message @@ -66,14 +72,14 @@ public State onBodyPartReceived(HttpResponseBodyPart bodyPart) { return State.CONTINUE; } - private String toUtf8String(ServerResponseBodyPart bodyPart) { - return new String(bodyPart.getBodyPartBytes(), StandardCharsets.UTF_8); - } - //we don't check for hasObservers in the onStatusReceived() and onHeadersReceived(). This guarantees that //processing continues until some response body parts are received, after which the connection can be //marked as to be closed. + private String toUtf8String(ServerResponseBodyPart bodyPart) { + return new String(bodyPart.getBodyPartBytes(), StandardCharsets.UTF_8); + } + /** * Invoked as soon as the HTTP status line has been received * @@ -101,7 +107,7 @@ public Optional getStatusText() { return Optional.ofNullable(responseStatus.getStatusText()); } - public String toString(){ + public String toString() { return String.format("Server response: %d", statuscode); } }); @@ -136,10 +142,4 @@ public Boolean onCompleted() { return true; } - private static void trace(String msg) { - if (logger.isTraceEnabled()) { - logger.trace(msg); - } - } - } \ No newline at end of file diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/CompleteResponseHandler.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/CompleteResponseHandler.java index c55ece9..435b138 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/CompleteResponseHandler.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/CompleteResponseHandler.java @@ -8,7 +8,6 @@ import java.util.function.Consumer; /** - * * Created by Karel Maesen, Geovise BVBA on 26/02/15. */ class CompleteResponseHandler { @@ -23,9 +22,9 @@ public static void withCompleteResponse( if (status < 400) { handleSuccess.accept(response); } else if (status < 500) { - handleClientError.accept(new HttpClientError(status, ServerResponse.wrap(response), "request failed with status = "+response.getStatusText())); + handleClientError.accept(new HttpClientError(status, ServerResponse.wrap(response), "request failed with status = " + response.getStatusText())); } else { - handleServerError.accept(new HttpServerError(status, ServerResponse.wrap(response), "request failed with status = "+response.getStatusText())); + handleServerError.accept(new HttpServerError(status, ServerResponse.wrap(response), "request failed with status = " + response.getStatusText())); } } diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/Dechunker.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/Dechunker.java index 4067c95..34c543e 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/Dechunker.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/Dechunker.java @@ -5,15 +5,12 @@ import org.reactivestreams.Subscriber; import org.reactivestreams.Subscription; -import java.nio.charset.Charset; import java.util.Arrays; /** * An operator that "de-chunks" the Observerable of ServerResponseElements in an Observable of messages. - * + *

* Created by Karel Maesen, Geovise BVBA on 2019-07-05. - * - * */ public class Dechunker implements FlowableOperator { @@ -26,16 +23,15 @@ public Dechunker(String sep) { } @Override - public Subscriber apply(Subscriber subscriber) throws Exception { + public Subscriber apply(Subscriber subscriber) { return new Op(subscriber, separator); } static final class Op implements FlowableSubscriber, Subscription { final Subscriber child; final String separator; - - private String previous = ""; Subscription s; + private String previous = ""; public Op(Subscriber child, String separator) { this.child = child; @@ -45,15 +41,15 @@ public Op(Subscriber child, String separator) { @Override public void onSubscribe(Subscription s) { - this.s =s; + this.s = s; child.onSubscribe(this); } @Override public void onNext(String str) { String[] events = toChunks(str); - for( String ev : events) { - if(!ev.isEmpty()) { + for (String ev : events) { + if (!ev.isEmpty()) { child.onNext(ev); } } @@ -89,12 +85,10 @@ private String[] toChunks(String chunk) { return parts; } else { previous = parts[parts.length - 1]; - return Arrays.copyOfRange(parts,0, parts.length - 1); + return Arrays.copyOfRange(parts, 0, parts.length - 1); } } } - - } diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/FlowableBodyGenerator.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/FlowableBodyGenerator.java index 8a4d3d9..5e3a3d4 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/FlowableBodyGenerator.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/FlowableBodyGenerator.java @@ -31,7 +31,7 @@ public class FlowableBodyGenerator implements BodyGenerator { private final Flowable observable; private Subscription subscription; - private BlockingQueue queue; + private final BlockingQueue queue; private volatile Throwable throwable = null; public FlowableBodyGenerator(Flowable observable) { @@ -45,7 +45,7 @@ public FlowableBodyGenerator(Flowable observable, int queueCapacity) { @Override public Body createBody() { - this.observable.subscribe(new Subscriber() { + this.observable.subscribe(new Subscriber<>() { @Override @@ -140,7 +140,7 @@ public void close() { } } - private class BodyPart { + private static class BodyPart { private final ByteBuffer buffer; private final boolean isLast; diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java index cef5147..22a4dd0 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java @@ -1,17 +1,16 @@ package be.wegenenverkeer.rxhttp.rxjava; import be.wegenenverkeer.rxhttp.*; - import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.core.Observable; import io.reactivex.rxjava3.processors.AsyncProcessor; import io.reactivex.rxjava3.processors.BehaviorProcessor; import org.asynchttpclient.AsyncHttpClient; -import org.reactivestreams.Publisher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.concurrent.CompletableFuture; import java.util.function.Function; @@ -22,7 +21,7 @@ public class RxJavaHttpClient extends BaseRxHttpClient implements RxHttpClient { final private static Logger logger = LoggerFactory.getLogger(RxHttpClient.class); - final private static Charset UTF8 = Charset.forName("UTF8"); + final private static Charset UTF8 = StandardCharsets.UTF_8; protected RxJavaHttpClient(AsyncHttpClient innerClient, RestClientConfig config, ClientRequestLogFormatter logFmt, RequestSigner... requestSigners) { @@ -39,8 +38,8 @@ public CompletableFuture execute(ClientRequest request, Function future = new CompletableFuture<>(); return inner().executeRequest(request.unwrap()).toCompletableFuture() - .thenApply( ServerResponse::wrap ) - .thenApply( transformer ); + .thenApply(ServerResponse::wrap) + .thenApply(transformer); } /** @@ -91,13 +90,12 @@ public Flowable executeObservably(ClientRequest request) * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. * - * @param request the request to send + * @param request the request to send * @param separator the separator * @return a cold Flowable of messages (UTF8 Strings) - */ public Flowable executeAndDechunk(ClientRequest request, String separator) { - return executeAndDechunk(request, separator, Charset.forName("UTF8")); + return executeAndDechunk(request, separator, StandardCharsets.UTF_8); } /** @@ -109,15 +107,15 @@ public Flowable executeAndDechunk(ClientRequest request, String separato * The returned Observable is Cold, i.e. on each subscription a new HTTP request is made * and the response elements returned as a new Observable. So for each subscriber, a separate HTTP request will be made. * - * @param request the request to send + * @param request the request to send * @param separator the separator - * @param charset the character set of the messages + * @param charset the character set of the messages * @return a cold Flowable of messages (Strings in the specified Charset) */ public Flowable executeAndDechunk(ClientRequest request, String separator, Charset charset) { return executeObservably(request) .filter(sre -> sre instanceof ServerResponseBodyPart) - .map( sre -> new String(((ServerResponseBodyPart)sre).getBodyPartBytes(), charset)) + .map(sre -> new String(((ServerResponseBodyPart) sre).getBodyPartBytes(), charset)) .lift(new Dechunker(separator)); } @@ -136,22 +134,22 @@ public Flowable executeAndDechunk(ClientRequest request, String separato */ public Flowable executeObservably(ClientRequest request, Function transform) { return executeObservably(request) - .filter(el -> el.match(e -> false, e -> false, e -> true, e -> true)) - .map(el -> el.match( - e -> null, //won't happen, is filtered - e -> null, //won't happen, is filtered - e -> transform.apply(e.getBodyPartBytes()), - e -> transform.apply(e.getResponseBodyAsBytes()))); + .filter(el -> el.match(e -> false, e -> false, e -> true, e -> true)) + .map(el -> el.match( + e -> null, //won't happen, is filtered + e -> null, //won't happen, is filtered + e -> transform.apply(e.getBodyPartBytes()), + e -> transform.apply(e.getResponseBodyAsBytes()))); } /** * A Builder for {@code RxHttpClient} builders. */ - static public class Builder extends be.wegenenverkeer.rxhttp.Builder{ + static public class Builder extends be.wegenenverkeer.rxhttp.Builder { @Override - public RxJavaHttpClient build(){ + public RxJavaHttpClient build() { return super.build(); } From 2e0d54f9f580f88987192ad042085106a0382172 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sat, 18 Apr 2020 15:59:18 +0200 Subject: [PATCH 09/30] Refactor to interop module RxJava is now the base module. An java-interop module is provided as a bridge to Reactive-streams, JDK 9 Flow, and Reactor. --- build.sbt | 31 ++++++++++++------- .../get-header-key-duplicate.authz | 1 - .../get-header-key-duplicate.creq | 9 ------ .../get-header-key-duplicate.req | 7 ----- .../get-header-key-duplicate.sreq | 8 ----- .../get-header-key-duplicate.sts | 4 --- .../get-header-value-order.authz | 1 - .../get-header-value-order.creq | 9 ------ .../aws4_testsuite/get-header-value-order.req | 8 ----- .../get-header-value-order.sreq | 9 ------ .../aws4_testsuite/get-header-value-order.sts | 4 --- .../get-header-value-trim.authz | 1 - .../aws4_testsuite/get-header-value-trim.creq | 9 ------ .../aws4_testsuite/get-header-value-trim.req | 5 --- .../aws4_testsuite/get-header-value-trim.sreq | 6 ---- .../aws4_testsuite/get-header-value-trim.sts | 4 --- .../get-relative-relative.authz | 1 - .../aws4_testsuite/get-relative-relative.creq | 8 ----- .../aws4_testsuite/get-relative-relative.req | 4 --- .../aws4_testsuite/get-relative-relative.sreq | 5 --- .../aws4_testsuite/get-relative-relative.sts | 4 --- .../aws4_testsuite/get-relative.authz | 1 - .../aws4_testsuite/get-relative.creq | 8 ----- .../resources/aws4_testsuite/get-relative.req | 4 --- .../aws4_testsuite/get-relative.sreq | 5 --- .../resources/aws4_testsuite/get-relative.sts | 4 --- .../aws4_testsuite/get-slash-dot-slash.authz | 1 - .../aws4_testsuite/get-slash-dot-slash.creq | 8 ----- .../aws4_testsuite/get-slash-dot-slash.req | 4 --- .../aws4_testsuite/get-slash-dot-slash.sreq | 5 --- .../aws4_testsuite/get-slash-dot-slash.sts | 4 --- .../get-slash-pointless-dot.authz | 1 - .../get-slash-pointless-dot.creq | 8 ----- .../get-slash-pointless-dot.req | 4 --- .../get-slash-pointless-dot.sreq | 5 --- .../get-slash-pointless-dot.sts | 4 --- .../resources/aws4_testsuite/get-slash.authz | 1 - .../resources/aws4_testsuite/get-slash.creq | 8 ----- .../resources/aws4_testsuite/get-slash.req | 4 --- .../resources/aws4_testsuite/get-slash.sreq | 5 --- .../resources/aws4_testsuite/get-slash.sts | 4 --- .../aws4_testsuite/get-slashes.authz | 1 - .../resources/aws4_testsuite/get-slashes.creq | 8 ----- .../resources/aws4_testsuite/get-slashes.req | 4 --- .../resources/aws4_testsuite/get-slashes.sreq | 5 --- .../resources/aws4_testsuite/get-slashes.sts | 4 --- .../resources/aws4_testsuite/get-space.authz | 1 - .../resources/aws4_testsuite/get-space.creq | 8 ----- .../resources/aws4_testsuite/get-space.req | 4 --- .../resources/aws4_testsuite/get-space.sreq | 5 --- .../resources/aws4_testsuite/get-space.sts | 4 --- .../aws4_testsuite/get-unreserved.authz | 1 - .../aws4_testsuite/get-unreserved.creq | 8 ----- .../aws4_testsuite/get-unreserved.req | 4 --- .../aws4_testsuite/get-unreserved.sreq | 5 --- .../aws4_testsuite/get-unreserved.sts | 4 --- .../resources/aws4_testsuite/get-utf8.authz | 1 - .../resources/aws4_testsuite/get-utf8.creq | 8 ----- .../resources/aws4_testsuite/get-utf8.req | 4 --- .../resources/aws4_testsuite/get-utf8.sreq | 5 --- .../resources/aws4_testsuite/get-utf8.sts | 4 --- .../get-vanilla-empty-query-key.authz | 1 - .../get-vanilla-empty-query-key.creq | 8 ----- .../get-vanilla-empty-query-key.req | 4 --- .../get-vanilla-empty-query-key.sreq | 5 --- .../get-vanilla-empty-query-key.sts | 4 --- .../get-vanilla-query-order-key-case.authz | 1 - .../get-vanilla-query-order-key-case.creq | 8 ----- .../get-vanilla-query-order-key-case.req | 4 --- .../get-vanilla-query-order-key-case.sreq | 5 --- .../get-vanilla-query-order-key-case.sts | 4 --- .../get-vanilla-query-order-key.authz | 1 - .../get-vanilla-query-order-key.creq | 8 ----- .../get-vanilla-query-order-key.req | 4 --- .../get-vanilla-query-order-key.sreq | 5 --- .../get-vanilla-query-order-key.sts | 4 --- .../get-vanilla-query-order-value.authz | 1 - .../get-vanilla-query-order-value.creq | 8 ----- .../get-vanilla-query-order-value.req | 4 --- .../get-vanilla-query-order-value.sreq | 5 --- .../get-vanilla-query-order-value.sts | 4 --- .../get-vanilla-query-unreserved.authz | 1 - .../get-vanilla-query-unreserved.creq | 8 ----- .../get-vanilla-query-unreserved.req | 4 --- .../get-vanilla-query-unreserved.sreq | 5 --- .../get-vanilla-query-unreserved.sts | 4 --- .../aws4_testsuite/get-vanilla-query.authz | 1 - .../aws4_testsuite/get-vanilla-query.creq | 8 ----- .../aws4_testsuite/get-vanilla-query.req | 4 --- .../aws4_testsuite/get-vanilla-query.sreq | 5 --- .../aws4_testsuite/get-vanilla-query.sts | 4 --- .../get-vanilla-ut8-query.authz | 1 - .../aws4_testsuite/get-vanilla-ut8-query.creq | 8 ----- .../aws4_testsuite/get-vanilla-ut8-query.req | 4 --- .../aws4_testsuite/get-vanilla-ut8-query.sreq | 5 --- .../aws4_testsuite/get-vanilla-ut8-query.sts | 4 --- .../aws4_testsuite/get-vanilla.authz | 1 - .../resources/aws4_testsuite/get-vanilla.creq | 8 ----- .../resources/aws4_testsuite/get-vanilla.req | 4 --- .../resources/aws4_testsuite/get-vanilla.sreq | 5 --- .../resources/aws4_testsuite/get-vanilla.sts | 4 --- .../aws4_testsuite/post-header-key-case.authz | 1 - .../aws4_testsuite/post-header-key-case.creq | 8 ----- .../aws4_testsuite/post-header-key-case.req | 4 --- .../aws4_testsuite/post-header-key-case.sreq | 5 --- .../aws4_testsuite/post-header-key-case.sts | 4 --- .../aws4_testsuite/post-header-key-sort.authz | 1 - .../aws4_testsuite/post-header-key-sort.creq | 9 ------ .../aws4_testsuite/post-header-key-sort.req | 5 --- .../aws4_testsuite/post-header-key-sort.sreq | 6 ---- .../aws4_testsuite/post-header-key-sort.sts | 4 --- .../post-header-value-case.authz | 1 - .../post-header-value-case.creq | 9 ------ .../aws4_testsuite/post-header-value-case.req | 5 --- .../post-header-value-case.sreq | 6 ---- .../aws4_testsuite/post-header-value-case.sts | 4 --- .../post-vanilla-empty-query-value.authz | 1 - .../post-vanilla-empty-query-value.creq | 8 ----- .../post-vanilla-empty-query-value.req | 4 --- .../post-vanilla-empty-query-value.sreq | 5 --- .../post-vanilla-empty-query-value.sts | 4 --- .../post-vanilla-query-nonunreserved.authz | 1 - .../post-vanilla-query-nonunreserved.creq | 8 ----- .../post-vanilla-query-nonunreserved.req | 4 --- .../post-vanilla-query-nonunreserved.sreq | 5 --- .../post-vanilla-query-nonunreserved.sts | 4 --- .../post-vanilla-query-space.authz | 1 - .../post-vanilla-query-space.creq | 8 ----- .../post-vanilla-query-space.req | 4 --- .../post-vanilla-query-space.sreq | 5 --- .../post-vanilla-query-space.sts | 4 --- .../aws4_testsuite/post-vanilla-query.authz | 1 - .../aws4_testsuite/post-vanilla-query.creq | 8 ----- .../aws4_testsuite/post-vanilla-query.req | 4 --- .../aws4_testsuite/post-vanilla-query.sreq | 5 --- .../aws4_testsuite/post-vanilla-query.sts | 4 --- .../aws4_testsuite/post-vanilla.authz | 1 - .../aws4_testsuite/post-vanilla.creq | 8 ----- .../resources/aws4_testsuite/post-vanilla.req | 4 --- .../aws4_testsuite/post-vanilla.sreq | 5 --- .../resources/aws4_testsuite/post-vanilla.sts | 4 --- ...ost-x-www-form-urlencoded-parameters.authz | 1 - ...post-x-www-form-urlencoded-parameters.creq | 9 ------ .../post-x-www-form-urlencoded-parameters.req | 6 ---- ...post-x-www-form-urlencoded-parameters.sreq | 7 ----- .../post-x-www-form-urlencoded-parameters.sts | 4 --- .../post-x-www-form-urlencoded.authz | 1 - .../post-x-www-form-urlencoded.creq | 9 ------ .../post-x-www-form-urlencoded.req | 6 ---- .../post-x-www-form-urlencoded.sreq | 7 ----- .../post-x-www-form-urlencoded.sts | 4 --- .../rxhttp/BaseRxHttpClient.java | 0 .../rxhttp/BuildValidation.java | 0 .../be/wegenenverkeer/rxhttp/Builder.java | 0 .../wegenenverkeer/rxhttp/ClientRequest.java | 0 .../rxhttp/ClientRequestBuilder.java | 0 .../rxhttp/ClientRequestLogFormatter.java | 0 .../rxhttp/CompatUtilities.java | 0 .../DefaultClientRequestLogFormatter.java | 0 .../wegenenverkeer/rxhttp/HTTPStatusCode.java | 0 .../rxhttp/HttpClientError.java | 0 .../be/wegenenverkeer/rxhttp/HttpError.java | 0 .../rxhttp/HttpServerError.java | 0 .../rxhttp/MutableResponseProcessor.java | 0 .../wegenenverkeer/rxhttp/RequestSigner.java | 0 .../rxhttp/RestClientConfig.java | 0 .../wegenenverkeer/rxhttp/RxHttpClient.java | 0 .../wegenenverkeer/rxhttp/ServerResponse.java | 0 .../rxhttp/ServerResponseBodyPart.java | 0 .../rxhttp/ServerResponseBodyPartImpl.java | 0 .../rxhttp/ServerResponseElement.java | 0 .../rxhttp/ServerResponseHeaders.java | 0 .../rxhttp/ServerResponseHeadersImpl.java | 0 .../rxhttp/ServerResponseStatus.java | 0 .../rxhttp/aws/AwsCredentials.java | 0 .../rxhttp/aws/AwsCredentialsProvider.java | 0 .../wegenenverkeer/rxhttp/aws/AwsRegion.java | 0 .../wegenenverkeer/rxhttp/aws/AwsService.java | 0 .../rxhttp/aws/AwsServiceEndPoint.java | 0 .../rxhttp/aws/AwsSignature4Signer.java | 0 .../aws/ConstantAwsCredentialProvider.java | 0 .../rxhttp/aws/DefaultEnvironment.java | 0 .../rxhttp/aws/Environment.java | 0 .../aws/EnvironmentCredentialsProvider.java | 0 .../aws/InstanceCredentialsProvider.java | 0 .../wegenenverkeer/rxhttp/aws/UrlEncoder.java | 0 186 files changed, 19 insertions(+), 707 deletions(-) delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-order.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-order.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-order.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative-relative.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative-relative.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative-relative.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-relative.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slash.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slashes.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slashes.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slashes.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slashes.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-slashes.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-space.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-space.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-space.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-space.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-space.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-unreserved.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-unreserved.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-unreserved.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-unreserved.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-unreserved.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-utf8.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-utf8.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-utf8.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-utf8.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-utf8.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/get-vanilla.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-case.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-case.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-case.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-value-case.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-value-case.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-value-case.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-vanilla.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sts delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.authz delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.creq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.req delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sreq delete mode 100755 modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sts rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/BuildValidation.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/Builder.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestBuilder.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestLogFormatter.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/DefaultClientRequestLogFormatter.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/HTTPStatusCode.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/HttpClientError.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/HttpError.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/HttpServerError.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/RequestSigner.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/RestClientConfig.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponse.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPart.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPartImpl.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseElement.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeaders.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseStatus.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentials.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentialsProvider.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsRegion.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsService.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsServiceEndPoint.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsSignature4Signer.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/ConstantAwsCredentialProvider.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/DefaultEnvironment.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/Environment.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/EnvironmentCredentialsProvider.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/InstanceCredentialsProvider.java (100%) rename modules/{core => java}/src/main/java/be/wegenenverkeer/rxhttp/aws/UrlEncoder.java (100%) diff --git a/build.sbt b/build.sbt index cedabdf..d64e129 100644 --- a/build.sbt +++ b/build.sbt @@ -14,14 +14,16 @@ val ScalaBuildOptions = Seq("-unchecked", val asyncClient = "org.asynchttpclient" % "async-http-client" % "2.12.1" -//val rxStreamsVersion = "1.0.2" +val rxStreamsVersion = "1.0.3" val rxJavaVersion = "3.0.1" +val reactorVersion = "3.3.3.RELEASE" val slf4j = "org.slf4j" % "slf4j-api" % "1.7.30" val commonsCodec = "commons-codec" % "commons-codec" % "1.10" val json = "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "provided" -//val rx = "org.reactivestreams" % "reactive-streams" % rxStreamsVersion -//val rxFlow = "org.reactivestreams" % "reactive-streams-flow-adapters" % rxStreamsVersion +val rx = "org.reactivestreams" % "reactive-streams" % rxStreamsVersion +val reactorAdapter = "io.projectreactor.addons" % "reactor-adapter" % reactorVersion + val rxJava = "io.reactivex.rxjava3" % "rxjava" % rxJavaVersion val specs2 = "org.specs2" %% "specs2-core" % "4.9.3" % "test" val slf4jSimple = "org.slf4j" % "slf4j-simple" % "1.7.30" % "test" @@ -34,8 +36,6 @@ val jsonPath = "com.jayway.jsonpath" % "json-path" % "2.4.0" % "test" val commonDependencies = Seq( asyncClient, slf4j, -// rx, -// rxFlow, commonsCodec, json ) @@ -44,6 +44,12 @@ val rxJavaDependencies = Seq( rxJava ) +lazy val interopDependencies = Seq( + rx, + reactorAdapter +) + + val javaDependencies = commonDependencies ++ Seq(slf4jSimple) val scalaDependencies = commonDependencies ++ Seq( @@ -73,6 +79,7 @@ lazy val moduleSettings = parallelExecution := false, resolvers += "Local Maven" at Path.userHome.asFile.toURI.toURL + ".m2/repository", resolvers += Resolver.typesafeRepo("releases"), + resolvers += "Spring repository" at "https://repo.spring.io/milestone" ) ++ testSettings ++ publishSettings //++ jacoco.settings lazy val extraJavaSettings = Seq( @@ -88,13 +95,13 @@ lazy val testSettings = Seq( libraryDependencies ++= mainTestDependencies, parallelExecution in Test := false ) -lazy val coreModule = (project in file("modules/core")).settings( - name := "RxHttpClient-Base", - moduleSettings, +lazy val javaInteropModule = (project in file("modules/java-interop")).settings( + name := "RxHttpClient-java-interop", + moduleSettings ++ extraJavaSettings, javacOptions ++= Seq("--release", "11"), - libraryDependencies ++= javaDependencies, + libraryDependencies ++= javaDependencies ++ interopDependencies, extraJavaSettings -) +) dependsOn rxJavaModule lazy val rxJavaModule = (project in file("modules/java")).settings( name := "RxHttpClient-RxJava", @@ -102,7 +109,7 @@ lazy val rxJavaModule = (project in file("modules/java")).settings( javacOptions ++= Seq("--release", "11"), libraryDependencies ++= javaDependencies ++ rxJavaDependencies, extraJavaSettings -) dependsOn coreModule +) lazy val main = (project in file(".")) @@ -110,7 +117,7 @@ lazy val main = (project in file(".")) moduleSettings ++ disablePublishingRoot ++ extraJavaSettings, name := "RxHttpClient" ) - .aggregate(coreModule, rxJavaModule) + .aggregate(javaInteropModule, rxJavaModule) lazy val pomInfo = https://github.com/WegenenVerkeer/atomium diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.authz b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.authz deleted file mode 100755 index ac05e35..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=54afcaaf45b331f81cd2edb974f7b824ff4dd594cbbaa945ed636b48477368ed \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.creq b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.creq deleted file mode 100755 index 57e0862..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.creq +++ /dev/null @@ -1,9 +0,0 @@ -POST -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -zoo:foobar,zoobar,zoobar - -date;host;zoo -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.req b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.req deleted file mode 100755 index eb3a429..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.req +++ /dev/null @@ -1,7 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -ZOO:zoobar -zoo:foobar -zoo:zoobar - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sreq b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sreq deleted file mode 100755 index 5c464f3..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sreq +++ /dev/null @@ -1,8 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -ZOO:zoobar -zoo:foobar -zoo:zoobar -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=54afcaaf45b331f81cd2edb974f7b824ff4dd594cbbaa945ed636b48477368ed - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sts b/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sts deleted file mode 100755 index 7b11b51..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-key-duplicate.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -3c52f0eaae2b61329c0a332e3fa15842a37bc5812cf4d80eb64784308850e313 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.authz b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.authz deleted file mode 100755 index c80262a..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;p, Signature=d2973954263943b11624a11d1c963ca81fb274169c7868b2858c04f083199e3d \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.creq b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.creq deleted file mode 100755 index 9b61ef5..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.creq +++ /dev/null @@ -1,9 +0,0 @@ -POST -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -p:a,a,p,z - -date;host;p -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.req b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.req deleted file mode 100755 index ea30500..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.req +++ /dev/null @@ -1,8 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -p:z -p:a -p:p -p:a - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sreq b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sreq deleted file mode 100755 index 536ab04..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sreq +++ /dev/null @@ -1,9 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -p:z -p:a -p:p -p:a -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;p, Signature=d2973954263943b11624a11d1c963ca81fb274169c7868b2858c04f083199e3d - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sts b/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sts deleted file mode 100755 index d80190a..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-value-order.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -94c0389fefe0988cbbedc8606f0ca0b485b48da010d09fc844b45b697c8924fe \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.authz b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.authz deleted file mode 100755 index 2d870cc..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;p, Signature=debf546796015d6f6ded8626f5ce98597c33b47b9164cf6b17b4642036fcb592 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.creq b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.creq deleted file mode 100755 index 43b4a85..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.creq +++ /dev/null @@ -1,9 +0,0 @@ -POST -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -p:phfft - -date;host;p -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.req b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.req deleted file mode 100755 index e148363..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.req +++ /dev/null @@ -1,5 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -p: phfft - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sreq b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sreq deleted file mode 100755 index ab33a91..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sreq +++ /dev/null @@ -1,6 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -p: phfft -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;p, Signature=debf546796015d6f6ded8626f5ce98597c33b47b9164cf6b17b4642036fcb592 - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sts b/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sts deleted file mode 100755 index 7b7ead8..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-header-value-trim.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -dddd1902add08da1ac94782b05f9278c08dc7468db178a84f8950d93b30b1f35 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.authz b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.authz deleted file mode 100755 index 06bd813..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.creq b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.creq deleted file mode 100755 index 8519923..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.req b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.req deleted file mode 100755 index dab95bb..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /foo/bar/../.. http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sreq b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sreq deleted file mode 100755 index b0d1c56..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /foo/bar/../.. http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sts b/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sts deleted file mode 100755 index c7bcc67..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-relative-relative.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative.authz b/modules/core/src/test/resources/aws4_testsuite/get-relative.authz deleted file mode 100755 index 06bd813..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-relative.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative.creq b/modules/core/src/test/resources/aws4_testsuite/get-relative.creq deleted file mode 100755 index 8519923..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-relative.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative.req b/modules/core/src/test/resources/aws4_testsuite/get-relative.req deleted file mode 100755 index 18344ee..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-relative.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /foo/.. http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative.sreq b/modules/core/src/test/resources/aws4_testsuite/get-relative.sreq deleted file mode 100755 index 2fc7620..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-relative.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /foo/.. http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-relative.sts b/modules/core/src/test/resources/aws4_testsuite/get-relative.sts deleted file mode 100755 index c7bcc67..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-relative.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.authz b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.authz deleted file mode 100755 index 06bd813..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.creq b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.creq deleted file mode 100755 index 8519923..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.req b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.req deleted file mode 100755 index 00ffac6..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /./ http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sreq b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sreq deleted file mode 100755 index 4b0e285..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /./ http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sts b/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sts deleted file mode 100755 index c7bcc67..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash-dot-slash.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.authz b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.authz deleted file mode 100755 index ffa78cf..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=910e4d6c9abafaf87898e1eb4c929135782ea25bb0279703146455745391e63a \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.creq b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.creq deleted file mode 100755 index 280cc1e..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/foo - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.req b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.req deleted file mode 100755 index 0953f61..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /./foo http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sreq b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sreq deleted file mode 100755 index aae53b3..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /./foo http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=910e4d6c9abafaf87898e1eb4c929135782ea25bb0279703146455745391e63a - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sts b/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sts deleted file mode 100755 index 0c3394b..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash-pointless-dot.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -8021a97572ee460f87ca67f4e8c0db763216d84715f5424a843a5312a3321e2d \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash.authz b/modules/core/src/test/resources/aws4_testsuite/get-slash.authz deleted file mode 100755 index 06bd813..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash.creq b/modules/core/src/test/resources/aws4_testsuite/get-slash.creq deleted file mode 100755 index 8519923..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash.req b/modules/core/src/test/resources/aws4_testsuite/get-slash.req deleted file mode 100755 index 2dcd49c..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash.req +++ /dev/null @@ -1,4 +0,0 @@ -GET // http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash.sreq b/modules/core/src/test/resources/aws4_testsuite/get-slash.sreq deleted file mode 100755 index 85dfc71..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET // http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slash.sts b/modules/core/src/test/resources/aws4_testsuite/get-slash.sts deleted file mode 100755 index c7bcc67..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slash.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slashes.authz b/modules/core/src/test/resources/aws4_testsuite/get-slashes.authz deleted file mode 100755 index 9c720f3..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slashes.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b00392262853cfe3201e47ccf945601079e9b8a7f51ee4c3d9ee4f187aa9bf19 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slashes.creq b/modules/core/src/test/resources/aws4_testsuite/get-slashes.creq deleted file mode 100755 index 759b0c3..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slashes.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/foo/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slashes.req b/modules/core/src/test/resources/aws4_testsuite/get-slashes.req deleted file mode 100755 index e326c43..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slashes.req +++ /dev/null @@ -1,4 +0,0 @@ -GET //foo// http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slashes.sreq b/modules/core/src/test/resources/aws4_testsuite/get-slashes.sreq deleted file mode 100755 index f2c5eef..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slashes.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET //foo// http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b00392262853cfe3201e47ccf945601079e9b8a7f51ee4c3d9ee4f187aa9bf19 - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-slashes.sts b/modules/core/src/test/resources/aws4_testsuite/get-slashes.sts deleted file mode 100755 index e6c6f14..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-slashes.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -6bb4476ee8745730c9cb79f33a0c70baa6d8af29c0077fa12e4e8f1dd17e7098 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-space.authz b/modules/core/src/test/resources/aws4_testsuite/get-space.authz deleted file mode 100755 index 4f8ec5e..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-space.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=f309cfbd10197a230c42dd17dbf5cca8a0722564cb40a872d25623cfa758e374 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-space.creq b/modules/core/src/test/resources/aws4_testsuite/get-space.creq deleted file mode 100755 index e34ff1a..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-space.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/%20/foo - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-space.req b/modules/core/src/test/resources/aws4_testsuite/get-space.req deleted file mode 100755 index 0c64446..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-space.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /%20/foo http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-space.sreq b/modules/core/src/test/resources/aws4_testsuite/get-space.sreq deleted file mode 100755 index 3fde5d2..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-space.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /%20/foo http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=f309cfbd10197a230c42dd17dbf5cca8a0722564cb40a872d25623cfa758e374 - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-space.sts b/modules/core/src/test/resources/aws4_testsuite/get-space.sts deleted file mode 100755 index 48b7200..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-space.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -69c45fb9fe3fd76442b5086e50b2e9fec8298358da957b293ef26e506fdfb54b \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.authz b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.authz deleted file mode 100755 index 99d2016..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=830cc36d03f0f84e6ee4953fbe701c1c8b71a0372c63af9255aa364dd183281e \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.creq b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.creq deleted file mode 100755 index a0c0c2b..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.req b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.req deleted file mode 100755 index d88a5d7..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sreq b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sreq deleted file mode 100755 index 8e9280b..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=830cc36d03f0f84e6ee4953fbe701c1c8b71a0372c63af9255aa364dd183281e - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sts b/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sts deleted file mode 100755 index c02109b..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-unreserved.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -df63ee3247c0356c696a3b21f8d8490b01fa9cd5bc6550ef5ef5f4636b7b8901 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-utf8.authz b/modules/core/src/test/resources/aws4_testsuite/get-utf8.authz deleted file mode 100755 index a8b8492..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-utf8.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=8d6634c189aa8c75c2e51e106b6b5121bed103fdb351f7d7d4381c738823af74 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-utf8.creq b/modules/core/src/test/resources/aws4_testsuite/get-utf8.creq deleted file mode 100755 index 65946cb..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-utf8.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/%E1%88%B4 - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-utf8.req b/modules/core/src/test/resources/aws4_testsuite/get-utf8.req deleted file mode 100755 index 83291e8..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-utf8.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /%E1%88%B4 http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-utf8.sreq b/modules/core/src/test/resources/aws4_testsuite/get-utf8.sreq deleted file mode 100755 index 1d69c23..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-utf8.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /%E1%88%B4 http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=8d6634c189aa8c75c2e51e106b6b5121bed103fdb351f7d7d4381c738823af74 - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-utf8.sts b/modules/core/src/test/resources/aws4_testsuite/get-utf8.sts deleted file mode 100755 index 63871e5..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-utf8.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -27ba31df5dbc6e063d8f87d62eb07143f7f271c5330a917840586ac1c85b6f6b \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.authz deleted file mode 100755 index cb7a1cc..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=56c054473fd260c13e4e7393eb203662195f5d4a1fada5314b8b52b23f985e9f \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.creq deleted file mode 100755 index 1efbecf..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ -foo=bar -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.req deleted file mode 100755 index fac3491..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /?foo=bar http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sreq deleted file mode 100755 index 71d5463..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /?foo=bar http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=56c054473fd260c13e4e7393eb203662195f5d4a1fada5314b8b52b23f985e9f - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sts deleted file mode 100755 index 785c7e5..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-empty-query-key.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -0846c2945b0832deb7a463c66af5c4f8bd54ec28c438e67a214445b157c9ddf8 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.authz deleted file mode 100755 index 10fe960..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=be7148d34ebccdc6423b19085378aa0bee970bdc61d144bd1a8c48c33079ab09 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.creq deleted file mode 100755 index f1e99d1..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ -foo=Zoo&foo=aha -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.req deleted file mode 100755 index d5e81df..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /?foo=Zoo&foo=aha http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sreq deleted file mode 100755 index a438d93..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /?foo=Zoo&foo=aha http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=be7148d34ebccdc6423b19085378aa0bee970bdc61d144bd1a8c48c33079ab09 - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sts deleted file mode 100755 index 4d255cc..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key-case.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -e25f777ba161a0f1baf778a87faf057187cf5987f17953320e3ca399feb5f00d \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.authz deleted file mode 100755 index bc5463e..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.creq deleted file mode 100755 index 46b1c0f..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ -a=foo&b=foo -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.req deleted file mode 100755 index f1b75b1..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /?a=foo&b=foo http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sreq deleted file mode 100755 index 7cb2519..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /?a=foo&b=foo http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=0dc122f3b28b831ab48ba65cb47300de53fbe91b577fe113edac383730254a3b - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sts deleted file mode 100755 index e791351..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-key.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -2f23d14fe13caebf6dfda346285c6d9c14f49eaca8f5ec55c627dd7404f7a727 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.authz deleted file mode 100755 index 9b96017..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=feb926e49e382bec75c9d7dcb2a1b6dc8aa50ca43c25d2bc51143768c0875acc \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.creq deleted file mode 100755 index 3c0d516..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ -foo=a&foo=b -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.req deleted file mode 100755 index 004f153..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /?foo=b&foo=a http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sreq deleted file mode 100755 index 61bd549..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /?foo=b&foo=a http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=feb926e49e382bec75c9d7dcb2a1b6dc8aa50ca43c25d2bc51143768c0875acc - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sts deleted file mode 100755 index 95becb2..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-order-value.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -33dffc220e89131f8f6157a35c40903daa658608d9129ff9489e5cf5bbd9b11b \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.authz deleted file mode 100755 index bc28668..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=f1498ddb4d6dae767d97c466fb92f1b59a2c71ca29ac954692663f9db03426fb \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.creq deleted file mode 100755 index 4a43670..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ --._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.req deleted file mode 100755 index 72f6173..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /?-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sreq deleted file mode 100755 index a18d653..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /?-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=-._~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=f1498ddb4d6dae767d97c466fb92f1b59a2c71ca29ac954692663f9db03426fb - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sts deleted file mode 100755 index b454387..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query-unreserved.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -d2578f3156d4c9d180713d1ff20601d8a3eed0dd35447d24603d7d67414bd6b5 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.authz deleted file mode 100755 index 06bd813..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.creq deleted file mode 100755 index 8519923..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.req deleted file mode 100755 index 77b339a..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.req +++ /dev/null @@ -1,4 +0,0 @@ -GET / http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sreq deleted file mode 100755 index bd1f8f2..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET / http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sts deleted file mode 100755 index c7bcc67..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-query.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.authz deleted file mode 100755 index 8e925e3..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=6fb359e9a05394cc7074e0feb42573a2601abc0c869a953e8c5c12e4e01f1a8c \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.creq deleted file mode 100755 index 9e4be3c..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ -%E1%88%B4=bar -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.req deleted file mode 100755 index 581e335..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.req +++ /dev/null @@ -1,4 +0,0 @@ -GET /?ሴ=bar http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sreq deleted file mode 100755 index 4f108da..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET /?ሴ=bar http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=6fb359e9a05394cc7074e0feb42573a2601abc0c869a953e8c5c12e4e01f1a8c - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sts deleted file mode 100755 index d14eedf..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla-ut8-query.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -de5065ff39c131e6c2e2bd19cd9345a794bf3b561eab20b8d97b2093fc2a979e \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.authz b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.authz deleted file mode 100755 index 06bd813..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.creq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.creq deleted file mode 100755 index 8519923..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.creq +++ /dev/null @@ -1,8 +0,0 @@ -GET -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.req b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.req deleted file mode 100755 index 77b339a..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.req +++ /dev/null @@ -1,4 +0,0 @@ -GET / http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sreq b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sreq deleted file mode 100755 index bd1f8f2..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sreq +++ /dev/null @@ -1,5 +0,0 @@ -GET / http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b27ccfbfa7df52a200ff74193ca6e32d4b48b8856fab7ebf1c595d0670a7e470 - diff --git a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sts b/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sts deleted file mode 100755 index c7bcc67..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/get-vanilla.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -366b91fb121d72a00f46bbe8d395f53a102b06dfb7e79636515208ed3fa606b1 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.authz b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.authz deleted file mode 100755 index a6a7cbb..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.creq b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.creq deleted file mode 100755 index a1c8480..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.creq +++ /dev/null @@ -1,8 +0,0 @@ -POST -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.req b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.req deleted file mode 100755 index 67d74a3..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.req +++ /dev/null @@ -1,4 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sreq b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sreq deleted file mode 100755 index 97875f9..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sreq +++ /dev/null @@ -1,5 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726 - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sts b/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sts deleted file mode 100755 index 30fb98a..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-key-case.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -05da62cee468d24ae84faff3c39f1b85540de60243c1bcaace39c0a2acc7b2c4 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.authz b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.authz deleted file mode 100755 index fdcbdd9..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=b7a95a52518abbca0964a999a880429ab734f35ebbf1235bd79a5de87756dc4a \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.creq b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.creq deleted file mode 100755 index 7cea8ea..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.creq +++ /dev/null @@ -1,9 +0,0 @@ -POST -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -zoo:zoobar - -date;host;zoo -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.req b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.req deleted file mode 100755 index 61c73de..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.req +++ /dev/null @@ -1,5 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -ZOO:zoobar - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sreq b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sreq deleted file mode 100755 index a645b45..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sreq +++ /dev/null @@ -1,6 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -ZOO:zoobar -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=b7a95a52518abbca0964a999a880429ab734f35ebbf1235bd79a5de87756dc4a - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sts b/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sts deleted file mode 100755 index 3cf1dd7..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-key-sort.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -34e1bddeb99e76ee01d63b5e28656111e210529efeec6cdfd46a48e4c734545d \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.authz b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.authz deleted file mode 100755 index 651c954..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=273313af9d0c265c531e11db70bbd653f3ba074c1009239e8559d3987039cad7 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.creq b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.creq deleted file mode 100755 index e97491d..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.creq +++ /dev/null @@ -1,9 +0,0 @@ -POST -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -zoo:ZOOBAR - -date;host;zoo -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.req b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.req deleted file mode 100755 index f687230..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.req +++ /dev/null @@ -1,5 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -zoo:ZOOBAR - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sreq b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sreq deleted file mode 100755 index 5f95618..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sreq +++ /dev/null @@ -1,6 +0,0 @@ -POST / http/1.1 -DATE:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com -zoo:ZOOBAR -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host;zoo, Signature=273313af9d0c265c531e11db70bbd653f3ba074c1009239e8559d3987039cad7 - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sts b/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sts deleted file mode 100755 index e67301c..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-header-value-case.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -3aae6d8274b8c03e2cc96fc7d6bda4b9bd7a0a184309344470b2c96953e124aa \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.authz b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.authz deleted file mode 100755 index acfa0fe..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.creq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.creq deleted file mode 100755 index f46634d..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.creq +++ /dev/null @@ -1,8 +0,0 @@ -POST -/ -foo=bar -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.req b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.req deleted file mode 100755 index 1351de5..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.req +++ /dev/null @@ -1,4 +0,0 @@ -POST /?foo=bar http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sreq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sreq deleted file mode 100755 index 662dd6b..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sreq +++ /dev/null @@ -1,5 +0,0 @@ -POST /?foo=bar http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92 - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sts b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sts deleted file mode 100755 index fddcbb7..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-empty-query-value.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -cd4f39132d8e60bb388831d734230460872b564871c47f5de62e62d1a68dbe1e \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.authz b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.authz deleted file mode 100755 index e97bdaa..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=28675d93ac1d686ab9988d6617661da4dffe7ba848a2285cb75eac6512e861f9 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.creq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.creq deleted file mode 100755 index 48b903f..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.creq +++ /dev/null @@ -1,8 +0,0 @@ -POST -/ -%20=%2F%2C%3F%3E%3C%60%22%3B%3A%5C%7C%5D%5B%7B%7D&%40%23%24%25%5E= -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.req b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.req deleted file mode 100755 index 1821438..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.req +++ /dev/null @@ -1,4 +0,0 @@ -POST /?@#$%^&+=/,?><`";:\|][{} =@#$%^&+=/,?><`";:\|][{} http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sreq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sreq deleted file mode 100755 index 0b53fd7..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sreq +++ /dev/null @@ -1,5 +0,0 @@ -POST /?@#$%^&+=/,?><`";:\|][{} =@#$%^&+=/,?><`";:\|][{} http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=28675d93ac1d686ab9988d6617661da4dffe7ba848a2285cb75eac6512e861f9 - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sts b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sts deleted file mode 100755 index 0df239b..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-nonunreserved.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -eb3f16b23b20c91e1b5d6f3cd1c1f8c32a6ddcae6024e44bcfa980fbf8561f6c \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.authz b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.authz deleted file mode 100755 index 59ccfcb..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b7eb653abe5f846e7eee4d1dba33b15419dc424aaf215d49b1240732b10cc4ca \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.creq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.creq deleted file mode 100755 index 0cb49e5..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.creq +++ /dev/null @@ -1,8 +0,0 @@ -POST -/ -f= -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.req b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.req deleted file mode 100755 index fca4e4a..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.req +++ /dev/null @@ -1,4 +0,0 @@ -POST /?f oo=b ar http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sreq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sreq deleted file mode 100755 index f9d2f73..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sreq +++ /dev/null @@ -1,5 +0,0 @@ -POST /?f oo=b ar http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b7eb653abe5f846e7eee4d1dba33b15419dc424aaf215d49b1240732b10cc4ca - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sts b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sts deleted file mode 100755 index bff0d26..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query-space.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -0d5f8ed88e9cd0a2a093e1719fff945e3718d30a6b240b9de994cdf9442c89f5 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.authz b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.authz deleted file mode 100755 index acfa0fe..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.creq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.creq deleted file mode 100755 index f46634d..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.creq +++ /dev/null @@ -1,8 +0,0 @@ -POST -/ -foo=bar -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.req b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.req deleted file mode 100755 index 1351de5..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.req +++ /dev/null @@ -1,4 +0,0 @@ -POST /?foo=bar http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sreq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sreq deleted file mode 100755 index 662dd6b..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sreq +++ /dev/null @@ -1,5 +0,0 @@ -POST /?foo=bar http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=b6e3b79003ce0743a491606ba1035a804593b0efb1e20a11cba83f8c25a57a92 - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sts b/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sts deleted file mode 100755 index fddcbb7..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla-query.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -cd4f39132d8e60bb388831d734230460872b564871c47f5de62e62d1a68dbe1e \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.authz b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.authz deleted file mode 100755 index a6a7cbb..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.creq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.creq deleted file mode 100755 index a1c8480..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.creq +++ /dev/null @@ -1,8 +0,0 @@ -POST -/ - -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -date;host -e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.req b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.req deleted file mode 100755 index b072b83..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.req +++ /dev/null @@ -1,4 +0,0 @@ -POST / http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sreq b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sreq deleted file mode 100755 index f2f199a..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sreq +++ /dev/null @@ -1,5 +0,0 @@ -POST / http/1.1 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=date;host, Signature=22902d79e148b64e7571c3565769328423fe276eae4b26f83afceda9e767f726 - diff --git a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sts b/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sts deleted file mode 100755 index 30fb98a..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-vanilla.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -05da62cee468d24ae84faff3c39f1b85540de60243c1bcaace39c0a2acc7b2c4 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.authz b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.authz deleted file mode 100755 index 438b01c..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=b105eb10c6d318d2294de9d49dd8b031b55e3c3fe139f2e637da70511e9e7b71 \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.creq b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.creq deleted file mode 100755 index 56a9b26..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.creq +++ /dev/null @@ -1,9 +0,0 @@ -POST -/ - -content-type:application/x-www-form-urlencoded; charset=utf8 -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -content-type;date;host -3ba8907e7a252327488df390ed517c45b96dead033600219bdca7107d1d3f88a \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.req b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.req deleted file mode 100755 index b537b64..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.req +++ /dev/null @@ -1,6 +0,0 @@ -POST / http/1.1 -Content-Type:application/x-www-form-urlencoded; charset=utf8 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - -foo=bar \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sreq b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sreq deleted file mode 100755 index 4c351dd..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sreq +++ /dev/null @@ -1,7 +0,0 @@ -POST / http/1.1 -Content-Type:application/x-www-form-urlencoded; charset=utf8 -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=b105eb10c6d318d2294de9d49dd8b031b55e3c3fe139f2e637da70511e9e7b71 - -foo=bar \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sts b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sts deleted file mode 100755 index df165ed..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded-parameters.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -c4115f9e54b5cecf192b1eaa23b8e88ed8dc5391bd4fde7b3fff3d9c9fe0af1f \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.authz b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.authz deleted file mode 100755 index 73b6478..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.authz +++ /dev/null @@ -1 +0,0 @@ -AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=5a15b22cf462f047318703b92e6f4f38884e4a7ab7b1d6426ca46a8bd1c26cbc \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.creq b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.creq deleted file mode 100755 index e4c5127..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.creq +++ /dev/null @@ -1,9 +0,0 @@ -POST -/ - -content-type:application/x-www-form-urlencoded -date:Mon, 09 Sep 2011 23:36:00 GMT -host:host.foo.com - -content-type;date;host -3ba8907e7a252327488df390ed517c45b96dead033600219bdca7107d1d3f88a \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.req b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.req deleted file mode 100755 index fd58d79..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.req +++ /dev/null @@ -1,6 +0,0 @@ -POST / http/1.1 -Content-Type:application/x-www-form-urlencoded -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com - -foo=bar \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sreq b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sreq deleted file mode 100755 index 3c66800..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sreq +++ /dev/null @@ -1,7 +0,0 @@ -POST / http/1.1 -Content-Type:application/x-www-form-urlencoded -Date:Mon, 09 Sep 2011 23:36:00 GMT -Host:host.foo.com -Authorization: AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20110909/us-east-1/host/aws4_request, SignedHeaders=content-type;date;host, Signature=5a15b22cf462f047318703b92e6f4f38884e4a7ab7b1d6426ca46a8bd1c26cbc - -foo=bar \ No newline at end of file diff --git a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sts b/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sts deleted file mode 100755 index b6661a3..0000000 --- a/modules/core/src/test/resources/aws4_testsuite/post-x-www-form-urlencoded.sts +++ /dev/null @@ -1,4 +0,0 @@ -AWS4-HMAC-SHA256 -20110909T233600Z -20110909/us-east-1/host/aws4_request -4c5c6e4b52fb5fb947a8733982a8a5a61b14f04345cbfe6e739236c76dd48f74 \ No newline at end of file diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/BaseRxHttpClient.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/BuildValidation.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/BuildValidation.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/BuildValidation.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/BuildValidation.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/Builder.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Builder.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/Builder.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/Builder.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequest.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestBuilder.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestBuilder.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestBuilder.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestBuilder.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestLogFormatter.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestLogFormatter.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestLogFormatter.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/ClientRequestLogFormatter.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/CompatUtilities.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/DefaultClientRequestLogFormatter.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/DefaultClientRequestLogFormatter.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/DefaultClientRequestLogFormatter.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/DefaultClientRequestLogFormatter.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/HTTPStatusCode.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/HTTPStatusCode.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/HTTPStatusCode.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/HTTPStatusCode.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpClientError.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpClientError.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpClientError.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpClientError.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpError.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpError.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpError.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpError.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpServerError.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpServerError.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/HttpServerError.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/HttpServerError.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/MutableResponseProcessor.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RequestSigner.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RequestSigner.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/RequestSigner.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/RequestSigner.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RestClientConfig.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RestClientConfig.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/RestClientConfig.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/RestClientConfig.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponse.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponse.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponse.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponse.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPart.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPart.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPart.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPart.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPartImpl.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPartImpl.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPartImpl.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseBodyPartImpl.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseElement.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseElement.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseElement.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseElement.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeaders.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeaders.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeaders.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeaders.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseHeadersImpl.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseStatus.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseStatus.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseStatus.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/ServerResponseStatus.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentials.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentials.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentials.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentials.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentialsProvider.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentialsProvider.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentialsProvider.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsCredentialsProvider.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsRegion.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsRegion.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsRegion.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsRegion.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsService.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsService.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsService.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsService.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsServiceEndPoint.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsServiceEndPoint.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsServiceEndPoint.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsServiceEndPoint.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsSignature4Signer.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsSignature4Signer.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsSignature4Signer.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/AwsSignature4Signer.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/ConstantAwsCredentialProvider.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/ConstantAwsCredentialProvider.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/ConstantAwsCredentialProvider.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/ConstantAwsCredentialProvider.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/DefaultEnvironment.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/DefaultEnvironment.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/DefaultEnvironment.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/DefaultEnvironment.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/Environment.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/Environment.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/Environment.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/Environment.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/EnvironmentCredentialsProvider.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/EnvironmentCredentialsProvider.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/EnvironmentCredentialsProvider.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/EnvironmentCredentialsProvider.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/InstanceCredentialsProvider.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/InstanceCredentialsProvider.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/InstanceCredentialsProvider.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/InstanceCredentialsProvider.java diff --git a/modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/UrlEncoder.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/UrlEncoder.java similarity index 100% rename from modules/core/src/main/java/be/wegenenverkeer/rxhttp/aws/UrlEncoder.java rename to modules/java/src/main/java/be/wegenenverkeer/rxhttp/aws/UrlEncoder.java From e5e6159c0c8de36f80fa10cad7adc07538188e25 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sat, 18 Apr 2020 17:04:40 +0200 Subject: [PATCH 10/30] RxStreamsHttpClient --- build.sbt | 2 +- .../rxhttp/rxstreams/RxStreamsHttpClient.java | 108 ++++++++++++++++++ .../rx/client/RxHttpApiTest.java | 55 +++++++++ .../rx/client/UsingWiremockRxStreams.java | 30 +++++ .../be/wegenenverkeer/rxhttp/Builder.java | 12 +- .../rxhttp/rxjava/RxJavaHttpClient.java | 2 +- .../java/be/wegenenverkeer/UsingWiremock.java | 28 +++++ .../wegenenverkeer/UsingWiremockRxJava.java | 33 ++++++ .../designtests/RxHttpClientDesignTests.java | 3 +- .../RxHttpClientMultipleRequests.java | 3 +- ...ClientObservableOfServerElementsTests.java | 3 +- .../designtests/RxHttpClientPostTests.java | 3 +- .../RxHttpClientTestChunkedResponse.java | 3 +- .../designtests/UsingWireMock.java | 44 ------- 14 files changed, 277 insertions(+), 52 deletions(-) create mode 100644 modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/rxstreams/RxStreamsHttpClient.java create mode 100644 modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/RxHttpApiTest.java create mode 100644 modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/UsingWiremockRxStreams.java create mode 100644 modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java create mode 100644 modules/java/src/test/java/be/wegenenverkeer/UsingWiremockRxJava.java delete mode 100644 modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java diff --git a/build.sbt b/build.sbt index d64e129..c59da49 100644 --- a/build.sbt +++ b/build.sbt @@ -101,7 +101,7 @@ lazy val javaInteropModule = (project in file("modules/java-interop")).settings( javacOptions ++= Seq("--release", "11"), libraryDependencies ++= javaDependencies ++ interopDependencies, extraJavaSettings -) dependsOn rxJavaModule +) dependsOn (rxJavaModule % "compile->compile;test->test") lazy val rxJavaModule = (project in file("modules/java")).settings( name := "RxHttpClient-RxJava", diff --git a/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/rxstreams/RxStreamsHttpClient.java b/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/rxstreams/RxStreamsHttpClient.java new file mode 100644 index 0000000..47c5375 --- /dev/null +++ b/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/rxstreams/RxStreamsHttpClient.java @@ -0,0 +1,108 @@ +package be.wegenenverkeer.rxhttp.rxstreams; + +import be.wegenenverkeer.rxhttp.*; +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; +import org.asynchttpclient.AsyncHttpClient; +import org.reactivestreams.Publisher; + +import java.nio.charset.Charset; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; + +/** + * Created by Karel Maesen, Geovise BVBA on 18/04/2020. + */ +public class RxStreamsHttpClient implements RxHttpClient { + + private final RxJavaHttpClient delegate; + + private RxStreamsHttpClient(RxJavaHttpClient delegate) { + this.delegate = delegate; + } + + @Override + public CompletableFuture execute(ClientRequest request, Function transformer) { + return delegate.execute(request, transformer); + } + + @Override + public Publisher executeToCompletion(ClientRequest request, Function transformer) { + return delegate.executeToCompletion(request, transformer); + } + + @Override + public Publisher executeObservably(ClientRequest request) { + return delegate.executeObservably(request); + } + + @Override + public Publisher executeAndDechunk(ClientRequest request, String separator) { + return delegate.executeAndDechunk(request, separator); + } + + @Override + public Publisher executeAndDechunk(ClientRequest request, String separator, Charset charset) { + return delegate.executeAndDechunk(request, separator, charset); + } + + @Override + public Publisher executeObservably(ClientRequest request, Function transform) { + return delegate.executeObservably(request, transform); + } + + @Override + public String getBaseUrl() { + return delegate.getBaseUrl(); + } + + @Override + public String getAccept() { + return delegate.getAccept(); + } + + @Override + public List getRequestSigners() { + return delegate.getRequestSigners(); + } + + @Override + public void close() { + delegate.close(); + } + + @Override + public ClientRequestBuilder requestBuilder() { + return delegate.requestBuilder(); + } + + @Override + public String toLogMessage(ClientRequest request) { + return delegate.toLogMessage(request); + } + + @Override + public AsyncHttpClient inner() { + return delegate.inner(); + } + + @Override + public int getMaxConnections() { + return delegate.getMaxConnections(); + } + + + public static class Builder extends be.wegenenverkeer.rxhttp.Builder { + + @Override + public RxStreamsHttpClient build() { + return super.build(); + } + + @Override + public RxStreamsHttpClient createClient(AsyncHttpClient innerClient, RestClientConfig rcConfig, ClientRequestLogFormatter logFmt, RequestSigner... signers) { + RxJavaHttpClient delegate = new RxJavaHttpClient.Builder().createClient(innerClient, rcConfig, logFmt, signers); + return new RxStreamsHttpClient(delegate); + } + } +} diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/RxHttpApiTest.java b/modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/RxHttpApiTest.java new file mode 100644 index 0000000..fa20cbd --- /dev/null +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/RxHttpApiTest.java @@ -0,0 +1,55 @@ +package be.wegenenverkeer.rx.client; + + +import be.wegenenverkeer.rxhttp.ClientRequest; +import io.reactivex.rxjava3.subscribers.TestSubscriber; +import org.junit.Test; +import org.reactivestreams.Publisher; +import org.reactivestreams.Subscriber; + +import java.nio.charset.Charset; +import java.util.concurrent.TimeUnit; + +import static com.github.tomakehurst.wiremock.client.WireMock.*; + +/** + * These tests ensure that the code compiles and provides the required + * interface. + * + * Functionality is tested in the RxJava (base) module. + * + * Created by Karel Maesen, Geovise BVBA on 18/04/2020. + */ +public class RxHttpApiTest extends UsingWiremockRxStreams { + + @Test + public void smokeTest(){ + String expectBody = "{ 'contacts': [1,2,3] }"; + stubFor(get(urlPathEqualTo("/contacts")) + .withQueryParam("q", equalTo("test")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(expectBody))); + + //set up use case + String path = "/contacts"; + ClientRequest request = client.requestBuilder() + .setMethod("GET") + .setUrlRelativetoBase(path) + .addQueryParam("q", "test") + .build(); + + Publisher publisher = client.executeObservably(request, bytes -> new String(bytes, Charset.forName("UTF8"))); + TestSubscriber testSubscriber = TestSubscriber.create(); + publisher.subscribe(testSubscriber); + + testSubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); + testSubscriber.assertNoErrors(); + testSubscriber.assertValues(expectBody); + + + } + +} diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/UsingWiremockRxStreams.java b/modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/UsingWiremockRxStreams.java new file mode 100644 index 0000000..a50189d --- /dev/null +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/UsingWiremockRxStreams.java @@ -0,0 +1,30 @@ +package be.wegenenverkeer.rx.client; + +import be.wegenenverkeer.UsingWiremock; +import be.wegenenverkeer.rxhttp.RxHttpClient; + +import be.wegenenverkeer.rxhttp.rxstreams.RxStreamsHttpClient; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +/** + * Created by Karel Maesen, Geovise BVBA on 18/04/2020. + */ +abstract public class UsingWiremockRxStreams extends UsingWiremock { + public static RxHttpClient client; + + @BeforeClass + public static void setUpAndStartServer() { + client = new RxStreamsHttpClient.Builder() + .setRequestTimeout(REQUEST_TIME_OUT) + .setMaxConnections(3) + .setAccept("application/json") + .setBaseUrl("http://localhost:" + port) + .build(); + } + + @AfterClass + public static void stopServer() { + client.close(); + } +} diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Builder.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Builder.java index 80ae26c..354273e 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Builder.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Builder.java @@ -66,7 +66,17 @@ public T build() { return createClient(innerClient, rcConfig, logFmt, requestSigners.toArray(new RequestSigner[0])); } - protected abstract T createClient(AsyncHttpClient innerClient, RestClientConfig rcConfig, ClientRequestLogFormatter logFmt, RequestSigner... signers); + //TODO -- make the createClient method protected or private. This implies a builder() factory method, rather than directly invoking a static inner class constructor + // to get a Builder + /** + * This is for internal use only. Clients are advised NOT to use this methode. + * @param innerClient + * @param rcConfig + * @param logFmt + * @param signers + * @return + */ + public abstract T createClient(AsyncHttpClient innerClient, RestClientConfig rcConfig, ClientRequestLogFormatter logFmt, RequestSigner... signers); diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java index 22a4dd0..84ef3b8 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/rxjava/RxJavaHttpClient.java @@ -154,7 +154,7 @@ public RxJavaHttpClient build() { } @Override - protected RxJavaHttpClient createClient(AsyncHttpClient innerClient, RestClientConfig rcConfig, ClientRequestLogFormatter logFmt, RequestSigner... signers) { + public RxJavaHttpClient createClient(AsyncHttpClient innerClient, RestClientConfig rcConfig, ClientRequestLogFormatter logFmt, RequestSigner... signers) { return new RxJavaHttpClient(innerClient, rcConfig, logFmt, requestSigners.toArray(new RequestSigner[0])); } diff --git a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java b/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java new file mode 100644 index 0000000..b26391d --- /dev/null +++ b/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java @@ -0,0 +1,28 @@ +package be.wegenenverkeer; + +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; +import com.github.tomakehurst.wiremock.core.Options; +import com.github.tomakehurst.wiremock.junit.WireMockRule; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; + +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; + +/** + * Created by Karel Maesen, Geovise BVBA on 18/04/2020. + */ +abstract public class UsingWiremock { + + public static final int REQUEST_TIME_OUT = 5000; + public static final int DEFAULT_TIME_OUT = REQUEST_TIME_OUT * 5; + public static int port = 8089; + + @Rule + public WireMockRule wireMockRule = new WireMockRule(options() + .port(port) + .useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.BODY_FILE) + ); + + +} diff --git a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremockRxJava.java b/modules/java/src/test/java/be/wegenenverkeer/UsingWiremockRxJava.java new file mode 100644 index 0000000..c53a5e4 --- /dev/null +++ b/modules/java/src/test/java/be/wegenenverkeer/UsingWiremockRxJava.java @@ -0,0 +1,33 @@ +package be.wegenenverkeer; + +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; +import com.github.tomakehurst.wiremock.core.Options; +import com.github.tomakehurst.wiremock.junit.WireMockRule; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; + +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; + +/** + * Created by Karel Maesen, Geovise BVBA on 19/12/14. + */ +abstract public class UsingWiremockRxJava extends UsingWiremock { + + public static RxJavaHttpClient client; + + @BeforeClass + public static void setUpAndStartServer() { + client = new RxJavaHttpClient.Builder() + .setRequestTimeout(REQUEST_TIME_OUT) + .setMaxConnections(3) + .setAccept("application/json") + .setBaseUrl("http://localhost:" + port) + .build(); + } + + @AfterClass + public static void stopServer() { + client.close(); + } +} diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java index 4895fb8..3dc1bbe 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java @@ -1,5 +1,6 @@ package be.wegenenverkeer.designtests; +import be.wegenenverkeer.UsingWiremockRxJava; import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.HttpClientError; import be.wegenenverkeer.rxhttp.HttpServerError; @@ -23,7 +24,7 @@ * Behavior Unit test * Created by Karel Maesen, Geovise BVBA on 06/12/14. */ -public class RxHttpClientDesignTests extends UsingWireMock { +public class RxHttpClientDesignTests extends UsingWiremockRxJava { @Test diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java index c1c033c..c3b1f26 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java @@ -1,5 +1,6 @@ package be.wegenenverkeer.designtests; +import be.wegenenverkeer.UsingWiremockRxJava; import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.ServerResponse; import com.jayway.jsonpath.JsonPath; @@ -18,7 +19,7 @@ /** * Created by Karel Maesen, Geovise BVBA on 27/11/15. */ -public class RxHttpClientMultipleRequests extends UsingWireMock { +public class RxHttpClientMultipleRequests extends UsingWiremockRxJava { private static Logger LOGGER = LoggerFactory.getLogger(RxHttpClientMultipleRequests.class); diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java index e0fe519..5522362 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java @@ -1,5 +1,6 @@ package be.wegenenverkeer.designtests; +import be.wegenenverkeer.UsingWiremockRxJava; import be.wegenenverkeer.rxhttp.*; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.subscribers.TestSubscriber; @@ -16,7 +17,7 @@ * Supports the same set of tests as {@link RxHttpClientDesignTests}, but uses the executeObservably(ServerRequest) method. * * Created by Karel Maesen, Geovise BVBA on 18/12/14. */ -public class RxHttpClientObservableOfServerElementsTests extends UsingWireMock { +public class RxHttpClientObservableOfServerElementsTests extends UsingWiremockRxJava { @Test public void GETHappyPath() { diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java index 0ec68f0..d9a908d 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java @@ -1,5 +1,6 @@ package be.wegenenverkeer.designtests; +import be.wegenenverkeer.UsingWiremockRxJava; import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.HttpClientError; import be.wegenenverkeer.rxhttp.ServerResponse; @@ -16,7 +17,7 @@ *

* Created by Karel Maesen, Geovise BVBA on 19/12/14. */ -public class RxHttpClientPostTests extends UsingWireMock { +public class RxHttpClientPostTests extends UsingWiremockRxJava { //this is a post that creates a contact entity, and then //retrieves it back from the server. diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java index 70c102a..06fa935 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java @@ -1,5 +1,6 @@ package be.wegenenverkeer.designtests; +import be.wegenenverkeer.UsingWiremockRxJava; import be.wegenenverkeer.rxhttp.ClientRequest; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.subscribers.TestSubscriber; @@ -18,7 +19,7 @@ * Created by Karel Maesen, Geovise BVBA on 18/12/14. */ -public class RxHttpClientTestChunkedResponse extends UsingWireMock { +public class RxHttpClientTestChunkedResponse extends UsingWiremockRxJava { @Test diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java deleted file mode 100644 index 8f98a71..0000000 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/UsingWireMock.java +++ /dev/null @@ -1,44 +0,0 @@ -package be.wegenenverkeer.designtests; - -import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; -import com.github.tomakehurst.wiremock.core.Options; -import com.github.tomakehurst.wiremock.junit.WireMockRule; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Rule; - -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; - -/** - * Created by Karel Maesen, Geovise BVBA on 19/12/14. - */ -abstract public class UsingWireMock { - - - static final int REQUEST_TIME_OUT = 5000; - static final int DEFAULT_TIME_OUT = REQUEST_TIME_OUT * 5; - static int port = 8089; - static RxJavaHttpClient client; - - @Rule - public WireMockRule wireMockRule = new WireMockRule(options() - .port(port) - .useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.BODY_FILE) - ); - - @BeforeClass - public static void setUpAndStartServer() { - - client = new RxJavaHttpClient.Builder() - .setRequestTimeout(REQUEST_TIME_OUT) - .setMaxConnections(3) - .setAccept("application/json") - .setBaseUrl("http://localhost:" + port) - .build(); - } - - @AfterClass - public static void stopServer() { - client.close(); - } -} From e872c26512779163e269ca6769543920bf23a11f Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sat, 18 Apr 2020 17:43:36 +0200 Subject: [PATCH 11/30] Adds ReactorHttpClient --- build.sbt | 4 +- .../rxhttp/reactor/ReactorHttpClient.java | 110 ++++++++++++++++++ .../client/RxHttpApiTest.java | 3 +- .../client/UsingWiremockRxStreams.java | 2 +- .../reactor/client/ReactorHttpTest.java | 49 ++++++++ .../reactor/client/UsingWiremockReactor.java | 30 +++++ 6 files changed, 194 insertions(+), 4 deletions(-) create mode 100644 modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/reactor/ReactorHttpClient.java rename modules/java-interop/src/test/java/be/wegenenverkeer/{rx => reactivestreams}/client/RxHttpApiTest.java (95%) rename modules/java-interop/src/test/java/be/wegenenverkeer/{rx => reactivestreams}/client/UsingWiremockRxStreams.java (94%) create mode 100644 modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/ReactorHttpTest.java create mode 100644 modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java diff --git a/build.sbt b/build.sbt index c59da49..981a615 100644 --- a/build.sbt +++ b/build.sbt @@ -23,6 +23,7 @@ val commonsCodec = "commons-codec" % "commons-codec" % "1.10" val json = "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "provided" val rx = "org.reactivestreams" % "reactive-streams" % rxStreamsVersion val reactorAdapter = "io.projectreactor.addons" % "reactor-adapter" % reactorVersion +val reactorTest = "io.projectreactor" % "reactor-test" % reactorVersion % "test" val rxJava = "io.reactivex.rxjava3" % "rxjava" % rxJavaVersion val specs2 = "org.specs2" %% "specs2-core" % "4.9.3" % "test" @@ -46,7 +47,8 @@ val rxJavaDependencies = Seq( lazy val interopDependencies = Seq( rx, - reactorAdapter + reactorAdapter, + reactorTest ) diff --git a/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/reactor/ReactorHttpClient.java b/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/reactor/ReactorHttpClient.java new file mode 100644 index 0000000..80bc9ff --- /dev/null +++ b/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/reactor/ReactorHttpClient.java @@ -0,0 +1,110 @@ +package be.wegenenverkeer.rxhttp.reactor; + +import be.wegenenverkeer.rxhttp.*; +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; +import be.wegenenverkeer.rxhttp.rxstreams.RxStreamsHttpClient; +import io.reactivex.rxjava3.core.Completable; +import org.asynchttpclient.AsyncHttpClient; +import reactor.adapter.rxjava.RxJava3Adapter; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.charset.Charset; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; + +/** + * Created by Karel Maesen, Geovise BVBA on 18/04/2020. + */ +public class ReactorHttpClient implements RxHttpClient { + + private final RxJavaHttpClient delegate; + + private ReactorHttpClient(RxJavaHttpClient delegate) { + this.delegate = delegate; + } + @Override + public CompletableFuture execute(ClientRequest request, Function transformer) { + return delegate.execute(request, transformer); + } + + @Override + public Mono executeToCompletion(ClientRequest request, Function transformer) { + return Mono.fromFuture(delegate.execute(request, transformer)); + } + + @Override + public Flux executeObservably(ClientRequest request) { + return RxJava3Adapter.flowableToFlux(delegate.executeObservably(request)); + } + + @Override + public Flux executeAndDechunk(ClientRequest request, String separator) { + return RxJava3Adapter.flowableToFlux(delegate.executeAndDechunk(request, separator)); + } + + @Override + public Flux executeAndDechunk(ClientRequest request, String separator, Charset charset) { + return RxJava3Adapter.flowableToFlux(delegate.executeAndDechunk(request, separator, charset)); + } + + @Override + public Flux executeObservably(ClientRequest request, Function transform) { + return RxJava3Adapter.flowableToFlux(delegate.executeObservably(request, transform)); + } + + @Override + public String getBaseUrl() { + return delegate.getBaseUrl(); + } + + @Override + public String getAccept() { + return delegate.getAccept(); + } + + @Override + public List getRequestSigners() { + return delegate.getRequestSigners(); + } + + @Override + public void close() { + delegate.close(); + } + + @Override + public ClientRequestBuilder requestBuilder() { + return delegate.requestBuilder(); + } + + @Override + public String toLogMessage(ClientRequest request) { + return delegate.toLogMessage(request); + } + + @Override + public AsyncHttpClient inner() { + return delegate.inner(); + } + + @Override + public int getMaxConnections() { + return delegate.getMaxConnections(); + } + + public static class Builder extends be.wegenenverkeer.rxhttp.Builder { + + @Override + public ReactorHttpClient build() { + return super.build(); + } + + @Override + public ReactorHttpClient createClient(AsyncHttpClient innerClient, RestClientConfig rcConfig, ClientRequestLogFormatter logFmt, RequestSigner... signers) { + RxJavaHttpClient delegate = new RxJavaHttpClient.Builder().createClient(innerClient, rcConfig, logFmt, signers); + return new ReactorHttpClient(delegate); + } + } +} diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/RxHttpApiTest.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/RxHttpApiTest.java similarity index 95% rename from modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/RxHttpApiTest.java rename to modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/RxHttpApiTest.java index fa20cbd..7cc8089 100644 --- a/modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/RxHttpApiTest.java +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/RxHttpApiTest.java @@ -1,11 +1,10 @@ -package be.wegenenverkeer.rx.client; +package be.wegenenverkeer.reactivestreams.client; import be.wegenenverkeer.rxhttp.ClientRequest; import io.reactivex.rxjava3.subscribers.TestSubscriber; import org.junit.Test; import org.reactivestreams.Publisher; -import org.reactivestreams.Subscriber; import java.nio.charset.Charset; import java.util.concurrent.TimeUnit; diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/UsingWiremockRxStreams.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWiremockRxStreams.java similarity index 94% rename from modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/UsingWiremockRxStreams.java rename to modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWiremockRxStreams.java index a50189d..f26d70c 100644 --- a/modules/java-interop/src/test/java/be/wegenenverkeer/rx/client/UsingWiremockRxStreams.java +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWiremockRxStreams.java @@ -1,4 +1,4 @@ -package be.wegenenverkeer.rx.client; +package be.wegenenverkeer.reactivestreams.client; import be.wegenenverkeer.UsingWiremock; import be.wegenenverkeer.rxhttp.RxHttpClient; diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/ReactorHttpTest.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/ReactorHttpTest.java new file mode 100644 index 0000000..94eee45 --- /dev/null +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/ReactorHttpTest.java @@ -0,0 +1,49 @@ +package be.wegenenverkeer.reactor.client; + +import be.wegenenverkeer.rxhttp.ClientRequest; +import org.junit.Test; +import reactor.core.publisher.Flux; +import reactor.test.StepVerifier; + +import java.nio.charset.Charset; +import static com.github.tomakehurst.wiremock.client.WireMock.*; + +/** + * These tests ensure that the code compiles and provides the required + * interface. + * + * Functionality is tested in the RxJava (base) module. + * + * Created by Karel Maesen, Geovise BVBA on 18/04/2020. + */ +public class ReactorHttpTest extends UsingWiremockReactor { + + @Test + public void smokeTest(){ + String expectBody = "{ 'contacts': [1,2,3] }"; + stubFor(get(urlPathEqualTo("/contacts")) + .withQueryParam("q", equalTo("test")) + .withHeader("Accept", equalTo("application/json")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(expectBody))); + + //set up use case + String path = "/contacts"; + ClientRequest request = client.requestBuilder() + .setMethod("GET") + .setUrlRelativetoBase(path) + .addQueryParam("q", "test") + .build(); + Flux flux = client.executeObservably(request, bytes -> new String(bytes, Charset.forName("UTF8"))); + + StepVerifier + .create(flux) + .expectNext(expectBody) + .expectComplete() + .verify(); + + } + +} diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java new file mode 100644 index 0000000..58061d2 --- /dev/null +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java @@ -0,0 +1,30 @@ +package be.wegenenverkeer.reactor.client; + +import be.wegenenverkeer.UsingWiremock; +import be.wegenenverkeer.rxhttp.RxHttpClient; +import be.wegenenverkeer.rxhttp.reactor.ReactorHttpClient; +import be.wegenenverkeer.rxhttp.rxstreams.RxStreamsHttpClient; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +/** + * Created by Karel Maesen, Geovise BVBA on 18/04/2020. + */ +abstract public class UsingWiremockReactor extends UsingWiremock { + public static ReactorHttpClient client; + + @BeforeClass + public static void setUpAndStartServer() { + client = new ReactorHttpClient.Builder() + .setRequestTimeout(REQUEST_TIME_OUT) + .setMaxConnections(3) + .setAccept("application/json") + .setBaseUrl("http://localhost:" + port) + .build(); + } + + @AfterClass + public static void stopServer() { + client.close(); + } +} From a60aa7a7cfa89563904e73bcbd611ad00731bc4f Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sat, 18 Apr 2020 18:02:41 +0200 Subject: [PATCH 12/30] Fix test execution problem --- build.sbt | 18 +++++++++++++++--- .../reactor/client/UsingWiremockReactor.java | 19 ++++++++++++++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 981a615..c4254f4 100644 --- a/build.sbt +++ b/build.sbt @@ -17,6 +17,7 @@ val asyncClient = "org.asynchttpclient" % "async-http-client" % "2.12.1" val rxStreamsVersion = "1.0.3" val rxJavaVersion = "3.0.1" val reactorVersion = "3.3.3.RELEASE" +val fs2Version = "2.2.1" val slf4j = "org.slf4j" % "slf4j-api" % "1.7.30" val commonsCodec = "commons-codec" % "commons-codec" % "1.10" @@ -58,6 +59,11 @@ val scalaDependencies = commonDependencies ++ Seq( specs2 ) +val fs2Dependencies = commonDependencies ++ scalaDependencies ++ Seq( + "co.fs2" %% "fs2-core" % fs2Version, + "co.fs2" %% "fs2-reactive-streams" % fs2Version +) + val mainTestDependencies = Seq( slf4jSimple, wiremock, @@ -79,6 +85,8 @@ lazy val moduleSettings = scalaVersion := ScalaVersion, scalacOptions := ScalaBuildOptions, parallelExecution := false, + Test / parallelExecution := false, + test / fork := true, resolvers += "Local Maven" at Path.userHome.asFile.toURI.toURL + ".m2/repository", resolvers += Resolver.typesafeRepo("releases"), resolvers += "Spring repository" at "https://repo.spring.io/milestone" @@ -88,7 +96,6 @@ lazy val extraJavaSettings = Seq( crossPaths := false, autoScalaLibrary := false, libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, - //Test / parallelExecution := false, // javacOptions ++= Seq("-Xlint:deprecation"), testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v") ) @@ -105,6 +112,12 @@ lazy val javaInteropModule = (project in file("modules/java-interop")).settings( extraJavaSettings ) dependsOn (rxJavaModule % "compile->compile;test->test") +lazy val fs2Module = (project in file("modules/fs2")).settings( + name := "RxHttpclient-fs2", + moduleSettings, + libraryDependencies ++= fs2Dependencies +).dependsOn(rxJavaModule % "compile->compile;test->test") + lazy val rxJavaModule = (project in file("modules/java")).settings( name := "RxHttpClient-RxJava", moduleSettings, @@ -113,13 +126,12 @@ lazy val rxJavaModule = (project in file("modules/java")).settings( extraJavaSettings ) - lazy val main = (project in file(".")) .settings( moduleSettings ++ disablePublishingRoot ++ extraJavaSettings, name := "RxHttpClient" ) - .aggregate(javaInteropModule, rxJavaModule) + .aggregate(javaInteropModule, rxJavaModule, fs2Module) lazy val pomInfo = https://github.com/WegenenVerkeer/atomium diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java index 58061d2..28a452a 100644 --- a/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java @@ -4,13 +4,30 @@ import be.wegenenverkeer.rxhttp.RxHttpClient; import be.wegenenverkeer.rxhttp.reactor.ReactorHttpClient; import be.wegenenverkeer.rxhttp.rxstreams.RxStreamsHttpClient; +import com.github.tomakehurst.wiremock.core.Options; +import com.github.tomakehurst.wiremock.junit.WireMockRule; import org.junit.AfterClass; import org.junit.BeforeClass; +import org.junit.Rule; + +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; /** * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -abstract public class UsingWiremockReactor extends UsingWiremock { +abstract public class UsingWiremockReactor{ + + //TODO -- this is a hack to solve issue with port-in-use conflict (Wiremock). + public static final int REQUEST_TIME_OUT = 5000; + public static final int DEFAULT_TIME_OUT = REQUEST_TIME_OUT * 5; + public static int port = 8088; + + @Rule + public WireMockRule wireMockRule = new WireMockRule(options() + .port(port) + .useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.BODY_FILE) + ); + public static ReactorHttpClient client; @BeforeClass From bd3e085515927c9865865eadba66a5f87b3dd79d Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sat, 18 Apr 2020 18:07:08 +0200 Subject: [PATCH 13/30] Package renames --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index c4254f4..6c5969f 100644 --- a/build.sbt +++ b/build.sbt @@ -105,7 +105,7 @@ lazy val testSettings = Seq( parallelExecution in Test := false ) lazy val javaInteropModule = (project in file("modules/java-interop")).settings( - name := "RxHttpClient-java-interop", + name := "RxHttpClient-interop", moduleSettings ++ extraJavaSettings, javacOptions ++= Seq("--release", "11"), libraryDependencies ++= javaDependencies ++ interopDependencies, @@ -119,7 +119,7 @@ lazy val fs2Module = (project in file("modules/fs2")).settings( ).dependsOn(rxJavaModule % "compile->compile;test->test") lazy val rxJavaModule = (project in file("modules/java")).settings( - name := "RxHttpClient-RxJava", + name := "RxHttpClient", moduleSettings, javacOptions ++= Seq("--release", "11"), libraryDependencies ++= javaDependencies ++ rxJavaDependencies, From 0bcda8baaa4869979a859ac7dd1ebb6a888d0c8b Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sat, 18 Apr 2020 19:36:51 +0200 Subject: [PATCH 14/30] First iteration for FS2 interop --- build.sbt | 5 ++- .../rxhttp/fs2interop/fs2interop.scala | 35 +++++++++++++++++++ src/test/resources/__files/sse-output.txt | 19 ---------- 3 files changed, 39 insertions(+), 20 deletions(-) create mode 100644 modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala delete mode 100644 src/test/resources/__files/sse-output.txt diff --git a/build.sbt b/build.sbt index 6c5969f..d42a221 100644 --- a/build.sbt +++ b/build.sbt @@ -9,7 +9,9 @@ val ScalaBuildOptions = Seq("-unchecked", "-feature", "-language:reflectiveCalls", "-language:implicitConversions", - "-language:postfixOps") + "-language:postfixOps", + "-Ypartial-unification", + "-language:higherKinds") val asyncClient = "org.asynchttpclient" % "async-http-client" % "2.12.1" @@ -77,6 +79,7 @@ lazy val disablePublishingRoot = Seq( publish / skip := true ) +addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.11.0" cross CrossVersion.full) lazy val moduleSettings = Seq( diff --git a/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala b/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala new file mode 100644 index 0000000..fa6b169 --- /dev/null +++ b/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala @@ -0,0 +1,35 @@ +package be.wegenenverkeer.rxhttp + +import java.nio.charset.Charset + +import be.wegenenverkeer.rxhttp +import be.wegenenverkeer.rxhttp.ClientRequest +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient +import cats.effect.{ConcurrentEffect, ContextShift} +import fs2.Stream +import fs2.interop.reactivestreams._ + +/** + * Created by Karel Maesen, Geovise BVBA on 18/04/2020. + */ +package object fs2interop { + + implicit class RxJavaHttpClientOps(client: RxJavaHttpClient) { + + def stream[F[_]:ConcurrentEffect](request: ClientRequest): Stream[F, ServerResponseElement] = + client.executeObservably(request).toStream() + + def streamDechunked[F[_]:ConcurrentEffect](request: ClientRequest, separator: String, charset: Charset) : Stream[F, String] = + client.executeAndDechunk(request, separator, charset).toStream() + + + def streamDechunked[F[_]:ConcurrentEffect](request: ClientRequest, separator: String) : Stream[F, String] = + client.executeAndDechunk(request, separator).toStream() + + def stream[F[_]: ConcurrentEffect, A](req: ClientRequest, transform: Array[Byte] => A) : Stream[F, A] = + client.executeObservably(req, (t: Array[Byte]) => transform(t)).toStream() + + //TODO return an async in stead of a (Completable)Future for a complete response + } + +} diff --git a/src/test/resources/__files/sse-output.txt b/src/test/resources/__files/sse-output.txt deleted file mode 100644 index a1516a2..0000000 --- a/src/test/resources/__files/sse-output.txt +++ /dev/null @@ -1,19 +0,0 @@ -data:{"id":804,"versie":3,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":1,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"BEZIG"}],"edeltaKey":"100000787"} - -data:{"id":804,"versie":4,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"}],"edeltaKey":"100000787"} - -data:{"id":804,"versie":5,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":1,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"BEZIG"}],"edeltaKey":"100000787"} - -data:{"id":804,"versie":6,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"}],"edeltaKey":"100000787"} - -data:{"id":804,"versie":7,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":1,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"BEZIG"}],"edeltaKey":"100000787"} - -data:{"id":804,"versie":8,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"GELUKT"}],"edeltaKey":"100000787"} - -data:{"id":804,"versie":9,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"GELUKT"},{"id":2716,"versie":1,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGSSTATEN_IMPORTEREN","stapBericht":"Uitvoeringsstaten (Posten) importeren","status":"BEZIG"}],"edeltaKey":"100000787"} - -data:{"id":804,"versie":10,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"GELUKT"},{"id":2716,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"stap":"UITVOERINGSSTATEN_IMPORTEREN","stapBericht":"Uitvoeringsstaten (Posten) importeren","status":"GELUKT"}],"edeltaKey":"100000787"} - -data:{"id":804,"versie":11,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"GELUKT"},{"id":2716,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"stap":"UITVOERINGSSTATEN_IMPORTEREN","stapBericht":"Uitvoeringsstaten (Posten) importeren","status":"GELUKT"},{"id":2717,"versie":1,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"stap":"BESTEK_OPSLAAN","stapBericht":"Gegevens opslaan","status":"BEZIG"}],"edeltaKey":"100000787"} - -data:{"id":804,"versie":12,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"GELUKT"},{"id":2716,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"stap":"UITVOERINGSSTATEN_IMPORTEREN","stapBericht":"Uitvoeringsstaten (Posten) importeren","status":"GELUKT"},{"id":2717,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"stap":"BESTEK_OPSLAAN","stapBericht":"Gegevens opslaan","status":"GELUKT"}],"edeltaKey":"100000787"} From 151aebb4f7f5b43903d31d03948e7240a86a1786 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sun, 19 Apr 2020 12:19:56 +0200 Subject: [PATCH 15/30] Complete first iteration FS2 interop --- build.sbt | 1 - .../rxhttp/fs2interop/fs2interop.scala | 22 +++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index d42a221..3f5eb20 100644 --- a/build.sbt +++ b/build.sbt @@ -10,7 +10,6 @@ val ScalaBuildOptions = Seq("-unchecked", "-language:reflectiveCalls", "-language:implicitConversions", "-language:postfixOps", - "-Ypartial-unification", "-language:higherKinds") diff --git a/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala b/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala index fa6b169..205c8c0 100644 --- a/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala +++ b/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala @@ -2,12 +2,14 @@ package be.wegenenverkeer.rxhttp import java.nio.charset.Charset -import be.wegenenverkeer.rxhttp -import be.wegenenverkeer.rxhttp.ClientRequest +import scala.jdk.FunctionConverters._ import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient -import cats.effect.{ConcurrentEffect, ContextShift} +import cats.effect.{Async, ConcurrentEffect} import fs2.Stream import fs2.interop.reactivestreams._ +import org.asynchttpclient.Response + +import scala.util.Try /** * Created by Karel Maesen, Geovise BVBA on 18/04/2020. @@ -16,6 +18,8 @@ package object fs2interop { implicit class RxJavaHttpClientOps(client: RxJavaHttpClient) { + + def stream[F[_]:ConcurrentEffect](request: ClientRequest): Stream[F, ServerResponseElement] = client.executeObservably(request).toStream() @@ -29,7 +33,17 @@ package object fs2interop { def stream[F[_]: ConcurrentEffect, A](req: ClientRequest, transform: Array[Byte] => A) : Stream[F, A] = client.executeObservably(req, (t: Array[Byte]) => transform(t)).toStream() - //TODO return an async in stead of a (Completable)Future for a complete response + def execute[F[_]: Async, A](req: ClientRequest, tr: ServerResponse => A): F[A] = { + def attemptTransform(resp: Response) : Either[Throwable, A] = + Try{ tr(ServerResponse.wrap(resp)) }.toEither + Async[F].async{ cb => + client.inner().executeRequest(req.unwrap()).toCompletableFuture + .whenComplete( (a, t) => + if (t==null) cb( attemptTransform(a)) else cb(Left(t)) ) + } + } + + } } From b512a0d985cceaa39346017c638dd02fbebfade8 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sun, 19 Apr 2020 13:33:02 +0200 Subject: [PATCH 16/30] Wiremock at random ports --- .../client/UsingWiremockRxStreams.java | 25 ++++------- .../reactor/client/UsingWiremockReactor.java | 36 +++------------- .../java/be/wegenenverkeer/UsingWiremock.java | 42 +++++++++++++++---- .../wegenenverkeer/UsingWiremockRxJava.java | 27 ++++-------- .../designtests/RxHttpClientDesignTests.java | 5 ++- .../RxHttpClientTestChunkedResponse.java | 2 +- 6 files changed, 58 insertions(+), 79 deletions(-) diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWiremockRxStreams.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWiremockRxStreams.java index f26d70c..784e918 100644 --- a/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWiremockRxStreams.java +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWiremockRxStreams.java @@ -1,30 +1,19 @@ package be.wegenenverkeer.reactivestreams.client; import be.wegenenverkeer.UsingWiremock; +import be.wegenenverkeer.rxhttp.Builder; import be.wegenenverkeer.rxhttp.RxHttpClient; - import be.wegenenverkeer.rxhttp.rxstreams.RxStreamsHttpClient; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.After; +import org.junit.Before; /** * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -abstract public class UsingWiremockRxStreams extends UsingWiremock { - public static RxHttpClient client; - - @BeforeClass - public static void setUpAndStartServer() { - client = new RxStreamsHttpClient.Builder() - .setRequestTimeout(REQUEST_TIME_OUT) - .setMaxConnections(3) - .setAccept("application/json") - .setBaseUrl("http://localhost:" + port) - .build(); - } +public class UsingWiremockRxStreams extends UsingWiremock { - @AfterClass - public static void stopServer() { - client.close(); + @Override + public Builder getBuilder() { + return new RxStreamsHttpClient.Builder(); } } diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java index 28a452a..49e2ec6 100644 --- a/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java @@ -1,47 +1,23 @@ package be.wegenenverkeer.reactor.client; import be.wegenenverkeer.UsingWiremock; +import be.wegenenverkeer.rxhttp.Builder; import be.wegenenverkeer.rxhttp.RxHttpClient; import be.wegenenverkeer.rxhttp.reactor.ReactorHttpClient; import be.wegenenverkeer.rxhttp.rxstreams.RxStreamsHttpClient; import com.github.tomakehurst.wiremock.core.Options; import com.github.tomakehurst.wiremock.junit.WireMockRule; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Rule; +import org.junit.*; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; /** * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -abstract public class UsingWiremockReactor{ +public class UsingWiremockReactor extends UsingWiremock { - //TODO -- this is a hack to solve issue with port-in-use conflict (Wiremock). - public static final int REQUEST_TIME_OUT = 5000; - public static final int DEFAULT_TIME_OUT = REQUEST_TIME_OUT * 5; - public static int port = 8088; - - @Rule - public WireMockRule wireMockRule = new WireMockRule(options() - .port(port) - .useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.BODY_FILE) - ); - - public static ReactorHttpClient client; - - @BeforeClass - public static void setUpAndStartServer() { - client = new ReactorHttpClient.Builder() - .setRequestTimeout(REQUEST_TIME_OUT) - .setMaxConnections(3) - .setAccept("application/json") - .setBaseUrl("http://localhost:" + port) - .build(); - } - - @AfterClass - public static void stopServer() { - client.close(); + @Override + public Builder getBuilder() { + return new ReactorHttpClient.Builder(); } } diff --git a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java b/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java index b26391d..d96b30a 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java +++ b/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java @@ -1,28 +1,54 @@ package be.wegenenverkeer; -import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; +import be.wegenenverkeer.rxhttp.Builder; +import be.wegenenverkeer.rxhttp.RxHttpClient; import com.github.tomakehurst.wiremock.core.Options; import com.github.tomakehurst.wiremock.junit.WireMockRule; -import org.junit.AfterClass; -import org.junit.BeforeClass; +import org.junit.After; +import org.junit.Before; import org.junit.Rule; + import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; /** * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -abstract public class UsingWiremock { +public class UsingWiremock { + + public final int REQUEST_TIME_OUT = 5000; + public final int DEFAULT_TIME_OUT = REQUEST_TIME_OUT * 5; - public static final int REQUEST_TIME_OUT = 5000; - public static final int DEFAULT_TIME_OUT = REQUEST_TIME_OUT * 5; - public static int port = 8089; + public C client; @Rule public WireMockRule wireMockRule = new WireMockRule(options() - .port(port) + .dynamicPort() .useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.BODY_FILE) ); + protected int port() { + return wireMockRule.port(); + } + ; + + @Before + public void setUpAndStartServer() { + System.out.println("Starting SERVER"); + client = getBuilder() + .setRequestTimeout(REQUEST_TIME_OUT) + .setMaxConnections(3) + .setAccept("application/json") + .setBaseUrl("http://localhost:" + port()) + .build(); + } + + @After + public void stopServer() { + System.out.println("Stopping SERVER"); + client.close(); + } + + public Builder getBuilder() { return null;} } diff --git a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremockRxJava.java b/modules/java/src/test/java/be/wegenenverkeer/UsingWiremockRxJava.java index c53a5e4..2794f67 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremockRxJava.java +++ b/modules/java/src/test/java/be/wegenenverkeer/UsingWiremockRxJava.java @@ -1,33 +1,20 @@ package be.wegenenverkeer; +import be.wegenenverkeer.rxhttp.Builder; import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; import com.github.tomakehurst.wiremock.core.Options; import com.github.tomakehurst.wiremock.junit.WireMockRule; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Rule; +import org.junit.*; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; /** * Created by Karel Maesen, Geovise BVBA on 19/12/14. */ -abstract public class UsingWiremockRxJava extends UsingWiremock { +public class UsingWiremockRxJava extends UsingWiremock { - public static RxJavaHttpClient client; - - @BeforeClass - public static void setUpAndStartServer() { - client = new RxJavaHttpClient.Builder() - .setRequestTimeout(REQUEST_TIME_OUT) - .setMaxConnections(3) - .setAccept("application/json") - .setBaseUrl("http://localhost:" + port) - .build(); - } - - @AfterClass - public static void stopServer() { - client.close(); - } + @Override + public Builder getBuilder() { + return new RxJavaHttpClient.Builder(); + } } diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java index 3dc1bbe..ab0bca2 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java @@ -8,6 +8,8 @@ import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.subscribers.TestSubscriber; +import org.junit.After; +import org.junit.Before; import org.junit.Test; import java.nio.charset.Charset; @@ -26,7 +28,6 @@ */ public class RxHttpClientDesignTests extends UsingWiremockRxJava { - @Test public void GETObservably() { //set up stub @@ -246,7 +247,7 @@ public void testConnectionTimeOut() { .setRequestTimeout(100) .setMaxConnections(1) .setAccept("application/json") - .setBaseUrl("http://localhost:" + port) + .setBaseUrl("http://localhost:" + port()) .build(); //set up use case diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java index 06fa935..aacde9b 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java @@ -40,7 +40,7 @@ public void testChunkedTransfer() { Flowable flowable = client.executeAndDechunk(request, "\n"); TestSubscriber subscriber = flowable.test(); - subscriber.awaitDone(120, TimeUnit.MILLISECONDS); + subscriber.awaitDone(200, TimeUnit.MILLISECONDS); subscriber.assertValueCount(10); From 274fe27cfb2a740f25fd3a40fa8f3a899b1f7ca6 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Sun, 19 Apr 2020 13:49:29 +0200 Subject: [PATCH 17/30] Fix missing SSE wiremock output --- src/test/resources/__files/sse-output.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/resources/__files/sse-output.txt diff --git a/src/test/resources/__files/sse-output.txt b/src/test/resources/__files/sse-output.txt new file mode 100644 index 0000000..a1516a2 --- /dev/null +++ b/src/test/resources/__files/sse-output.txt @@ -0,0 +1,19 @@ +data:{"id":804,"versie":3,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":1,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"BEZIG"}],"edeltaKey":"100000787"} + +data:{"id":804,"versie":4,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"}],"edeltaKey":"100000787"} + +data:{"id":804,"versie":5,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":1,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"BEZIG"}],"edeltaKey":"100000787"} + +data:{"id":804,"versie":6,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"}],"edeltaKey":"100000787"} + +data:{"id":804,"versie":7,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":1,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"BEZIG"}],"edeltaKey":"100000787"} + +data:{"id":804,"versie":8,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"GELUKT"}],"edeltaKey":"100000787"} + +data:{"id":804,"versie":9,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"GELUKT"},{"id":2716,"versie":1,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGSSTATEN_IMPORTEREN","stapBericht":"Uitvoeringsstaten (Posten) importeren","status":"BEZIG"}],"edeltaKey":"100000787"} + +data:{"id":804,"versie":10,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"GELUKT"},{"id":2716,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"stap":"UITVOERINGSSTATEN_IMPORTEREN","stapBericht":"Uitvoeringsstaten (Posten) importeren","status":"GELUKT"}],"edeltaKey":"100000787"} + +data:{"id":804,"versie":11,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"GELUKT"},{"id":2716,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"stap":"UITVOERINGSSTATEN_IMPORTEREN","stapBericht":"Uitvoeringsstaten (Posten) importeren","status":"GELUKT"},{"id":2717,"versie":1,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"stap":"BESTEK_OPSLAAN","stapBericht":"Gegevens opslaan","status":"BEZIG"}],"edeltaKey":"100000787"} + +data:{"id":804,"versie":12,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"status":"BEZIG","eDeltaKey":"100000787","stappen":[{"id":2713,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:07"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"stap":"OPDRACHT_KOPPELEN","stapBericht":"Bestek koppelen met eDelta opdracht","status":"GELUKT"},{"id":2714,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:08"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"OPDRACHT_DETAILS_OPHALEN","stapBericht":"Ophalen van details eDelta opdracht","status":"GELUKT"},{"id":2715,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"stap":"UITVOERINGEN_KOPPELEN","stapBericht":"Koppelen met contractjaar(en)","status":"GELUKT"},{"id":2716,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:12"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"stap":"UITVOERINGSSTATEN_IMPORTEREN","stapBericht":"Uitvoeringsstaten (Posten) importeren","status":"GELUKT"},{"id":2717,"versie":2,"creationEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"lastUpdateEvent":{"naam":"VeryLongLastName","voornaam":"VeryLongFirstName","ldapId":"SomeLDAPID","voId":"e97b22a7-c3c6-46ff-8ff-90ffffffff9ec85","voornaamNaam":"VeryLongFirstName VeryLongLastName","naamVoornaam":"VeryLongLastName VeryLongFirstName","tijdstip":"2019-07-04T14:02:15"},"stap":"BESTEK_OPSLAAN","stapBericht":"Gegevens opslaan","status":"GELUKT"}],"edeltaKey":"100000787"} From afcf26566156d6795dff152f7c12dcc4e05c8395 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Mon, 20 Apr 2020 10:29:54 +0200 Subject: [PATCH 18/30] Cleanup println statements --- modules/fs2/src/test/scala/Fs2InteropSpecification.scala | 6 ++++++ modules/fs2/src/test/scala/WiremockSupport.scala | 6 ++++++ .../java/src/test/java/be/wegenenverkeer/UsingWiremock.java | 2 -- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 modules/fs2/src/test/scala/Fs2InteropSpecification.scala create mode 100644 modules/fs2/src/test/scala/WiremockSupport.scala diff --git a/modules/fs2/src/test/scala/Fs2InteropSpecification.scala b/modules/fs2/src/test/scala/Fs2InteropSpecification.scala new file mode 100644 index 0000000..ac5ead3 --- /dev/null +++ b/modules/fs2/src/test/scala/Fs2InteropSpecification.scala @@ -0,0 +1,6 @@ +/** + * Created by Karel Maesen, Geovise BVBA on 20/04/2020. + */ +class Fs2InteropSpecification { + +} diff --git a/modules/fs2/src/test/scala/WiremockSupport.scala b/modules/fs2/src/test/scala/WiremockSupport.scala new file mode 100644 index 0000000..e3f4952 --- /dev/null +++ b/modules/fs2/src/test/scala/WiremockSupport.scala @@ -0,0 +1,6 @@ +/** + * Created by Karel Maesen, Geovise BVBA on 20/04/2020. + */ +trait WiremockSupport { + +} diff --git a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java b/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java index d96b30a..bfaca1c 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java +++ b/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java @@ -34,7 +34,6 @@ protected int port() { @Before public void setUpAndStartServer() { - System.out.println("Starting SERVER"); client = getBuilder() .setRequestTimeout(REQUEST_TIME_OUT) .setMaxConnections(3) @@ -45,7 +44,6 @@ public void setUpAndStartServer() { @After public void stopServer() { - System.out.println("Stopping SERVER"); client.close(); } From ea3da5cf363be8c42e7b315ded53255d12b29c50 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Mon, 20 Apr 2020 10:41:32 +0200 Subject: [PATCH 19/30] Consistent names for WireMock classes --- ...ockSupport.scala => WireMockSupport.scala} | 0 .../reactivestreams/client/RxHttpApiTest.java | 2 +- ...reams.java => UsingWireMockRxStreams.java} | 7 ++---- .../reactor/client/ReactorHttpTest.java | 2 +- .../reactor/client/UsingWireMockReactor.java | 16 +++++++++++++ .../reactor/client/UsingWiremockReactor.java | 23 ------------------- ...{UsingWiremock.java => UsingWireMock.java} | 2 +- ...ckRxJava.java => UsingWireMockRxJava.java} | 7 +----- .../designtests/RxHttpClientDesignTests.java | 6 ++--- .../RxHttpClientMultipleRequests.java | 4 ++-- ...ClientObservableOfServerElementsTests.java | 4 ++-- .../designtests/RxHttpClientPostTests.java | 4 ++-- .../RxHttpClientTestChunkedResponse.java | 4 ++-- 13 files changed, 32 insertions(+), 49 deletions(-) rename modules/fs2/src/test/scala/{WiremockSupport.scala => WireMockSupport.scala} (100%) rename modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/{UsingWiremockRxStreams.java => UsingWireMockRxStreams.java} (62%) create mode 100644 modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWireMockReactor.java delete mode 100644 modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java rename modules/java/src/test/java/be/wegenenverkeer/{UsingWiremock.java => UsingWireMock.java} (96%) rename modules/java/src/test/java/be/wegenenverkeer/{UsingWiremockRxJava.java => UsingWireMockRxJava.java} (53%) diff --git a/modules/fs2/src/test/scala/WiremockSupport.scala b/modules/fs2/src/test/scala/WireMockSupport.scala similarity index 100% rename from modules/fs2/src/test/scala/WiremockSupport.scala rename to modules/fs2/src/test/scala/WireMockSupport.scala diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/RxHttpApiTest.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/RxHttpApiTest.java index 7cc8089..15c30cf 100644 --- a/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/RxHttpApiTest.java +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/RxHttpApiTest.java @@ -19,7 +19,7 @@ * * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -public class RxHttpApiTest extends UsingWiremockRxStreams { +public class RxHttpApiTest extends UsingWireMockRxStreams { @Test public void smokeTest(){ diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWiremockRxStreams.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWireMockRxStreams.java similarity index 62% rename from modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWiremockRxStreams.java rename to modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWireMockRxStreams.java index 784e918..1c9875c 100644 --- a/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWiremockRxStreams.java +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWireMockRxStreams.java @@ -1,16 +1,13 @@ package be.wegenenverkeer.reactivestreams.client; -import be.wegenenverkeer.UsingWiremock; +import be.wegenenverkeer.UsingWireMock; import be.wegenenverkeer.rxhttp.Builder; -import be.wegenenverkeer.rxhttp.RxHttpClient; import be.wegenenverkeer.rxhttp.rxstreams.RxStreamsHttpClient; -import org.junit.After; -import org.junit.Before; /** * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -public class UsingWiremockRxStreams extends UsingWiremock { +public class UsingWireMockRxStreams extends UsingWireMock { @Override public Builder getBuilder() { diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/ReactorHttpTest.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/ReactorHttpTest.java index 94eee45..729a404 100644 --- a/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/ReactorHttpTest.java +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/ReactorHttpTest.java @@ -16,7 +16,7 @@ * * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -public class ReactorHttpTest extends UsingWiremockReactor { +public class ReactorHttpTest extends UsingWireMockReactor { @Test public void smokeTest(){ diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWireMockReactor.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWireMockReactor.java new file mode 100644 index 0000000..629325f77 --- /dev/null +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWireMockReactor.java @@ -0,0 +1,16 @@ +package be.wegenenverkeer.reactor.client; + +import be.wegenenverkeer.UsingWireMock; +import be.wegenenverkeer.rxhttp.Builder; +import be.wegenenverkeer.rxhttp.reactor.ReactorHttpClient; + +/** + * Created by Karel Maesen, Geovise BVBA on 18/04/2020. + */ +public class UsingWireMockReactor extends UsingWireMock { + + @Override + public Builder getBuilder() { + return new ReactorHttpClient.Builder(); + } +} diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java deleted file mode 100644 index 49e2ec6..0000000 --- a/modules/java-interop/src/test/java/be/wegenenverkeer/reactor/client/UsingWiremockReactor.java +++ /dev/null @@ -1,23 +0,0 @@ -package be.wegenenverkeer.reactor.client; - -import be.wegenenverkeer.UsingWiremock; -import be.wegenenverkeer.rxhttp.Builder; -import be.wegenenverkeer.rxhttp.RxHttpClient; -import be.wegenenverkeer.rxhttp.reactor.ReactorHttpClient; -import be.wegenenverkeer.rxhttp.rxstreams.RxStreamsHttpClient; -import com.github.tomakehurst.wiremock.core.Options; -import com.github.tomakehurst.wiremock.junit.WireMockRule; -import org.junit.*; - -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; - -/** - * Created by Karel Maesen, Geovise BVBA on 18/04/2020. - */ -public class UsingWiremockReactor extends UsingWiremock { - - @Override - public Builder getBuilder() { - return new ReactorHttpClient.Builder(); - } -} diff --git a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java b/modules/java/src/test/java/be/wegenenverkeer/UsingWireMock.java similarity index 96% rename from modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java rename to modules/java/src/test/java/be/wegenenverkeer/UsingWireMock.java index bfaca1c..095eafa 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremock.java +++ b/modules/java/src/test/java/be/wegenenverkeer/UsingWireMock.java @@ -14,7 +14,7 @@ /** * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -public class UsingWiremock { +public class UsingWireMock { public final int REQUEST_TIME_OUT = 5000; public final int DEFAULT_TIME_OUT = REQUEST_TIME_OUT * 5; diff --git a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremockRxJava.java b/modules/java/src/test/java/be/wegenenverkeer/UsingWireMockRxJava.java similarity index 53% rename from modules/java/src/test/java/be/wegenenverkeer/UsingWiremockRxJava.java rename to modules/java/src/test/java/be/wegenenverkeer/UsingWireMockRxJava.java index 2794f67..65dcc9c 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/UsingWiremockRxJava.java +++ b/modules/java/src/test/java/be/wegenenverkeer/UsingWireMockRxJava.java @@ -2,16 +2,11 @@ import be.wegenenverkeer.rxhttp.Builder; import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; -import com.github.tomakehurst.wiremock.core.Options; -import com.github.tomakehurst.wiremock.junit.WireMockRule; -import org.junit.*; - -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; /** * Created by Karel Maesen, Geovise BVBA on 19/12/14. */ -public class UsingWiremockRxJava extends UsingWiremock { +public class UsingWireMockRxJava extends UsingWireMock { @Override public Builder getBuilder() { diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java index ab0bca2..0a864f6 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientDesignTests.java @@ -1,6 +1,6 @@ package be.wegenenverkeer.designtests; -import be.wegenenverkeer.UsingWiremockRxJava; +import be.wegenenverkeer.UsingWireMockRxJava; import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.HttpClientError; import be.wegenenverkeer.rxhttp.HttpServerError; @@ -8,8 +8,6 @@ import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.subscribers.TestSubscriber; -import org.junit.After; -import org.junit.Before; import org.junit.Test; import java.nio.charset.Charset; @@ -26,7 +24,7 @@ * Behavior Unit test * Created by Karel Maesen, Geovise BVBA on 06/12/14. */ -public class RxHttpClientDesignTests extends UsingWiremockRxJava { +public class RxHttpClientDesignTests extends UsingWireMockRxJava { @Test public void GETObservably() { diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java index c3b1f26..2ca5bd9 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientMultipleRequests.java @@ -1,6 +1,6 @@ package be.wegenenverkeer.designtests; -import be.wegenenverkeer.UsingWiremockRxJava; +import be.wegenenverkeer.UsingWireMockRxJava; import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.ServerResponse; import com.jayway.jsonpath.JsonPath; @@ -19,7 +19,7 @@ /** * Created by Karel Maesen, Geovise BVBA on 27/11/15. */ -public class RxHttpClientMultipleRequests extends UsingWiremockRxJava { +public class RxHttpClientMultipleRequests extends UsingWireMockRxJava { private static Logger LOGGER = LoggerFactory.getLogger(RxHttpClientMultipleRequests.class); diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java index 5522362..dd0681d 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientObservableOfServerElementsTests.java @@ -1,6 +1,6 @@ package be.wegenenverkeer.designtests; -import be.wegenenverkeer.UsingWiremockRxJava; +import be.wegenenverkeer.UsingWireMockRxJava; import be.wegenenverkeer.rxhttp.*; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.subscribers.TestSubscriber; @@ -17,7 +17,7 @@ * Supports the same set of tests as {@link RxHttpClientDesignTests}, but uses the executeObservably(ServerRequest) method. * * Created by Karel Maesen, Geovise BVBA on 18/12/14. */ -public class RxHttpClientObservableOfServerElementsTests extends UsingWiremockRxJava { +public class RxHttpClientObservableOfServerElementsTests extends UsingWireMockRxJava { @Test public void GETHappyPath() { diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java index d9a908d..e124279 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientPostTests.java @@ -1,6 +1,6 @@ package be.wegenenverkeer.designtests; -import be.wegenenverkeer.UsingWiremockRxJava; +import be.wegenenverkeer.UsingWireMockRxJava; import be.wegenenverkeer.rxhttp.ClientRequest; import be.wegenenverkeer.rxhttp.HttpClientError; import be.wegenenverkeer.rxhttp.ServerResponse; @@ -17,7 +17,7 @@ *

* Created by Karel Maesen, Geovise BVBA on 19/12/14. */ -public class RxHttpClientPostTests extends UsingWiremockRxJava { +public class RxHttpClientPostTests extends UsingWireMockRxJava { //this is a post that creates a contact entity, and then //retrieves it back from the server. diff --git a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java index aacde9b..74f8c5e 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java +++ b/modules/java/src/test/java/be/wegenenverkeer/designtests/RxHttpClientTestChunkedResponse.java @@ -1,6 +1,6 @@ package be.wegenenverkeer.designtests; -import be.wegenenverkeer.UsingWiremockRxJava; +import be.wegenenverkeer.UsingWireMockRxJava; import be.wegenenverkeer.rxhttp.ClientRequest; import io.reactivex.rxjava3.core.Flowable; import io.reactivex.rxjava3.subscribers.TestSubscriber; @@ -19,7 +19,7 @@ * Created by Karel Maesen, Geovise BVBA on 18/12/14. */ -public class RxHttpClientTestChunkedResponse extends UsingWiremockRxJava { +public class RxHttpClientTestChunkedResponse extends UsingWireMockRxJava { @Test From 34aded08764284b1a58ff33900593f78e589f940 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Mon, 20 Apr 2020 14:27:16 +0200 Subject: [PATCH 20/30] Refactoring en minimale test support --- build.sbt | 2 +- .../rxhttp/fs2/Fs2HttpApi.scala | 29 ++++++++ .../rxhttp/fs2/Fs2HtttpClient.scala | 50 ++++++++++++++ .../wegenenverkeer/rxhttp/fs2/Implicits.scala | 15 +++++ .../rxhttp/fs2interop/fs2interop.scala | 49 -------------- .../test/scala/Fs2InteropSpecification.scala | 66 ++++++++++++++++++- .../fs2/src/test/scala/WireMockSupport.scala | 43 +++++++++++- 7 files changed, 202 insertions(+), 52 deletions(-) create mode 100644 modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Fs2HttpApi.scala create mode 100644 modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Fs2HtttpClient.scala create mode 100644 modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Implicits.scala delete mode 100644 modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala diff --git a/build.sbt b/build.sbt index 3f5eb20..517d4b1 100644 --- a/build.sbt +++ b/build.sbt @@ -87,7 +87,7 @@ lazy val moduleSettings = scalaVersion := ScalaVersion, scalacOptions := ScalaBuildOptions, parallelExecution := false, - Test / parallelExecution := false, + parallelExecution in Test := false, test / fork := true, resolvers += "Local Maven" at Path.userHome.asFile.toURI.toURL + ".m2/repository", resolvers += Resolver.typesafeRepo("releases"), diff --git a/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Fs2HttpApi.scala b/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Fs2HttpApi.scala new file mode 100644 index 0000000..52c8d6e --- /dev/null +++ b/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Fs2HttpApi.scala @@ -0,0 +1,29 @@ +package be.wegenenverkeer.rxhttp.fs2 + +import java.nio.charset.Charset +import java.util + +import be.wegenenverkeer.rxhttp._ +import cats.effect.{Async, ConcurrentEffect} +import _root_.fs2.Stream + +/** + * Created by Karel Maesen, Geovise BVBA on 20/04/2020. + */ +trait Fs2HttpApi { + + def stream[F[_] : ConcurrentEffect](request: ClientRequest): Stream[F, ServerResponseElement] + + def streamDechunked[F[_] : ConcurrentEffect](request: ClientRequest, separator: String, charset: Charset): Stream[F, String] + + def streamDechunked[F[_] : ConcurrentEffect](request: ClientRequest, separator: String): Stream[F, String] + + def stream[F[_] : ConcurrentEffect, A](req: ClientRequest, transform: Array[Byte] => A): Stream[F, A] + + def execute[F[_] : Async, A](req: ClientRequest, tr: ServerResponse => A): F[A] + + def requestBuilder: ClientRequestBuilder + + def requestSigners: util.List[RequestSigner] + +} diff --git a/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Fs2HtttpClient.scala b/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Fs2HtttpClient.scala new file mode 100644 index 0000000..f5b724a --- /dev/null +++ b/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Fs2HtttpClient.scala @@ -0,0 +1,50 @@ +package be.wegenenverkeer.rxhttp.fs2 + +import java.nio.charset.Charset +import java.util + +import be.wegenenverkeer.rxhttp.{ClientRequest, ClientRequestBuilder, RequestSigner, ServerResponse, ServerResponseElement} +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient +import cats.effect.{Async, ConcurrentEffect} +import fs2.Stream +import fs2.interop.reactivestreams.fromPublisher +import org.asynchttpclient.Response + +import scala.util.Try + +/** + * Created by Karel Maesen, Geovise BVBA on 20/04/2020. + */ +case class Fs2HtttpClient(client: RxJavaHttpClient) extends Fs2HttpApi { + + def stream[F[_] : ConcurrentEffect](request: ClientRequest): Stream[F, ServerResponseElement] = + fromPublisher[F, ServerResponseElement](client.executeObservably(request)) + + def streamDechunked[F[_] : ConcurrentEffect](request: ClientRequest, separator: String, charset: Charset): Stream[F, String] = + fromPublisher[F, String](client.executeAndDechunk(request, separator, charset)) + + def streamDechunked[F[_] : ConcurrentEffect](request: ClientRequest, separator: String): Stream[F, String] = + fromPublisher[F, String](client.executeAndDechunk(request, separator)) + + def stream[F[_] : ConcurrentEffect, A](req: ClientRequest, transform: Array[Byte] => A): Stream[F, A] = + fromPublisher[F, A](client.executeObservably(req, (t: Array[Byte]) => transform(t))) + + def execute[F[_] : Async, A](req: ClientRequest, tr: ServerResponse => A): F[A] = { + def attemptTransform(resp: Response): Either[Throwable, A] = + Try { + tr(ServerResponse.wrap(resp)) + }.toEither + + Async[F].async { cb => + client.inner().executeRequest(req.unwrap()).toCompletableFuture + .whenComplete((a, t) => + if (t == null) cb(attemptTransform(a)) else cb(Left(t))) + } + } + + def requestBuilder: ClientRequestBuilder = client.requestBuilder + + def requestSigners: util.List[RequestSigner] = client.getRequestSigners + +} + diff --git a/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Implicits.scala b/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Implicits.scala new file mode 100644 index 0000000..53c40f9 --- /dev/null +++ b/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2/Implicits.scala @@ -0,0 +1,15 @@ + +package be.wegenenverkeer.rxhttp.fs2 + +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient + +/** + * Created by Karel Maesen, Geovise BVBA on 20/04/2020. + */ +object Implicits { + + implicit class RxJavaHttpClientOps(client: RxJavaHttpClient) { + def fs2HttpApi: Fs2HttpApi = new Fs2HtttpClient(client) + } +} + diff --git a/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala b/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala deleted file mode 100644 index 205c8c0..0000000 --- a/modules/fs2/src/main/scala/be/wegenenverkeer/rxhttp/fs2interop/fs2interop.scala +++ /dev/null @@ -1,49 +0,0 @@ -package be.wegenenverkeer.rxhttp - -import java.nio.charset.Charset - -import scala.jdk.FunctionConverters._ -import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient -import cats.effect.{Async, ConcurrentEffect} -import fs2.Stream -import fs2.interop.reactivestreams._ -import org.asynchttpclient.Response - -import scala.util.Try - -/** - * Created by Karel Maesen, Geovise BVBA on 18/04/2020. - */ -package object fs2interop { - - implicit class RxJavaHttpClientOps(client: RxJavaHttpClient) { - - - - def stream[F[_]:ConcurrentEffect](request: ClientRequest): Stream[F, ServerResponseElement] = - client.executeObservably(request).toStream() - - def streamDechunked[F[_]:ConcurrentEffect](request: ClientRequest, separator: String, charset: Charset) : Stream[F, String] = - client.executeAndDechunk(request, separator, charset).toStream() - - - def streamDechunked[F[_]:ConcurrentEffect](request: ClientRequest, separator: String) : Stream[F, String] = - client.executeAndDechunk(request, separator).toStream() - - def stream[F[_]: ConcurrentEffect, A](req: ClientRequest, transform: Array[Byte] => A) : Stream[F, A] = - client.executeObservably(req, (t: Array[Byte]) => transform(t)).toStream() - - def execute[F[_]: Async, A](req: ClientRequest, tr: ServerResponse => A): F[A] = { - def attemptTransform(resp: Response) : Either[Throwable, A] = - Try{ tr(ServerResponse.wrap(resp)) }.toEither - Async[F].async{ cb => - client.inner().executeRequest(req.unwrap()).toCompletableFuture - .whenComplete( (a, t) => - if (t==null) cb( attemptTransform(a)) else cb(Left(t)) ) - } - } - - - } - -} diff --git a/modules/fs2/src/test/scala/Fs2InteropSpecification.scala b/modules/fs2/src/test/scala/Fs2InteropSpecification.scala index ac5ead3..cf9b86c 100644 --- a/modules/fs2/src/test/scala/Fs2InteropSpecification.scala +++ b/modules/fs2/src/test/scala/Fs2InteropSpecification.scala @@ -1,6 +1,70 @@ +import be.wegenenverkeer.rxhttp.fs2.Implicits._ +import cats.effect.{ContextShift, IO} +import org.specs2.Specification + /** * Created by Karel Maesen, Geovise BVBA on 20/04/2020. */ -class Fs2InteropSpecification { +class Fs2InteropSpecification extends org.specs2.mutable.Specification + with WireMockSupport { + + sequential + + "The implicits object" should { + + "provide an a FS2-compliant streaming interface" in { + val expectBody = "{ 'contacts': [1,2,3] }" + + import com.github.tomakehurst.wiremock.client.{WireMock => wm} + server.stubFor(wm.get(wm.urlPathEqualTo("/contacts")) + .withQueryParam("q", wm.equalTo("test")) + .withHeader("Accept", wm.equalTo("application/json")) + .willReturn(wm.aResponse.withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(expectBody) + ) + ) + + import scala.concurrent.ExecutionContext + implicit val contextShift: ContextShift[IO] = IO.contextShift(ExecutionContext.global) + + val path = "/contacts" + val request = client.requestBuilder.setMethod("GET").setUrlRelativetoBase(path).addQueryParam("q", "test").build + + val str = client.fs2HttpApi.stream[IO, String](request, b => new String(b)) + val output = str.compile.toVector.unsafeRunSync() + + output(0) must_== expectBody + + } + + "provide a Cats-Effect Async compliant interface" in { + + val expectBody = "{ 'contacts': [1,2,3] }" + + import com.github.tomakehurst.wiremock.client.{WireMock => wm} + server.stubFor(wm.get(wm.urlPathEqualTo("/contacts")) + .withQueryParam("q", wm.equalTo("test")) + .withHeader("Accept", wm.equalTo("application/json")) + .willReturn(wm.aResponse.withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(expectBody) + ) + ) + + + //set up use case + + import scala.concurrent.ExecutionContext + implicit val contextShift: ContextShift[IO] = IO.contextShift(ExecutionContext.global) + + val path = "/contacts" + val request = client.requestBuilder.setMethod("GET").setUrlRelativetoBase(path).addQueryParam("q", "test").build + + val resp = client.fs2HttpApi.execute[IO, String](request, sr => sr.getResponseBody) + val output = resp.unsafeRunSync() + output must_== expectBody + } + } } diff --git a/modules/fs2/src/test/scala/WireMockSupport.scala b/modules/fs2/src/test/scala/WireMockSupport.scala index e3f4952..c3a2f10 100644 --- a/modules/fs2/src/test/scala/WireMockSupport.scala +++ b/modules/fs2/src/test/scala/WireMockSupport.scala @@ -1,6 +1,47 @@ +import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient +import com.github.tomakehurst.wiremock.WireMockServer +import com.github.tomakehurst.wiremock.core.Options +import com.github.tomakehurst.wiremock.core.WireMockConfiguration._ +import org.specs2.mutable.BeforeAfter +import org.specs2.specification.BeforeAfterEach + /** * Created by Karel Maesen, Geovise BVBA on 20/04/2020. */ -trait WiremockSupport { +trait WireMockSupport extends BeforeAfterEach { + + val REQUEST_TIME_OUT = 5000 + val DEFAULT_TIME_OUT: Int = REQUEST_TIME_OUT * 5 + + val server: WireMockServer = new WireMockServer(options() + .dynamicPort() + .useChunkedTransferEncoding(Options.ChunkedEncodingPolicy.BODY_FILE)) + + private[this] var rx: RxJavaHttpClient = null + + def client: RxJavaHttpClient = rx + + def before: Unit = { + println("Starting server") + + server.start() + rx = new RxJavaHttpClient.Builder() + .setRequestTimeout(REQUEST_TIME_OUT) + .setMaxConnections(3) + .setAccept("application/json") + .setBaseUrl("http://localhost:" + port) + .build(); + } + + def after(): Unit = { + println("Stopping server") + server.stop() + rx.close() + } + + protected def port: Int = { + println(s"Server reported as: ${server.port()}") + server.port() + } } From bf0ad1e3cbb2bc4f0fe6bff4ac1f09d19790da81 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Mon, 20 Apr 2020 15:12:25 +0200 Subject: [PATCH 21/30] Cleanup test --- .../test/scala/Fs2InteropSpecification.scala | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/modules/fs2/src/test/scala/Fs2InteropSpecification.scala b/modules/fs2/src/test/scala/Fs2InteropSpecification.scala index cf9b86c..bd6a3db 100644 --- a/modules/fs2/src/test/scala/Fs2InteropSpecification.scala +++ b/modules/fs2/src/test/scala/Fs2InteropSpecification.scala @@ -1,6 +1,5 @@ import be.wegenenverkeer.rxhttp.fs2.Implicits._ import cats.effect.{ContextShift, IO} -import org.specs2.Specification /** * Created by Karel Maesen, Geovise BVBA on 20/04/2020. @@ -15,15 +14,8 @@ class Fs2InteropSpecification extends org.specs2.mutable.Specification "provide an a FS2-compliant streaming interface" in { val expectBody = "{ 'contacts': [1,2,3] }" - import com.github.tomakehurst.wiremock.client.{WireMock => wm} - server.stubFor(wm.get(wm.urlPathEqualTo("/contacts")) - .withQueryParam("q", wm.equalTo("test")) - .withHeader("Accept", wm.equalTo("application/json")) - .willReturn(wm.aResponse.withStatus(200) - .withHeader("Content-Type", "application/json") - .withBody(expectBody) - ) - ) + + stub(expectBody) import scala.concurrent.ExecutionContext implicit val contextShift: ContextShift[IO] = IO.contextShift(ExecutionContext.global) @@ -38,21 +30,11 @@ class Fs2InteropSpecification extends org.specs2.mutable.Specification } - "provide a Cats-Effect Async compliant interface" in { + "provide a Cats-Effect Aƒsync compliant interface" in { val expectBody = "{ 'contacts': [1,2,3] }" - import com.github.tomakehurst.wiremock.client.{WireMock => wm} - server.stubFor(wm.get(wm.urlPathEqualTo("/contacts")) - .withQueryParam("q", wm.equalTo("test")) - .withHeader("Accept", wm.equalTo("application/json")) - .willReturn(wm.aResponse.withStatus(200) - .withHeader("Content-Type", "application/json") - .withBody(expectBody) - ) - ) - - + stub(expectBody) //set up use case import scala.concurrent.ExecutionContext @@ -67,4 +49,18 @@ class Fs2InteropSpecification extends org.specs2.mutable.Specification output must_== expectBody } } + + def stub(expectBody: String) = { + import com.github.tomakehurst.wiremock.client.{WireMock => wm} + server.stubFor(wm.get(wm.urlPathEqualTo("/contacts")) + .withQueryParam("q", wm.equalTo("test")) + .withHeader("Accept", wm.equalTo("application/json")) + .willReturn(wm.aResponse.withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(expectBody) + ) + ) + } + + } From e5498e4159b435cf9f1615064b273a4234d2f3be Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Mon, 20 Apr 2020 15:58:20 +0200 Subject: [PATCH 22/30] Set fs2 dependencies als provided --- build.sbt | 18 +++++++++--------- .../fs2/src/test/scala/WireMockSupport.scala | 2 -- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/build.sbt b/build.sbt index 517d4b1..b166e91 100644 --- a/build.sbt +++ b/build.sbt @@ -18,7 +18,7 @@ val asyncClient = "org.asynchttpclient" % "async-http-client" % "2.12.1" val rxStreamsVersion = "1.0.3" val rxJavaVersion = "3.0.1" val reactorVersion = "3.3.3.RELEASE" -val fs2Version = "2.2.1" +val fs2Version = "2.2.2" val slf4j = "org.slf4j" % "slf4j-api" % "1.7.30" val commonsCodec = "commons-codec" % "commons-codec" % "1.10" @@ -61,8 +61,8 @@ val scalaDependencies = commonDependencies ++ Seq( ) val fs2Dependencies = commonDependencies ++ scalaDependencies ++ Seq( - "co.fs2" %% "fs2-core" % fs2Version, - "co.fs2" %% "fs2-reactive-streams" % fs2Version + "co.fs2" %% "fs2-core" % fs2Version % "provided", + "co.fs2" %% "fs2-reactive-streams" % fs2Version % "provided" ) val mainTestDependencies = Seq( @@ -106,21 +106,21 @@ lazy val testSettings = Seq( libraryDependencies ++= mainTestDependencies, parallelExecution in Test := false ) -lazy val javaInteropModule = (project in file("modules/java-interop")).settings( +lazy val javaInterop = (project in file("modules/java-interop")).settings( name := "RxHttpClient-interop", moduleSettings ++ extraJavaSettings, javacOptions ++= Seq("--release", "11"), libraryDependencies ++= javaDependencies ++ interopDependencies, extraJavaSettings -) dependsOn (rxJavaModule % "compile->compile;test->test") +) dependsOn (java % "compile->compile;test->test") -lazy val fs2Module = (project in file("modules/fs2")).settings( +lazy val fs2 = (project in file("modules/fs2")).settings( name := "RxHttpclient-fs2", moduleSettings, libraryDependencies ++= fs2Dependencies -).dependsOn(rxJavaModule % "compile->compile;test->test") +).dependsOn(java % "compile->compile;test->test") -lazy val rxJavaModule = (project in file("modules/java")).settings( +lazy val java = (project in file("modules/java")).settings( name := "RxHttpClient", moduleSettings, javacOptions ++= Seq("--release", "11"), @@ -133,7 +133,7 @@ lazy val main = (project in file(".")) moduleSettings ++ disablePublishingRoot ++ extraJavaSettings, name := "RxHttpClient" ) - .aggregate(javaInteropModule, rxJavaModule, fs2Module) + .aggregate(javaInterop, java, fs2) lazy val pomInfo = https://github.com/WegenenVerkeer/atomium diff --git a/modules/fs2/src/test/scala/WireMockSupport.scala b/modules/fs2/src/test/scala/WireMockSupport.scala index c3a2f10..9f43cfd 100644 --- a/modules/fs2/src/test/scala/WireMockSupport.scala +++ b/modules/fs2/src/test/scala/WireMockSupport.scala @@ -22,8 +22,6 @@ trait WireMockSupport extends BeforeAfterEach { def client: RxJavaHttpClient = rx def before: Unit = { - println("Starting server") - server.start() rx = new RxJavaHttpClient.Builder() .setRequestTimeout(REQUEST_TIME_OUT) From a90a053680fb7fc49ae3beb2ede7a79a4fef645b Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Mon, 20 Apr 2020 17:05:15 +0200 Subject: [PATCH 23/30] Fix test/doc --- modules/fs2/README.adoc | 58 +++++++++++++++++++ .../test/scala/Fs2InteropSpecification.scala | 12 ++-- 2 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 modules/fs2/README.adoc diff --git a/modules/fs2/README.adoc b/modules/fs2/README.adoc new file mode 100644 index 0000000..4b3c35f --- /dev/null +++ b/modules/fs2/README.adoc @@ -0,0 +1,58 @@ += Overview + +This module provides interop with the https://github.com/functional-streams-for-scala/fs2[FS2] library. + + +== Getting Started + +This module requires fs2, fs-reactive-streams on the classpath. + +[source, scala] +.... +val fs2Version = ??? // any recent one should work +libraryDependencies ++= Seq( + "co.fs2" %% "fs2-core" % fs2Version, + "co.fs2" %% "fs2-reactive-streams" % fs2Version, + "be.wegenenverkeer" %% "rxhttp-fs2" % "2.0-RC1") +.... + +This will pull the `be.wegenenverkeer.rxhttpClient` package in as a transitive dependency. + +== API + +This module provides a Streaming API `FSHttpApi`: + +[source, scala] +---- +include::src/main/scala/be/wegenenverkeer/rxhttp/fs2/Fs2HttpApi.scala[lines=13..29] +---- + +After importing `fs2.Implicits._` a RxJavaHttpClient can be converted into an implementation +of this trait. + +[source, scala] +---- +val client : RxJavaHttpClient = ??? +include::src/test/scala/Fs2InteropSpecification.scala[lines=24..26,indent=0] +---- + +== Usage + +Here is an example that gets the response elements (chunks) in a `fs2.Stream[IO, String]`. Obviously, +the request will only fire when the effect is run. + +[source, scala] +---- +val client : RxJavaHttpClient = ??? +include::src/test/scala/Fs2InteropSpecification.scala[lines=21..25, indent=0] +---- + +We can also return the complete response as a single value wrapped in an `IO`. +[source, scala] +---- +include::src/test/scala/Fs2InteropSpecification.scala[lines=46, indent=0] +//resp : IO[String] +---- + + + diff --git a/modules/fs2/src/test/scala/Fs2InteropSpecification.scala b/modules/fs2/src/test/scala/Fs2InteropSpecification.scala index bd6a3db..6d84d1e 100644 --- a/modules/fs2/src/test/scala/Fs2InteropSpecification.scala +++ b/modules/fs2/src/test/scala/Fs2InteropSpecification.scala @@ -1,4 +1,3 @@ -import be.wegenenverkeer.rxhttp.fs2.Implicits._ import cats.effect.{ContextShift, IO} /** @@ -16,15 +15,15 @@ class Fs2InteropSpecification extends org.specs2.mutable.Specification stub(expectBody) + val path = "/contacts" + val request = client.requestBuilder.setMethod("GET").setUrlRelativetoBase(path).addQueryParam("q", "test").build import scala.concurrent.ExecutionContext implicit val contextShift: ContextShift[IO] = IO.contextShift(ExecutionContext.global) + import be.wegenenverkeer.rxhttp.fs2.Implicits._ - val path = "/contacts" - val request = client.requestBuilder.setMethod("GET").setUrlRelativetoBase(path).addQueryParam("q", "test").build - - val str = client.fs2HttpApi.stream[IO, String](request, b => new String(b)) - val output = str.compile.toVector.unsafeRunSync() + val response = client.fs2HttpApi.stream[IO, String](request, b => new String(b)) + val output = response.compile.toVector.unsafeRunSync() output(0) must_== expectBody @@ -43,6 +42,7 @@ class Fs2InteropSpecification extends org.specs2.mutable.Specification val path = "/contacts" val request = client.requestBuilder.setMethod("GET").setUrlRelativetoBase(path).addQueryParam("q", "test").build + import be.wegenenverkeer.rxhttp.fs2.Implicits._ val resp = client.fs2HttpApi.execute[IO, String](request, sr => sr.getResponseBody) val output = resp.unsafeRunSync() From d6218c13bf7c9ae9a52362660bb1d226f09d6cb3 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Mon, 20 Apr 2020 17:09:44 +0200 Subject: [PATCH 24/30] Examples manually pasted in doc Because Asciidocs include directive doesn't work in github --- modules/fs2/README.adoc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/fs2/README.adoc b/modules/fs2/README.adoc index 4b3c35f..43da2f6 100644 --- a/modules/fs2/README.adoc +++ b/modules/fs2/README.adoc @@ -33,7 +33,9 @@ of this trait. [source, scala] ---- val client : RxJavaHttpClient = ??? -include::src/test/scala/Fs2InteropSpecification.scala[lines=24..26,indent=0] + +val response = client.fs2HttpApi.stream[IO, String](request, b => new String(b)) +val output = response.compile.toVector.unsafeRunSync() ---- == Usage @@ -43,14 +45,20 @@ the request will only fire when the effect is run. [source, scala] ---- + +import scala.concurrent.ExecutionContext +implicit val contextShift: ContextShift[IO] = IO.contextShift(ExecutionContext.global) +import be.wegenenverkeer.rxhttp.fs2.Implicits._ + val client : RxJavaHttpClient = ??? -include::src/test/scala/Fs2InteropSpecification.scala[lines=21..25, indent=0] +val response = client.fs2HttpApi.stream[IO, String](request, b => new String(b)) + ---- We can also return the complete response as a single value wrapped in an `IO`. [source, scala] ---- -include::src/test/scala/Fs2InteropSpecification.scala[lines=46, indent=0] +val resp = client.fs2HttpApi.execute[IO, String](request, sr => sr.getResponseBody) //resp : IO[String] ---- From d69520619f974567a98c3f42061920e29f4f14f9 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Mon, 20 Apr 2020 17:18:06 +0200 Subject: [PATCH 25/30] Switch to markdown --- modules/fs2/{README.adoc => README.md} | 47 ++++++++++++++------------ 1 file changed, 25 insertions(+), 22 deletions(-) rename modules/fs2/{README.adoc => README.md} (67%) diff --git a/modules/fs2/README.adoc b/modules/fs2/README.md similarity index 67% rename from modules/fs2/README.adoc rename to modules/fs2/README.md index 43da2f6..4d5e532 100644 --- a/modules/fs2/README.adoc +++ b/modules/fs2/README.md @@ -1,66 +1,69 @@ -= Overview +# Overview This module provides interop with the https://github.com/functional-streams-for-scala/fs2[FS2] library. -== Getting Started +# Getting Started This module requires fs2, fs-reactive-streams on the classpath. -[source, scala] -.... +``` val fs2Version = ??? // any recent one should work libraryDependencies ++= Seq( "co.fs2" %% "fs2-core" % fs2Version, "co.fs2" %% "fs2-reactive-streams" % fs2Version, "be.wegenenverkeer" %% "rxhttp-fs2" % "2.0-RC1") -.... +``` This will pull the `be.wegenenverkeer.rxhttpClient` package in as a transitive dependency. -== API +# API This module provides a Streaming API `FSHttpApi`: -[source, scala] ----- -include::src/main/scala/be/wegenenverkeer/rxhttp/fs2/Fs2HttpApi.scala[lines=13..29] ----- +``` +trait Fs2HttpApi { + def stream[F[_] : ConcurrentEffect](request: ClientRequest): Stream[F, ServerResponseElement] + def streamDechunked[F[_] : ConcurrentEffect](request: ClientRequest, separator: String, charset: Charset): Stream[F, String] + def streamDechunked[F[_] : ConcurrentEffect](request: ClientRequest, separator: String): Stream[F, String] + def stream[F[_] : ConcurrentEffect, A](req: ClientRequest, transform: Array[Byte] => A): Stream[F, A] + def execute[F[_] : Async, A](req: ClientRequest, tr: ServerResponse => A): F[A] + def requestBuilder: ClientRequestBuilder + def requestSigners: util.List[RequestSigner] +} +``` After importing `fs2.Implicits._` a RxJavaHttpClient can be converted into an implementation of this trait. -[source, scala] ----- + +``` val client : RxJavaHttpClient = ??? val response = client.fs2HttpApi.stream[IO, String](request, b => new String(b)) val output = response.compile.toVector.unsafeRunSync() ----- +``` -== Usage +# Usage Here is an example that gets the response elements (chunks) in a `fs2.Stream[IO, String]`. Obviously, the request will only fire when the effect is run. -[source, scala] ----- - +``` import scala.concurrent.ExecutionContext implicit val contextShift: ContextShift[IO] = IO.contextShift(ExecutionContext.global) import be.wegenenverkeer.rxhttp.fs2.Implicits._ val client : RxJavaHttpClient = ??? val response = client.fs2HttpApi.stream[IO, String](request, b => new String(b)) - ----- +``` We can also return the complete response as a single value wrapped in an `IO`. -[source, scala] ----- + +``` val resp = client.fs2HttpApi.execute[IO, String](request, sr => sr.getResponseBody) //resp : IO[String] ----- +``` From 3bbf2ea41979853d30fb5447d38ba102a24de435 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Mon, 20 Apr 2020 17:30:02 +0200 Subject: [PATCH 26/30] Clean up --- modules/fs2/README.md | 2 +- modules/fs2/src/test/scala/Fs2InteropSpecification.scala | 7 +++---- modules/fs2/src/test/scala/WireMockSupport.scala | 2 -- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/fs2/README.md b/modules/fs2/README.md index 4d5e532..d8bb0c3 100644 --- a/modules/fs2/README.md +++ b/modules/fs2/README.md @@ -1,6 +1,6 @@ # Overview -This module provides interop with the https://github.com/functional-streams-for-scala/fs2[FS2] library. +This module provides interop with the [FS2](https://github.com/functional-streams-for-scala/fs2) library. # Getting Started diff --git a/modules/fs2/src/test/scala/Fs2InteropSpecification.scala b/modules/fs2/src/test/scala/Fs2InteropSpecification.scala index 6d84d1e..2ae6191 100644 --- a/modules/fs2/src/test/scala/Fs2InteropSpecification.scala +++ b/modules/fs2/src/test/scala/Fs2InteropSpecification.scala @@ -1,4 +1,6 @@ +import be.wegenenverkeer.rxhttp.fs2.Implicits._ import cats.effect.{ContextShift, IO} +import scala.concurrent.ExecutionContext /** * Created by Karel Maesen, Geovise BVBA on 20/04/2020. @@ -13,14 +15,12 @@ class Fs2InteropSpecification extends org.specs2.mutable.Specification "provide an a FS2-compliant streaming interface" in { val expectBody = "{ 'contacts': [1,2,3] }" + implicit val contextShift: ContextShift[IO] = IO.contextShift(ExecutionContext.global) stub(expectBody) val path = "/contacts" val request = client.requestBuilder.setMethod("GET").setUrlRelativetoBase(path).addQueryParam("q", "test").build - import scala.concurrent.ExecutionContext - implicit val contextShift: ContextShift[IO] = IO.contextShift(ExecutionContext.global) - import be.wegenenverkeer.rxhttp.fs2.Implicits._ val response = client.fs2HttpApi.stream[IO, String](request, b => new String(b)) val output = response.compile.toVector.unsafeRunSync() @@ -42,7 +42,6 @@ class Fs2InteropSpecification extends org.specs2.mutable.Specification val path = "/contacts" val request = client.requestBuilder.setMethod("GET").setUrlRelativetoBase(path).addQueryParam("q", "test").build - import be.wegenenverkeer.rxhttp.fs2.Implicits._ val resp = client.fs2HttpApi.execute[IO, String](request, sr => sr.getResponseBody) val output = resp.unsafeRunSync() diff --git a/modules/fs2/src/test/scala/WireMockSupport.scala b/modules/fs2/src/test/scala/WireMockSupport.scala index 9f43cfd..093d6af 100644 --- a/modules/fs2/src/test/scala/WireMockSupport.scala +++ b/modules/fs2/src/test/scala/WireMockSupport.scala @@ -32,13 +32,11 @@ trait WireMockSupport extends BeforeAfterEach { } def after(): Unit = { - println("Stopping server") server.stop() rx.close() } protected def port: Int = { - println(s"Server reported as: ${server.port()}") server.port() } From 85354da170f10502a25f2de172cb75983d9aa5b9 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Mon, 20 Apr 2020 18:23:01 +0200 Subject: [PATCH 27/30] Enable JDK9 Flow API interop --- .../FlowHttpClient.java} | 65 ++++++++++--------- .../rxhttp/reactor/ReactorHttpClient.java | 2 - ...RxHttpApiTest.java => JdkFlowApiTest.java} | 11 ++-- ...Streams.java => UsingWireMockJdkFlow.java} | 6 +- .../be/wegenenverkeer/rxhttp/Builder.java | 2 +- .../wegenenverkeer/rxhttp/RxHttpClient.java | 3 +- .../java/be/wegenenverkeer/UsingWireMock.java | 11 +++- 7 files changed, 55 insertions(+), 45 deletions(-) rename modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/{rxstreams/RxStreamsHttpClient.java => jdk/FlowHttpClient.java} (51%) rename modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/{RxHttpApiTest.java => JdkFlowApiTest.java} (77%) rename modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/{UsingWireMockRxStreams.java => UsingWireMockJdkFlow.java} (59%) diff --git a/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/rxstreams/RxStreamsHttpClient.java b/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/jdk/FlowHttpClient.java similarity index 51% rename from modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/rxstreams/RxStreamsHttpClient.java rename to modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/jdk/FlowHttpClient.java index 47c5375..55f5ca8 100644 --- a/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/rxstreams/RxStreamsHttpClient.java +++ b/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/jdk/FlowHttpClient.java @@ -1,108 +1,109 @@ -package be.wegenenverkeer.rxhttp.rxstreams; +package be.wegenenverkeer.rxhttp.jdk; import be.wegenenverkeer.rxhttp.*; import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; import org.asynchttpclient.AsyncHttpClient; -import org.reactivestreams.Publisher; +import org.reactivestreams.FlowAdapters; +import java.io.Closeable; import java.nio.charset.Charset; import java.util.List; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Flow; import java.util.function.Function; /** * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -public class RxStreamsHttpClient implements RxHttpClient { +public class FlowHttpClient implements Closeable { private final RxJavaHttpClient delegate; - private RxStreamsHttpClient(RxJavaHttpClient delegate) { + private FlowHttpClient(RxJavaHttpClient delegate) { this.delegate = delegate; } - @Override public CompletableFuture execute(ClientRequest request, Function transformer) { return delegate.execute(request, transformer); } - @Override - public Publisher executeToCompletion(ClientRequest request, Function transformer) { - return delegate.executeToCompletion(request, transformer); + + public Flow.Publisher executeToCompletion(ClientRequest request, Function transformer) { + return FlowAdapters.toFlowPublisher(delegate.executeToCompletion(request, transformer)); } - @Override - public Publisher executeObservably(ClientRequest request) { - return delegate.executeObservably(request); + + public Flow.Publisher executeObservably(ClientRequest request) { + return FlowAdapters.toFlowPublisher(delegate.executeObservably(request)); } - @Override - public Publisher executeAndDechunk(ClientRequest request, String separator) { - return delegate.executeAndDechunk(request, separator); + + public Flow.Publisher executeAndDechunk(ClientRequest request, String separator) { + return FlowAdapters.toFlowPublisher(delegate.executeAndDechunk(request, separator)); } - @Override - public Publisher executeAndDechunk(ClientRequest request, String separator, Charset charset) { - return delegate.executeAndDechunk(request, separator, charset); + + public Flow.Publisher executeAndDechunk(ClientRequest request, String separator, Charset charset) { + return FlowAdapters.toFlowPublisher(delegate.executeAndDechunk(request, separator, charset)); } - @Override - public Publisher executeObservably(ClientRequest request, Function transform) { - return delegate.executeObservably(request, transform); + + public Flow.Publisher executeObservably(ClientRequest request, Function transform) { + return FlowAdapters.toFlowPublisher(delegate.executeObservably(request, transform)); } - @Override + public String getBaseUrl() { return delegate.getBaseUrl(); } - @Override + public String getAccept() { return delegate.getAccept(); } - @Override + public List getRequestSigners() { return delegate.getRequestSigners(); } - @Override + public void close() { delegate.close(); } - @Override + public ClientRequestBuilder requestBuilder() { return delegate.requestBuilder(); } - @Override + public String toLogMessage(ClientRequest request) { return delegate.toLogMessage(request); } - @Override + public AsyncHttpClient inner() { return delegate.inner(); } - @Override + public int getMaxConnections() { return delegate.getMaxConnections(); } - public static class Builder extends be.wegenenverkeer.rxhttp.Builder { + public static class Builder extends be.wegenenverkeer.rxhttp.Builder { @Override - public RxStreamsHttpClient build() { + public FlowHttpClient build() { return super.build(); } @Override - public RxStreamsHttpClient createClient(AsyncHttpClient innerClient, RestClientConfig rcConfig, ClientRequestLogFormatter logFmt, RequestSigner... signers) { + public FlowHttpClient createClient(AsyncHttpClient innerClient, RestClientConfig rcConfig, ClientRequestLogFormatter logFmt, RequestSigner... signers) { RxJavaHttpClient delegate = new RxJavaHttpClient.Builder().createClient(innerClient, rcConfig, logFmt, signers); - return new RxStreamsHttpClient(delegate); + return new FlowHttpClient(delegate); } } } diff --git a/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/reactor/ReactorHttpClient.java b/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/reactor/ReactorHttpClient.java index 80bc9ff..49f5be9 100644 --- a/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/reactor/ReactorHttpClient.java +++ b/modules/java-interop/src/main/java/be/wegenenverkeer/rxhttp/reactor/ReactorHttpClient.java @@ -2,8 +2,6 @@ import be.wegenenverkeer.rxhttp.*; import be.wegenenverkeer.rxhttp.rxjava.RxJavaHttpClient; -import be.wegenenverkeer.rxhttp.rxstreams.RxStreamsHttpClient; -import io.reactivex.rxjava3.core.Completable; import org.asynchttpclient.AsyncHttpClient; import reactor.adapter.rxjava.RxJava3Adapter; import reactor.core.publisher.Flux; diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/RxHttpApiTest.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/JdkFlowApiTest.java similarity index 77% rename from modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/RxHttpApiTest.java rename to modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/JdkFlowApiTest.java index 15c30cf..73a4ea1 100644 --- a/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/RxHttpApiTest.java +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/JdkFlowApiTest.java @@ -4,9 +4,10 @@ import be.wegenenverkeer.rxhttp.ClientRequest; import io.reactivex.rxjava3.subscribers.TestSubscriber; import org.junit.Test; -import org.reactivestreams.Publisher; +import org.reactivestreams.FlowAdapters; import java.nio.charset.Charset; +import java.util.concurrent.Flow; import java.util.concurrent.TimeUnit; import static com.github.tomakehurst.wiremock.client.WireMock.*; @@ -19,7 +20,7 @@ * * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -public class RxHttpApiTest extends UsingWireMockRxStreams { +public class JdkFlowApiTest extends UsingWireMockJdkFlow { @Test public void smokeTest(){ @@ -40,9 +41,11 @@ public void smokeTest(){ .addQueryParam("q", "test") .build(); - Publisher publisher = client.executeObservably(request, bytes -> new String(bytes, Charset.forName("UTF8"))); + Flow.Publisher publisher = client.executeObservably(request, bytes -> new String(bytes, Charset.forName("UTF8"))); TestSubscriber testSubscriber = TestSubscriber.create(); - publisher.subscribe(testSubscriber); + + //and back to RxJava to enable test (we basically test whether all this compiles anyway) + FlowAdapters.toPublisher(publisher).subscribe(testSubscriber); testSubscriber.awaitDone(DEFAULT_TIME_OUT, TimeUnit.MILLISECONDS); testSubscriber.assertNoErrors(); diff --git a/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWireMockRxStreams.java b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWireMockJdkFlow.java similarity index 59% rename from modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWireMockRxStreams.java rename to modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWireMockJdkFlow.java index 1c9875c..b7f7392 100644 --- a/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWireMockRxStreams.java +++ b/modules/java-interop/src/test/java/be/wegenenverkeer/reactivestreams/client/UsingWireMockJdkFlow.java @@ -2,15 +2,15 @@ import be.wegenenverkeer.UsingWireMock; import be.wegenenverkeer.rxhttp.Builder; -import be.wegenenverkeer.rxhttp.rxstreams.RxStreamsHttpClient; +import be.wegenenverkeer.rxhttp.jdk.FlowHttpClient; /** * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -public class UsingWireMockRxStreams extends UsingWireMock { +public class UsingWireMockJdkFlow extends UsingWireMock { @Override public Builder getBuilder() { - return new RxStreamsHttpClient.Builder(); + return new FlowHttpClient.Builder(); } } diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Builder.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Builder.java index 354273e..137d198 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Builder.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/Builder.java @@ -25,7 +25,7 @@ /** * A Builder for {@code RxHttpClient} builders. */ -public abstract class Builder> { +public abstract class Builder> { final private static Logger logger = LoggerFactory.getLogger(BaseRxHttpClient.class); diff --git a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java index 0d8a37c..b212bae 100644 --- a/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java +++ b/modules/java/src/main/java/be/wegenenverkeer/rxhttp/RxHttpClient.java @@ -3,6 +3,7 @@ import org.asynchttpclient.AsyncHttpClient; import org.reactivestreams.Publisher; +import java.io.Closeable; import java.nio.charset.Charset; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -11,7 +12,7 @@ /** * Created by Karel Maesen, Geovise BVBA on 2019-07-12. */ -public interface RxHttpClient { +public interface RxHttpClient extends Closeable { CompletableFuture execute(ClientRequest request, Function transformer); /** diff --git a/modules/java/src/test/java/be/wegenenverkeer/UsingWireMock.java b/modules/java/src/test/java/be/wegenenverkeer/UsingWireMock.java index 095eafa..9f03673 100644 --- a/modules/java/src/test/java/be/wegenenverkeer/UsingWireMock.java +++ b/modules/java/src/test/java/be/wegenenverkeer/UsingWireMock.java @@ -9,12 +9,15 @@ import org.junit.Rule; +import java.io.Closeable; +import java.io.IOException; + import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; /** * Created by Karel Maesen, Geovise BVBA on 18/04/2020. */ -public class UsingWireMock { +public class UsingWireMock< C extends Closeable> { public final int REQUEST_TIME_OUT = 5000; public final int DEFAULT_TIME_OUT = REQUEST_TIME_OUT * 5; @@ -44,7 +47,11 @@ public void setUpAndStartServer() { @After public void stopServer() { - client.close(); + try { + client.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } } public Builder getBuilder() { return null;} From c11e7af6054bf525773c4a0d8ea61ab683b05902 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Mon, 20 Apr 2020 20:00:21 +0200 Subject: [PATCH 28/30] Update README --- README.md | 85 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 206252c..2277f79 100644 --- a/README.md +++ b/README.md @@ -6,46 +6,45 @@ This HTTP Client wraps the excellent [AsyncHttpClient](https://github.com/AsyncHttpClient/async-http-client) (AHC) so that Observables are returned, and a number of best practices in RESTful integration are enforced. -# Upgrade to AHC 2 +# Version 2.x -This version of RxHttpClient uses AHC 2.8.x. This implies a number of minor API changes w.r.t to the 0.x versions. +## Overview of changes -API Changes: - - - The methods in ObservableBodyGenerators no longer declare that the throw `Exception`s - - `ServerResponse#getResponseBody(String)` replaced by `ServerResponse#getResponseBody(String)` - -The following methods have been removed: - - - `RxHttpClient.Builder#setExecutorService()`. Replaced by `RxHttpClient.Builder#setThreadFactory()` - - `RxHttpClient.Builder#setHostnameVerifier()` - - `RxHttpClient.Builder#setUseRelativeURIsWithConnectProxies()` +- `RxHttpClient` is now an interface that exposes an API based on [Reactive Streams](https://github.com/reactive-streams/reactive-streams-jvm). This + API is intended as a foundation for interoperability. It is not to be used in client code +- The primary implementation of `RxHttpClient` is `RxJavaHttpClient`, which is based on [RxJava 3](https://github.com/ReactiveX/RxJava) +- A java-interop libraries contains implementations for Spring `Reactor` and the jdk9 `Flow` API +- A scala `fs2` module, provides an alternative io.fs2.Streams-based API (see the [README](modules/fs2/README.md)) +## Design +This version is built primarily on: -The following methods have been deprecated: + - [AsyncHttpClient 2.x](https://github.com/AsyncHttpClient/async-http-client) + - [RxJava 3.x](https://github.com/ReactiveX/RxJava) + +RxJava 3 is fully compatible with [Reactive Streams](https://github.com/reactive-streams/reactive-streams-jvm) which enables this library to +work with with other Reactive-streams compatible libraries such as Reactor, Akka and FS2. - - `ClientRequest#getContentLength()` - - `RxHttpClient.Builder#setAllowPoolingConnections(boolean)`: use `setKeepAlive()` - - `RxHttpClient.Builder#setAcceptAnyCertificate(boolean)`: use `RxHttpClient.Builder#setUseInsecureTrustManager(boolean)` - - `RxHttpClient.Builder setDisableUrlEncodingForBoundedRequests(boolean)`: use ` RxHttpClient.Builder#setDisableUrlEncodingForBoundRequests(boolean)` +Although the JDK9 Flow API is semantically equivalent to the Reactive-Streams API, *it does not implement the +Reactive Streams API*. For this reason, the `FlowHttpClient` is not an implementor of the `RxHttpClient` interface. # User Guide -## The RxHttpClient +## The RxJavaHttpClient -The intent is that your application uses one `RxHttpClient` instance for each integration point (usually a REST service). Because creating - an `RxHttpClient` is expensive, you should do this only once in your application. +The intent is that your application uses one `RxJavaHttpClient` instance for each integration point (usually a REST service). Because creating + an `RxJavaHttpClient` is expensive, you should do this only once in your application. -As `RxHttpClients` are limited to one service, we have natural bulkheads between integration points: errors and failures with +As `RxJavaHttpClients` are limited to one service, we have natural bulkheads between integration points: errors and failures with respect to one integration point will have no direct effect on other integration points (at least if following the recommendations below). -## Creating an RxHttpClient +### Creating an RxHttpClient -An `RxHttpClient` is created using the `RxHttpClient.Builder` as in this example for Java: +An `RxJavaHttpClient` is created using the `RxHttpClient.Builder` as in this example for Java: - RxHttpClient client = new RxHttpClient.Builder() + RxJavaHttpClient client = new RxJavaHttpClient.Builder() .setRequestTimeout(REQUEST_TIME_OUT) .setMaxConnections(MAX_CONNECTIONS) .setConnectionTTL(60000) @@ -54,22 +53,8 @@ An `RxHttpClient` is created using the `RxHttpClient.Builder` as in this example .setBaseUrl("http://example.com/api") .build(); -and for Scala: - - import be.wegenenverkeer.rxhttp.scala.ImplicitConversions._ - - val client = new RxHttpClient.Builder() - .setRequestTimeout(REQUEST_TIME_OUT) - .setMaxConnections(MAX_CONNECTIONS) - .setConnectionTTL(60000) - .setConnectionTimeout(1000) - .setAccept("application/json") - .setBaseUrl("http://example.com/api") - .build - .asScala - -## Creating Requests +### Creating Requests REST Requests can be created using `ClientRequestBuilders` which in turn can be got from `RxHttpClient` instances, like so: @@ -115,5 +100,27 @@ doesn't get stuck waiting for very slow or non-responsive servers. destroyed +# Notes when upgrading from versions prior to 1.0 + +Since version 1.0, RxHttpClient uses AHC 2.6.x. or later. This implies a number of minor API changes w.r.t to the 0.x versions. + +API Changes: + + - The methods in ObservableBodyGenerators no longer declare that the throw `Exception`s + - `ServerResponse#getResponseBody(String)` replaced by `ServerResponse#getResponseBody(String)` + +The following methods have been removed: + + - `RxHttpClient.Builder#setExecutorService()`. Replaced by `RxHttpClient.Builder#setThreadFactory()` + - `RxHttpClient.Builder#setHostnameVerifier()` + - `RxHttpClient.Builder#setUseRelativeURIsWithConnectProxies()` + + +The following methods have been deprecated: + + - `ClientRequest#getContentLength()` + - `RxHttpClient.Builder#setAllowPoolingConnections(boolean)`: use `setKeepAlive()` + - `RxHttpClient.Builder#setAcceptAnyCertificate(boolean)`: use `RxHttpClient.Builder#setUseInsecureTrustManager(boolean)` + - `RxHttpClient.Builder setDisableUrlEncodingForBoundedRequests(boolean)`: use ` RxHttpClient.Builder#setDisableUrlEncodingForBoundRequests(boolean)` From 15a69eaf9c2b5afd6efc0e311045f1b697a908cd Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Tue, 21 Apr 2020 10:58:31 +0200 Subject: [PATCH 29/30] Update version number --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b166e91..14a8d63 100644 --- a/build.sbt +++ b/build.sbt @@ -1,6 +1,6 @@ val Organization = "be.wegenenverkeer" -val Version = "2.0.0-SNAPSHOT" +val Version = "2.0-RC1" val ScalaVersion = "2.13.0" From 2dd2961b86409c980d9a00f57540882fdc6d4637 Mon Sep 17 00:00:00 2001 From: Karel Maesen Date: Tue, 21 Apr 2020 11:53:06 +0200 Subject: [PATCH 30/30] Update SBT release plugin --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 49575d7..a740832 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,5 +6,5 @@ addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2") addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1") // supports release in maven central -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.4") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")