diff --git a/CHANGELOG.md b/CHANGELOG.md index 055ee5bbe..acbef38a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -763,7 +763,9 @@ **Fixed bugs:** - PrimitiveJsonPropertyBodyFilter regexp is incorrect [\#780](https://github.com/zalando/logbook/issues/780) -- I can not find logs in console using spring boot app, I have just installed `logbook-spring-boot-starter` and add `logging.level.org.zalando.logbook.Logbook=TRACE` to my common.properties file [\#768](https://github.com/zalando/logbook/issues/768) +- I can not find logs in console using spring boot app, I have just installed `logbook-spring-boot-starter` and + add `logging.level.org.zalando.logbook.api.Logbook=TRACE` to my common.properties + file [\#768](https://github.com/zalando/logbook/issues/768) **Merged pull requests:** diff --git a/README.md b/README.md index 7513ecbdb..9065270ad 100644 --- a/README.md +++ b/README.md @@ -254,19 +254,19 @@ respectively (in conjunction with `ForwardingHttpRequest`/`ForwardingHttpRespons You can configure filters like this: ```java -import static org.zalando.logbook.HeaderFilters.authorization; -import static org.zalando.logbook.HeaderFilters.eachHeader; -import static org.zalando.logbook.QueryFilters.accessToken; -import static org.zalando.logbook.QueryFilters.replaceQuery; - -Logbook logbook = Logbook.builder() - .requestFilter(RequestFilters.replaceBody(message -> contentType("audio/*").test(message) ? "mmh mmh mmh mmh" : null)) - .responseFilter(ResponseFilters.replaceBody(message -> contentType("*/*-stream").test(message) ? "It just keeps going and going..." : null)) - .queryFilter(accessToken()) - .queryFilter(replaceQuery("password", "")) - .headerFilter(authorization()) - .headerFilter(eachHeader("X-Secret"::equalsIgnoreCase, "")) - .build(); +import static org.zalando.logbook.core.HeaderFilters.authorization; +import static org.zalando.logbook.core.HeaderFilters.eachHeader; +import static org.zalando.logbook.core.QueryFilters.accessToken; +import static org.zalando.logbook.core.QueryFilters.replaceQuery; + +Logbook logbook=Logbook.builder() + .requestFilter(RequestFilters.replaceBody(message->contentType("audio/*").test(message)?"mmh mmh mmh mmh":null)) + .responseFilter(ResponseFilters.replaceBody(message->contentType("*/*-stream").test(message)?"It just keeps going and going...":null)) + .queryFilter(accessToken()) + .queryFilter(replaceQuery("password","")) + .headerFilter(authorization()) + .headerFilter(eachHeader("X-Secret"::equalsIgnoreCase,"")) + .build(); ``` You can configure as many filters as you want - they will run consecutively. @@ -549,7 +549,8 @@ Logger, Stream and Chunking. ##### Logger -By default, requests and responses are logged with an *slf4j* logger that uses the `org.zalando.logbook.Logbook` category and the log level `trace`. This can be customized: +By default, requests and responses are logged with an *slf4j* logger that uses the `org.zalando.logbook.api.Logbook` +category and the log level `trace`. This can be customized: ```java Logbook logbook = Logbook.builder() @@ -986,7 +987,7 @@ for outputs like "@timestamp" : "2019-03-08T09:37:46.239+01:00", "@version" : "1", "message" : "GET http://localhost/test?limit=1", - "logger_name" : "org.zalando.logbook.Logbook", + "logger_name" : "org.zalando.logbook.api.Logbook", "thread_name" : "main", "level" : "TRACE", "level_value" : 5000, diff --git a/logbook-api/src/main/java/org/zalando/logbook/ApplyHttpHeaders.java b/logbook-api/src/main/java/org/zalando/logbook/api/ApplyHttpHeaders.java similarity index 96% rename from logbook-api/src/main/java/org/zalando/logbook/ApplyHttpHeaders.java rename to logbook-api/src/main/java/org/zalando/logbook/api/ApplyHttpHeaders.java index 543ff1314..36c468641 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/ApplyHttpHeaders.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/ApplyHttpHeaders.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import com.google.gag.annotation.remark.ThisWouldBeOneLineIn; @@ -10,7 +10,7 @@ import java.util.function.UnaryOperator; import static java.util.Collections.singleton; -import static org.zalando.logbook.Fold.fold; +import static org.zalando.logbook.api.Fold.fold; interface ApplyHttpHeaders extends HttpHeaders { diff --git a/logbook-api/src/main/java/org/zalando/logbook/BodyFilter.java b/logbook-api/src/main/java/org/zalando/logbook/api/BodyFilter.java similarity index 95% rename from logbook-api/src/main/java/org/zalando/logbook/BodyFilter.java rename to logbook-api/src/main/java/org/zalando/logbook/api/BodyFilter.java index 6e99c3198..afa1308e2 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/BodyFilter.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/BodyFilter.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/BodyReplacer.java b/logbook-api/src/main/java/org/zalando/logbook/api/BodyReplacer.java similarity index 95% rename from logbook-api/src/main/java/org/zalando/logbook/BodyReplacer.java rename to logbook-api/src/main/java/org/zalando/logbook/api/BodyReplacer.java index 646b07d14..2c0213015 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/BodyReplacer.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/BodyReplacer.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/ContentType.java b/logbook-api/src/main/java/org/zalando/logbook/api/ContentType.java similarity index 98% rename from logbook-api/src/main/java/org/zalando/logbook/ContentType.java rename to logbook-api/src/main/java/org/zalando/logbook/api/ContentType.java index 99e1167d3..0c42ed380 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/ContentType.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/ContentType.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import lombok.experimental.UtilityClass; @@ -58,4 +58,4 @@ Charset parseCharset(@Nullable String contentTypeValue) { static final String CONTENT_TYPE_HEADER = "Content-Type"; private static final String SEMICOLON = ";"; private static final String CHARSET_PREFIX = "charset="; -} \ No newline at end of file +} diff --git a/logbook-api/src/main/java/org/zalando/logbook/Correlation.java b/logbook-api/src/main/java/org/zalando/logbook/api/Correlation.java similarity index 91% rename from logbook-api/src/main/java/org/zalando/logbook/Correlation.java rename to logbook-api/src/main/java/org/zalando/logbook/api/Correlation.java index 1686d5b28..7fffed523 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/Correlation.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/Correlation.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/CorrelationId.java b/logbook-api/src/main/java/org/zalando/logbook/api/CorrelationId.java similarity index 70% rename from logbook-api/src/main/java/org/zalando/logbook/CorrelationId.java rename to logbook-api/src/main/java/org/zalando/logbook/api/CorrelationId.java index fc426a7b1..13150a095 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/CorrelationId.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/CorrelationId.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; public interface CorrelationId { String generate(HttpRequest request); diff --git a/logbook-api/src/main/java/org/zalando/logbook/DefaultHttpHeaders.java b/logbook-api/src/main/java/org/zalando/logbook/api/DefaultHttpHeaders.java similarity index 96% rename from logbook-api/src/main/java/org/zalando/logbook/DefaultHttpHeaders.java rename to logbook-api/src/main/java/org/zalando/logbook/api/DefaultHttpHeaders.java index de474c22f..b97c49c4a 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/DefaultHttpHeaders.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/DefaultHttpHeaders.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import lombok.AllArgsConstructor; import lombok.With; @@ -15,7 +15,7 @@ import static lombok.AccessLevel.PRIVATE; import static org.organicdesign.fp.collections.PersistentVector.ofIter; -import static org.zalando.logbook.Fold.fold; +import static org.zalando.logbook.api.Fold.fold; @SuppressWarnings("deprecation") // needed because of @Delegate and @Deprecated @AllArgsConstructor(access = PRIVATE) diff --git a/logbook-api/src/main/java/org/zalando/logbook/DeleteHttpHeaders.java b/logbook-api/src/main/java/org/zalando/logbook/api/DeleteHttpHeaders.java similarity index 93% rename from logbook-api/src/main/java/org/zalando/logbook/DeleteHttpHeaders.java rename to logbook-api/src/main/java/org/zalando/logbook/api/DeleteHttpHeaders.java index 1403deac0..9e3098f4a 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/DeleteHttpHeaders.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/DeleteHttpHeaders.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import java.util.Arrays; import java.util.List; diff --git a/logbook-api/src/main/java/org/zalando/logbook/Fold.java b/logbook-api/src/main/java/org/zalando/logbook/api/Fold.java similarity index 96% rename from logbook-api/src/main/java/org/zalando/logbook/Fold.java rename to logbook-api/src/main/java/org/zalando/logbook/api/Fold.java index 57e906479..e92d1fb25 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/Fold.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/Fold.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import lombok.experimental.UtilityClass; diff --git a/logbook-api/src/main/java/org/zalando/logbook/ForwardingHttpMessage.java b/logbook-api/src/main/java/org/zalando/logbook/api/ForwardingHttpMessage.java similarity index 96% rename from logbook-api/src/main/java/org/zalando/logbook/ForwardingHttpMessage.java rename to logbook-api/src/main/java/org/zalando/logbook/api/ForwardingHttpMessage.java index 513d10ad7..313839c89 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/ForwardingHttpMessage.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/ForwardingHttpMessage.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/ForwardingHttpRequest.java b/logbook-api/src/main/java/org/zalando/logbook/api/ForwardingHttpRequest.java similarity index 97% rename from logbook-api/src/main/java/org/zalando/logbook/ForwardingHttpRequest.java rename to logbook-api/src/main/java/org/zalando/logbook/api/ForwardingHttpRequest.java index ac0880aca..bafe1de7f 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/ForwardingHttpRequest.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/ForwardingHttpRequest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/ForwardingHttpResponse.java b/logbook-api/src/main/java/org/zalando/logbook/api/ForwardingHttpResponse.java similarity index 95% rename from logbook-api/src/main/java/org/zalando/logbook/ForwardingHttpResponse.java rename to logbook-api/src/main/java/org/zalando/logbook/api/ForwardingHttpResponse.java index c3a8ef3fe..cf0618670 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/ForwardingHttpResponse.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/ForwardingHttpResponse.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/HeaderFilter.java b/logbook-api/src/main/java/org/zalando/logbook/api/HeaderFilter.java similarity index 93% rename from logbook-api/src/main/java/org/zalando/logbook/HeaderFilter.java rename to logbook-api/src/main/java/org/zalando/logbook/api/HeaderFilter.java index 3dc4b1139..ec97e2d19 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/HeaderFilter.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/HeaderFilter.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/HttpHeaders.java b/logbook-api/src/main/java/org/zalando/logbook/api/HttpHeaders.java similarity index 97% rename from logbook-api/src/main/java/org/zalando/logbook/HttpHeaders.java rename to logbook-api/src/main/java/org/zalando/logbook/api/HttpHeaders.java index 63245db7a..6e8e36847 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/HttpHeaders.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/HttpHeaders.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import javax.annotation.CheckReturnValue; import javax.annotation.Nullable; @@ -13,7 +13,7 @@ import java.util.function.Predicate; import java.util.function.UnaryOperator; -import static org.zalando.logbook.DefaultHttpHeaders.EMPTY; +import static org.zalando.logbook.api.DefaultHttpHeaders.EMPTY; /** * An immutable multi-map representing HTTP headers. It offers three kinds of diff --git a/logbook-api/src/main/java/org/zalando/logbook/HttpLogFormatter.java b/logbook-api/src/main/java/org/zalando/logbook/api/HttpLogFormatter.java similarity index 91% rename from logbook-api/src/main/java/org/zalando/logbook/HttpLogFormatter.java rename to logbook-api/src/main/java/org/zalando/logbook/api/HttpLogFormatter.java index 2283d2811..b9a4051ef 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/HttpLogFormatter.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/HttpLogFormatter.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/HttpLogWriter.java b/logbook-api/src/main/java/org/zalando/logbook/api/HttpLogWriter.java similarity index 92% rename from logbook-api/src/main/java/org/zalando/logbook/HttpLogWriter.java rename to logbook-api/src/main/java/org/zalando/logbook/api/HttpLogWriter.java index c60f95c3e..c68b41a97 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/HttpLogWriter.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/HttpLogWriter.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/HttpMessage.java b/logbook-api/src/main/java/org/zalando/logbook/api/HttpMessage.java similarity index 97% rename from logbook-api/src/main/java/org/zalando/logbook/HttpMessage.java rename to logbook-api/src/main/java/org/zalando/logbook/api/HttpMessage.java index 5ce995532..82af95585 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/HttpMessage.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/HttpMessage.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/HttpRequest.java b/logbook-api/src/main/java/org/zalando/logbook/api/HttpRequest.java similarity index 96% rename from logbook-api/src/main/java/org/zalando/logbook/HttpRequest.java rename to logbook-api/src/main/java/org/zalando/logbook/api/HttpRequest.java index 2283923a5..845a346d3 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/HttpRequest.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/HttpRequest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/HttpResponse.java b/logbook-api/src/main/java/org/zalando/logbook/api/HttpResponse.java similarity index 99% rename from logbook-api/src/main/java/org/zalando/logbook/HttpResponse.java rename to logbook-api/src/main/java/org/zalando/logbook/api/HttpResponse.java index f92489ea6..5c4f2a242 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/HttpResponse.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/HttpResponse.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/Logbook.java b/logbook-api/src/main/java/org/zalando/logbook/api/Logbook.java similarity index 96% rename from logbook-api/src/main/java/org/zalando/logbook/Logbook.java rename to logbook-api/src/main/java/org/zalando/logbook/api/Logbook.java index dd2a32e78..caacae8ee 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/Logbook.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/Logbook.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/LogbookCreator.java b/logbook-api/src/main/java/org/zalando/logbook/api/LogbookCreator.java similarity index 98% rename from logbook-api/src/main/java/org/zalando/logbook/LogbookCreator.java rename to logbook-api/src/main/java/org/zalando/logbook/api/LogbookCreator.java index 0412c7554..bd8b1be32 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/LogbookCreator.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/LogbookCreator.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import lombok.Singular; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/LogbookFactory.java b/logbook-api/src/main/java/org/zalando/logbook/api/LogbookFactory.java similarity index 92% rename from logbook-api/src/main/java/org/zalando/logbook/LogbookFactory.java rename to logbook-api/src/main/java/org/zalando/logbook/api/LogbookFactory.java index f97948d19..9fb0f3efa 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/LogbookFactory.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/LogbookFactory.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; @@ -9,7 +9,7 @@ import static org.apiguardian.api.API.Status.STABLE; @API(status = STABLE) -interface LogbookFactory { +public interface LogbookFactory { LogbookFactory INSTANCE = load(LogbookFactory.class).iterator().next(); diff --git a/logbook-api/src/main/java/org/zalando/logbook/NonMergeableBodyFilterPair.java b/logbook-api/src/main/java/org/zalando/logbook/api/NonMergeableBodyFilterPair.java similarity index 89% rename from logbook-api/src/main/java/org/zalando/logbook/NonMergeableBodyFilterPair.java rename to logbook-api/src/main/java/org/zalando/logbook/api/NonMergeableBodyFilterPair.java index 08018958a..4f6f20608 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/NonMergeableBodyFilterPair.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/NonMergeableBodyFilterPair.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import lombok.AllArgsConstructor; import lombok.Getter; @@ -6,7 +6,7 @@ import javax.annotation.Nullable; import static lombok.AccessLevel.PACKAGE; -import static org.zalando.logbook.BodyFilter.merge; +import static org.zalando.logbook.api.BodyFilter.merge; @AllArgsConstructor @Getter(PACKAGE) diff --git a/logbook-api/src/main/java/org/zalando/logbook/NoneBodyFilter.java b/logbook-api/src/main/java/org/zalando/logbook/api/NoneBodyFilter.java similarity index 90% rename from logbook-api/src/main/java/org/zalando/logbook/NoneBodyFilter.java rename to logbook-api/src/main/java/org/zalando/logbook/api/NoneBodyFilter.java index b2086da70..2f0f3920f 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/NoneBodyFilter.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/NoneBodyFilter.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import javax.annotation.Nullable; diff --git a/logbook-api/src/main/java/org/zalando/logbook/Origin.java b/logbook-api/src/main/java/org/zalando/logbook/api/Origin.java similarity index 82% rename from logbook-api/src/main/java/org/zalando/logbook/Origin.java rename to logbook-api/src/main/java/org/zalando/logbook/api/Origin.java index e5181d2b9..c100e3cec 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/Origin.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/Origin.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/PathFilter.java b/logbook-api/src/main/java/org/zalando/logbook/api/PathFilter.java similarity index 92% rename from logbook-api/src/main/java/org/zalando/logbook/PathFilter.java rename to logbook-api/src/main/java/org/zalando/logbook/api/PathFilter.java index a6977a96f..4898807a6 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/PathFilter.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/PathFilter.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/Precorrelation.java b/logbook-api/src/main/java/org/zalando/logbook/api/Precorrelation.java similarity index 88% rename from logbook-api/src/main/java/org/zalando/logbook/Precorrelation.java rename to logbook-api/src/main/java/org/zalando/logbook/api/Precorrelation.java index d512591dd..1c70b086b 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/Precorrelation.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/Precorrelation.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/QueryFilter.java b/logbook-api/src/main/java/org/zalando/logbook/api/QueryFilter.java similarity index 92% rename from logbook-api/src/main/java/org/zalando/logbook/QueryFilter.java rename to logbook-api/src/main/java/org/zalando/logbook/api/QueryFilter.java index c4454bcf0..d3313d75d 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/QueryFilter.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/QueryFilter.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/RequestFilter.java b/logbook-api/src/main/java/org/zalando/logbook/api/RequestFilter.java similarity index 93% rename from logbook-api/src/main/java/org/zalando/logbook/RequestFilter.java rename to logbook-api/src/main/java/org/zalando/logbook/api/RequestFilter.java index 8199cc4d8..645240930 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/RequestFilter.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/RequestFilter.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/RequestURI.java b/logbook-api/src/main/java/org/zalando/logbook/api/RequestURI.java similarity index 73% rename from logbook-api/src/main/java/org/zalando/logbook/RequestURI.java rename to logbook-api/src/main/java/org/zalando/logbook/api/RequestURI.java index 6a9ed1a00..486cd8653 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/RequestURI.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/RequestURI.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import lombok.experimental.UtilityClass; @@ -7,35 +7,35 @@ import java.util.Set; import static java.util.Arrays.asList; -import static org.zalando.logbook.RequestURI.Component.AUTHORITY; -import static org.zalando.logbook.RequestURI.Component.PATH; -import static org.zalando.logbook.RequestURI.Component.QUERY; -import static org.zalando.logbook.RequestURI.Component.SCHEME; +import static org.zalando.logbook.api.RequestURI.Component.AUTHORITY; +import static org.zalando.logbook.api.RequestURI.Component.PATH; +import static org.zalando.logbook.api.RequestURI.Component.QUERY; +import static org.zalando.logbook.api.RequestURI.Component.SCHEME; @UtilityClass -final class RequestURI { +public final class RequestURI { - enum Component { + public enum Component { SCHEME, AUTHORITY, PATH, QUERY } - static String reconstruct(final HttpRequest request) { + public static String reconstruct(final HttpRequest request) { final StringBuilder url = new StringBuilder(); reconstruct(request, url); return url.toString(); } - static void reconstruct(final HttpRequest request, final StringBuilder output) { + public static void reconstruct(final HttpRequest request, final StringBuilder output) { reconstruct(request, EnumSet.allOf(Component.class), output); } - static String reconstruct(final HttpRequest request, final Component... components) { + public static String reconstruct(final HttpRequest request, final Component... components) { final StringBuilder url = new StringBuilder(); reconstruct(request, EnumSet.copyOf(asList(components)), url); return url.toString(); } - static String reconstruct(final HttpRequest request, final Set components) { + public static String reconstruct(final HttpRequest request, final Set components) { final StringBuilder url = new StringBuilder(); reconstruct(request, components, url); return url.toString(); diff --git a/logbook-api/src/main/java/org/zalando/logbook/ResponseFilter.java b/logbook-api/src/main/java/org/zalando/logbook/api/ResponseFilter.java similarity index 93% rename from logbook-api/src/main/java/org/zalando/logbook/ResponseFilter.java rename to logbook-api/src/main/java/org/zalando/logbook/api/ResponseFilter.java index 19b9a5967..efda17673 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/ResponseFilter.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/ResponseFilter.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/Sink.java b/logbook-api/src/main/java/org/zalando/logbook/api/Sink.java similarity index 94% rename from logbook-api/src/main/java/org/zalando/logbook/Sink.java rename to logbook-api/src/main/java/org/zalando/logbook/api/Sink.java index 8b20cb184..98390d33e 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/Sink.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/Sink.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import java.io.IOException; diff --git a/logbook-api/src/main/java/org/zalando/logbook/Strategy.java b/logbook-api/src/main/java/org/zalando/logbook/api/Strategy.java similarity index 99% rename from logbook-api/src/main/java/org/zalando/logbook/Strategy.java rename to logbook-api/src/main/java/org/zalando/logbook/api/Strategy.java index 6a001708a..8a1ea21b4 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/Strategy.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/Strategy.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/StructuredHttpLogFormatter.java b/logbook-api/src/main/java/org/zalando/logbook/api/StructuredHttpLogFormatter.java similarity index 99% rename from logbook-api/src/main/java/org/zalando/logbook/StructuredHttpLogFormatter.java rename to logbook-api/src/main/java/org/zalando/logbook/api/StructuredHttpLogFormatter.java index af22222d0..badd70250 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/StructuredHttpLogFormatter.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/StructuredHttpLogFormatter.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.apiguardian.api.API; diff --git a/logbook-api/src/main/java/org/zalando/logbook/UpdateHttpHeaders.java b/logbook-api/src/main/java/org/zalando/logbook/api/UpdateHttpHeaders.java similarity index 89% rename from logbook-api/src/main/java/org/zalando/logbook/UpdateHttpHeaders.java rename to logbook-api/src/main/java/org/zalando/logbook/api/UpdateHttpHeaders.java index fcc012aa1..d598d31a9 100644 --- a/logbook-api/src/main/java/org/zalando/logbook/UpdateHttpHeaders.java +++ b/logbook-api/src/main/java/org/zalando/logbook/api/UpdateHttpHeaders.java @@ -1,10 +1,10 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import java.util.Arrays; import java.util.List; import java.util.Map; -import static org.zalando.logbook.Fold.fold; +import static org.zalando.logbook.api.Fold.fold; interface UpdateHttpHeaders extends HttpHeaders { diff --git a/logbook-api/src/main/java/org/zalando/logbook/api/package-info.java b/logbook-api/src/main/java/org/zalando/logbook/api/package-info.java new file mode 100644 index 000000000..40ecc2be8 --- /dev/null +++ b/logbook-api/src/main/java/org/zalando/logbook/api/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package org.zalando.logbook.api; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/logbook-api/src/main/java/org/zalando/logbook/package-info.java b/logbook-api/src/main/java/org/zalando/logbook/package-info.java deleted file mode 100644 index 46107ffb3..000000000 --- a/logbook-api/src/main/java/org/zalando/logbook/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@ParametersAreNonnullByDefault -package org.zalando.logbook; - -import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/logbook-api/src/test/java/org/zalando/logbook/BodyFilterMergeTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/BodyFilterMergeTest.java similarity index 98% rename from logbook-api/src/test/java/org/zalando/logbook/BodyFilterMergeTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/BodyFilterMergeTest.java index 5bc7ced1b..7b946d4bf 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/BodyFilterMergeTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/BodyFilterMergeTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import lombok.AllArgsConstructor; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/BodyFilterTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/BodyFilterTest.java similarity index 90% rename from logbook-api/src/test/java/org/zalando/logbook/BodyFilterTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/BodyFilterTest.java index 00ab06231..75e03653e 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/BodyFilterTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/BodyFilterTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/BodyReplacerTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/BodyReplacerTest.java similarity index 89% rename from logbook-api/src/test/java/org/zalando/logbook/BodyReplacerTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/BodyReplacerTest.java index 5bb51c156..82ae210e2 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/BodyReplacerTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/BodyReplacerTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; @@ -7,7 +7,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.zalando.logbook.BodyReplacer.composite; +import static org.zalando.logbook.api.BodyReplacer.composite; final class BodyReplacerTest { diff --git a/logbook-api/src/test/java/org/zalando/logbook/ContentTypeTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/ContentTypeTest.java similarity index 96% rename from logbook-api/src/test/java/org/zalando/logbook/ContentTypeTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/ContentTypeTest.java index 963fb3736..cb8bbfb35 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/ContentTypeTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/ContentTypeTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; @@ -22,4 +22,4 @@ void unitTest() { assertThat(ContentType.parseCharset("charset=\"bar")).isNull(); assertThat(ContentType.parseCharset("application/json; charset=\"us-ascii\"")).isEqualTo(StandardCharsets.US_ASCII); } -} \ No newline at end of file +} diff --git a/logbook-api/src/test/java/org/zalando/logbook/CorrelationTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/CorrelationTest.java similarity index 92% rename from logbook-api/src/test/java/org/zalando/logbook/CorrelationTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/CorrelationTest.java index e40606fbb..1f2f202a4 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/CorrelationTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/CorrelationTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; import org.mockito.invocation.InvocationOnMock; diff --git a/logbook-api/src/test/java/org/zalando/logbook/EnforceCoverageTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/EnforceCoverageTest.java similarity index 97% rename from logbook-api/src/test/java/org/zalando/logbook/EnforceCoverageTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/EnforceCoverageTest.java index 8c7305b95..32b3999ea 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/EnforceCoverageTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/EnforceCoverageTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import com.google.gag.annotation.remark.Hack; import com.google.gag.annotation.remark.OhNoYouDidnt; diff --git a/logbook-api/src/test/java/org/zalando/logbook/FoldTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/FoldTest.java similarity index 80% rename from logbook-api/src/test/java/org/zalando/logbook/FoldTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/FoldTest.java index dd2899c25..bff8a147e 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/FoldTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/FoldTest.java @@ -1,7 +1,7 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; -import org.zalando.logbook.Fold.NoCombiner; +import org.zalando.logbook.api.Fold.NoCombiner; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/logbook-api/src/test/java/org/zalando/logbook/ForwardingTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/ForwardingTest.java similarity index 96% rename from logbook-api/src/test/java/org/zalando/logbook/ForwardingTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/ForwardingTest.java index 3fd1fcf77..bf291d33a 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/ForwardingTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/ForwardingTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import lombok.SneakyThrows; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/HeaderFilterTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/HeaderFilterTest.java similarity index 92% rename from logbook-api/src/test/java/org/zalando/logbook/HeaderFilterTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/HeaderFilterTest.java index 953403416..ec56c6962 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/HeaderFilterTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/HeaderFilterTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/HttpHeadersApplyTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersApplyTest.java similarity index 96% rename from logbook-api/src/test/java/org/zalando/logbook/HttpHeadersApplyTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersApplyTest.java index 01fa75e08..ffb2a1392 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/HttpHeadersApplyTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersApplyTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; @@ -9,7 +9,7 @@ import static java.util.Collections.singletonList; import static java.util.Collections.singletonMap; import static org.assertj.core.api.Assertions.assertThat; -import static org.zalando.logbook.HttpHeaders.predicate; +import static org.zalando.logbook.api.HttpHeaders.predicate; class HttpHeadersApplyTest { diff --git a/logbook-api/src/test/java/org/zalando/logbook/HttpHeadersImmutabilityTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersImmutabilityTest.java similarity index 96% rename from logbook-api/src/test/java/org/zalando/logbook/HttpHeadersImmutabilityTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersImmutabilityTest.java index 9fab5fb3c..6c4051b2c 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/HttpHeadersImmutabilityTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersImmutabilityTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/HttpHeadersTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersTest.java similarity index 97% rename from logbook-api/src/test/java/org/zalando/logbook/HttpHeadersTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersTest.java index 821149738..1f7595dba 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/HttpHeadersTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersTest.java @@ -1,16 +1,16 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; import java.util.List; import java.util.Map; +import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; import static java.util.Collections.singletonMap; -import static java.util.Collections.emptyList; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; class HttpHeadersTest { diff --git a/logbook-api/src/test/java/org/zalando/logbook/HttpHeadersUpdateTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersUpdateTest.java similarity index 95% rename from logbook-api/src/test/java/org/zalando/logbook/HttpHeadersUpdateTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersUpdateTest.java index 5140ef03e..1f74d4c59 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/HttpHeadersUpdateTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/HttpHeadersUpdateTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/HttpLogWriterTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/HttpLogWriterTest.java similarity index 90% rename from logbook-api/src/test/java/org/zalando/logbook/HttpLogWriterTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/HttpLogWriterTest.java index 6d84ac1db..d7813084e 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/HttpLogWriterTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/HttpLogWriterTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/HttpMessageTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/HttpMessageTest.java similarity index 98% rename from logbook-api/src/test/java/org/zalando/logbook/HttpMessageTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/HttpMessageTest.java index b101f69f1..9fd73b360 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/HttpMessageTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/HttpMessageTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/HttpResponseTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/HttpResponseTest.java similarity index 98% rename from logbook-api/src/test/java/org/zalando/logbook/HttpResponseTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/HttpResponseTest.java index 833f35471..bc71636f1 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/HttpResponseTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/HttpResponseTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/LogbookFactoryTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/LogbookFactoryTest.java similarity index 90% rename from logbook-api/src/test/java/org/zalando/logbook/LogbookFactoryTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/LogbookFactoryTest.java index 5543580e0..1d919cc2c 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/LogbookFactoryTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/LogbookFactoryTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/LogbookTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/LogbookTest.java similarity index 99% rename from logbook-api/src/test/java/org/zalando/logbook/LogbookTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/LogbookTest.java index 282587143..2c36316cd 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/LogbookTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/LogbookTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; diff --git a/logbook-api/src/test/java/org/zalando/logbook/Mockbook.java b/logbook-api/src/test/java/org/zalando/logbook/api/Mockbook.java similarity index 96% rename from logbook-api/src/test/java/org/zalando/logbook/Mockbook.java rename to logbook-api/src/test/java/org/zalando/logbook/api/Mockbook.java index bf3073eb9..5366cc749 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/Mockbook.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/Mockbook.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/logbook-api/src/test/java/org/zalando/logbook/MockbookFactory.java b/logbook-api/src/test/java/org/zalando/logbook/api/MockbookFactory.java similarity index 96% rename from logbook-api/src/test/java/org/zalando/logbook/MockbookFactory.java rename to logbook-api/src/test/java/org/zalando/logbook/api/MockbookFactory.java index 0c4576a4e..38b00e01d 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/MockbookFactory.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/MockbookFactory.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import javax.annotation.Nullable; import java.util.function.Predicate; diff --git a/logbook-api/src/test/java/org/zalando/logbook/PathFilterTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/PathFilterTest.java similarity index 93% rename from logbook-api/src/test/java/org/zalando/logbook/PathFilterTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/PathFilterTest.java index 2a40605e7..08ee4bccf 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/PathFilterTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/PathFilterTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/QueryFilterTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/QueryFilterTest.java similarity index 90% rename from logbook-api/src/test/java/org/zalando/logbook/QueryFilterTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/QueryFilterTest.java index d3cf159bc..4e2cfbe77 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/QueryFilterTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/QueryFilterTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/RequestFilterTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/RequestFilterTest.java similarity index 92% rename from logbook-api/src/test/java/org/zalando/logbook/RequestFilterTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/RequestFilterTest.java index 64b76591b..0386838e3 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/RequestFilterTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/RequestFilterTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; diff --git a/logbook-api/src/test/java/org/zalando/logbook/RequestURITest.java b/logbook-api/src/test/java/org/zalando/logbook/api/RequestURITest.java similarity index 88% rename from logbook-api/src/test/java/org/zalando/logbook/RequestURITest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/RequestURITest.java index a158b7391..037d953a7 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/RequestURITest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/RequestURITest.java @@ -1,8 +1,10 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.zalando.logbook.RequestURI.Component; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; +import org.zalando.logbook.api.RequestURI.Component; import java.util.EnumSet; import java.util.Optional; @@ -10,11 +12,11 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.zalando.logbook.RequestURI.Component.AUTHORITY; -import static org.zalando.logbook.RequestURI.Component.PATH; -import static org.zalando.logbook.RequestURI.Component.QUERY; -import static org.zalando.logbook.RequestURI.Component.SCHEME; -import static org.zalando.logbook.RequestURI.reconstruct; +import static org.zalando.logbook.api.RequestURI.Component.AUTHORITY; +import static org.zalando.logbook.api.RequestURI.Component.PATH; +import static org.zalando.logbook.api.RequestURI.Component.QUERY; +import static org.zalando.logbook.api.RequestURI.Component.SCHEME; +import static org.zalando.logbook.api.RequestURI.reconstruct; final class RequestURITest { diff --git a/logbook-api/src/test/java/org/zalando/logbook/ResponseFilterTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/ResponseFilterTest.java similarity index 76% rename from logbook-api/src/test/java/org/zalando/logbook/ResponseFilterTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/ResponseFilterTest.java index b3a2e223f..fc340a892 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/ResponseFilterTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/ResponseFilterTest.java @@ -1,6 +1,8 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.ResponseFilter; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/logbook-api/src/test/java/org/zalando/logbook/SinkTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/SinkTest.java similarity index 84% rename from logbook-api/src/test/java/org/zalando/logbook/SinkTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/SinkTest.java index fb6992410..b9dcacdc2 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/SinkTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/SinkTest.java @@ -1,6 +1,10 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Sink; import java.io.IOException; diff --git a/logbook-api/src/test/java/org/zalando/logbook/StrategyTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/StrategyTest.java similarity index 84% rename from logbook-api/src/test/java/org/zalando/logbook/StrategyTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/StrategyTest.java index 0cc9de358..7f3c90316 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/StrategyTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/StrategyTest.java @@ -1,7 +1,13 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.Test; import org.mockito.invocation.InvocationOnMock; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; +import org.zalando.logbook.api.Strategy; import java.io.IOException; diff --git a/logbook-api/src/test/java/org/zalando/logbook/StructuredHttpLogFormatterTest.java b/logbook-api/src/test/java/org/zalando/logbook/api/StructuredHttpLogFormatterTest.java similarity index 94% rename from logbook-api/src/test/java/org/zalando/logbook/StructuredHttpLogFormatterTest.java rename to logbook-api/src/test/java/org/zalando/logbook/api/StructuredHttpLogFormatterTest.java index c7cb86d8a..9efb729f6 100644 --- a/logbook-api/src/test/java/org/zalando/logbook/StructuredHttpLogFormatterTest.java +++ b/logbook-api/src/test/java/org/zalando/logbook/api/StructuredHttpLogFormatterTest.java @@ -1,7 +1,13 @@ -package org.zalando.logbook; +package org.zalando.logbook.api; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.StructuredHttpLogFormatter; import java.io.IOException; import java.time.Duration; @@ -14,7 +20,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.zalando.logbook.HttpHeaders.empty; +import static org.zalando.logbook.api.HttpHeaders.empty; class StructuredHttpLogFormatterTest { diff --git a/logbook-api/src/test/resources/META-INF/services/org.zalando.logbook.LogbookFactory b/logbook-api/src/test/resources/META-INF/services/org.zalando.logbook.LogbookFactory index bbacac721..9c8ee3d38 100644 --- a/logbook-api/src/test/resources/META-INF/services/org.zalando.logbook.LogbookFactory +++ b/logbook-api/src/test/resources/META-INF/services/org.zalando.logbook.LogbookFactory @@ -1 +1 @@ -org.zalando.logbook.MockbookFactory \ No newline at end of file +org.zalando.logbook.api.MockbookFactory diff --git a/logbook-core/src/main/java/org/zalando/logbook/BodyFilters.java b/logbook-core/src/main/java/org/zalando/logbook/core/BodyFilters.java similarity index 88% rename from logbook-core/src/main/java/org/zalando/logbook/BodyFilters.java rename to logbook-core/src/main/java/org/zalando/logbook/core/BodyFilters.java index f08578114..5d101c7d4 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/BodyFilters.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/BodyFilters.java @@ -1,6 +1,8 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.BodyFilter; +import org.zalando.logbook.api.QueryFilter; import org.zalando.logbook.common.MediaTypeQuery; import java.util.HashSet; @@ -10,8 +12,8 @@ import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.MAINTAINED; import static org.apiguardian.api.API.Status.STABLE; -import static org.zalando.logbook.DefaultFilters.defaultValues; -import static org.zalando.logbook.QueryFilters.replaceQuery; +import static org.zalando.logbook.core.DefaultFilters.defaultValues; +import static org.zalando.logbook.core.QueryFilters.replaceQuery; @API(status = STABLE) public final class BodyFilters { diff --git a/logbook-core/src/main/java/org/zalando/logbook/BodyOnlyIfStatusAtLeastStrategy.java b/logbook-core/src/main/java/org/zalando/logbook/core/BodyOnlyIfStatusAtLeastStrategy.java similarity index 70% rename from logbook-core/src/main/java/org/zalando/logbook/BodyOnlyIfStatusAtLeastStrategy.java rename to logbook-core/src/main/java/org/zalando/logbook/core/BodyOnlyIfStatusAtLeastStrategy.java index fff9d1a1f..73b761138 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/BodyOnlyIfStatusAtLeastStrategy.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/BodyOnlyIfStatusAtLeastStrategy.java @@ -1,7 +1,13 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; import org.apiguardian.api.API; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; +import org.zalando.logbook.api.Strategy; import java.io.IOException; @@ -20,7 +26,7 @@ public void write(final Precorrelation precorrelation, final HttpRequest request @Override public void write(final Correlation correlation, final HttpRequest request, final HttpResponse response, - final Sink sink) throws IOException { + final Sink sink) throws IOException { if (response.getStatus() >= status) { sink.writeBoth(correlation, request, response); diff --git a/logbook-core/src/main/java/org/zalando/logbook/BodyReplacementHttpRequest.java b/logbook-core/src/main/java/org/zalando/logbook/core/BodyReplacementHttpRequest.java similarity index 85% rename from logbook-core/src/main/java/org/zalando/logbook/BodyReplacementHttpRequest.java rename to logbook-core/src/main/java/org/zalando/logbook/core/BodyReplacementHttpRequest.java index b9608696e..879a53744 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/BodyReplacementHttpRequest.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/BodyReplacementHttpRequest.java @@ -1,6 +1,8 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; +import org.zalando.logbook.api.ForwardingHttpRequest; +import org.zalando.logbook.api.HttpRequest; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/logbook-core/src/main/java/org/zalando/logbook/BodyReplacementHttpResponse.java b/logbook-core/src/main/java/org/zalando/logbook/core/BodyReplacementHttpResponse.java similarity index 85% rename from logbook-core/src/main/java/org/zalando/logbook/BodyReplacementHttpResponse.java rename to logbook-core/src/main/java/org/zalando/logbook/core/BodyReplacementHttpResponse.java index c147872d1..b12aabce3 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/BodyReplacementHttpResponse.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/BodyReplacementHttpResponse.java @@ -1,6 +1,8 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; +import org.zalando.logbook.api.ForwardingHttpResponse; +import org.zalando.logbook.api.HttpResponse; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/logbook-core/src/main/java/org/zalando/logbook/BodyReplacers.java b/logbook-core/src/main/java/org/zalando/logbook/core/BodyReplacers.java similarity index 93% rename from logbook-core/src/main/java/org/zalando/logbook/BodyReplacers.java rename to logbook-core/src/main/java/org/zalando/logbook/core/BodyReplacers.java index dbda40333..1c72131e1 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/BodyReplacers.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/BodyReplacers.java @@ -1,12 +1,14 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.BodyReplacer; +import org.zalando.logbook.api.HttpMessage; import java.util.function.Predicate; import static org.apiguardian.api.API.Status.MAINTAINED; import static org.apiguardian.api.API.Status.STABLE; -import static org.zalando.logbook.Conditions.contentType; +import static org.zalando.logbook.core.Conditions.contentType; @API(status = STABLE) public final class BodyReplacers { diff --git a/logbook-core/src/main/java/org/zalando/logbook/Cache.java b/logbook-core/src/main/java/org/zalando/logbook/core/Cache.java similarity index 92% rename from logbook-core/src/main/java/org/zalando/logbook/Cache.java rename to logbook-core/src/main/java/org/zalando/logbook/core/Cache.java index 565d26a3a..87a116dab 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/Cache.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/Cache.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; diff --git a/logbook-core/src/main/java/org/zalando/logbook/CachingHttpRequest.java b/logbook-core/src/main/java/org/zalando/logbook/core/CachingHttpRequest.java similarity index 72% rename from logbook-core/src/main/java/org/zalando/logbook/CachingHttpRequest.java rename to logbook-core/src/main/java/org/zalando/logbook/core/CachingHttpRequest.java index a3817b0b7..e1343e0a9 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/CachingHttpRequest.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/CachingHttpRequest.java @@ -1,4 +1,8 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; + +import org.zalando.logbook.api.ForwardingHttpRequest; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; final class CachingHttpRequest implements ForwardingHttpRequest { diff --git a/logbook-core/src/main/java/org/zalando/logbook/CachingHttpResponse.java b/logbook-core/src/main/java/org/zalando/logbook/core/CachingHttpResponse.java similarity index 73% rename from logbook-core/src/main/java/org/zalando/logbook/CachingHttpResponse.java rename to logbook-core/src/main/java/org/zalando/logbook/core/CachingHttpResponse.java index 9ce9dd2ad..86ab4f5f5 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/CachingHttpResponse.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/CachingHttpResponse.java @@ -1,4 +1,8 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; + +import org.zalando.logbook.api.ForwardingHttpResponse; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; final class CachingHttpResponse implements ForwardingHttpResponse { diff --git a/logbook-core/src/main/java/org/zalando/logbook/ChunkingSink.java b/logbook-core/src/main/java/org/zalando/logbook/core/ChunkingSink.java similarity index 86% rename from logbook-core/src/main/java/org/zalando/logbook/ChunkingSink.java rename to logbook-core/src/main/java/org/zalando/logbook/core/ChunkingSink.java index 617786f22..f3705f0fa 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/ChunkingSink.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/ChunkingSink.java @@ -1,6 +1,12 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpMessage; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; import java.io.IOException; import java.util.stream.Stream; diff --git a/logbook-core/src/main/java/org/zalando/logbook/ChunkingSpliterator.java b/logbook-core/src/main/java/org/zalando/logbook/core/ChunkingSpliterator.java similarity index 98% rename from logbook-core/src/main/java/org/zalando/logbook/ChunkingSpliterator.java rename to logbook-core/src/main/java/org/zalando/logbook/core/ChunkingSpliterator.java index 1066eac4b..b16bce333 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/ChunkingSpliterator.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/ChunkingSpliterator.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import java.util.Spliterator; import java.util.function.Consumer; diff --git a/logbook-core/src/main/java/org/zalando/logbook/CommonsLogFormatSink.java b/logbook-core/src/main/java/org/zalando/logbook/core/CommonsLogFormatSink.java similarity index 90% rename from logbook-core/src/main/java/org/zalando/logbook/CommonsLogFormatSink.java rename to logbook-core/src/main/java/org/zalando/logbook/core/CommonsLogFormatSink.java index 4191b32c2..6a19f2c49 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/CommonsLogFormatSink.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/CommonsLogFormatSink.java @@ -1,7 +1,13 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; import org.apiguardian.api.API; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; import java.io.IOException; import java.time.ZoneId; @@ -62,7 +68,7 @@ public void write(final Precorrelation precorrelation, final HttpRequest request @Override public void write(final Correlation correlation, final HttpRequest request, - final HttpResponse response) throws IOException { + final HttpResponse response) throws IOException { final StringBuilder output = new StringBuilder(120); diff --git a/logbook-core/src/main/java/org/zalando/logbook/CompactingXmlBodyFilter.java b/logbook-core/src/main/java/org/zalando/logbook/core/CompactingXmlBodyFilter.java similarity index 98% rename from logbook-core/src/main/java/org/zalando/logbook/CompactingXmlBodyFilter.java rename to logbook-core/src/main/java/org/zalando/logbook/core/CompactingXmlBodyFilter.java index 75c0cb18a..a5ffabd11 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/CompactingXmlBodyFilter.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/CompactingXmlBodyFilter.java @@ -1,9 +1,10 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.extern.slf4j.Slf4j; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.zalando.logbook.api.BodyFilter; import org.zalando.logbook.common.MediaTypeQuery; import javax.annotation.Nullable; diff --git a/logbook-core/src/main/java/org/zalando/logbook/CompositeSink.java b/logbook-core/src/main/java/org/zalando/logbook/core/CompositeSink.java similarity index 81% rename from logbook-core/src/main/java/org/zalando/logbook/CompositeSink.java rename to logbook-core/src/main/java/org/zalando/logbook/core/CompositeSink.java index 9325036fd..3bf770b92 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/CompositeSink.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/CompositeSink.java @@ -1,7 +1,12 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; import org.zalando.fauxpas.ThrowingConsumer; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; import java.io.IOException; import java.util.Collection; diff --git a/logbook-core/src/main/java/org/zalando/logbook/Conditions.java b/logbook-core/src/main/java/org/zalando/logbook/core/Conditions.java similarity index 85% rename from logbook-core/src/main/java/org/zalando/logbook/Conditions.java rename to logbook-core/src/main/java/org/zalando/logbook/core/Conditions.java index 5f26fe6ed..269a0f98a 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/Conditions.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/Conditions.java @@ -1,6 +1,9 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.HttpMessage; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.RequestURI; import org.zalando.logbook.common.Glob; import org.zalando.logbook.common.MediaTypeQuery; @@ -12,10 +15,9 @@ import static java.util.Collections.emptyList; import static org.apiguardian.api.API.Status.STABLE; -import static org.zalando.logbook.RequestURI.Component.AUTHORITY; -import static org.zalando.logbook.RequestURI.Component.PATH; -import static org.zalando.logbook.RequestURI.Component.SCHEME; -import static org.zalando.logbook.RequestURI.reconstruct; +import static org.zalando.logbook.api.RequestURI.Component.AUTHORITY; +import static org.zalando.logbook.api.RequestURI.Component.PATH; +import static org.zalando.logbook.api.RequestURI.Component.SCHEME; @API(status = STABLE) public final class Conditions { @@ -41,7 +43,7 @@ public static Predicate requestTo(final String patter return pattern.startsWith("/") ? requestTo(HttpRequest::getPath, predicate) : - requestTo(request -> reconstruct(request, SCHEME, AUTHORITY, PATH), predicate); + requestTo(request -> RequestURI.reconstruct(request, SCHEME, AUTHORITY, PATH), predicate); } private static Predicate requestTo(final Function extractor, diff --git a/logbook-core/src/main/java/org/zalando/logbook/CookieHeaderFilter.java b/logbook-core/src/main/java/org/zalando/logbook/core/CookieHeaderFilter.java similarity index 95% rename from logbook-core/src/main/java/org/zalando/logbook/CookieHeaderFilter.java rename to logbook-core/src/main/java/org/zalando/logbook/core/CookieHeaderFilter.java index 120b6a007..334999a00 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/CookieHeaderFilter.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/CookieHeaderFilter.java @@ -1,4 +1,7 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; + +import org.zalando.logbook.api.HeaderFilter; +import org.zalando.logbook.api.HttpHeaders; import java.util.HashMap; import java.util.Map; diff --git a/logbook-core/src/main/java/org/zalando/logbook/CurlHttpLogFormatter.java b/logbook-core/src/main/java/org/zalando/logbook/core/CurlHttpLogFormatter.java similarity index 87% rename from logbook-core/src/main/java/org/zalando/logbook/CurlHttpLogFormatter.java rename to logbook-core/src/main/java/org/zalando/logbook/core/CurlHttpLogFormatter.java index b072c2b3d..d61f627c1 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/CurlHttpLogFormatter.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/CurlHttpLogFormatter.java @@ -1,6 +1,11 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; import java.util.ArrayList; diff --git a/logbook-core/src/main/java/org/zalando/logbook/DefaultCorrelationId.java b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultCorrelationId.java similarity index 81% rename from logbook-core/src/main/java/org/zalando/logbook/DefaultCorrelationId.java rename to logbook-core/src/main/java/org/zalando/logbook/core/DefaultCorrelationId.java index 4c61b1e7c..4681bea02 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/DefaultCorrelationId.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultCorrelationId.java @@ -1,6 +1,8 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.CorrelationId; +import org.zalando.logbook.api.HttpRequest; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; diff --git a/logbook-core/src/main/java/org/zalando/logbook/DefaultFilters.java b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultFilters.java similarity index 92% rename from logbook-core/src/main/java/org/zalando/logbook/DefaultFilters.java rename to logbook-core/src/main/java/org/zalando/logbook/core/DefaultFilters.java index 856c93fbf..5ae68855b 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/DefaultFilters.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultFilters.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import java.util.Collection; diff --git a/logbook-core/src/main/java/org/zalando/logbook/DefaultHttpLogFormatter.java b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultHttpLogFormatter.java similarity index 89% rename from logbook-core/src/main/java/org/zalando/logbook/DefaultHttpLogFormatter.java rename to logbook-core/src/main/java/org/zalando/logbook/core/DefaultHttpLogFormatter.java index 6b87d8b4b..5b5e4c40a 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/DefaultHttpLogFormatter.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultHttpLogFormatter.java @@ -1,6 +1,15 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpMessage; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.RequestURI; +import org.zalando.logbook.api.StructuredHttpLogFormatter; import java.io.IOException; import java.util.List; diff --git a/logbook-core/src/main/java/org/zalando/logbook/DefaultHttpLogWriter.java b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultHttpLogWriter.java similarity index 75% rename from logbook-core/src/main/java/org/zalando/logbook/DefaultHttpLogWriter.java rename to logbook-core/src/main/java/org/zalando/logbook/core/DefaultHttpLogWriter.java index 2a2c14bc6..93bb69b37 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/DefaultHttpLogWriter.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultHttpLogWriter.java @@ -1,8 +1,12 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import static org.apiguardian.api.API.Status.STABLE; diff --git a/logbook-core/src/main/java/org/zalando/logbook/DefaultLogbook.java b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultLogbook.java similarity index 88% rename from logbook-core/src/main/java/org/zalando/logbook/DefaultLogbook.java rename to logbook-core/src/main/java/org/zalando/logbook/core/DefaultLogbook.java index 55fd1f328..11702942d 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/DefaultLogbook.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultLogbook.java @@ -1,7 +1,17 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; import lombok.Getter; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.CorrelationId; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.RequestFilter; +import org.zalando.logbook.api.ResponseFilter; +import org.zalando.logbook.api.Sink; +import org.zalando.logbook.api.Strategy; import java.io.IOException; import java.time.Clock; diff --git a/logbook-core/src/main/java/org/zalando/logbook/DefaultLogbookFactory.java b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultLogbookFactory.java similarity index 84% rename from logbook-core/src/main/java/org/zalando/logbook/DefaultLogbookFactory.java rename to logbook-core/src/main/java/org/zalando/logbook/core/DefaultLogbookFactory.java index 24bb6b7ab..fceaedd14 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/DefaultLogbookFactory.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultLogbookFactory.java @@ -1,6 +1,18 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.BodyFilter; +import org.zalando.logbook.api.CorrelationId; +import org.zalando.logbook.api.HeaderFilter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.LogbookFactory; +import org.zalando.logbook.api.PathFilter; +import org.zalando.logbook.api.QueryFilter; +import org.zalando.logbook.api.RequestFilter; +import org.zalando.logbook.api.ResponseFilter; +import org.zalando.logbook.api.Sink; +import org.zalando.logbook.api.Strategy; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/logbook-core/src/main/java/org/zalando/logbook/DefaultPathFilter.java b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultPathFilter.java similarity index 97% rename from logbook-core/src/main/java/org/zalando/logbook/DefaultPathFilter.java rename to logbook-core/src/main/java/org/zalando/logbook/core/DefaultPathFilter.java index fabb23e24..8145729d4 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/DefaultPathFilter.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultPathFilter.java @@ -1,4 +1,6 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; + +import org.zalando.logbook.api.PathFilter; import java.util.ArrayList; import java.util.List; diff --git a/logbook-core/src/main/java/org/zalando/logbook/DefaultSink.java b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultSink.java similarity index 68% rename from logbook-core/src/main/java/org/zalando/logbook/DefaultSink.java rename to logbook-core/src/main/java/org/zalando/logbook/core/DefaultSink.java index cc9a09d7f..21c3b789c 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/DefaultSink.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultSink.java @@ -1,6 +1,13 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; import java.io.IOException; diff --git a/logbook-core/src/main/java/org/zalando/logbook/DefaultStrategy.java b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultStrategy.java similarity index 60% rename from logbook-core/src/main/java/org/zalando/logbook/DefaultStrategy.java rename to logbook-core/src/main/java/org/zalando/logbook/core/DefaultStrategy.java index b1396439f..11cd78730 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/DefaultStrategy.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/DefaultStrategy.java @@ -1,6 +1,7 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; +import org.zalando.logbook.api.Strategy; @AllArgsConstructor public final class DefaultStrategy implements Strategy { diff --git a/logbook-core/src/main/java/org/zalando/logbook/DynamicPathFilter.java b/logbook-core/src/main/java/org/zalando/logbook/core/DynamicPathFilter.java similarity index 95% rename from logbook-core/src/main/java/org/zalando/logbook/DynamicPathFilter.java rename to logbook-core/src/main/java/org/zalando/logbook/core/DynamicPathFilter.java index 592a69f62..a6550e4d5 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/DynamicPathFilter.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/DynamicPathFilter.java @@ -1,4 +1,6 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; + +import org.zalando.logbook.api.PathFilter; import java.util.Objects; import java.util.function.UnaryOperator; diff --git a/logbook-core/src/main/java/org/zalando/logbook/ExtendedLogFormatSink.java b/logbook-core/src/main/java/org/zalando/logbook/core/ExtendedLogFormatSink.java similarity index 94% rename from logbook-core/src/main/java/org/zalando/logbook/ExtendedLogFormatSink.java rename to logbook-core/src/main/java/org/zalando/logbook/core/ExtendedLogFormatSink.java index be50ba4d0..c3d2dbf5d 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/ExtendedLogFormatSink.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/ExtendedLogFormatSink.java @@ -1,10 +1,18 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; import lombok.Getter; import org.apiguardian.api.API; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; import java.io.IOException; import java.math.BigDecimal; @@ -13,7 +21,12 @@ import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/logbook-core/src/main/java/org/zalando/logbook/FilteredHttpRequest.java b/logbook-core/src/main/java/org/zalando/logbook/core/FilteredHttpRequest.java similarity index 84% rename from logbook-core/src/main/java/org/zalando/logbook/FilteredHttpRequest.java rename to logbook-core/src/main/java/org/zalando/logbook/core/FilteredHttpRequest.java index abfc8fb1a..6cc6061ce 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/FilteredHttpRequest.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/FilteredHttpRequest.java @@ -1,7 +1,15 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; import org.apiguardian.api.API; +import org.zalando.logbook.api.BodyFilter; +import org.zalando.logbook.api.ForwardingHttpRequest; +import org.zalando.logbook.api.HeaderFilter; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.PathFilter; +import org.zalando.logbook.api.QueryFilter; +import org.zalando.logbook.api.RequestURI; import java.io.IOException; diff --git a/logbook-core/src/main/java/org/zalando/logbook/FilteredHttpResponse.java b/logbook-core/src/main/java/org/zalando/logbook/core/FilteredHttpResponse.java similarity index 83% rename from logbook-core/src/main/java/org/zalando/logbook/FilteredHttpResponse.java rename to logbook-core/src/main/java/org/zalando/logbook/core/FilteredHttpResponse.java index ca9e82a53..ea8a1d5a1 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/FilteredHttpResponse.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/FilteredHttpResponse.java @@ -1,7 +1,12 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; import org.apiguardian.api.API; +import org.zalando.logbook.api.BodyFilter; +import org.zalando.logbook.api.ForwardingHttpResponse; +import org.zalando.logbook.api.HeaderFilter; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; import java.io.IOException; diff --git a/logbook-core/src/main/java/org/zalando/logbook/HeaderFilters.java b/logbook-core/src/main/java/org/zalando/logbook/core/HeaderFilters.java similarity index 94% rename from logbook-core/src/main/java/org/zalando/logbook/HeaderFilters.java rename to logbook-core/src/main/java/org/zalando/logbook/core/HeaderFilters.java index 9e9cd82cc..f90da4216 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/HeaderFilters.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/HeaderFilters.java @@ -1,12 +1,13 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; -import java.util.function.Function; import org.apiguardian.api.API; +import org.zalando.logbook.api.HeaderFilter; import java.util.Collection; import java.util.List; import java.util.function.BiPredicate; import java.util.function.BinaryOperator; +import java.util.function.Function; import java.util.function.Predicate; import static java.util.Collections.nCopies; @@ -14,8 +15,8 @@ import static java.util.stream.Collectors.toList; import static org.apiguardian.api.API.Status.MAINTAINED; import static org.apiguardian.api.API.Status.STABLE; -import static org.zalando.logbook.DefaultFilters.defaultValues; -import static org.zalando.logbook.HttpHeaders.predicate; +import static org.zalando.logbook.api.HttpHeaders.predicate; +import static org.zalando.logbook.core.DefaultFilters.defaultValues; @API(status = STABLE) public final class HeaderFilters { diff --git a/logbook-core/src/main/java/org/zalando/logbook/PathFilters.java b/logbook-core/src/main/java/org/zalando/logbook/core/PathFilters.java similarity index 95% rename from logbook-core/src/main/java/org/zalando/logbook/PathFilters.java rename to logbook-core/src/main/java/org/zalando/logbook/core/PathFilters.java index 18033e543..0e2537dd9 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/PathFilters.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/PathFilters.java @@ -1,6 +1,7 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.PathFilter; import java.util.function.UnaryOperator; diff --git a/logbook-core/src/main/java/org/zalando/logbook/QueryFilters.java b/logbook-core/src/main/java/org/zalando/logbook/core/QueryFilters.java similarity index 95% rename from logbook-core/src/main/java/org/zalando/logbook/QueryFilters.java rename to logbook-core/src/main/java/org/zalando/logbook/core/QueryFilters.java index ce06cc4d9..b89d6e213 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/QueryFilters.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/QueryFilters.java @@ -1,6 +1,7 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.QueryFilter; import java.util.function.Predicate; import java.util.function.UnaryOperator; @@ -11,7 +12,7 @@ import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.MAINTAINED; import static org.apiguardian.api.API.Status.STABLE; -import static org.zalando.logbook.DefaultFilters.defaultValues; +import static org.zalando.logbook.core.DefaultFilters.defaultValues; @API(status = STABLE) public final class QueryFilters { diff --git a/logbook-core/src/main/java/org/zalando/logbook/RequestFilters.java b/logbook-core/src/main/java/org/zalando/logbook/core/RequestFilters.java similarity index 78% rename from logbook-core/src/main/java/org/zalando/logbook/RequestFilters.java rename to logbook-core/src/main/java/org/zalando/logbook/core/RequestFilters.java index b6f66a785..2b74238ac 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/RequestFilters.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/RequestFilters.java @@ -1,12 +1,15 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.BodyReplacer; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.RequestFilter; import javax.annotation.Nullable; import static org.apiguardian.api.API.Status.MAINTAINED; import static org.apiguardian.api.API.Status.STABLE; -import static org.zalando.logbook.DefaultFilters.defaultValues; +import static org.zalando.logbook.core.DefaultFilters.defaultValues; @API(status = STABLE) public final class RequestFilters { diff --git a/logbook-core/src/main/java/org/zalando/logbook/ResponseFilters.java b/logbook-core/src/main/java/org/zalando/logbook/core/ResponseFilters.java similarity index 78% rename from logbook-core/src/main/java/org/zalando/logbook/ResponseFilters.java rename to logbook-core/src/main/java/org/zalando/logbook/core/ResponseFilters.java index a13ae07ea..c69721624 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/ResponseFilters.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/ResponseFilters.java @@ -1,12 +1,15 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.BodyReplacer; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.ResponseFilter; import javax.annotation.Nullable; import static org.apiguardian.api.API.Status.MAINTAINED; import static org.apiguardian.api.API.Status.STABLE; -import static org.zalando.logbook.DefaultFilters.defaultValues; +import static org.zalando.logbook.core.DefaultFilters.defaultValues; @API(status = STABLE) public final class ResponseFilters { diff --git a/logbook-core/src/main/java/org/zalando/logbook/SecurityStrategy.java b/logbook-core/src/main/java/org/zalando/logbook/core/SecurityStrategy.java similarity index 74% rename from logbook-core/src/main/java/org/zalando/logbook/SecurityStrategy.java rename to logbook-core/src/main/java/org/zalando/logbook/core/SecurityStrategy.java index 7287b5680..ab29e2b36 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/SecurityStrategy.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/SecurityStrategy.java @@ -1,6 +1,12 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; +import org.zalando.logbook.api.Strategy; import java.io.IOException; @@ -27,7 +33,7 @@ public void write(final Precorrelation precorrelation, final HttpRequest request @Override public void write(final Correlation correlation, final HttpRequest request, final HttpResponse response, - final Sink sink) throws IOException { + final Sink sink) throws IOException { final int status = response.getStatus(); if (status == 401 || status == 403) { diff --git a/logbook-core/src/main/java/org/zalando/logbook/SplunkHttpLogFormatter.java b/logbook-core/src/main/java/org/zalando/logbook/core/SplunkHttpLogFormatter.java similarity index 81% rename from logbook-core/src/main/java/org/zalando/logbook/SplunkHttpLogFormatter.java rename to logbook-core/src/main/java/org/zalando/logbook/core/SplunkHttpLogFormatter.java index ac462e303..b8ddc46e8 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/SplunkHttpLogFormatter.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/SplunkHttpLogFormatter.java @@ -1,4 +1,6 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; + +import org.zalando.logbook.api.StructuredHttpLogFormatter; import java.util.Map; import java.util.stream.Collectors; diff --git a/logbook-core/src/main/java/org/zalando/logbook/Stages.java b/logbook-core/src/main/java/org/zalando/logbook/core/Stages.java similarity index 75% rename from logbook-core/src/main/java/org/zalando/logbook/Stages.java rename to logbook-core/src/main/java/org/zalando/logbook/core/Stages.java index 58969fd7d..e0c441988 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/Stages.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/Stages.java @@ -1,9 +1,10 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; -import org.zalando.logbook.Logbook.RequestWritingStage; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook.RequestWritingStage; -import static org.zalando.logbook.Logbook.ResponseProcessingStage; -import static org.zalando.logbook.Logbook.ResponseWritingStage; +import static org.zalando.logbook.api.Logbook.ResponseProcessingStage; +import static org.zalando.logbook.api.Logbook.ResponseWritingStage; final class Stages { diff --git a/logbook-core/src/main/java/org/zalando/logbook/StatusAtLeastStrategy.java b/logbook-core/src/main/java/org/zalando/logbook/core/StatusAtLeastStrategy.java similarity index 67% rename from logbook-core/src/main/java/org/zalando/logbook/StatusAtLeastStrategy.java rename to logbook-core/src/main/java/org/zalando/logbook/core/StatusAtLeastStrategy.java index 9c22d2acd..d01b12e4d 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/StatusAtLeastStrategy.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/StatusAtLeastStrategy.java @@ -1,7 +1,13 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import lombok.AllArgsConstructor; import org.apiguardian.api.API; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; +import org.zalando.logbook.api.Strategy; import java.io.IOException; @@ -20,7 +26,7 @@ public void write(final Precorrelation precorrelation, final HttpRequest request @Override public void write(final Correlation correlation, final HttpRequest request, final HttpResponse response, - final Sink sink) throws IOException { + final Sink sink) throws IOException { if (response.getStatus() >= status) { sink.writeBoth(correlation, request, response); diff --git a/logbook-core/src/main/java/org/zalando/logbook/StreamHttpLogWriter.java b/logbook-core/src/main/java/org/zalando/logbook/core/StreamHttpLogWriter.java similarity index 81% rename from logbook-core/src/main/java/org/zalando/logbook/StreamHttpLogWriter.java rename to logbook-core/src/main/java/org/zalando/logbook/core/StreamHttpLogWriter.java index a8dc65a46..6ea5bec4e 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/StreamHttpLogWriter.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/StreamHttpLogWriter.java @@ -1,6 +1,9 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; import java.io.PrintStream; diff --git a/logbook-core/src/main/java/org/zalando/logbook/WithoutBodyStrategy.java b/logbook-core/src/main/java/org/zalando/logbook/core/WithoutBodyStrategy.java similarity index 73% rename from logbook-core/src/main/java/org/zalando/logbook/WithoutBodyStrategy.java rename to logbook-core/src/main/java/org/zalando/logbook/core/WithoutBodyStrategy.java index 18f4893cc..0d2e1c405 100644 --- a/logbook-core/src/main/java/org/zalando/logbook/WithoutBodyStrategy.java +++ b/logbook-core/src/main/java/org/zalando/logbook/core/WithoutBodyStrategy.java @@ -1,6 +1,9 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.apiguardian.api.API; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Strategy; import static org.apiguardian.api.API.Status.EXPERIMENTAL; diff --git a/logbook-core/src/main/java/org/zalando/logbook/core/package-info.java b/logbook-core/src/main/java/org/zalando/logbook/core/package-info.java new file mode 100644 index 000000000..eb6557388 --- /dev/null +++ b/logbook-core/src/main/java/org/zalando/logbook/core/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package org.zalando.logbook.core; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/logbook-core/src/main/java/org/zalando/logbook/package-info.java b/logbook-core/src/main/java/org/zalando/logbook/package-info.java deleted file mode 100644 index 46107ffb3..000000000 --- a/logbook-core/src/main/java/org/zalando/logbook/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@ParametersAreNonnullByDefault -package org.zalando.logbook; - -import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/logbook-core/src/main/resources/META-INF/services/org.zalando.logbook.LogbookFactory b/logbook-core/src/main/resources/META-INF/services/org.zalando.logbook.LogbookFactory index 9319635be..6e4d05939 100644 --- a/logbook-core/src/main/resources/META-INF/services/org.zalando.logbook.LogbookFactory +++ b/logbook-core/src/main/resources/META-INF/services/org.zalando.logbook.LogbookFactory @@ -1 +1 @@ -org.zalando.logbook.DefaultLogbookFactory \ No newline at end of file +org.zalando.logbook.core.DefaultLogbookFactory diff --git a/logbook-core/src/test/java/org/zalando/logbook/BodyFiltersTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/BodyFiltersTest.java similarity index 89% rename from logbook-core/src/test/java/org/zalando/logbook/BodyFiltersTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/BodyFiltersTest.java index d9a833f2f..cd9e07b26 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/BodyFiltersTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/BodyFiltersTest.java @@ -1,13 +1,14 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.BodyFilter; import static java.util.Collections.singleton; import static org.assertj.core.api.Assertions.assertThat; -import static org.zalando.logbook.BodyFilters.defaultValue; -import static org.zalando.logbook.BodyFilters.oauthRequest; -import static org.zalando.logbook.BodyFilters.replaceFormUrlEncodedProperty; -import static org.zalando.logbook.BodyFilters.truncate; +import static org.zalando.logbook.core.BodyFilters.defaultValue; +import static org.zalando.logbook.core.BodyFilters.oauthRequest; +import static org.zalando.logbook.core.BodyFilters.replaceFormUrlEncodedProperty; +import static org.zalando.logbook.core.BodyFilters.truncate; final class BodyFiltersTest { diff --git a/logbook-core/src/test/java/org/zalando/logbook/BodyOnlyIfStatusAtLeastStrategyTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/BodyOnlyIfStatusAtLeastStrategyTest.java similarity index 90% rename from logbook-core/src/test/java/org/zalando/logbook/BodyOnlyIfStatusAtLeastStrategyTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/BodyOnlyIfStatusAtLeastStrategyTest.java index a106bb44a..1dfbe1b71 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/BodyOnlyIfStatusAtLeastStrategyTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/BodyOnlyIfStatusAtLeastStrategyTest.java @@ -1,10 +1,16 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.mockito.ArgumentCaptor; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Sink; import java.io.IOException; diff --git a/logbook-core/src/test/java/org/zalando/logbook/BodyReplacersTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/BodyReplacersTest.java similarity index 85% rename from logbook-core/src/test/java/org/zalando/logbook/BodyReplacersTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/BodyReplacersTest.java index 2bf020b1a..5da9d9038 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/BodyReplacersTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/BodyReplacersTest.java @@ -1,13 +1,15 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.BodyReplacer; +import org.zalando.logbook.api.HttpMessage; import java.io.IOException; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.zalando.logbook.BodyReplacers.replaceBody; +import static org.zalando.logbook.core.BodyReplacers.replaceBody; final class BodyReplacersTest { diff --git a/logbook-core/src/test/java/org/zalando/logbook/CachingHttpRequestTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/CachingHttpRequestTest.java similarity index 83% rename from logbook-core/src/test/java/org/zalando/logbook/CachingHttpRequestTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/CachingHttpRequestTest.java index d1b42a51d..017b45b85 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/CachingHttpRequestTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/CachingHttpRequestTest.java @@ -1,6 +1,9 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.atMost; diff --git a/logbook-core/src/test/java/org/zalando/logbook/CachingHttpResponseTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/CachingHttpResponseTest.java similarity index 83% rename from logbook-core/src/test/java/org/zalando/logbook/CachingHttpResponseTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/CachingHttpResponseTest.java index 9f14b4bdc..6c0e2af70 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/CachingHttpResponseTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/CachingHttpResponseTest.java @@ -1,6 +1,9 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.atMost; diff --git a/logbook-core/src/test/java/org/zalando/logbook/ChunkingSinkTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/ChunkingSinkTest.java similarity index 91% rename from logbook-core/src/test/java/org/zalando/logbook/ChunkingSinkTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/ChunkingSinkTest.java index db9a9f90d..88dfa55e6 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/ChunkingSinkTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/ChunkingSinkTest.java @@ -1,9 +1,14 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.DefaultLogbook.SimpleCorrelation; -import org.zalando.logbook.DefaultLogbook.SimplePrecorrelation; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; +import org.zalando.logbook.core.DefaultLogbook.SimpleCorrelation; +import org.zalando.logbook.core.DefaultLogbook.SimplePrecorrelation; import java.io.IOException; import java.time.Clock; diff --git a/logbook-core/src/test/java/org/zalando/logbook/ChunkingSpliteratorTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/ChunkingSpliteratorTest.java similarity index 98% rename from logbook-core/src/test/java/org/zalando/logbook/ChunkingSpliteratorTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/ChunkingSpliteratorTest.java index 0ec995697..924a17d98 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/ChunkingSpliteratorTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/ChunkingSpliteratorTest.java @@ -1,4 +1,4 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; diff --git a/logbook-core/src/test/java/org/zalando/logbook/CommonsLogFormatSinkTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/CommonsLogFormatSinkTest.java similarity index 90% rename from logbook-core/src/test/java/org/zalando/logbook/CommonsLogFormatSinkTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/CommonsLogFormatSinkTest.java index 70ec72864..d3437622a 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/CommonsLogFormatSinkTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/CommonsLogFormatSinkTest.java @@ -1,10 +1,18 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.DefaultLogbook.SimpleCorrelation; -import org.zalando.logbook.DefaultLogbook.SimplePrecorrelation; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; +import org.zalando.logbook.core.DefaultLogbook.SimpleCorrelation; +import org.zalando.logbook.core.DefaultLogbook.SimplePrecorrelation; import java.io.IOException; import java.time.Clock; diff --git a/logbook-core/src/test/java/org/zalando/logbook/CompactingXmlBodyFilterTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/CompactingXmlBodyFilterTest.java similarity index 95% rename from logbook-core/src/test/java/org/zalando/logbook/CompactingXmlBodyFilterTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/CompactingXmlBodyFilterTest.java index 3796e42ce..cdc75200a 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/CompactingXmlBodyFilterTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/CompactingXmlBodyFilterTest.java @@ -1,6 +1,7 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.BodyFilter; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-core/src/test/java/org/zalando/logbook/CompositeSinkTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/CompositeSinkTest.java similarity index 93% rename from logbook-core/src/test/java/org/zalando/logbook/CompositeSinkTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/CompositeSinkTest.java index 6f424d0d1..5dd807663 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/CompositeSinkTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/CompositeSinkTest.java @@ -1,6 +1,11 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; import java.io.IOException; import java.util.Arrays; diff --git a/logbook-core/src/test/java/org/zalando/logbook/ConditionsTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/ConditionsTest.java similarity index 89% rename from logbook-core/src/test/java/org/zalando/logbook/ConditionsTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/ConditionsTest.java index ae10bbe49..8e41973ed 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/ConditionsTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/ConditionsTest.java @@ -1,17 +1,21 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpMessage; +import org.zalando.logbook.api.HttpRequest; import java.util.function.Predicate; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; -import static org.zalando.logbook.Conditions.contentType; -import static org.zalando.logbook.Conditions.exclude; -import static org.zalando.logbook.Conditions.header; -import static org.zalando.logbook.Conditions.requestTo; -import static org.zalando.logbook.Conditions.withoutContentType; -import static org.zalando.logbook.Conditions.withoutHeader; +import static org.zalando.logbook.core.Conditions.contentType; +import static org.zalando.logbook.core.Conditions.exclude; +import static org.zalando.logbook.core.Conditions.header; +import static org.zalando.logbook.core.Conditions.requestTo; +import static org.zalando.logbook.core.Conditions.withoutContentType; +import static org.zalando.logbook.core.Conditions.withoutHeader; final class ConditionsTest { diff --git a/logbook-core/src/test/java/org/zalando/logbook/CookieHeaderFilterTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/CookieHeaderFilterTest.java similarity index 94% rename from logbook-core/src/test/java/org/zalando/logbook/CookieHeaderFilterTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/CookieHeaderFilterTest.java index b34b1168e..d4e4aea51 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/CookieHeaderFilterTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/CookieHeaderFilterTest.java @@ -1,19 +1,20 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; -import java.util.Arrays; -import java.util.List; -import java.util.Set; -import java.util.function.Function; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; +import org.zalando.logbook.api.HeaderFilter; +import org.zalando.logbook.api.HttpHeaders; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Function; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; -import static org.apache.commons.lang3.StringUtils.reverse; import static org.assertj.core.api.Assertions.assertThat; -import static org.zalando.logbook.HeaderFilters.replaceCookies; +import static org.zalando.logbook.core.HeaderFilters.replaceCookies; final class CookieHeaderFilterTest { diff --git a/logbook-core/src/test/java/org/zalando/logbook/CurlHttpLogFormatterTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/CurlHttpLogFormatterTest.java similarity index 88% rename from logbook-core/src/test/java/org/zalando/logbook/CurlHttpLogFormatterTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/CurlHttpLogFormatterTest.java index 8cb35e06f..5e6d3d1c3 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/CurlHttpLogFormatterTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/CurlHttpLogFormatterTest.java @@ -1,8 +1,15 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; -import org.zalando.logbook.DefaultLogbook.SimpleCorrelation; -import org.zalando.logbook.DefaultLogbook.SimplePrecorrelation; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; +import org.zalando.logbook.core.DefaultLogbook.SimpleCorrelation; +import org.zalando.logbook.core.DefaultLogbook.SimplePrecorrelation; import java.io.IOException; diff --git a/logbook-core/src/test/java/org/zalando/logbook/DefaultHttpLogFormatterTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultHttpLogFormatterTest.java similarity index 93% rename from logbook-core/src/test/java/org/zalando/logbook/DefaultHttpLogFormatterTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/DefaultHttpLogFormatterTest.java index 2512a7ff6..2f2e4c72d 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/DefaultHttpLogFormatterTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultHttpLogFormatterTest.java @@ -1,8 +1,15 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; -import org.zalando.logbook.DefaultLogbook.SimpleCorrelation; -import org.zalando.logbook.DefaultLogbook.SimplePrecorrelation; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; +import org.zalando.logbook.core.DefaultLogbook.SimpleCorrelation; +import org.zalando.logbook.core.DefaultLogbook.SimplePrecorrelation; import java.io.IOException; import java.time.Instant; diff --git a/logbook-core/src/test/java/org/zalando/logbook/DefaultHttpLogWriterTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultHttpLogWriterTest.java similarity index 89% rename from logbook-core/src/test/java/org/zalando/logbook/DefaultHttpLogWriterTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/DefaultHttpLogWriterTest.java index d15d6c81f..cc197c8c2 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/DefaultHttpLogWriterTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultHttpLogWriterTest.java @@ -1,10 +1,12 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.zalando.logbook.DefaultLogbook.SimpleCorrelation; -import org.zalando.logbook.DefaultLogbook.SimplePrecorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.core.DefaultLogbook.SimpleCorrelation; +import org.zalando.logbook.core.DefaultLogbook.SimplePrecorrelation; import uk.org.lidalia.slf4jtest.LoggingEvent; import uk.org.lidalia.slf4jtest.TestLogger; import uk.org.lidalia.slf4jtest.TestLoggerFactory; diff --git a/logbook-core/src/test/java/org/zalando/logbook/DefaultLogbookFactoryTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultLogbookFactoryTest.java similarity index 63% rename from logbook-core/src/test/java/org/zalando/logbook/DefaultLogbookFactoryTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/DefaultLogbookFactoryTest.java index 25b9e7be9..6018975ca 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/DefaultLogbookFactoryTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultLogbookFactoryTest.java @@ -1,6 +1,11 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; import java.io.IOException; diff --git a/logbook-core/src/test/java/org/zalando/logbook/DefaultLogbookTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultLogbookTest.java similarity index 89% rename from logbook-core/src/test/java/org/zalando/logbook/DefaultLogbookTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/DefaultLogbookTest.java index 4e79d2afd..4c501a525 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/DefaultLogbookTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultLogbookTest.java @@ -1,9 +1,18 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import org.mockito.stubbing.Answer; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.BodyFilter; +import org.zalando.logbook.api.HeaderFilter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.QueryFilter; +import org.zalando.logbook.api.Sink; import java.io.IOException; import java.util.function.Predicate; diff --git a/logbook-core/src/test/java/org/zalando/logbook/DefaultPathFilterTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultPathFilterTest.java similarity index 98% rename from logbook-core/src/test/java/org/zalando/logbook/DefaultPathFilterTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/DefaultPathFilterTest.java index b4d2ef13a..cd36a6eeb 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/DefaultPathFilterTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultPathFilterTest.java @@ -1,6 +1,7 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.PathFilter; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-core/src/test/java/org/zalando/logbook/DefaultSinkTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultSinkTest.java similarity index 85% rename from logbook-core/src/test/java/org/zalando/logbook/DefaultSinkTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/DefaultSinkTest.java index ed6a63b3d..52050684c 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/DefaultSinkTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/DefaultSinkTest.java @@ -1,6 +1,13 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; import java.io.IOException; diff --git a/logbook-core/src/test/java/org/zalando/logbook/DynamicPathFilterTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/DynamicPathFilterTest.java similarity index 98% rename from logbook-core/src/test/java/org/zalando/logbook/DynamicPathFilterTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/DynamicPathFilterTest.java index 6c9395c19..a28633ad4 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/DynamicPathFilterTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/DynamicPathFilterTest.java @@ -1,6 +1,7 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.PathFilter; import static org.assertj.core.api.Assertions.assertThat; @@ -160,4 +161,4 @@ public void testDynamicPathEndsAtSubstitute() { assertThat(result).isEqualTo(path); } -} \ No newline at end of file +} diff --git a/logbook-core/src/test/java/org/zalando/logbook/ExtendedLogFormatSinkTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/ExtendedLogFormatSinkTest.java similarity index 87% rename from logbook-core/src/test/java/org/zalando/logbook/ExtendedLogFormatSinkTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/ExtendedLogFormatSinkTest.java index ce6addf2f..e5d6ae10a 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/ExtendedLogFormatSinkTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/ExtendedLogFormatSinkTest.java @@ -1,18 +1,37 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; import java.io.IOException; import java.time.Clock; import java.time.Instant; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import static java.time.Clock.fixed; import static java.time.ZoneOffset.UTC; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; final public class ExtendedLogFormatSinkTest { diff --git a/logbook-core/src/test/java/org/zalando/logbook/FilteredHttpRequestTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/FilteredHttpRequestTest.java similarity index 93% rename from logbook-core/src/test/java/org/zalando/logbook/FilteredHttpRequestTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/FilteredHttpRequestTest.java index 7d356f098..a8d94e668 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/FilteredHttpRequestTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/FilteredHttpRequestTest.java @@ -1,6 +1,12 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.api.BodyFilter; +import org.zalando.logbook.api.HeaderFilter; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.PathFilter; import java.io.IOException; diff --git a/logbook-core/src/test/java/org/zalando/logbook/FilteredHttpResponseTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/FilteredHttpResponseTest.java similarity index 91% rename from logbook-core/src/test/java/org/zalando/logbook/FilteredHttpResponseTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/FilteredHttpResponseTest.java index 1da61705e..04990dac5 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/FilteredHttpResponseTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/FilteredHttpResponseTest.java @@ -1,6 +1,9 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; import java.io.IOException; diff --git a/logbook-core/src/test/java/org/zalando/logbook/HeaderFiltersTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/HeaderFiltersTest.java similarity index 94% rename from logbook-core/src/test/java/org/zalando/logbook/HeaderFiltersTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/HeaderFiltersTest.java index 91aafa582..c55c19805 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/HeaderFiltersTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/HeaderFiltersTest.java @@ -1,6 +1,8 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.HeaderFilter; +import org.zalando.logbook.api.HttpHeaders; import java.util.Arrays; @@ -9,9 +11,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertSame; -import static org.zalando.logbook.HeaderFilters.defaultValue; -import static org.zalando.logbook.HeaderFilters.eachHeader; -import static org.zalando.logbook.HeaderFilters.removeHeaders; +import static org.zalando.logbook.core.HeaderFilters.defaultValue; +import static org.zalando.logbook.core.HeaderFilters.eachHeader; +import static org.zalando.logbook.core.HeaderFilters.removeHeaders; final class HeaderFiltersTest { diff --git a/logbook-core/src/test/java/org/zalando/logbook/QueryFiltersTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/QueryFiltersTest.java similarity index 91% rename from logbook-core/src/test/java/org/zalando/logbook/QueryFiltersTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/QueryFiltersTest.java index ce1c6a274..90002d00b 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/QueryFiltersTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/QueryFiltersTest.java @@ -1,15 +1,16 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; +import org.zalando.logbook.api.QueryFilter; import java.util.Set; import static com.google.common.collect.Sets.newTreeSet; import static org.assertj.core.api.Assertions.assertThat; -import static org.zalando.logbook.QueryFilters.defaultValue; -import static org.zalando.logbook.QueryFilters.replaceQuery; +import static org.zalando.logbook.core.QueryFilters.defaultValue; +import static org.zalando.logbook.core.QueryFilters.replaceQuery; final class QueryFiltersTest { diff --git a/logbook-core/src/test/java/org/zalando/logbook/RequestFiltersTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/RequestFiltersTest.java similarity index 91% rename from logbook-core/src/test/java/org/zalando/logbook/RequestFiltersTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/RequestFiltersTest.java index 19ce1cafe..6d9c0909c 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/RequestFiltersTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/RequestFiltersTest.java @@ -1,6 +1,9 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.RequestFilter; import java.io.IOException; diff --git a/logbook-core/src/test/java/org/zalando/logbook/ResponseFiltersTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/ResponseFiltersTest.java similarity index 91% rename from logbook-core/src/test/java/org/zalando/logbook/ResponseFiltersTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/ResponseFiltersTest.java index 2071dc388..d0b567163 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/ResponseFiltersTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/ResponseFiltersTest.java @@ -1,6 +1,9 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.ResponseFilter; import java.io.IOException; diff --git a/logbook-core/src/test/java/org/zalando/logbook/SecurityStrategyTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/SecurityStrategyTest.java similarity index 89% rename from logbook-core/src/test/java/org/zalando/logbook/SecurityStrategyTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/SecurityStrategyTest.java index 8717ded2f..bdfd646a2 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/SecurityStrategyTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/SecurityStrategyTest.java @@ -1,10 +1,16 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.mockito.ArgumentCaptor; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.Sink; import java.io.IOException; diff --git a/logbook-core/src/test/java/org/zalando/logbook/SimplePrecorrelationTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/SimplePrecorrelationTest.java similarity index 82% rename from logbook-core/src/test/java/org/zalando/logbook/SimplePrecorrelationTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/SimplePrecorrelationTest.java index 5645cf919..a45271050 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/SimplePrecorrelationTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/SimplePrecorrelationTest.java @@ -1,7 +1,9 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; -import org.zalando.logbook.DefaultLogbook.SimplePrecorrelation; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultLogbook.SimplePrecorrelation; import java.time.Clock; diff --git a/logbook-core/src/test/java/org/zalando/logbook/SplunkHttpLogFormatterTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/SplunkHttpLogFormatterTest.java similarity index 91% rename from logbook-core/src/test/java/org/zalando/logbook/SplunkHttpLogFormatterTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/SplunkHttpLogFormatterTest.java index d7ed40d73..5d2a2bbcb 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/SplunkHttpLogFormatterTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/SplunkHttpLogFormatterTest.java @@ -1,8 +1,13 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.Test; -import org.zalando.logbook.DefaultLogbook.SimpleCorrelation; -import org.zalando.logbook.DefaultLogbook.SimplePrecorrelation; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.core.DefaultLogbook.SimpleCorrelation; +import org.zalando.logbook.core.DefaultLogbook.SimplePrecorrelation; import java.io.IOException; import java.time.Clock; @@ -13,8 +18,8 @@ import static java.time.Instant.MIN; import static org.assertj.core.api.Assertions.assertThat; import static org.zalando.logbook.MockHttpResponse.create; -import static org.zalando.logbook.Origin.LOCAL; -import static org.zalando.logbook.Origin.REMOTE; +import static org.zalando.logbook.api.Origin.LOCAL; +import static org.zalando.logbook.api.Origin.REMOTE; class SplunkHttpLogFormatterTest { diff --git a/logbook-core/src/test/java/org/zalando/logbook/StatusAtLeastStrategyTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/StatusAtLeastStrategyTest.java similarity index 88% rename from logbook-core/src/test/java/org/zalando/logbook/StatusAtLeastStrategyTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/StatusAtLeastStrategyTest.java index 719e1e063..107e05317 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/StatusAtLeastStrategyTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/StatusAtLeastStrategyTest.java @@ -1,10 +1,16 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.mockito.ArgumentCaptor; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.Sink; import java.io.IOException; diff --git a/logbook-core/src/test/java/org/zalando/logbook/StreamHttpLogWriterTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/StreamHttpLogWriterTest.java similarity index 91% rename from logbook-core/src/test/java/org/zalando/logbook/StreamHttpLogWriterTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/StreamHttpLogWriterTest.java index 03b768118..b6e72d7a6 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/StreamHttpLogWriterTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/StreamHttpLogWriterTest.java @@ -1,9 +1,10 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import net.jcip.annotations.NotThreadSafe; import org.junit.jupiter.api.Test; -import org.zalando.logbook.DefaultLogbook.SimpleCorrelation; -import org.zalando.logbook.DefaultLogbook.SimplePrecorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.core.DefaultLogbook.SimpleCorrelation; +import org.zalando.logbook.core.DefaultLogbook.SimplePrecorrelation; import java.io.IOException; import java.io.PrintStream; diff --git a/logbook-core/src/test/java/org/zalando/logbook/WithoutBodyStrategyTest.java b/logbook-core/src/test/java/org/zalando/logbook/core/WithoutBodyStrategyTest.java similarity index 84% rename from logbook-core/src/test/java/org/zalando/logbook/WithoutBodyStrategyTest.java rename to logbook-core/src/test/java/org/zalando/logbook/core/WithoutBodyStrategyTest.java index 2f5ca192b..d7de9e1be 100644 --- a/logbook-core/src/test/java/org/zalando/logbook/WithoutBodyStrategyTest.java +++ b/logbook-core/src/test/java/org/zalando/logbook/core/WithoutBodyStrategyTest.java @@ -1,8 +1,14 @@ -package org.zalando.logbook; +package org.zalando.logbook.core; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.Sink; import java.io.IOException; diff --git a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/Attributes.java b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/Attributes.java index b81159ed2..139ff05a2 100644 --- a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/Attributes.java +++ b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/Attributes.java @@ -1,7 +1,7 @@ package org.zalando.logbook.httpclient; import lombok.experimental.UtilityClass; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; @UtilityClass final class Attributes { diff --git a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LocalRequest.java b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LocalRequest.java index 2e496a5ac..6b93004d3 100644 --- a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LocalRequest.java +++ b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LocalRequest.java @@ -8,8 +8,8 @@ import org.apache.http.client.methods.HttpRequestWrapper; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.ContentType; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.io.IOException; @@ -28,7 +28,7 @@ import static java.util.stream.Collectors.toList; import static org.zalando.fauxpas.FauxPas.throwingUnaryOperator; -final class LocalRequest implements org.zalando.logbook.HttpRequest { +final class LocalRequest implements org.zalando.logbook.api.HttpRequest { private final AtomicReference state = new AtomicReference<>(new Unbuffered()); @@ -228,13 +228,13 @@ public Charset getCharset() { } @Override - public org.zalando.logbook.HttpRequest withBody() { + public org.zalando.logbook.api.HttpRequest withBody() { state.updateAndGet(State::with); return this; } @Override - public org.zalando.logbook.HttpRequest withoutBody() { + public org.zalando.logbook.api.HttpRequest withoutBody() { state.updateAndGet(State::without); return this; } diff --git a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpAsyncResponseConsumer.java b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpAsyncResponseConsumer.java index fe7eafab4..9372569b9 100644 --- a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpAsyncResponseConsumer.java +++ b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpAsyncResponseConsumer.java @@ -5,7 +5,7 @@ import org.apache.http.nio.protocol.HttpAsyncResponseConsumer; import org.apache.http.protocol.HttpContext; import org.apiguardian.api.API; -import org.zalando.logbook.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; import java.io.IOException; import java.io.UncheckedIOException; diff --git a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpRequestInterceptor.java b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpRequestInterceptor.java index d1f69aa3e..5e624548d 100644 --- a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpRequestInterceptor.java +++ b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpRequestInterceptor.java @@ -4,8 +4,8 @@ import org.apache.http.HttpRequestInterceptor; import org.apache.http.protocol.HttpContext; import org.apiguardian.api.API; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; import java.io.IOException; diff --git a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpResponseInterceptor.java b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpResponseInterceptor.java index defd45550..1ce8ef0b7 100644 --- a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpResponseInterceptor.java +++ b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/LogbookHttpResponseInterceptor.java @@ -5,7 +5,7 @@ import org.apache.http.nio.client.HttpAsyncClient; import org.apache.http.protocol.HttpContext; import org.apiguardian.api.API; -import org.zalando.logbook.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; import java.io.IOException; diff --git a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/RemoteResponse.java b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/RemoteResponse.java index 007cd8dcc..cfd719958 100644 --- a/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/RemoteResponse.java +++ b/logbook-httpclient/src/main/java/org/zalando/logbook/httpclient/RemoteResponse.java @@ -5,8 +5,8 @@ import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.entity.ContentType; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.io.IOException; @@ -25,7 +25,7 @@ import static org.zalando.fauxpas.FauxPas.throwingUnaryOperator; @AllArgsConstructor -final class RemoteResponse implements org.zalando.logbook.HttpResponse { +final class RemoteResponse implements org.zalando.logbook.api.HttpResponse { private final AtomicReference state = new AtomicReference<>(new Unbuffered()); private final HttpResponse response; @@ -169,7 +169,7 @@ public Charset getCharset() { } @Override - public org.zalando.logbook.HttpResponse withBody() throws IOException { + public org.zalando.logbook.api.HttpResponse withBody() throws IOException { state.updateAndGet(State::with); return this; } diff --git a/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/AbstractHttpTest.java b/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/AbstractHttpTest.java index f2361cbb7..fe58ad4bd 100644 --- a/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/AbstractHttpTest.java +++ b/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/AbstractHttpTest.java @@ -7,9 +7,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Precorrelation; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpAsyncResponseConsumerTest.java b/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpAsyncResponseConsumerTest.java index f5713e34e..b7c9fa259 100644 --- a/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpAsyncResponseConsumerTest.java +++ b/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpAsyncResponseConsumerTest.java @@ -13,12 +13,12 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Logbook.ResponseProcessingStage; -import org.zalando.logbook.Logbook.ResponseWritingStage; import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook.ResponseWritingStage; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpInterceptorsPutTest.java b/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpInterceptorsPutTest.java index 7891039b2..8f0d2ec71 100644 --- a/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpInterceptorsPutTest.java +++ b/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpInterceptorsPutTest.java @@ -9,11 +9,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; diff --git a/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpInterceptorsTest.java b/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpInterceptorsTest.java index 3681edee6..36e6bb52a 100644 --- a/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpInterceptorsTest.java +++ b/logbook-httpclient/src/test/java/org/zalando/logbook/httpclient/LogbookHttpInterceptorsTest.java @@ -7,10 +7,10 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.junit.jupiter.api.AfterEach; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.Logbook; import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/Attributes.java b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/Attributes.java index 9e61d6cb5..1a82e9170 100644 --- a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/Attributes.java +++ b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/Attributes.java @@ -1,7 +1,7 @@ package org.zalando.logbook.httpclient5; import lombok.experimental.UtilityClass; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; @UtilityClass final class Attributes { diff --git a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LocalRequest.java b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LocalRequest.java index b35e5e032..715cc77cb 100644 --- a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LocalRequest.java +++ b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LocalRequest.java @@ -2,10 +2,17 @@ import lombok.AllArgsConstructor; import lombok.SneakyThrows; -import org.apache.hc.core5.http.*; +import org.apache.hc.core5.http.ClassicHttpRequest; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.EntityDetails; +import org.apache.hc.core5.http.Header; +import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.HttpRequest; +import org.apache.hc.core5.http.HttpVersion; +import org.apache.hc.core5.http.ProtocolVersion; import org.apache.hc.core5.http.nio.AsyncDataProducer; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.Origin; import java.io.IOException; import java.net.URI; @@ -24,7 +31,7 @@ import static org.apache.hc.core5.http.HttpHeaders.CONTENT_TYPE; import static org.zalando.fauxpas.FauxPas.throwingUnaryOperator; -final class LocalRequest implements org.zalando.logbook.HttpRequest { +final class LocalRequest implements org.zalando.logbook.api.HttpRequest { private final AtomicReference state = new AtomicReference<>(new Unbuffered()); @@ -227,13 +234,13 @@ public Charset getCharset() { } @Override - public org.zalando.logbook.HttpRequest withBody() { + public org.zalando.logbook.api.HttpRequest withBody() { state.updateAndGet(State::with); return this; } @Override - public org.zalando.logbook.HttpRequest withoutBody() { + public org.zalando.logbook.api.HttpRequest withoutBody() { state.updateAndGet(State::without); return this; } @@ -243,4 +250,4 @@ public byte[] getBody() { return state.updateAndGet(throwingUnaryOperator(state -> state.buffer(request, entity))).getBody(); } -} \ No newline at end of file +} diff --git a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpAsyncResponseConsumer.java b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpAsyncResponseConsumer.java index 9f8d3cea5..1f692f9fb 100644 --- a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpAsyncResponseConsumer.java +++ b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpAsyncResponseConsumer.java @@ -7,7 +7,7 @@ import org.apache.hc.core5.http.nio.AsyncResponseConsumer; import org.apache.hc.core5.http.protocol.HttpContext; import org.apiguardian.api.API; -import org.zalando.logbook.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; import java.io.IOException; import java.nio.ByteBuffer; diff --git a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpExecHandler.java b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpExecHandler.java index 6dad22e85..ba33df30f 100644 --- a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpExecHandler.java +++ b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpExecHandler.java @@ -5,7 +5,7 @@ import org.apache.hc.core5.http.ClassicHttpRequest; import org.apache.hc.core5.http.ClassicHttpResponse; import org.apache.hc.core5.http.HttpException; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import java.io.IOException; diff --git a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpRequestInterceptor.java b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpRequestInterceptor.java index 9e41074a9..d8745f76a 100644 --- a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpRequestInterceptor.java +++ b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpRequestInterceptor.java @@ -1,10 +1,13 @@ package org.zalando.logbook.httpclient5; -import org.apache.hc.core5.http.*; +import org.apache.hc.core5.http.EntityDetails; +import org.apache.hc.core5.http.HttpException; +import org.apache.hc.core5.http.HttpRequest; +import org.apache.hc.core5.http.HttpRequestInterceptor; import org.apache.hc.core5.http.protocol.HttpContext; import org.apiguardian.api.API; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; import java.io.IOException; diff --git a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpResponseInterceptor.java b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpResponseInterceptor.java index 0ea3b037b..1c29a22ad 100644 --- a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpResponseInterceptor.java +++ b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/LogbookHttpResponseInterceptor.java @@ -6,7 +6,7 @@ import org.apache.hc.core5.http.HttpResponseInterceptor; import org.apache.hc.core5.http.protocol.HttpContext; import org.apiguardian.api.API; -import org.zalando.logbook.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; import java.io.IOException; diff --git a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/RemoteResponse.java b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/RemoteResponse.java index a1736494c..77c5a7e04 100644 --- a/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/RemoteResponse.java +++ b/logbook-httpclient5/src/main/java/org/zalando/logbook/httpclient5/RemoteResponse.java @@ -2,24 +2,37 @@ import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; -import org.apache.hc.core5.http.*; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.Origin; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.EntityDetails; +import org.apache.hc.core5.http.Header; +import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.HttpResponse; +import org.apache.hc.core5.http.HttpVersion; +import org.apache.hc.core5.http.ProtocolVersion; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.Origin; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.charset.Charset; -import java.util.*; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Stream; import static java.nio.charset.StandardCharsets.UTF_8; -import static java.util.stream.Collectors.*; +import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.mapping; +import static java.util.stream.Collectors.toList; import static org.apache.hc.core5.http.HttpHeaders.CONTENT_TYPE; import static org.zalando.fauxpas.FauxPas.throwingUnaryOperator; @RequiredArgsConstructor -final class RemoteResponse implements org.zalando.logbook.HttpResponse { +final class RemoteResponse implements org.zalando.logbook.api.HttpResponse { private final AtomicReference state = new AtomicReference<>(new Unbuffered()); private final HttpResponse response; @@ -199,7 +212,7 @@ public Charset getCharset() { } @Override - public org.zalando.logbook.HttpResponse withBody() throws IOException { + public org.zalando.logbook.api.HttpResponse withBody() throws IOException { state.updateAndGet(State::with); return this; } diff --git a/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/AbstractHttpTest.java b/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/AbstractHttpTest.java index fef6b0381..2089acc8e 100644 --- a/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/AbstractHttpTest.java +++ b/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/AbstractHttpTest.java @@ -8,7 +8,13 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.*; +import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/LogbookHttpExecHandlerTest.java b/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/LogbookHttpExecHandlerTest.java index e1b5e4b3c..d12b02ffe 100644 --- a/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/LogbookHttpExecHandlerTest.java +++ b/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/LogbookHttpExecHandlerTest.java @@ -12,7 +12,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.Correlation; +import org.zalando.logbook.api.Correlation; import javax.annotation.Nullable; import java.io.ByteArrayInputStream; @@ -80,4 +80,4 @@ void shouldLogCompressedResponseWithBody() throws IOException, ParseException { .startsWith("Incoming Response:") .contains("HTTP/1.1 200 OK", "Content-Type: text/plain", "Hello, compressed world!"); } -} \ No newline at end of file +} diff --git a/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/LogbookHttpInterceptorsPutTest.java b/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/LogbookHttpInterceptorsPutTest.java index 5271b17b2..6e3b3ff27 100644 --- a/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/LogbookHttpInterceptorsPutTest.java +++ b/logbook-httpclient5/src/test/java/org/zalando/logbook/httpclient5/LogbookHttpInterceptorsPutTest.java @@ -9,11 +9,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; diff --git a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LocalRequest.java b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LocalRequest.java index d84ff15c6..d532738ca 100644 --- a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LocalRequest.java +++ b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LocalRequest.java @@ -1,9 +1,9 @@ package org.zalando.logbook.jaxrs; import lombok.AllArgsConstructor; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import javax.ws.rs.client.ClientRequestContext; diff --git a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LocalResponse.java b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LocalResponse.java index 4f89455c7..5bdb77345 100644 --- a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LocalResponse.java +++ b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LocalResponse.java @@ -1,9 +1,9 @@ package org.zalando.logbook.jaxrs; import lombok.AllArgsConstructor; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import javax.ws.rs.container.ContainerResponseContext; diff --git a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LogbookClientFilter.java b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LogbookClientFilter.java index a88282cc0..2a705534b 100644 --- a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LogbookClientFilter.java +++ b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LogbookClientFilter.java @@ -1,10 +1,10 @@ package org.zalando.logbook.jaxrs; import lombok.AllArgsConstructor; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Logbook.RequestWritingStage; -import org.zalando.logbook.Logbook.ResponseProcessingStage; -import org.zalando.logbook.Logbook.ResponseWritingStage; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Logbook.RequestWritingStage; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook.ResponseWritingStage; import javax.ws.rs.ConstrainedTo; import javax.ws.rs.RuntimeType; diff --git a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LogbookServerFilter.java b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LogbookServerFilter.java index 20c5c6d37..e55724f63 100644 --- a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LogbookServerFilter.java +++ b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/LogbookServerFilter.java @@ -1,10 +1,10 @@ package org.zalando.logbook.jaxrs; import lombok.AllArgsConstructor; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Logbook.RequestWritingStage; -import org.zalando.logbook.Logbook.ResponseProcessingStage; -import org.zalando.logbook.Logbook.ResponseWritingStage; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Logbook.RequestWritingStage; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook.ResponseWritingStage; import javax.ws.rs.ConstrainedTo; import javax.ws.rs.RuntimeType; diff --git a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/RemoteRequest.java b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/RemoteRequest.java index 06967a3b1..ca02a5e80 100644 --- a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/RemoteRequest.java +++ b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/RemoteRequest.java @@ -1,9 +1,9 @@ package org.zalando.logbook.jaxrs; import lombok.AllArgsConstructor; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import javax.ws.rs.container.ContainerRequestContext; diff --git a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/RemoteResponse.java b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/RemoteResponse.java index 1a6425c25..a524dd68b 100644 --- a/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/RemoteResponse.java +++ b/logbook-jaxrs/src/main/java/org/zalando/logbook/jaxrs/RemoteResponse.java @@ -1,15 +1,15 @@ package org.zalando.logbook.jaxrs; import lombok.AllArgsConstructor; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import javax.ws.rs.client.ClientResponseContext; import java.io.ByteArrayInputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.nio.charset.Charset; import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; diff --git a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerIgnoringBodyTest.java b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerIgnoringBodyTest.java index e6ac1d007..8dd001a67 100644 --- a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerIgnoringBodyTest.java +++ b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerIgnoringBodyTest.java @@ -10,11 +10,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Sink; import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Sink; import org.zalando.logbook.jaxrs.testing.support.TestModel; import org.zalando.logbook.jaxrs.testing.support.TestWebService; @@ -34,8 +34,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.zalando.logbook.BodyReplacers.stream; -import static org.zalando.logbook.RequestFilters.replaceBody; +import static org.zalando.logbook.core.BodyReplacers.stream; +import static org.zalando.logbook.core.RequestFilters.replaceBody; final class ClientAndServerIgnoringBodyTest extends JerseyTest { diff --git a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerTest.java b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerTest.java index d1f525133..69060b516 100644 --- a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerTest.java +++ b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerTest.java @@ -10,10 +10,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Sink; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Sink; import org.zalando.logbook.jaxrs.testing.support.TestModel; import org.zalando.logbook.jaxrs.testing.support.TestWebService; @@ -36,10 +36,10 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.zalando.logbook.BodyReplacers.stream; -import static org.zalando.logbook.Origin.LOCAL; -import static org.zalando.logbook.Origin.REMOTE; -import static org.zalando.logbook.RequestFilters.replaceBody; +import static org.zalando.logbook.api.Origin.LOCAL; +import static org.zalando.logbook.api.Origin.REMOTE; +import static org.zalando.logbook.core.BodyReplacers.stream; +import static org.zalando.logbook.core.RequestFilters.replaceBody; /** * This test starts in in-memory server with a Logbook server filter. The test diff --git a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerWithoutBodyTest.java b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerWithoutBodyTest.java index f4bb0ec8d..9ede083e4 100644 --- a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerWithoutBodyTest.java +++ b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientAndServerWithoutBodyTest.java @@ -10,11 +10,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Sink; -import org.zalando.logbook.WithoutBodyStrategy; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Sink; +import org.zalando.logbook.core.WithoutBodyStrategy; import org.zalando.logbook.jaxrs.testing.support.TestModel; import org.zalando.logbook.jaxrs.testing.support.TestWebService; @@ -34,8 +34,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.zalando.logbook.BodyReplacers.stream; -import static org.zalando.logbook.RequestFilters.replaceBody; +import static org.zalando.logbook.core.BodyReplacers.stream; +import static org.zalando.logbook.core.RequestFilters.replaceBody; final class ClientAndServerWithoutBodyTest extends JerseyTest { diff --git a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientWithApacheConnectorTest.java b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientWithApacheConnectorTest.java index 18b2b49cf..2bf71aac7 100644 --- a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientWithApacheConnectorTest.java +++ b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/ClientWithApacheConnectorTest.java @@ -1,11 +1,5 @@ package org.zalando.logbook.jaxrs; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import javax.ws.rs.core.Application; -import javax.ws.rs.core.MediaType; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.glassfish.jersey.apache.connector.ApacheClientProperties; import org.glassfish.jersey.apache.connector.ApacheConnectorProvider; @@ -18,11 +12,18 @@ import org.glassfish.jersey.test.TestProperties; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Sink; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Sink; import org.zalando.logbook.jaxrs.testing.support.TestModel; import org.zalando.logbook.jaxrs.testing.support.TestWebService; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.MediaType; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + final class ClientWithApacheConnectorTest extends JerseyTest { ClientWithApacheConnectorTest() { diff --git a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/LogbookClientFilterTest.java b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/LogbookClientFilterTest.java index 9c7409293..9f291f858 100644 --- a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/LogbookClientFilterTest.java +++ b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/LogbookClientFilterTest.java @@ -1,7 +1,7 @@ package org.zalando.logbook.jaxrs; import org.junit.jupiter.api.Test; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientResponseContext; diff --git a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/LogbookServerFilterTest.java b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/LogbookServerFilterTest.java index 52a1880ee..9f766db88 100644 --- a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/LogbookServerFilterTest.java +++ b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/LogbookServerFilterTest.java @@ -1,7 +1,7 @@ package org.zalando.logbook.jaxrs; import org.junit.jupiter.api.Test; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerResponseContext; diff --git a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/RoundTrip.java b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/RoundTrip.java index f69cc7f20..9a1a4990c 100644 --- a/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/RoundTrip.java +++ b/logbook-jaxrs/src/test/java/org/zalando/logbook/jaxrs/RoundTrip.java @@ -1,8 +1,8 @@ package org.zalando.logbook.jaxrs; import lombok.Value; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; @Value class RoundTrip { diff --git a/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/ForwardingHttpExchange.java b/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/ForwardingHttpExchange.java index c47f48ce1..ec84c4810 100644 --- a/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/ForwardingHttpExchange.java +++ b/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/ForwardingHttpExchange.java @@ -5,7 +5,7 @@ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpPrincipal; import lombok.RequiredArgsConstructor; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import java.io.IOException; import java.io.InputStream; diff --git a/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/LogbookFilter.java b/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/LogbookFilter.java index e2be8f2e2..5f1eadc8c 100644 --- a/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/LogbookFilter.java +++ b/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/LogbookFilter.java @@ -4,9 +4,9 @@ import com.sun.net.httpserver.HttpExchange; import lombok.AllArgsConstructor; import org.apiguardian.api.API; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Strategy; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Strategy; import java.io.IOException; diff --git a/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/Request.java b/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/Request.java index 08cf93ffd..bbc4c7a10 100644 --- a/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/Request.java +++ b/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/Request.java @@ -3,9 +3,9 @@ import com.sun.net.httpserver.HttpExchange; import lombok.AllArgsConstructor; import lombok.Getter; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/Response.java b/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/Response.java index 5ac359123..2325a2d15 100644 --- a/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/Response.java +++ b/logbook-jdkserver/src/main/java/org/zalando/logbook/jdkserver/Response.java @@ -3,9 +3,9 @@ import com.sun.net.httpserver.HttpExchange; import lombok.AllArgsConstructor; import lombok.Getter; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/LogbookFilterTest.java b/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/LogbookFilterTest.java index 420a6f3a9..d989c4d68 100644 --- a/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/LogbookFilterTest.java +++ b/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/LogbookFilterTest.java @@ -4,14 +4,14 @@ import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import org.junit.jupiter.api.Test; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; import org.zalando.logbook.TestStrategy; -import org.zalando.logbook.WithoutBodyStrategy; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; +import org.zalando.logbook.core.WithoutBodyStrategy; import java.io.IOException; import java.io.OutputStream; diff --git a/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/RequestTest.java b/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/RequestTest.java index f7daca0b4..36617c8e8 100644 --- a/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/RequestTest.java +++ b/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/RequestTest.java @@ -1,8 +1,8 @@ package org.zalando.logbook.jdkserver; import org.junit.jupiter.api.Test; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.Origin; import java.util.Arrays; diff --git a/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/ResponseTest.java b/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/ResponseTest.java index 9840a0a0e..3fceff7f3 100644 --- a/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/ResponseTest.java +++ b/logbook-jdkserver/src/test/java/org/zalando/logbook/jdkserver/ResponseTest.java @@ -2,8 +2,8 @@ import com.sun.net.httpserver.HttpExchange; import org.junit.jupiter.api.Test; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.Origin; import java.io.IOException; import java.io.OutputStream; diff --git a/logbook-jmh/src/main/java/org/zalando/logbook/HeaderState.java b/logbook-jmh/src/main/java/org/zalando/logbook/HeaderState.java index aabaacbe4..b5737605b 100644 --- a/logbook-jmh/src/main/java/org/zalando/logbook/HeaderState.java +++ b/logbook-jmh/src/main/java/org/zalando/logbook/HeaderState.java @@ -4,8 +4,11 @@ import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; +import org.zalando.logbook.api.HeaderFilter; +import org.zalando.logbook.api.HttpHeaders; import org.zalando.logbook.autoconfigure.LogbookAutoConfiguration; import org.zalando.logbook.autoconfigure.LogbookProperties; +import org.zalando.logbook.core.HeaderFilters; import java.util.Arrays; import java.util.UUID; diff --git a/logbook-jmh/src/main/java/org/zalando/logbook/HttpLogFormatterState.java b/logbook-jmh/src/main/java/org/zalando/logbook/HttpLogFormatterState.java index fe0b8947c..d9db8d62f 100644 --- a/logbook-jmh/src/main/java/org/zalando/logbook/HttpLogFormatterState.java +++ b/logbook-jmh/src/main/java/org/zalando/logbook/HttpLogFormatterState.java @@ -2,6 +2,8 @@ import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.core.DefaultHttpLogFormatter; import org.zalando.logbook.json.FastJsonHttpLogFormatter; import org.zalando.logbook.json.JsonHttpLogFormatter; diff --git a/logbook-jmh/src/main/java/org/zalando/logbook/LogbookBenchmark.java b/logbook-jmh/src/main/java/org/zalando/logbook/LogbookBenchmark.java index 62af3a35b..f871c11c0 100644 --- a/logbook-jmh/src/main/java/org/zalando/logbook/LogbookBenchmark.java +++ b/logbook-jmh/src/main/java/org/zalando/logbook/LogbookBenchmark.java @@ -10,6 +10,7 @@ import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; +import org.zalando.logbook.api.Logbook; import java.io.IOException; import java.util.concurrent.TimeUnit; diff --git a/logbook-jmh/src/main/java/org/zalando/logbook/LogbookState.java b/logbook-jmh/src/main/java/org/zalando/logbook/LogbookState.java index 88f947583..3223f6229 100644 --- a/logbook-jmh/src/main/java/org/zalando/logbook/LogbookState.java +++ b/logbook-jmh/src/main/java/org/zalando/logbook/LogbookState.java @@ -4,6 +4,8 @@ import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Sink; import org.zalando.logbook.autoconfigure.LogbookAutoConfiguration; import org.zalando.logbook.autoconfigure.LogbookProperties; import org.zalando.logbook.json.CompactingJsonBodyFilter; diff --git a/logbook-jmh/src/main/java/org/zalando/logbook/NoopHttpLogFormatter.java b/logbook-jmh/src/main/java/org/zalando/logbook/NoopHttpLogFormatter.java index 22b329844..efc9b56f1 100644 --- a/logbook-jmh/src/main/java/org/zalando/logbook/NoopHttpLogFormatter.java +++ b/logbook-jmh/src/main/java/org/zalando/logbook/NoopHttpLogFormatter.java @@ -1,5 +1,11 @@ package org.zalando.logbook; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; + import java.io.IOException; public class NoopHttpLogFormatter implements HttpLogFormatter { diff --git a/logbook-jmh/src/main/java/org/zalando/logbook/RequestResponseState.java b/logbook-jmh/src/main/java/org/zalando/logbook/RequestResponseState.java index 4094d23b2..423c04f47 100644 --- a/logbook-jmh/src/main/java/org/zalando/logbook/RequestResponseState.java +++ b/logbook-jmh/src/main/java/org/zalando/logbook/RequestResponseState.java @@ -4,6 +4,11 @@ import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; import org.zalando.logbook.jmh.DefaultCorrelation; import org.zalando.logbook.jmh.DefaultPrecorrelation; diff --git a/logbook-jmh/src/main/java/org/zalando/logbook/jmh/DefaultCorrelation.java b/logbook-jmh/src/main/java/org/zalando/logbook/jmh/DefaultCorrelation.java index 4e8797e25..3e4634d12 100644 --- a/logbook-jmh/src/main/java/org/zalando/logbook/jmh/DefaultCorrelation.java +++ b/logbook-jmh/src/main/java/org/zalando/logbook/jmh/DefaultCorrelation.java @@ -1,6 +1,6 @@ package org.zalando.logbook.jmh; -import org.zalando.logbook.Correlation; +import org.zalando.logbook.api.Correlation; import java.time.Duration; import java.time.Instant; diff --git a/logbook-jmh/src/main/java/org/zalando/logbook/jmh/DefaultPrecorrelation.java b/logbook-jmh/src/main/java/org/zalando/logbook/jmh/DefaultPrecorrelation.java index 1fe22974f..d233a48a1 100644 --- a/logbook-jmh/src/main/java/org/zalando/logbook/jmh/DefaultPrecorrelation.java +++ b/logbook-jmh/src/main/java/org/zalando/logbook/jmh/DefaultPrecorrelation.java @@ -1,7 +1,7 @@ package org.zalando.logbook.jmh; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.Precorrelation; import java.time.Instant; diff --git a/logbook-json/src/main/java/org/zalando/logbook/json/AccessTokenBodyFilter.java b/logbook-json/src/main/java/org/zalando/logbook/json/AccessTokenBodyFilter.java index 170f5db5a..f7c56daa7 100644 --- a/logbook-json/src/main/java/org/zalando/logbook/json/AccessTokenBodyFilter.java +++ b/logbook-json/src/main/java/org/zalando/logbook/json/AccessTokenBodyFilter.java @@ -2,7 +2,7 @@ import lombok.experimental.Delegate; import org.apiguardian.api.API; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import static org.apiguardian.api.API.Status.INTERNAL; import static org.zalando.logbook.json.JsonBodyFilters.accessToken; diff --git a/logbook-json/src/main/java/org/zalando/logbook/json/CompactingJsonBodyFilter.java b/logbook-json/src/main/java/org/zalando/logbook/json/CompactingJsonBodyFilter.java index 42f234745..2b65b8c48 100644 --- a/logbook-json/src/main/java/org/zalando/logbook/json/CompactingJsonBodyFilter.java +++ b/logbook-json/src/main/java/org/zalando/logbook/json/CompactingJsonBodyFilter.java @@ -3,7 +3,7 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apiguardian.api.API; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-json/src/main/java/org/zalando/logbook/json/FastCompactingJsonBodyFilter.java b/logbook-json/src/main/java/org/zalando/logbook/json/FastCompactingJsonBodyFilter.java index be957158e..4a4690a2b 100644 --- a/logbook-json/src/main/java/org/zalando/logbook/json/FastCompactingJsonBodyFilter.java +++ b/logbook-json/src/main/java/org/zalando/logbook/json/FastCompactingJsonBodyFilter.java @@ -2,7 +2,7 @@ import lombok.extern.slf4j.Slf4j; import org.apiguardian.api.API; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import javax.annotation.Nullable; diff --git a/logbook-json/src/main/java/org/zalando/logbook/json/FastJsonHttpLogFormatter.java b/logbook-json/src/main/java/org/zalando/logbook/json/FastJsonHttpLogFormatter.java index 764465396..6d6c3acd8 100644 --- a/logbook-json/src/main/java/org/zalando/logbook/json/FastJsonHttpLogFormatter.java +++ b/logbook-json/src/main/java/org/zalando/logbook/json/FastJsonHttpLogFormatter.java @@ -1,25 +1,23 @@ package org.zalando.logbook.json; -import static org.apiguardian.api.API.Status.STABLE; +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.AllArgsConstructor; +import org.apiguardian.api.API; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpMessage; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; import java.io.StringWriter; import java.util.List; import java.util.Map; -import org.apiguardian.api.API; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpMessage; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Precorrelation; - -import com.fasterxml.jackson.core.JsonFactory; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.ObjectMapper; - -import lombok.AllArgsConstructor; +import static org.apiguardian.api.API.Status.STABLE; /** * A custom {@link HttpLogFormatter} that produces JSON objects. @@ -86,8 +84,8 @@ private static class DefaultJsonFieldWriter implements JsonFieldWriter { @Override public void write(M message, JsonGenerator generator) throws IOException { - writeHeaders(message, generator); - writeBody(message, generator); + writeHeaders(message, generator); + writeBody(message, generator); } private void writeHeaders( diff --git a/logbook-json/src/main/java/org/zalando/logbook/json/JacksonJsonFieldBodyFilter.java b/logbook-json/src/main/java/org/zalando/logbook/json/JacksonJsonFieldBodyFilter.java index 06f6002ce..22ae3252a 100644 --- a/logbook-json/src/main/java/org/zalando/logbook/json/JacksonJsonFieldBodyFilter.java +++ b/logbook-json/src/main/java/org/zalando/logbook/json/JacksonJsonFieldBodyFilter.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; import lombok.extern.slf4j.Slf4j; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import javax.annotation.Nullable; import java.io.CharArrayWriter; diff --git a/logbook-json/src/main/java/org/zalando/logbook/json/JsonBodyFilters.java b/logbook-json/src/main/java/org/zalando/logbook/json/JsonBodyFilters.java index 54d13ff38..def72d37e 100644 --- a/logbook-json/src/main/java/org/zalando/logbook/json/JsonBodyFilters.java +++ b/logbook-json/src/main/java/org/zalando/logbook/json/JsonBodyFilters.java @@ -1,7 +1,7 @@ package org.zalando.logbook.json; import org.apiguardian.api.API; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import java.util.Arrays; import java.util.HashSet; diff --git a/logbook-json/src/main/java/org/zalando/logbook/json/JsonFieldWriter.java b/logbook-json/src/main/java/org/zalando/logbook/json/JsonFieldWriter.java index 7ec2802fa..c38a4ce09 100644 --- a/logbook-json/src/main/java/org/zalando/logbook/json/JsonFieldWriter.java +++ b/logbook-json/src/main/java/org/zalando/logbook/json/JsonFieldWriter.java @@ -2,19 +2,23 @@ import com.fasterxml.jackson.core.JsonGenerator; import org.apiguardian.api.API; -import org.zalando.logbook.*; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpMessage; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; import static org.apiguardian.api.API.Status.EXPERIMENTAL; -import static org.zalando.logbook.Origin.LOCAL; +import static org.zalando.logbook.api.Origin.LOCAL; public interface JsonFieldWriter { - void write(M message, JsonGenerator generator) throws IOException; - - @API(status = EXPERIMENTAL) - default void write(Precorrelation correlation, HttpRequest request, JsonGenerator generator) throws IOException { + void write(M message, JsonGenerator generator) throws IOException; + + @API(status = EXPERIMENTAL) + default void write(Precorrelation correlation, HttpRequest request, JsonGenerator generator) throws IOException { generator.writeStringField("origin", getOrigin(request)); generator.writeStringField("type", "request"); generator.writeStringField("correlation", correlation.getId()); @@ -22,20 +26,20 @@ default void write(Precorrelation correlation, HttpRequest request, JsonGenerato generator.writeStringField("remote", request.getRemote()); generator.writeStringField("method", request.getMethod()); generator.writeStringField("uri", request.getRequestUri()); - } + } - @API(status = EXPERIMENTAL) - default void write(Correlation correlation, HttpResponse response, JsonGenerator generator) throws IOException { + @API(status = EXPERIMENTAL) + default void write(Correlation correlation, HttpResponse response, JsonGenerator generator) throws IOException { generator.writeStringField("origin", getOrigin(response)); generator.writeStringField("type", "response"); generator.writeStringField("correlation", correlation.getId()); generator.writeStringField("protocol", response.getProtocolVersion()); generator.writeNumberField("duration", correlation.getDuration().toMillis()); generator.writeNumberField("status", response.getStatus()); - } + } - static String getOrigin(HttpMessage message) { - return message.getOrigin() == LOCAL ? "local" : "remote"; - } + static String getOrigin(HttpMessage message) { + return message.getOrigin() == LOCAL ? "local" : "remote"; + } } diff --git a/logbook-json/src/main/java/org/zalando/logbook/json/JsonHttpLogFormatter.java b/logbook-json/src/main/java/org/zalando/logbook/json/JsonHttpLogFormatter.java index 39fcf919c..7df264597 100644 --- a/logbook-json/src/main/java/org/zalando/logbook/json/JsonHttpLogFormatter.java +++ b/logbook-json/src/main/java/org/zalando/logbook/json/JsonHttpLogFormatter.java @@ -5,9 +5,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.AllArgsConstructor; import org.apiguardian.api.API; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpMessage; -import org.zalando.logbook.StructuredHttpLogFormatter; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpMessage; +import org.zalando.logbook.api.StructuredHttpLogFormatter; import java.io.IOException; import java.util.Map; diff --git a/logbook-json/src/main/java/org/zalando/logbook/json/JsonPathBodyFilters.java b/logbook-json/src/main/java/org/zalando/logbook/json/JsonPathBodyFilters.java index 65e6731d8..7738e4e49 100644 --- a/logbook-json/src/main/java/org/zalando/logbook/json/JsonPathBodyFilters.java +++ b/logbook-json/src/main/java/org/zalando/logbook/json/JsonPathBodyFilters.java @@ -5,16 +5,19 @@ import com.fasterxml.jackson.databind.node.DoubleNode; import com.fasterxml.jackson.databind.node.NullNode; import com.fasterxml.jackson.databind.node.TextNode; -import com.jayway.jsonpath.*; +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.DocumentContext; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.Option; +import com.jayway.jsonpath.ParseContext; import com.jayway.jsonpath.spi.json.JacksonJsonNodeJsonProvider; import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; - import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apiguardian.api.API; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import javax.annotation.Nullable; import java.util.Arrays; diff --git a/logbook-json/src/main/java/org/zalando/logbook/json/PrettyPrintingJsonBodyFilter.java b/logbook-json/src/main/java/org/zalando/logbook/json/PrettyPrintingJsonBodyFilter.java index bb1a42785..c6d401858 100644 --- a/logbook-json/src/main/java/org/zalando/logbook/json/PrettyPrintingJsonBodyFilter.java +++ b/logbook-json/src/main/java/org/zalando/logbook/json/PrettyPrintingJsonBodyFilter.java @@ -6,7 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.apiguardian.api.API; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import javax.annotation.Nullable; import java.io.CharArrayWriter; diff --git a/logbook-json/src/main/java/org/zalando/logbook/json/PrimitiveJsonPropertyBodyFilter.java b/logbook-json/src/main/java/org/zalando/logbook/json/PrimitiveJsonPropertyBodyFilter.java index 0942e8705..0b7210264 100644 --- a/logbook-json/src/main/java/org/zalando/logbook/json/PrimitiveJsonPropertyBodyFilter.java +++ b/logbook-json/src/main/java/org/zalando/logbook/json/PrimitiveJsonPropertyBodyFilter.java @@ -3,7 +3,7 @@ import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.With; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import javax.annotation.Nonnull; import javax.annotation.Nullable; diff --git a/logbook-json/src/main/resources/META-INF/services/org.zalando.logbook.BodyFilter b/logbook-json/src/main/resources/META-INF/services/org.zalando.logbook.api.BodyFilter similarity index 100% rename from logbook-json/src/main/resources/META-INF/services/org.zalando.logbook.BodyFilter rename to logbook-json/src/main/resources/META-INF/services/org.zalando.logbook.api.BodyFilter diff --git a/logbook-json/src/test/java/org/zalando/logbook/json/CompactingJsonBodyFilterTest.java b/logbook-json/src/test/java/org/zalando/logbook/json/CompactingJsonBodyFilterTest.java index 3657d7bac..82d07358f 100644 --- a/logbook-json/src/test/java/org/zalando/logbook/json/CompactingJsonBodyFilterTest.java +++ b/logbook-json/src/test/java/org/zalando/logbook/json/CompactingJsonBodyFilterTest.java @@ -1,7 +1,7 @@ package org.zalando.logbook.json; import org.junit.jupiter.api.Test; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-json/src/test/java/org/zalando/logbook/json/DefaultBodyFilterTest.java b/logbook-json/src/test/java/org/zalando/logbook/json/DefaultBodyFilterTest.java index c60f41720..b67fa3ec4 100644 --- a/logbook-json/src/test/java/org/zalando/logbook/json/DefaultBodyFilterTest.java +++ b/logbook-json/src/test/java/org/zalando/logbook/json/DefaultBodyFilterTest.java @@ -1,7 +1,7 @@ package org.zalando.logbook.json; import org.junit.jupiter.api.Test; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import static java.util.ServiceLoader.load; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-json/src/test/java/org/zalando/logbook/json/FastCompactingJsonBodyFilterTest.java b/logbook-json/src/test/java/org/zalando/logbook/json/FastCompactingJsonBodyFilterTest.java index 0f39d8dc0..a1aeed0a4 100644 --- a/logbook-json/src/test/java/org/zalando/logbook/json/FastCompactingJsonBodyFilterTest.java +++ b/logbook-json/src/test/java/org/zalando/logbook/json/FastCompactingJsonBodyFilterTest.java @@ -1,7 +1,7 @@ package org.zalando.logbook.json; import org.junit.jupiter.api.Test; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-json/src/test/java/org/zalando/logbook/json/FastJsonHttpLogFormatterTest.java b/logbook-json/src/test/java/org/zalando/logbook/json/FastJsonHttpLogFormatterTest.java index 992479942..dc101316d 100644 --- a/logbook-json/src/test/java/org/zalando/logbook/json/FastJsonHttpLogFormatterTest.java +++ b/logbook-json/src/test/java/org/zalando/logbook/json/FastJsonHttpLogFormatterTest.java @@ -2,9 +2,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpRequest; import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; import org.zalando.logbook.json.JsonHttpLogFormatterTest.SimplePrecorrelation; import java.io.IOException; @@ -13,7 +13,7 @@ import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_READING_DUP_TREE_KEY; import static java.time.Clock.systemUTC; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.zalando.logbook.Origin.REMOTE; +import static org.zalando.logbook.api.Origin.REMOTE; public class FastJsonHttpLogFormatterTest { private final ObjectMapper objectMapper; diff --git a/logbook-json/src/test/java/org/zalando/logbook/json/JsonBodyFilterMergeTest.java b/logbook-json/src/test/java/org/zalando/logbook/json/JsonBodyFilterMergeTest.java index 7cc82ca89..6cfacd783 100644 --- a/logbook-json/src/test/java/org/zalando/logbook/json/JsonBodyFilterMergeTest.java +++ b/logbook-json/src/test/java/org/zalando/logbook/json/JsonBodyFilterMergeTest.java @@ -1,7 +1,7 @@ package org.zalando.logbook.json; import org.junit.jupiter.api.Test; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import static org.assertj.core.api.Assertions.assertThat; import static org.zalando.logbook.json.JsonBodyFilters.replaceJsonNumberProperty; diff --git a/logbook-json/src/test/java/org/zalando/logbook/json/JsonBodyFiltersTest.java b/logbook-json/src/test/java/org/zalando/logbook/json/JsonBodyFiltersTest.java index eb4251f16..eab12430d 100644 --- a/logbook-json/src/test/java/org/zalando/logbook/json/JsonBodyFiltersTest.java +++ b/logbook-json/src/test/java/org/zalando/logbook/json/JsonBodyFiltersTest.java @@ -1,7 +1,7 @@ package org.zalando.logbook.json; import org.junit.jupiter.api.Test; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import java.io.IOException; import java.nio.file.Files; @@ -14,7 +14,9 @@ import static java.util.Arrays.asList; import static java.util.Collections.singleton; import static org.assertj.core.api.Assertions.assertThat; -import static org.zalando.logbook.json.JsonBodyFilters.*; +import static org.zalando.logbook.json.JsonBodyFilters.replaceJsonNumberProperty; +import static org.zalando.logbook.json.JsonBodyFilters.replaceJsonStringProperty; +import static org.zalando.logbook.json.JsonBodyFilters.replacePrimitiveJsonProperty; class JsonBodyFiltersTest { diff --git a/logbook-json/src/test/java/org/zalando/logbook/json/JsonHttpLogFormatterTest.java b/logbook-json/src/test/java/org/zalando/logbook/json/JsonHttpLogFormatterTest.java index aa7bc437b..1434f55e1 100644 --- a/logbook-json/src/test/java/org/zalando/logbook/json/JsonHttpLogFormatterTest.java +++ b/logbook-json/src/test/java/org/zalando/logbook/json/JsonHttpLogFormatterTest.java @@ -1,27 +1,25 @@ package org.zalando.logbook.json; +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.Configuration.Defaults; +import com.jayway.jsonpath.Option; +import com.jayway.jsonpath.spi.json.JacksonJsonProvider; +import com.jayway.jsonpath.spi.json.JsonProvider; +import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; +import com.jayway.jsonpath.spi.mapper.MappingProvider; import lombok.AllArgsConstructor; import lombok.Getter; - import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; import org.zalando.logbook.MockHttpRequest; import org.zalando.logbook.MockHttpResponse; -import org.zalando.logbook.Precorrelation; - -import com.jayway.jsonpath.Configuration; -import com.jayway.jsonpath.Option; -import com.jayway.jsonpath.Configuration.Defaults; -import com.jayway.jsonpath.spi.json.JacksonJsonProvider; -import com.jayway.jsonpath.spi.json.JsonProvider; -import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; -import com.jayway.jsonpath.spi.mapper.MappingProvider; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; import java.time.Clock; @@ -41,8 +39,8 @@ import static java.util.Collections.singletonList; import static java.util.Collections.singletonMap; import static org.assertj.core.api.Assertions.assertThat; -import static org.zalando.logbook.Origin.LOCAL; -import static org.zalando.logbook.Origin.REMOTE; +import static org.zalando.logbook.api.Origin.LOCAL; +import static org.zalando.logbook.api.Origin.REMOTE; final class JsonHttpLogFormatterTest { diff --git a/logbook-json/src/test/java/org/zalando/logbook/json/JsonPathBodyFiltersTest.java b/logbook-json/src/test/java/org/zalando/logbook/json/JsonPathBodyFiltersTest.java index 89e7ea91d..86cd3b935 100644 --- a/logbook-json/src/test/java/org/zalando/logbook/json/JsonPathBodyFiltersTest.java +++ b/logbook-json/src/test/java/org/zalando/logbook/json/JsonPathBodyFiltersTest.java @@ -8,11 +8,10 @@ import com.jayway.jsonpath.spi.json.JsonProvider; import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; import com.jayway.jsonpath.spi.mapper.MappingProvider; - import lombok.SneakyThrows; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import java.io.IOException; import java.util.EnumSet; @@ -279,4 +278,4 @@ void shouldNotFailWhenThereAreNullNodes() { assertThat(actual).isEqualTo(invalidBody); } -} \ No newline at end of file +} diff --git a/logbook-json/src/test/java/org/zalando/logbook/json/PrettyPrintingJsonBodyFilterTest.java b/logbook-json/src/test/java/org/zalando/logbook/json/PrettyPrintingJsonBodyFilterTest.java index cc23bfa2a..98c4ab648 100644 --- a/logbook-json/src/test/java/org/zalando/logbook/json/PrettyPrintingJsonBodyFilterTest.java +++ b/logbook-json/src/test/java/org/zalando/logbook/json/PrettyPrintingJsonBodyFilterTest.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import java.util.stream.Collectors; import java.util.stream.Stream; diff --git a/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/ClientRequest.kt b/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/ClientRequest.kt index 9388096da..f3a86fac8 100644 --- a/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/ClientRequest.kt +++ b/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/ClientRequest.kt @@ -4,16 +4,19 @@ package org.zalando.logbook.client -import io.ktor.client.request.* -import io.ktor.http.* +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.request.host +import io.ktor.client.request.port import io.ktor.http.HttpProtocolVersion.Companion.HTTP_1_1 -import io.ktor.util.* -import org.zalando.logbook.HttpHeaders -import org.zalando.logbook.HttpRequest -import org.zalando.logbook.Origin +import io.ktor.http.charset +import io.ktor.http.contentType +import io.ktor.util.toMap +import org.zalando.logbook.api.HttpHeaders +import org.zalando.logbook.api.HttpRequest +import org.zalando.logbook.api.Origin import org.zalando.logbook.common.State import java.nio.charset.Charset -import java.util.* +import java.util.Optional import java.util.concurrent.atomic.AtomicReference import kotlin.text.Charsets.UTF_8 @@ -40,4 +43,4 @@ internal class ClientRequest( override fun getBody(): ByteArray = state.get().body internal fun buffer(bytes: ByteArray): State = state.updateAndGet { it.buffer(bytes) } internal fun shouldBuffer(): Boolean = state.get() is State.Offering -} \ No newline at end of file +} diff --git a/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/ClientResponse.kt b/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/ClientResponse.kt index 89546272b..2bd331386 100644 --- a/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/ClientResponse.kt +++ b/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/ClientResponse.kt @@ -4,11 +4,12 @@ package org.zalando.logbook.client -import io.ktor.http.* -import io.ktor.util.* -import org.zalando.logbook.HttpHeaders -import org.zalando.logbook.HttpResponse -import org.zalando.logbook.Origin +import io.ktor.http.charset +import io.ktor.http.contentType +import io.ktor.util.toMap +import org.zalando.logbook.api.HttpHeaders +import org.zalando.logbook.api.HttpResponse +import org.zalando.logbook.api.Origin import org.zalando.logbook.common.State import java.nio.charset.Charset import java.util.concurrent.atomic.AtomicReference @@ -32,4 +33,4 @@ internal class ClientResponse( override fun getBody(): ByteArray = state.get().body internal fun buffer(bytes: ByteArray) = state.updateAndGet { it.buffer(bytes) } internal fun shouldBuffer(): Boolean = state.get() is State.Offering -} \ No newline at end of file +} diff --git a/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/LogbookClient.kt b/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/LogbookClient.kt index 54e12d78b..b616af85a 100644 --- a/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/LogbookClient.kt +++ b/logbook-ktor-client/src/main/kotlin/org/zalando/logbook/client/LogbookClient.kt @@ -4,17 +4,19 @@ package org.zalando.logbook.client -import io.ktor.client.* -import io.ktor.client.features.* -import io.ktor.client.features.observer.* -import io.ktor.client.request.* -import io.ktor.client.statement.* -import io.ktor.http.content.* -import io.ktor.util.* +import io.ktor.client.HttpClient +import io.ktor.client.features.HttpClientFeature +import io.ktor.client.features.observer.wrapWithContent +import io.ktor.client.request.HttpSendPipeline +import io.ktor.client.statement.HttpReceivePipeline +import io.ktor.http.content.ByteArrayContent +import io.ktor.http.content.OutgoingContent +import io.ktor.util.AttributeKey +import io.ktor.util.split import org.apiguardian.api.API import org.apiguardian.api.API.Status.EXPERIMENTAL -import org.zalando.logbook.Logbook -import org.zalando.logbook.Logbook.ResponseProcessingStage +import org.zalando.logbook.api.Logbook +import org.zalando.logbook.api.Logbook.ResponseProcessingStage import org.zalando.logbook.common.ExperimentalLogbookKtorApi import org.zalando.logbook.common.readBytes @@ -67,4 +69,4 @@ class LogbookClient( } } } -} \ No newline at end of file +} diff --git a/logbook-ktor-client/src/test/kotlin/org/zalando/logbook/client/LogbookClientTest.kt b/logbook-ktor-client/src/test/kotlin/org/zalando/logbook/client/LogbookClientTest.kt index fb0ad78d7..23ed48969 100644 --- a/logbook-ktor-client/src/test/kotlin/org/zalando/logbook/client/LogbookClientTest.kt +++ b/logbook-ktor-client/src/test/kotlin/org/zalando/logbook/client/LogbookClientTest.kt @@ -1,14 +1,17 @@ package org.zalando.logbook.client -import io.ktor.application.* -import io.ktor.client.* -import io.ktor.client.request.* -import io.ktor.http.* -import io.ktor.request.* -import io.ktor.response.* -import io.ktor.routing.* -import io.ktor.server.cio.* -import io.ktor.server.engine.* +import io.ktor.application.call +import io.ktor.client.HttpClient +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.request.post +import io.ktor.http.HttpStatusCode +import io.ktor.request.receiveText +import io.ktor.response.respond +import io.ktor.response.respondText +import io.ktor.routing.post +import io.ktor.routing.routing +import io.ktor.server.cio.CIO +import io.ktor.server.engine.embeddedServer import kotlinx.coroutines.runBlocking import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.AfterEach @@ -16,9 +19,19 @@ import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.mockito.ArgumentCaptor import org.mockito.ArgumentMatchers.any -import org.mockito.Mockito.* -import org.zalando.logbook.* +import org.mockito.Mockito.mock +import org.mockito.Mockito.never +import org.mockito.Mockito.timeout +import org.mockito.Mockito.verify +import org.mockito.Mockito.`when` +import org.zalando.logbook.TestStrategy +import org.zalando.logbook.api.Correlation +import org.zalando.logbook.api.HttpLogWriter +import org.zalando.logbook.api.Logbook +import org.zalando.logbook.api.Precorrelation import org.zalando.logbook.common.ExperimentalLogbookKtorApi +import org.zalando.logbook.core.DefaultHttpLogFormatter +import org.zalando.logbook.core.DefaultSink @ExperimentalLogbookKtorApi @@ -168,4 +181,4 @@ internal class LogbookClientTest { .apply { verify(writer, timeout(1_000)).write(any(Correlation::class.java), capture()) } .value } -} \ No newline at end of file +} diff --git a/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/LogbookServer.kt b/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/LogbookServer.kt index b121d05b4..f0b72eadd 100644 --- a/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/LogbookServer.kt +++ b/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/LogbookServer.kt @@ -4,15 +4,19 @@ package org.zalando.logbook.server -import io.ktor.application.* -import io.ktor.http.content.* -import io.ktor.request.* -import io.ktor.response.* -import io.ktor.util.* -import io.ktor.utils.io.* +import io.ktor.application.Application +import io.ktor.application.ApplicationFeature +import io.ktor.application.call +import io.ktor.http.content.ByteArrayContent +import io.ktor.http.content.OutgoingContent +import io.ktor.request.ApplicationReceivePipeline +import io.ktor.request.ApplicationReceiveRequest +import io.ktor.response.ApplicationSendPipeline +import io.ktor.util.AttributeKey +import io.ktor.utils.io.ByteReadChannel import org.apiguardian.api.API import org.apiguardian.api.API.Status.EXPERIMENTAL -import org.zalando.logbook.Logbook +import org.zalando.logbook.api.Logbook import org.zalando.logbook.common.ExperimentalLogbookKtorApi import org.zalando.logbook.common.readBytes @@ -69,4 +73,4 @@ class LogbookServer( return feature } } -} \ No newline at end of file +} diff --git a/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/ServerRequest.kt b/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/ServerRequest.kt index 433075edc..b04f2f54f 100644 --- a/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/ServerRequest.kt +++ b/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/ServerRequest.kt @@ -5,9 +5,9 @@ import io.ktor.http.ContentType.Companion.parse import io.ktor.http.HttpHeaders.ContentType import io.ktor.request.* import io.ktor.util.* -import org.zalando.logbook.HttpHeaders -import org.zalando.logbook.HttpRequest -import org.zalando.logbook.Origin +import org.zalando.logbook.api.HttpHeaders +import org.zalando.logbook.api.HttpRequest +import org.zalando.logbook.api.Origin import org.zalando.logbook.common.State import java.nio.charset.Charset import java.util.* @@ -39,4 +39,4 @@ internal class ServerRequest( internal fun shouldBuffer(): Boolean = state.get() is State.Offering private val ApplicationRequest.contentType: ContentType? get() = headers[(ContentType)]?.let { parse(it) } -} \ No newline at end of file +} diff --git a/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/ServerResponse.kt b/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/ServerResponse.kt index d052959e1..fb46d4e65 100644 --- a/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/ServerResponse.kt +++ b/logbook-ktor-server/src/main/kotlin/org/zalando/logbook/server/ServerResponse.kt @@ -10,9 +10,9 @@ import io.ktor.http.HttpHeaders.ContentType import io.ktor.request.* import io.ktor.response.* import io.ktor.util.* -import org.zalando.logbook.HttpHeaders -import org.zalando.logbook.HttpResponse -import org.zalando.logbook.Origin +import org.zalando.logbook.api.HttpHeaders +import org.zalando.logbook.api.HttpResponse +import org.zalando.logbook.api.Origin import org.zalando.logbook.common.State import java.nio.charset.Charset import java.util.concurrent.atomic.AtomicReference @@ -38,4 +38,4 @@ internal class ServerResponse( internal fun shouldBuffer(): Boolean = state.get() is State.Offering private val ApplicationResponse.contentType: ContentType? get() = headers[ContentType]?.let { parse(it) } -} \ No newline at end of file +} diff --git a/logbook-ktor-server/src/test/kotlin/org/zalando/logbook/server/LogbookServerTest.kt b/logbook-ktor-server/src/test/kotlin/org/zalando/logbook/server/LogbookServerTest.kt index cd7cae30f..eec693b95 100644 --- a/logbook-ktor-server/src/test/kotlin/org/zalando/logbook/server/LogbookServerTest.kt +++ b/logbook-ktor-server/src/test/kotlin/org/zalando/logbook/server/LogbookServerTest.kt @@ -1,14 +1,20 @@ package org.zalando.logbook.server -import io.ktor.application.* -import io.ktor.client.* -import io.ktor.client.request.* -import io.ktor.http.* -import io.ktor.request.* -import io.ktor.response.* -import io.ktor.routing.* -import io.ktor.server.cio.* -import io.ktor.server.engine.* +import io.ktor.application.call +import io.ktor.application.install +import io.ktor.client.HttpClient +import io.ktor.client.request.HttpRequestBuilder +import io.ktor.client.request.post +import io.ktor.http.ContentType +import io.ktor.http.HttpStatusCode +import io.ktor.http.contentType +import io.ktor.request.receiveText +import io.ktor.response.respond +import io.ktor.response.respondText +import io.ktor.routing.post +import io.ktor.routing.routing +import io.ktor.server.cio.CIO +import io.ktor.server.engine.embeddedServer import kotlinx.coroutines.runBlocking import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.AfterEach @@ -16,9 +22,19 @@ import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.mockito.ArgumentCaptor import org.mockito.ArgumentMatchers.any -import org.mockito.Mockito.* -import org.zalando.logbook.* +import org.mockito.Mockito.mock +import org.mockito.Mockito.never +import org.mockito.Mockito.timeout +import org.mockito.Mockito.verify +import org.mockito.Mockito.`when` +import org.zalando.logbook.TestStrategy +import org.zalando.logbook.api.Correlation +import org.zalando.logbook.api.HttpLogWriter +import org.zalando.logbook.api.Logbook +import org.zalando.logbook.api.Precorrelation import org.zalando.logbook.common.ExperimentalLogbookKtorApi +import org.zalando.logbook.core.DefaultHttpLogFormatter +import org.zalando.logbook.core.DefaultSink @ExperimentalLogbookKtorApi @@ -30,7 +46,12 @@ internal class LogbookServerTest { private val testLogbook: Logbook = Logbook .builder() .strategy(TestStrategy()) - .sink(DefaultSink(DefaultHttpLogFormatter(), writer)) + .sink( + DefaultSink( + DefaultHttpLogFormatter(), + writer + ) + ) .build() private val client = HttpClient { diff --git a/logbook-logstash/src/main/java/org/zalando/logbook/logstash/LogstashLogbackSink.java b/logbook-logstash/src/main/java/org/zalando/logbook/logstash/LogstashLogbackSink.java index cafaeae73..cfcd49d43 100644 --- a/logbook-logstash/src/main/java/org/zalando/logbook/logstash/LogstashLogbackSink.java +++ b/logbook-logstash/src/main/java/org/zalando/logbook/logstash/LogstashLogbackSink.java @@ -5,13 +5,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.Marker; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; -import org.zalando.logbook.Sink; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; import java.io.IOException; diff --git a/logbook-logstash/src/test/java/org/zalando/logbook/logstash/LogbackLogstashSinkTest.java b/logbook-logstash/src/test/java/org/zalando/logbook/logstash/LogbackLogstashSinkTest.java index c7d188337..bd730d070 100644 --- a/logbook-logstash/src/test/java/org/zalando/logbook/logstash/LogbackLogstashSinkTest.java +++ b/logbook-logstash/src/test/java/org/zalando/logbook/logstash/LogbackLogstashSinkTest.java @@ -1,18 +1,5 @@ package org.zalando.logbook.logstash; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.MockHttpResponse; -import org.zalando.logbook.Precorrelation; -import org.zalando.logbook.json.JsonHttpLogFormatter; - import com.jayway.jsonpath.Configuration; import com.jayway.jsonpath.Configuration.Defaults; import com.jayway.jsonpath.Option; @@ -20,6 +7,18 @@ import com.jayway.jsonpath.spi.json.JsonProvider; import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; import com.jayway.jsonpath.spi.mapper.MappingProvider; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.MockHttpResponse; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.json.JsonHttpLogFormatter; import java.io.IOException; import java.time.Duration; @@ -33,7 +32,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.zalando.logbook.Origin.REMOTE; +import static org.zalando.logbook.api.Origin.REMOTE; /** * Test request and response logging with and without pretty-printing. diff --git a/logbook-netty/src/main/java/org/zalando/logbook/netty/HeaderSupport.java b/logbook-netty/src/main/java/org/zalando/logbook/netty/HeaderSupport.java index 04a71d213..0e89443e3 100644 --- a/logbook-netty/src/main/java/org/zalando/logbook/netty/HeaderSupport.java +++ b/logbook-netty/src/main/java/org/zalando/logbook/netty/HeaderSupport.java @@ -1,7 +1,7 @@ package org.zalando.logbook.netty; import com.google.gag.annotation.remark.ThisWouldBeOneLineIn; -import org.zalando.logbook.HttpHeaders; +import org.zalando.logbook.api.HttpHeaders; import java.util.ArrayList; import java.util.List; diff --git a/logbook-netty/src/main/java/org/zalando/logbook/netty/LogbookClientHandler.java b/logbook-netty/src/main/java/org/zalando/logbook/netty/LogbookClientHandler.java index 7f705ea8a..e49a4e281 100644 --- a/logbook-netty/src/main/java/org/zalando/logbook/netty/LogbookClientHandler.java +++ b/logbook-netty/src/main/java/org/zalando/logbook/netty/LogbookClientHandler.java @@ -8,16 +8,18 @@ import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.HttpResponse; import io.netty.handler.codec.http.LastHttpContent; -import javax.annotation.concurrent.NotThreadSafe; import lombok.RequiredArgsConstructor; import org.apiguardian.api.API; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; + +import javax.annotation.concurrent.NotThreadSafe; + import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.zalando.fauxpas.FauxPas.throwingRunnable; -import static org.zalando.logbook.Logbook.RequestWritingStage; -import static org.zalando.logbook.Logbook.ResponseWritingStage; -import static org.zalando.logbook.Origin.LOCAL; -import static org.zalando.logbook.Origin.REMOTE; +import static org.zalando.logbook.api.Logbook.RequestWritingStage; +import static org.zalando.logbook.api.Logbook.ResponseWritingStage; +import static org.zalando.logbook.api.Origin.LOCAL; +import static org.zalando.logbook.api.Origin.REMOTE; import static org.zalando.logbook.netty.Conditionals.runIf; @API(status = EXPERIMENTAL) diff --git a/logbook-netty/src/main/java/org/zalando/logbook/netty/LogbookServerHandler.java b/logbook-netty/src/main/java/org/zalando/logbook/netty/LogbookServerHandler.java index 2c384a4e6..20aaede3a 100644 --- a/logbook-netty/src/main/java/org/zalando/logbook/netty/LogbookServerHandler.java +++ b/logbook-netty/src/main/java/org/zalando/logbook/netty/LogbookServerHandler.java @@ -10,16 +10,16 @@ import io.netty.handler.codec.http.LastHttpContent; import lombok.RequiredArgsConstructor; import org.apiguardian.api.API; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import javax.annotation.concurrent.NotThreadSafe; import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.zalando.fauxpas.FauxPas.throwingRunnable; -import static org.zalando.logbook.Logbook.RequestWritingStage; -import static org.zalando.logbook.Logbook.ResponseWritingStage; -import static org.zalando.logbook.Origin.LOCAL; -import static org.zalando.logbook.Origin.REMOTE; +import static org.zalando.logbook.api.Logbook.RequestWritingStage; +import static org.zalando.logbook.api.Logbook.ResponseWritingStage; +import static org.zalando.logbook.api.Origin.LOCAL; +import static org.zalando.logbook.api.Origin.REMOTE; import static org.zalando.logbook.netty.Conditionals.runIf; @API(status = EXPERIMENTAL) diff --git a/logbook-netty/src/main/java/org/zalando/logbook/netty/Request.java b/logbook-netty/src/main/java/org/zalando/logbook/netty/Request.java index 9d928eee4..de1e1d761 100644 --- a/logbook-netty/src/main/java/org/zalando/logbook/netty/Request.java +++ b/logbook-netty/src/main/java/org/zalando/logbook/netty/Request.java @@ -7,26 +7,25 @@ import io.netty.handler.codec.http.HttpUtil; import io.netty.handler.codec.http.QueryStringDecoder; import io.netty.handler.ssl.SslHandler; +import lombok.AllArgsConstructor; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.Origin; +import javax.annotation.Nullable; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.nio.charset.Charset; import java.util.Objects; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; -import javax.annotation.Nullable; - -import lombok.AllArgsConstructor; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.Origin; import static io.netty.handler.codec.http.HttpHeaderNames.HOST; import static java.nio.charset.StandardCharsets.UTF_8; import static lombok.AccessLevel.PRIVATE; -import static org.zalando.logbook.Origin.LOCAL; +import static org.zalando.logbook.api.Origin.LOCAL; @AllArgsConstructor(access = PRIVATE) -final class Request implements org.zalando.logbook.HttpRequest, HeaderSupport { +final class Request implements org.zalando.logbook.api.HttpRequest, HeaderSupport { private final AtomicReference state = new AtomicReference<>(new Unbuffered()); @@ -122,13 +121,13 @@ public Charset getCharset() { } @Override - public org.zalando.logbook.HttpRequest withBody() { + public org.zalando.logbook.api.HttpRequest withBody() { state.updateAndGet(State::with); return this; } @Override - public org.zalando.logbook.HttpRequest withoutBody() { + public org.zalando.logbook.api.HttpRequest withoutBody() { state.updateAndGet(State::without); return this; } diff --git a/logbook-netty/src/main/java/org/zalando/logbook/netty/Response.java b/logbook-netty/src/main/java/org/zalando/logbook/netty/Response.java index 3fa19fe1f..e2077b36a 100644 --- a/logbook-netty/src/main/java/org/zalando/logbook/netty/Response.java +++ b/logbook-netty/src/main/java/org/zalando/logbook/netty/Response.java @@ -2,6 +2,7 @@ import io.netty.buffer.ByteBuf; import io.netty.handler.codec.http.HttpResponse; + import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.concurrent.atomic.AtomicReference; @@ -9,13 +10,14 @@ import io.netty.handler.codec.http.HttpUtil; import lombok.AllArgsConstructor; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.Origin; + import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE; @AllArgsConstructor final class Response - implements org.zalando.logbook.HttpResponse, HeaderSupport { + implements org.zalando.logbook.api.HttpResponse, HeaderSupport { private final AtomicReference state = new AtomicReference<>(new Unbuffered()); @@ -55,13 +57,13 @@ public Charset getCharset() { } @Override - public org.zalando.logbook.HttpResponse withBody() { + public org.zalando.logbook.api.HttpResponse withBody() { state.updateAndGet(State::with); return this; } @Override - public org.zalando.logbook.HttpResponse withoutBody() { + public org.zalando.logbook.api.HttpResponse withoutBody() { state.updateAndGet(State::without); return this; } diff --git a/logbook-netty/src/test/java/org/zalando/logbook/netty/LogbookClientHandlerTest.java b/logbook-netty/src/test/java/org/zalando/logbook/netty/LogbookClientHandlerTest.java index 5ca3337ad..12e64c594 100644 --- a/logbook-netty/src/test/java/org/zalando/logbook/netty/LogbookClientHandlerTest.java +++ b/logbook-netty/src/test/java/org/zalando/logbook/netty/LogbookClientHandlerTest.java @@ -5,13 +5,13 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import reactor.core.publisher.Mono; import reactor.netty.DisposableServer; import reactor.netty.http.client.HttpClient; diff --git a/logbook-netty/src/test/java/org/zalando/logbook/netty/LogbookServerHandlerTest.java b/logbook-netty/src/test/java/org/zalando/logbook/netty/LogbookServerHandlerTest.java index 11fc4b7fc..cf7c055bb 100644 --- a/logbook-netty/src/test/java/org/zalando/logbook/netty/LogbookServerHandlerTest.java +++ b/logbook-netty/src/test/java/org/zalando/logbook/netty/LogbookServerHandlerTest.java @@ -5,13 +5,13 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import reactor.core.publisher.Mono; import reactor.netty.DisposableServer; import reactor.netty.http.client.HttpClient; diff --git a/logbook-netty/src/test/java/org/zalando/logbook/netty/RequestUnitTest.java b/logbook-netty/src/test/java/org/zalando/logbook/netty/RequestUnitTest.java index 397d173c0..038de3b7f 100644 --- a/logbook-netty/src/test/java/org/zalando/logbook/netty/RequestUnitTest.java +++ b/logbook-netty/src/test/java/org/zalando/logbook/netty/RequestUnitTest.java @@ -17,8 +17,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.zalando.logbook.Origin.LOCAL; -import static org.zalando.logbook.Origin.REMOTE; +import static org.zalando.logbook.api.Origin.LOCAL; +import static org.zalando.logbook.api.Origin.REMOTE; /** diff --git a/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/LocalRequest.java b/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/LocalRequest.java index dc14f5920..5ec7d34c6 100644 --- a/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/LocalRequest.java +++ b/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/LocalRequest.java @@ -6,9 +6,9 @@ import okhttp3.Request; import okhttp3.RequestBody; import okio.Buffer; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/LogbookInterceptor.java b/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/LogbookInterceptor.java index 652f5cfac..e52b59d90 100644 --- a/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/LogbookInterceptor.java +++ b/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/LogbookInterceptor.java @@ -4,8 +4,8 @@ import okhttp3.Interceptor; import okhttp3.Response; import org.apiguardian.api.API; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; import javax.annotation.Nonnull; import java.io.IOException; diff --git a/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/RemoteResponse.java b/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/RemoteResponse.java index 290711686..51faca5c7 100644 --- a/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/RemoteResponse.java +++ b/logbook-okhttp/src/main/java/org/zalando/logbook/okhttp/RemoteResponse.java @@ -5,9 +5,9 @@ import okhttp3.MediaType; import okhttp3.Response; import okhttp3.ResponseBody; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; import java.io.IOException; import java.nio.charset.Charset; diff --git a/logbook-okhttp/src/test/java/org/zalando/logbook/okhttp/GzipInterceptorTest.java b/logbook-okhttp/src/test/java/org/zalando/logbook/okhttp/GzipInterceptorTest.java index d208da633..c2addcc28 100644 --- a/logbook-okhttp/src/test/java/org/zalando/logbook/okhttp/GzipInterceptorTest.java +++ b/logbook-okhttp/src/test/java/org/zalando/logbook/okhttp/GzipInterceptorTest.java @@ -8,10 +8,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; diff --git a/logbook-okhttp/src/test/java/org/zalando/logbook/okhttp/LogbookInterceptorTest.java b/logbook-okhttp/src/test/java/org/zalando/logbook/okhttp/LogbookInterceptorTest.java index 811a52830..0e6544fb3 100644 --- a/logbook-okhttp/src/test/java/org/zalando/logbook/okhttp/LogbookInterceptorTest.java +++ b/logbook-okhttp/src/test/java/org/zalando/logbook/okhttp/LogbookInterceptorTest.java @@ -8,13 +8,13 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; diff --git a/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/LocalRequest.java b/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/LocalRequest.java index 7e45210c7..8ecb7704d 100644 --- a/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/LocalRequest.java +++ b/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/LocalRequest.java @@ -6,9 +6,9 @@ import lombok.AllArgsConstructor; import lombok.Getter; import okio.Buffer; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/LogbookInterceptor.java b/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/LogbookInterceptor.java index ccb55c106..59c5ab301 100644 --- a/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/LogbookInterceptor.java +++ b/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/LogbookInterceptor.java @@ -4,8 +4,8 @@ import com.squareup.okhttp.Response; import lombok.AllArgsConstructor; import org.apiguardian.api.API; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; import java.io.IOException; diff --git a/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/RemoteResponse.java b/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/RemoteResponse.java index 3d1f75969..c45fbd9d0 100644 --- a/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/RemoteResponse.java +++ b/logbook-okhttp2/src/main/java/org/zalando/logbook/okhttp2/RemoteResponse.java @@ -5,9 +5,9 @@ import com.squareup.okhttp.ResponseBody; import lombok.AllArgsConstructor; import lombok.Getter; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; import java.io.IOException; import java.nio.charset.Charset; diff --git a/logbook-okhttp2/src/test/java/org/zalando/logbook/okhttp2/GzipInterceptorTest.java b/logbook-okhttp2/src/test/java/org/zalando/logbook/okhttp2/GzipInterceptorTest.java index 6026b0e2b..fe939a691 100644 --- a/logbook-okhttp2/src/test/java/org/zalando/logbook/okhttp2/GzipInterceptorTest.java +++ b/logbook-okhttp2/src/test/java/org/zalando/logbook/okhttp2/GzipInterceptorTest.java @@ -8,10 +8,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; diff --git a/logbook-okhttp2/src/test/java/org/zalando/logbook/okhttp2/LogbookInterceptorTest.java b/logbook-okhttp2/src/test/java/org/zalando/logbook/okhttp2/LogbookInterceptorTest.java index c4327628a..352a5978d 100644 --- a/logbook-okhttp2/src/test/java/org/zalando/logbook/okhttp2/LogbookInterceptorTest.java +++ b/logbook-okhttp2/src/test/java/org/zalando/logbook/okhttp2/LogbookInterceptorTest.java @@ -8,13 +8,13 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; diff --git a/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/FeignLogbookLogger.java b/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/FeignLogbookLogger.java index 950b44e56..17172445c 100644 --- a/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/FeignLogbookLogger.java +++ b/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/FeignLogbookLogger.java @@ -5,10 +5,10 @@ import lombok.AllArgsConstructor; import lombok.Generated; import org.apiguardian.api.API; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; import java.io.IOException; import java.io.UncheckedIOException; diff --git a/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/HeaderUtils.java b/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/HeaderUtils.java index 4f5659cd0..a7c6c6134 100644 --- a/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/HeaderUtils.java +++ b/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/HeaderUtils.java @@ -1,8 +1,12 @@ package org.zalando.logbook.openfeign; -import org.zalando.logbook.HttpHeaders; +import org.zalando.logbook.api.HttpHeaders; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; class HeaderUtils { private HeaderUtils() { diff --git a/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/LocalRequest.java b/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/LocalRequest.java index 8f12c7011..db2827515 100644 --- a/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/LocalRequest.java +++ b/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/LocalRequest.java @@ -2,9 +2,9 @@ import feign.Request; import lombok.RequiredArgsConstructor; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.net.URI; diff --git a/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/RemoteResponse.java b/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/RemoteResponse.java index 737588749..13e3550a3 100644 --- a/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/RemoteResponse.java +++ b/logbook-openfeign/src/main/java/org/zalando/logbook/openfeign/RemoteResponse.java @@ -2,9 +2,9 @@ import feign.Response; import lombok.RequiredArgsConstructor; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.nio.charset.Charset; diff --git a/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/FeignLogbookLoggerExceptionTest.java b/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/FeignLogbookLoggerExceptionTest.java index b273cb31c..274e65cb3 100644 --- a/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/FeignLogbookLoggerExceptionTest.java +++ b/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/FeignLogbookLoggerExceptionTest.java @@ -3,24 +3,25 @@ import feign.Feign; import feign.Logger; import feign.RetryableException; -import feign.Retryer; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Logbook.RequestWritingStage; import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Logbook.RequestWritingStage; import java.io.IOException; import java.io.UncheckedIOException; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; -import static org.zalando.logbook.Logbook.ResponseProcessingStage; -import static org.zalando.logbook.Logbook.builder; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; +import static org.zalando.logbook.api.Logbook.ResponseProcessingStage; +import static org.zalando.logbook.api.Logbook.builder; @ExtendWith(MockitoExtension.class) class FeignLogbookLoggerExceptionTest extends FeignHttpServerRunner { diff --git a/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/FeignLogbookLoggerTest.java b/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/FeignLogbookLoggerTest.java index 1404eeeab..a10f78bbd 100644 --- a/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/FeignLogbookLoggerTest.java +++ b/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/FeignLogbookLoggerTest.java @@ -10,11 +10,19 @@ import org.mockito.Captor; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.zalando.logbook.*; +import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/LocalRequestTest.java b/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/LocalRequestTest.java index 017146938..7b559fa40 100644 --- a/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/LocalRequestTest.java +++ b/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/LocalRequestTest.java @@ -3,7 +3,7 @@ import feign.Request; import feign.RequestTemplate; import org.junit.jupiter.api.Test; -import org.zalando.logbook.HttpRequest; +import org.zalando.logbook.api.HttpRequest; import java.io.IOException; import java.nio.charset.StandardCharsets; diff --git a/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/RemoteResponseTest.java b/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/RemoteResponseTest.java index 5596b508f..2a495c60d 100644 --- a/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/RemoteResponseTest.java +++ b/logbook-openfeign/src/test/java/org/zalando/logbook/openfeign/RemoteResponseTest.java @@ -4,7 +4,7 @@ import feign.RequestTemplate; import feign.Response; import org.junit.jupiter.api.Test; -import org.zalando.logbook.HttpResponse; +import org.zalando.logbook.api.HttpResponse; import java.io.IOException; import java.nio.charset.StandardCharsets; diff --git a/logbook-servlet/src/main/java/org/zalando/logbook/servlet/LocalResponse.java b/logbook-servlet/src/main/java/org/zalando/logbook/servlet/LocalResponse.java index 730d1ee8e..6d4f6d2f5 100644 --- a/logbook-servlet/src/main/java/org/zalando/logbook/servlet/LocalResponse.java +++ b/logbook-servlet/src/main/java/org/zalando/logbook/servlet/LocalResponse.java @@ -7,9 +7,9 @@ import jakarta.servlet.http.HttpServletResponseWrapper; import lombok.AllArgsConstructor; import lombok.Getter; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/logbook-servlet/src/main/java/org/zalando/logbook/servlet/LogbookFilter.java b/logbook-servlet/src/main/java/org/zalando/logbook/servlet/LogbookFilter.java index 6cc639e40..a9ba97ce6 100644 --- a/logbook-servlet/src/main/java/org/zalando/logbook/servlet/LogbookFilter.java +++ b/logbook-servlet/src/main/java/org/zalando/logbook/servlet/LogbookFilter.java @@ -7,12 +7,12 @@ import lombok.AllArgsConstructor; import lombok.With; import org.apiguardian.api.API; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Logbook.RequestWritingStage; -import org.zalando.logbook.Logbook.ResponseProcessingStage; -import org.zalando.logbook.Logbook.ResponseWritingStage; -import org.zalando.logbook.Strategy; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Logbook.RequestWritingStage; +import org.zalando.logbook.api.Logbook.ResponseProcessingStage; +import org.zalando.logbook.api.Logbook.ResponseWritingStage; +import org.zalando.logbook.api.Strategy; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-servlet/src/main/java/org/zalando/logbook/servlet/RemoteRequest.java b/logbook-servlet/src/main/java/org/zalando/logbook/servlet/RemoteRequest.java index b8778f639..943e85ef8 100644 --- a/logbook-servlet/src/main/java/org/zalando/logbook/servlet/RemoteRequest.java +++ b/logbook-servlet/src/main/java/org/zalando/logbook/servlet/RemoteRequest.java @@ -10,9 +10,9 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.SneakyThrows; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; import org.zalando.logbook.common.MediaTypeQuery; import java.io.BufferedReader; diff --git a/logbook-servlet/src/main/java/org/zalando/logbook/servlet/SecureLogbookFilter.java b/logbook-servlet/src/main/java/org/zalando/logbook/servlet/SecureLogbookFilter.java index 134b024aa..f5e9541de 100644 --- a/logbook-servlet/src/main/java/org/zalando/logbook/servlet/SecureLogbookFilter.java +++ b/logbook-servlet/src/main/java/org/zalando/logbook/servlet/SecureLogbookFilter.java @@ -5,8 +5,8 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.apiguardian.api.API; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.SecurityStrategy; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.core.SecurityStrategy; import java.io.IOException; diff --git a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/AsyncDispatchTest.java b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/AsyncDispatchTest.java index c2ec341f4..71ad99d8d 100644 --- a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/AsyncDispatchTest.java +++ b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/AsyncDispatchTest.java @@ -19,12 +19,12 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.web.client.RestTemplate; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; import java.time.Duration; diff --git a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/FormRequestTest.java b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/FormRequestTest.java index 142d2d657..138e9d8c4 100644 --- a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/FormRequestTest.java +++ b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/FormRequestTest.java @@ -7,12 +7,12 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.RequestPostProcessor; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; diff --git a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/FormattingTest.java b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/FormattingTest.java index 7dd4b85d4..97ef67f50 100644 --- a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/FormattingTest.java +++ b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/FormattingTest.java @@ -1,5 +1,12 @@ package org.zalando.logbook.servlet; +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.Configuration.Defaults; +import com.jayway.jsonpath.Option; +import com.jayway.jsonpath.spi.json.JacksonJsonProvider; +import com.jayway.jsonpath.spi.json.JsonProvider; +import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; +import com.jayway.jsonpath.spi.mapper.MappingProvider; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -7,23 +14,15 @@ import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpMessage; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Logbook; import org.zalando.logbook.TestStrategy; - -import com.jayway.jsonpath.Configuration; -import com.jayway.jsonpath.Option; -import com.jayway.jsonpath.Configuration.Defaults; -import com.jayway.jsonpath.spi.json.JacksonJsonProvider; -import com.jayway.jsonpath.spi.json.JsonProvider; -import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; -import com.jayway.jsonpath.spi.mapper.MappingProvider; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpMessage; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; import java.util.EnumSet; diff --git a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/ForwardingHttpLogFormatter.java b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/ForwardingHttpLogFormatter.java index 97cd88c5d..66fcefb14 100644 --- a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/ForwardingHttpLogFormatter.java +++ b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/ForwardingHttpLogFormatter.java @@ -1,10 +1,10 @@ package org.zalando.logbook.servlet; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/HttpSupportTest.java b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/HttpSupportTest.java index 3081767af..2c5a64780 100644 --- a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/HttpSupportTest.java +++ b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/HttpSupportTest.java @@ -7,7 +7,7 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.junit.jupiter.api.Test; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import java.io.IOException; diff --git a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/MultiFilterSecurityTest.java b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/MultiFilterSecurityTest.java index a96ebc7cf..2589a0a29 100644 --- a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/MultiFilterSecurityTest.java +++ b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/MultiFilterSecurityTest.java @@ -7,15 +7,15 @@ import org.mockito.ArgumentCaptor; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; @@ -30,8 +30,8 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.request; -import static org.zalando.logbook.Conditions.exclude; -import static org.zalando.logbook.Conditions.requestTo; +import static org.zalando.logbook.core.Conditions.exclude; +import static org.zalando.logbook.core.Conditions.requestTo; import static org.zalando.logbook.servlet.RequestBuilders.async; /** diff --git a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/MultiFilterTest.java b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/MultiFilterTest.java index d1e7f50e7..29c0120bb 100644 --- a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/MultiFilterTest.java +++ b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/MultiFilterTest.java @@ -8,15 +8,15 @@ import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; diff --git a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/SkipTest.java b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/SkipTest.java index 858dea28f..589447baa 100644 --- a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/SkipTest.java +++ b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/SkipTest.java @@ -5,15 +5,15 @@ import org.junit.jupiter.api.Test; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; diff --git a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/TeeTest.java b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/TeeTest.java index e61bb3cb5..10e5fe018 100644 --- a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/TeeTest.java +++ b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/TeeTest.java @@ -6,11 +6,11 @@ import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; import com.jayway.jsonpath.Configuration; import com.jayway.jsonpath.Option; diff --git a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/WritingTest.java b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/WritingTest.java index 7746f4bc2..611ced0ea 100644 --- a/logbook-servlet/src/test/java/org/zalando/logbook/servlet/WritingTest.java +++ b/logbook-servlet/src/test/java/org/zalando/logbook/servlet/WritingTest.java @@ -7,13 +7,13 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.RequestPostProcessor; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogFormatter; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import javax.annotation.concurrent.NotThreadSafe; diff --git a/logbook-spring-boot-autoconfigure/src/main/java/org/zalando/logbook/autoconfigure/LogbookAutoConfiguration.java b/logbook-spring-boot-autoconfigure/src/main/java/org/zalando/logbook/autoconfigure/LogbookAutoConfiguration.java index 7cc500a69..8c67e1052 100644 --- a/logbook-spring-boot-autoconfigure/src/main/java/org/zalando/logbook/autoconfigure/LogbookAutoConfiguration.java +++ b/logbook-spring-boot-autoconfigure/src/main/java/org/zalando/logbook/autoconfigure/LogbookAutoConfiguration.java @@ -8,7 +8,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.boot.autoconfigure.condition.*; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -19,7 +23,36 @@ import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.security.web.SecurityFilterChain; -import org.zalando.logbook.*; +import org.zalando.logbook.api.BodyFilter; +import org.zalando.logbook.api.CorrelationId; +import org.zalando.logbook.api.HeaderFilter; +import org.zalando.logbook.api.HttpLogFormatter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.PathFilter; +import org.zalando.logbook.api.QueryFilter; +import org.zalando.logbook.api.RequestFilter; +import org.zalando.logbook.api.ResponseFilter; +import org.zalando.logbook.api.Sink; +import org.zalando.logbook.api.Strategy; +import org.zalando.logbook.core.BodyOnlyIfStatusAtLeastStrategy; +import org.zalando.logbook.core.ChunkingSink; +import org.zalando.logbook.core.Conditions; +import org.zalando.logbook.core.CurlHttpLogFormatter; +import org.zalando.logbook.core.DefaultCorrelationId; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultHttpLogWriter; +import org.zalando.logbook.core.DefaultSink; +import org.zalando.logbook.core.DefaultStrategy; +import org.zalando.logbook.core.HeaderFilters; +import org.zalando.logbook.core.PathFilters; +import org.zalando.logbook.core.QueryFilters; +import org.zalando.logbook.core.RequestFilters; +import org.zalando.logbook.core.ResponseFilters; +import org.zalando.logbook.core.SplunkHttpLogFormatter; +import org.zalando.logbook.core.StatusAtLeastStrategy; +import org.zalando.logbook.core.WithoutBodyStrategy; import org.zalando.logbook.httpclient.LogbookHttpRequestInterceptor; import org.zalando.logbook.httpclient.LogbookHttpResponseInterceptor; import org.zalando.logbook.json.JsonHttpLogFormatter; @@ -38,11 +71,11 @@ import static jakarta.servlet.DispatcherType.REQUEST; import static org.apiguardian.api.API.Status.INTERNAL; import static org.apiguardian.api.API.Status.STABLE; -import static org.zalando.logbook.BodyFilters.defaultValue; -import static org.zalando.logbook.BodyFilters.truncate; -import static org.zalando.logbook.HeaderFilters.replaceHeaders; -import static org.zalando.logbook.QueryFilters.replaceQuery; import static org.zalando.logbook.autoconfigure.LogbookAutoConfiguration.JakartaServletFilterConfiguration.newFilter; +import static org.zalando.logbook.core.BodyFilters.defaultValue; +import static org.zalando.logbook.core.BodyFilters.truncate; +import static org.zalando.logbook.core.HeaderFilters.replaceHeaders; +import static org.zalando.logbook.core.QueryFilters.replaceQuery; @API(status = STABLE) @Configuration(proxyBeanMethods = false) diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/BodyOnlyIfStatusAtLeastStrategyTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/BodyOnlyIfStatusAtLeastStrategyTest.java index c4ef5bccb..6ceab0f3a 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/BodyOnlyIfStatusAtLeastStrategyTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/BodyOnlyIfStatusAtLeastStrategyTest.java @@ -2,8 +2,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.zalando.logbook.BodyOnlyIfStatusAtLeastStrategy; -import org.zalando.logbook.Strategy; +import org.zalando.logbook.api.Strategy; +import org.zalando.logbook.core.BodyOnlyIfStatusAtLeastStrategy; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ExcludeTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ExcludeTest.java index b35489118..2d4426caa 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ExcludeTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ExcludeTest.java @@ -6,11 +6,11 @@ import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Bean; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; import java.util.function.Predicate; @@ -19,8 +19,8 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; -import static org.zalando.logbook.Conditions.exclude; -import static org.zalando.logbook.Conditions.requestTo; +import static org.zalando.logbook.core.Conditions.exclude; +import static org.zalando.logbook.core.Conditions.requestTo; @TestConfiguration class Config { diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleCurlTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleCurlTest.java index 4008b7ca7..356469637 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleCurlTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleCurlTest.java @@ -5,10 +5,10 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleDefaultTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleDefaultTest.java index 5425889e3..cb8399a2c 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleDefaultTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleDefaultTest.java @@ -5,10 +5,10 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleHttpTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleHttpTest.java index 55066fa89..f55225a40 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleHttpTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleHttpTest.java @@ -5,10 +5,10 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleSplunkTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleSplunkTest.java index c3a8aa836..543607884 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleSplunkTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/FormatStyleSplunkTest.java @@ -5,10 +5,10 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/IncludeTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/IncludeTest.java index bb527a439..b839321f3 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/IncludeTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/IncludeTest.java @@ -7,9 +7,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.context.annotation.Bean; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; import uk.org.lidalia.slf4jtest.LoggingEvent; import uk.org.lidalia.slf4jtest.TestLogger; import uk.org.lidalia.slf4jtest.TestLoggerFactory; @@ -18,8 +18,8 @@ import java.util.function.Predicate; import static org.assertj.core.api.Assertions.assertThat; -import static org.zalando.logbook.Conditions.exclude; -import static org.zalando.logbook.Conditions.requestTo; +import static org.zalando.logbook.core.Conditions.exclude; +import static org.zalando.logbook.core.Conditions.requestTo; import static uk.org.lidalia.slf4jext.Level.TRACE; @LogbookTest(profiles = "include", imports = IncludeTest.Config.class) diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/JavaxFilterTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/JavaxFilterTest.java index c8d09c8be..5d06779b7 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/JavaxFilterTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/JavaxFilterTest.java @@ -3,7 +3,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.WebApplicationContextRunner; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateBodyCustomTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateBodyCustomTest.java index a2505c2ea..bb3470dcd 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateBodyCustomTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateBodyCustomTest.java @@ -5,12 +5,12 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.BodyFilter; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.BodyFilter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateHeadersCustomTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateHeadersCustomTest.java index f65a5e1e2..841c9f10d 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateHeadersCustomTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateHeadersCustomTest.java @@ -5,12 +5,12 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateHeadersDefaultTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateHeadersDefaultTest.java index 78485215d..7af39da81 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateHeadersDefaultTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateHeadersDefaultTest.java @@ -5,12 +5,12 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateParametersCustomTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateParametersCustomTest.java index bd4e1163d..86bbe277b 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateParametersCustomTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateParametersCustomTest.java @@ -5,11 +5,11 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateParametersDefaultTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateParametersDefaultTest.java index 9b058ed09..07643aa6e 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateParametersDefaultTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateParametersDefaultTest.java @@ -5,11 +5,11 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscatePathCustomTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscatePathCustomTest.java index a2cb536b3..8f452935c 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscatePathCustomTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscatePathCustomTest.java @@ -5,11 +5,11 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscatePathDefaultTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscatePathDefaultTest.java index 8240be580..e454b6930 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscatePathDefaultTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscatePathDefaultTest.java @@ -5,11 +5,11 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateRequestCustomTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateRequestCustomTest.java index 8acf34c4a..21b57e11c 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateRequestCustomTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateRequestCustomTest.java @@ -5,12 +5,12 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; -import org.zalando.logbook.Precorrelation; -import org.zalando.logbook.RequestFilter; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.RequestFilter; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateResponseCustomTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateResponseCustomTest.java index 5c5be5a71..b33737bc5 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateResponseCustomTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/ObfuscateResponseCustomTest.java @@ -5,12 +5,12 @@ import org.mockito.ArgumentCaptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; import org.zalando.logbook.MockHttpRequest; import org.zalando.logbook.MockHttpResponse; -import org.zalando.logbook.ResponseFilter; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.ResponseFilter; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/StandardTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/StandardTest.java index c91e889c5..de994e068 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/StandardTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/StandardTest.java @@ -2,7 +2,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/StatusAtLeastStrategyTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/StatusAtLeastStrategyTest.java index aa379dcc4..ed507ff67 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/StatusAtLeastStrategyTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/StatusAtLeastStrategyTest.java @@ -2,8 +2,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.zalando.logbook.StatusAtLeastStrategy; -import org.zalando.logbook.Strategy; +import org.zalando.logbook.core.StatusAtLeastStrategy; +import org.zalando.logbook.api.Strategy; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WithoutBodyStrategyTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WithoutBodyStrategyTest.java index 5286d89d0..e171328e7 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WithoutBodyStrategyTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WithoutBodyStrategyTest.java @@ -2,8 +2,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.zalando.logbook.Strategy; -import org.zalando.logbook.WithoutBodyStrategy; +import org.zalando.logbook.api.Strategy; +import org.zalando.logbook.core.WithoutBodyStrategy; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteBodyMaxSizeTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteBodyMaxSizeTest.java index 6640006b4..69560ecee 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteBodyMaxSizeTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteBodyMaxSizeTest.java @@ -2,7 +2,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteChunkingTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteChunkingTest.java index ec57a4f70..a679f2eb0 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteChunkingTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteChunkingTest.java @@ -2,8 +2,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.zalando.logbook.ChunkingSink; -import org.zalando.logbook.Sink; +import org.zalando.logbook.core.ChunkingSink; +import org.zalando.logbook.api.Sink; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteCustomTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteCustomTest.java index 122857e4a..6398369c2 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteCustomTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteCustomTest.java @@ -3,9 +3,9 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.mock.mockito.MockBean; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Logbook; import org.zalando.logbook.MockHttpRequest; import java.io.IOException; diff --git a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteNoBodyMaxSizeTest.java b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteNoBodyMaxSizeTest.java index 7bd3dac89..c7a830d31 100644 --- a/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteNoBodyMaxSizeTest.java +++ b/logbook-spring-boot-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/WriteNoBodyMaxSizeTest.java @@ -2,7 +2,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.zalando.logbook.BodyFilter; +import org.zalando.logbook.api.BodyFilter; import static org.assertj.core.api.Assertions.assertThat; diff --git a/logbook-spring-boot-webflux-autoconfigure/src/main/java/org/zalando/logbook/autoconfigure/webflux/LogbookWebFluxAutoConfiguration.java b/logbook-spring-boot-webflux-autoconfigure/src/main/java/org/zalando/logbook/autoconfigure/webflux/LogbookWebFluxAutoConfiguration.java index 8cca7b8e0..335b2b53d 100644 --- a/logbook-spring-boot-webflux-autoconfigure/src/main/java/org/zalando/logbook/autoconfigure/webflux/LogbookWebFluxAutoConfiguration.java +++ b/logbook-spring-boot-webflux-autoconfigure/src/main/java/org/zalando/logbook/autoconfigure/webflux/LogbookWebFluxAutoConfiguration.java @@ -12,7 +12,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.function.client.ExchangeFilterFunction; import org.springframework.web.server.WebFilter; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import org.zalando.logbook.netty.LogbookClientHandler; import org.zalando.logbook.netty.LogbookServerHandler; import org.zalando.logbook.spring.webflux.LogbookExchangeFilterFunction; @@ -82,4 +82,4 @@ public ExchangeFilterFunction logbookClientExchangeFunction(final Logbook logboo return new LogbookExchangeFilterFunction(logbook); } } -} \ No newline at end of file +} diff --git a/logbook-spring-boot-webflux-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/webflux/LogbookWebFluxAutoConfigurationTest.java b/logbook-spring-boot-webflux-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/webflux/LogbookWebFluxAutoConfigurationTest.java index dcafa0490..71a1517a6 100644 --- a/logbook-spring-boot-webflux-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/webflux/LogbookWebFluxAutoConfigurationTest.java +++ b/logbook-spring-boot-webflux-autoconfigure/src/test/java/org/zalando/logbook/autoconfigure/webflux/LogbookWebFluxAutoConfigurationTest.java @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.FilteredClassLoader; import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import org.zalando.logbook.autoconfigure.webflux.LogbookWebFluxAutoConfiguration.WebFluxClientConfiguration; import org.zalando.logbook.autoconfigure.webflux.LogbookWebFluxAutoConfiguration.WebFluxNettyClientConfiguration; import org.zalando.logbook.autoconfigure.webflux.LogbookWebFluxAutoConfiguration.WebFluxNettyServerConfiguration; diff --git a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ClientRequest.java b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ClientRequest.java index 87a0f9a96..8479144b9 100644 --- a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ClientRequest.java +++ b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ClientRequest.java @@ -2,9 +2,9 @@ import lombok.RequiredArgsConstructor; import org.springframework.util.MimeType; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ClientResponse.java b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ClientResponse.java index 4ded9bc50..e80a97c5b 100644 --- a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ClientResponse.java +++ b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ClientResponse.java @@ -2,9 +2,9 @@ import lombok.AllArgsConstructor; import org.springframework.util.MimeType; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.nio.charset.Charset; diff --git a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/LogbookExchangeFilterFunction.java b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/LogbookExchangeFilterFunction.java index 387f1e83f..ae813343e 100644 --- a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/LogbookExchangeFilterFunction.java +++ b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/LogbookExchangeFilterFunction.java @@ -6,13 +6,15 @@ import org.springframework.http.HttpHeaders; import org.springframework.web.reactive.function.client.ExchangeFilterFunction; import org.springframework.web.reactive.function.client.ExchangeFunction; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.springframework.http.HttpHeaders.TRANSFER_ENCODING; -import static org.zalando.fauxpas.FauxPas.*; +import static org.zalando.fauxpas.FauxPas.throwingConsumer; +import static org.zalando.fauxpas.FauxPas.throwingFunction; +import static org.zalando.fauxpas.FauxPas.throwingSupplier; @RequiredArgsConstructor @API(status = EXPERIMENTAL) diff --git a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/LogbookWebFilter.java b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/LogbookWebFilter.java index 007a25367..218e59729 100644 --- a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/LogbookWebFilter.java +++ b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/LogbookWebFilter.java @@ -5,7 +5,7 @@ import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.WebFilter; import org.springframework.web.server.WebFilterChain; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.Logbook; import reactor.core.publisher.Mono; import java.util.concurrent.atomic.AtomicReference; diff --git a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ServerRequest.java b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ServerRequest.java index 83a97e738..79e0d2340 100644 --- a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ServerRequest.java +++ b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ServerRequest.java @@ -4,9 +4,9 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.util.MimeType; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ServerResponse.java b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ServerResponse.java index e680e9f0b..8c97318d3 100644 --- a/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ServerResponse.java +++ b/logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/ServerResponse.java @@ -4,9 +4,9 @@ import org.springframework.http.HttpStatus; import org.springframework.http.server.reactive.ServerHttpResponse; import org.springframework.util.MimeType; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.nio.charset.Charset; diff --git a/logbook-spring-webflux/src/test/java/org/zalando/logbook/spring/webflux/LogbookExchangeFilterFunctionTest.java b/logbook-spring-webflux/src/test/java/org/zalando/logbook/spring/webflux/LogbookExchangeFilterFunctionTest.java index 061ce6bca..6c5b6358c 100644 --- a/logbook-spring-webflux/src/test/java/org/zalando/logbook/spring/webflux/LogbookExchangeFilterFunctionTest.java +++ b/logbook-spring-webflux/src/test/java/org/zalando/logbook/spring/webflux/LogbookExchangeFilterFunctionTest.java @@ -6,14 +6,24 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.web.reactive.function.client.WebClient; -import org.zalando.logbook.*; +import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.timeout; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; @SpringBootTest(classes = TestApplication.class, webEnvironment = RANDOM_PORT) diff --git a/logbook-spring-webflux/src/test/java/org/zalando/logbook/spring/webflux/LogbookWebFilterTest.java b/logbook-spring-webflux/src/test/java/org/zalando/logbook/spring/webflux/LogbookWebFilterTest.java index e3e8d62e8..38c683b64 100644 --- a/logbook-spring-webflux/src/test/java/org/zalando/logbook/spring/webflux/LogbookWebFilterTest.java +++ b/logbook-spring-webflux/src/test/java/org/zalando/logbook/spring/webflux/LogbookWebFilterTest.java @@ -12,16 +12,25 @@ import org.springframework.context.annotation.Import; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.server.WebFilter; -import org.zalando.logbook.*; +import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; import java.io.IOException; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.timeout; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; -import static org.zalando.logbook.spring.webflux.LogbookWebFilterTest.*; +import static org.zalando.logbook.spring.webflux.LogbookWebFilterTest.FilterConfiguration; @SpringBootTest(classes = {TestApplication.class, FilterConfiguration.class}, webEnvironment = RANDOM_PORT) @Import(MockitoExtension.class) diff --git a/logbook-spring/src/main/java/org/zalando/logbook/spring/LocalRequest.java b/logbook-spring/src/main/java/org/zalando/logbook/spring/LocalRequest.java index da1e5feec..b169f1a16 100644 --- a/logbook-spring/src/main/java/org/zalando/logbook/spring/LocalRequest.java +++ b/logbook-spring/src/main/java/org/zalando/logbook/spring/LocalRequest.java @@ -2,9 +2,9 @@ import lombok.RequiredArgsConstructor; import org.springframework.http.MediaType; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpRequest; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-spring/src/main/java/org/zalando/logbook/spring/LogbookClientHttpRequestInterceptor.java b/logbook-spring/src/main/java/org/zalando/logbook/spring/LogbookClientHttpRequestInterceptor.java index 0b5f95169..6f6c20399 100644 --- a/logbook-spring/src/main/java/org/zalando/logbook/spring/LogbookClientHttpRequestInterceptor.java +++ b/logbook-spring/src/main/java/org/zalando/logbook/spring/LogbookClientHttpRequestInterceptor.java @@ -6,8 +6,8 @@ import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.client.ClientHttpResponse; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Logbook; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Logbook; import java.io.IOException; @@ -19,7 +19,7 @@ public final class LogbookClientHttpRequestInterceptor implements ClientHttpRequ @Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { - final org.zalando.logbook.HttpRequest httpRequest = new LocalRequest(request, body); + final org.zalando.logbook.api.HttpRequest httpRequest = new LocalRequest(request, body); final Logbook.ResponseProcessingStage stage = logbook.process(httpRequest).write(); ClientHttpResponse response = new BufferingClientHttpResponseWrapper(execution.execute(request, body)); diff --git a/logbook-spring/src/main/java/org/zalando/logbook/spring/RemoteResponse.java b/logbook-spring/src/main/java/org/zalando/logbook/spring/RemoteResponse.java index edefc9941..05b98a7f6 100644 --- a/logbook-spring/src/main/java/org/zalando/logbook/spring/RemoteResponse.java +++ b/logbook-spring/src/main/java/org/zalando/logbook/spring/RemoteResponse.java @@ -3,9 +3,9 @@ import lombok.AllArgsConstructor; import org.springframework.http.client.ClientHttpResponse; import org.springframework.util.MimeType; -import org.zalando.logbook.HttpHeaders; -import org.zalando.logbook.HttpResponse; -import org.zalando.logbook.Origin; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; import javax.annotation.Nullable; import java.io.IOException; diff --git a/logbook-spring/src/test/java/org/zalando/logbook/spring/LocalRequestTest.java b/logbook-spring/src/test/java/org/zalando/logbook/spring/LocalRequestTest.java index ef04368e7..a8334737c 100644 --- a/logbook-spring/src/test/java/org/zalando/logbook/spring/LocalRequestTest.java +++ b/logbook-spring/src/test/java/org/zalando/logbook/spring/LocalRequestTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.Test; import org.springframework.http.HttpMethod; import org.springframework.mock.http.client.MockClientHttpRequest; +import org.zalando.logbook.api.HttpRequest; import java.io.IOException; import java.net.URI; @@ -23,37 +24,37 @@ void setup() throws URISyntaxException { @Test void shouldResolveLocalhost() { - final org.zalando.logbook.HttpRequest unit = unit(get("http://localhost/")); + final HttpRequest unit = unit(get("http://localhost/")); assertThat(unit.getRemote()).isEqualTo("localhost"); } @Test void shouldIgnoreDefaultHttpPort() { - final org.zalando.logbook.HttpRequest unit = unit(get("http://localhost/")); + final HttpRequest unit = unit(get("http://localhost/")); assertThat(unit.getPort()).isEmpty(); } @Test void shouldIgnoreDefaultHttpsPort() { - final org.zalando.logbook.HttpRequest unit = unit(get("https://localhost/")); + final HttpRequest unit = unit(get("https://localhost/")); assertThat(unit.getPort()).isEmpty(); } @Test void canResolvePort() { - final org.zalando.logbook.HttpRequest unit = unit(get("https://localhost:8080/")); + final HttpRequest unit = unit(get("https://localhost:8080/")); assertThat(unit.getPort()).hasValue(8080); } @Test void noBody() throws IOException { - final org.zalando.logbook.HttpRequest unit = unit(get("https://localhost:8080/")); + final HttpRequest unit = unit(get("https://localhost:8080/")); assertThat(unit.withoutBody().getBody()).asString().isEqualTo(""); } @Test void handleDefaultCharset() { - final org.zalando.logbook.HttpRequest unit = unit(get("https://localhost:8080/")); + final HttpRequest unit = unit(get("https://localhost:8080/")); assertThat(unit.getCharset()).isEqualTo(StandardCharsets.UTF_8); } @@ -73,7 +74,7 @@ private MockClientHttpRequest get(String uri) { } } - private org.zalando.logbook.HttpRequest unit(MockClientHttpRequest request) { + private HttpRequest unit(MockClientHttpRequest request) { return new LocalRequest(request, body); } } diff --git a/logbook-spring/src/test/java/org/zalando/logbook/spring/LogbookClientHttpRequestInterceptorTest.java b/logbook-spring/src/test/java/org/zalando/logbook/spring/LogbookClientHttpRequestInterceptorTest.java index 8dd4f8d3e..a63b2d8bd 100644 --- a/logbook-spring/src/test/java/org/zalando/logbook/spring/LogbookClientHttpRequestInterceptorTest.java +++ b/logbook-spring/src/test/java/org/zalando/logbook/spring/LogbookClientHttpRequestInterceptorTest.java @@ -1,7 +1,6 @@ package org.zalando.logbook.spring; import com.github.tomakehurst.wiremock.WireMockServer; -import java.io.IOException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -10,16 +9,18 @@ import org.mockito.Captor; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; -import org.zalando.logbook.Correlation; -import org.zalando.logbook.DefaultHttpLogFormatter; -import org.zalando.logbook.DefaultSink; -import org.zalando.logbook.HttpLogWriter; -import org.zalando.logbook.Logbook; -import org.zalando.logbook.Precorrelation; import org.zalando.logbook.TestStrategy; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpLogWriter; +import org.zalando.logbook.api.Logbook; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.core.DefaultHttpLogFormatter; +import org.zalando.logbook.core.DefaultSink; + +import java.io.IOException; + import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; import static com.github.tomakehurst.wiremock.client.WireMock.get; diff --git a/logbook-spring/src/test/java/org/zalando/logbook/spring/RemoteResponseTest.java b/logbook-spring/src/test/java/org/zalando/logbook/spring/RemoteResponseTest.java index ac4617010..ce61a293d 100644 --- a/logbook-spring/src/test/java/org/zalando/logbook/spring/RemoteResponseTest.java +++ b/logbook-spring/src/test/java/org/zalando/logbook/spring/RemoteResponseTest.java @@ -4,6 +4,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpResponse; import org.springframework.mock.http.client.MockClientHttpResponse; +import org.zalando.logbook.api.HttpResponse; import java.io.IOException; @@ -35,7 +36,7 @@ private MockClientHttpResponse helloWorld() { return new MockClientHttpResponse("hello world".getBytes(), HttpStatus.OK); } - private org.zalando.logbook.HttpResponse unit(ClientHttpResponse response) { + private HttpResponse unit(ClientHttpResponse response) { return new RemoteResponse(response); } } diff --git a/logbook-test/src/main/java/org/zalando/logbook/MockHttpRequest.java b/logbook-test/src/main/java/org/zalando/logbook/MockHttpRequest.java index d295b4d05..0aaf8febb 100644 --- a/logbook-test/src/main/java/org/zalando/logbook/MockHttpRequest.java +++ b/logbook-test/src/main/java/org/zalando/logbook/MockHttpRequest.java @@ -6,6 +6,9 @@ import lombok.With; import lombok.experimental.FieldDefaults; import org.apiguardian.api.API; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.Origin; import java.nio.charset.Charset; import java.util.Optional; @@ -13,7 +16,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static lombok.AccessLevel.PRIVATE; import static org.apiguardian.api.API.Status.MAINTAINED; -import static org.zalando.logbook.Origin.REMOTE; +import static org.zalando.logbook.api.Origin.REMOTE; @API(status = MAINTAINED) @FieldDefaults(level = PRIVATE) diff --git a/logbook-test/src/main/java/org/zalando/logbook/MockHttpResponse.java b/logbook-test/src/main/java/org/zalando/logbook/MockHttpResponse.java index c2fdbed8e..b81bb2fc5 100644 --- a/logbook-test/src/main/java/org/zalando/logbook/MockHttpResponse.java +++ b/logbook-test/src/main/java/org/zalando/logbook/MockHttpResponse.java @@ -6,13 +6,16 @@ import lombok.With; import lombok.experimental.FieldDefaults; import org.apiguardian.api.API; +import org.zalando.logbook.api.HttpHeaders; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Origin; import java.nio.charset.Charset; import static java.nio.charset.StandardCharsets.UTF_8; import static lombok.AccessLevel.PRIVATE; import static org.apiguardian.api.API.Status.MAINTAINED; -import static org.zalando.logbook.Origin.LOCAL; +import static org.zalando.logbook.api.Origin.LOCAL; @API(status = MAINTAINED) @FieldDefaults(level = PRIVATE) diff --git a/logbook-test/src/main/java/org/zalando/logbook/TestStrategy.java b/logbook-test/src/main/java/org/zalando/logbook/TestStrategy.java index 300b18893..c77addd39 100644 --- a/logbook-test/src/main/java/org/zalando/logbook/TestStrategy.java +++ b/logbook-test/src/main/java/org/zalando/logbook/TestStrategy.java @@ -1,5 +1,12 @@ package org.zalando.logbook; +import org.zalando.logbook.api.Correlation; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; +import org.zalando.logbook.api.Precorrelation; +import org.zalando.logbook.api.Sink; +import org.zalando.logbook.api.Strategy; + import java.io.IOException; public final class TestStrategy implements Strategy { diff --git a/logbook-test/src/test/java/org/zalando/logbook/MockHttpMessageTester.java b/logbook-test/src/test/java/org/zalando/logbook/MockHttpMessageTester.java index 9aee9ca8d..34fe892f3 100644 --- a/logbook-test/src/test/java/org/zalando/logbook/MockHttpMessageTester.java +++ b/logbook-test/src/test/java/org/zalando/logbook/MockHttpMessageTester.java @@ -1,5 +1,8 @@ package org.zalando.logbook; +import org.zalando.logbook.api.HttpRequest; +import org.zalando.logbook.api.HttpResponse; + import java.io.IOException; import java.util.Optional; import java.util.function.BiFunction; @@ -7,8 +10,8 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; -import static org.zalando.logbook.Origin.LOCAL; -import static org.zalando.logbook.Origin.REMOTE; +import static org.zalando.logbook.api.Origin.LOCAL; +import static org.zalando.logbook.api.Origin.REMOTE; interface MockHttpMessageTester { diff --git a/logbook-test/src/test/java/org/zalando/logbook/MockHttpRequestTest.java b/logbook-test/src/test/java/org/zalando/logbook/MockHttpRequestTest.java index 35baffc09..e30032453 100644 --- a/logbook-test/src/test/java/org/zalando/logbook/MockHttpRequestTest.java +++ b/logbook-test/src/test/java/org/zalando/logbook/MockHttpRequestTest.java @@ -1,6 +1,7 @@ package org.zalando.logbook; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.HttpRequest; import java.io.IOException; import java.util.Optional; @@ -9,8 +10,8 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; import static org.zalando.fauxpas.FauxPas.throwingFunction; -import static org.zalando.logbook.HttpHeaders.of; -import static org.zalando.logbook.Origin.LOCAL; +import static org.zalando.logbook.api.HttpHeaders.of; +import static org.zalando.logbook.api.Origin.LOCAL; final class MockHttpRequestTest implements MockHttpMessageTester { diff --git a/logbook-test/src/test/java/org/zalando/logbook/MockHttpResponseTest.java b/logbook-test/src/test/java/org/zalando/logbook/MockHttpResponseTest.java index d125f0a09..cc2983972 100644 --- a/logbook-test/src/test/java/org/zalando/logbook/MockHttpResponseTest.java +++ b/logbook-test/src/test/java/org/zalando/logbook/MockHttpResponseTest.java @@ -1,6 +1,7 @@ package org.zalando.logbook; import org.junit.jupiter.api.Test; +import org.zalando.logbook.api.HttpResponse; import java.io.IOException; @@ -8,8 +9,8 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; import static org.zalando.fauxpas.FauxPas.throwingFunction; -import static org.zalando.logbook.HttpHeaders.of; -import static org.zalando.logbook.Origin.REMOTE; +import static org.zalando.logbook.api.HttpHeaders.of; +import static org.zalando.logbook.api.Origin.REMOTE; final class MockHttpResponseTest implements MockHttpMessageTester {