From 7d5a760de630871b9a41a24259ca34633ee31792 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Wed, 10 Jan 2024 13:09:24 +0100 Subject: [PATCH 01/13] Update to Vert.x 4.5.1 --- .../cache/storage/RedisCacheStorageTest.java | 8 +- .../core/http/AbstractHttpClient.java | 6 ++ .../core/http/DummyHttpServerRequest.java | 54 +++++++++++++ .../core/http/FastFailHttpServerRequest.java | 13 +-- .../core/http/FastFailHttpServerResponse.java | 13 +++ .../core/http/LocalHttpClientRequest.java | 80 ++++++++++++++++++- .../core/http/LocalHttpConnection.java | 10 +++ .../core/lock/impl/RedisBasedLockTest.java | 8 +- .../gateleen/hook/HookHandlerTest.java | 31 +++++++ ...tionStorageAddQueueMultipleQueuesTest.java | 7 +- ...onStorageRemoveExpiredQueuesEmptyTest.java | 7 +- .../RedisReducedPropagationStorageTest.java | 7 +- .../kafka/KafkaMessageSenderTest.java | 8 +- .../swisspush/gateleen/playground/Server.java | 12 ++- .../RedisQueueCircuitBreakerStorageTest.java | 27 +++++-- .../routing/DeferCloseHttpClient.java | 6 ++ .../org/swisspush/gateleen/AbstractTest.java | 7 +- .../mocks/HttpServerRequestMock.java | 16 ++++ .../mocks/HttpServerResponseMock.java | 16 ++++ pom.xml | 8 +- 20 files changed, 299 insertions(+), 45 deletions(-) diff --git a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java index 738717edb..14beb5e33 100644 --- a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java +++ b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java @@ -4,12 +4,15 @@ import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.json.JsonObject; +import io.vertx.core.net.NetClientOptions; +import io.vertx.core.tracing.TracingPolicy; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.Timeout; import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.redis.client.PoolOptions; import io.vertx.redis.client.RedisAPI; -import io.vertx.redis.client.RedisOptions; +import io.vertx.redis.client.RedisStandaloneConnectOptions; import io.vertx.redis.client.impl.RedisClient; import org.hamcrest.core.IsEqual; import org.junit.After; @@ -59,7 +62,8 @@ public void setUp() { Mockito.when(lock.acquireLock(anyString(), anyString(), anyLong())).thenReturn(Future.succeededFuture(Boolean.TRUE)); Mockito.when(lock.releaseLock(anyString(), anyString())).thenReturn(Future.succeededFuture(Boolean.TRUE)); - RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new NetClientOptions(), new PoolOptions(), + new RedisStandaloneConnectOptions(), TracingPolicy.IGNORE)); redisCacheStorage = new RedisCacheStorage(vertx, lock, () -> Future.succeededFuture(redisAPI), 2000); jedis = new Jedis(new HostAndPort("localhost", 6379)); diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/AbstractHttpClient.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/AbstractHttpClient.java index 27d312587..8999e59cc 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/AbstractHttpClient.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/AbstractHttpClient.java @@ -7,6 +7,7 @@ import io.vertx.core.Promise; import io.vertx.core.Vertx; import io.vertx.core.http.*; +import io.vertx.core.net.SSLOptions; import java.util.List; import java.util.function.Function; @@ -165,4 +166,9 @@ public Future webSocketAbs(String s, MultiMap multiMap, WebsocketVers public boolean isMetricsEnabled() { throw new UnsupportedOperationException(); } + + @Override + public Future updateSSLOptions(SSLOptions options, boolean force) { + throw new UnsupportedOperationException(); + } } diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/DummyHttpServerRequest.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/DummyHttpServerRequest.java index 5d266ad50..10ddd7371 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/DummyHttpServerRequest.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/DummyHttpServerRequest.java @@ -1,9 +1,19 @@ package org.swisspush.gateleen.core.http; +import io.netty.handler.codec.http.QueryStringDecoder; +import io.vertx.codegen.annotations.Nullable; +import io.vertx.core.MultiMap; import io.vertx.core.http.HttpServerRequest; +import io.vertx.core.http.impl.headers.HeadersMultiMap; +import io.vertx.core.net.HostAndPort; import javax.net.ssl.SSLPeerUnverifiedException; import javax.security.cert.X509Certificate; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; +import java.util.Objects; /** @@ -13,13 +23,57 @@ */ public class DummyHttpServerRequest implements FastFailHttpServerRequest { + private Charset paramsCharset = StandardCharsets.UTF_8; + private MultiMap params; + @Override public boolean isSSL() { return false; } + @Override + public @Nullable HostAndPort authority() { + return null; + } + @Override public String getHeader(String headerName) { return null; } + @Override + public HttpServerRequest setParamsCharset(String charset) { + Objects.requireNonNull(charset, "Charset must not be null"); + Charset current = paramsCharset; + paramsCharset = Charset.forName(charset); + if (!paramsCharset.equals(current)) { + params = null; + } + return this; + } + + @Override + public String getParamsCharset() { + return paramsCharset.name(); + } + + @Override + public MultiMap params() { + if (params == null) { + QueryStringDecoder queryStringDecoder = new QueryStringDecoder(uri(), paramsCharset); + Map> prms = queryStringDecoder.parameters(); + params = new HeadersMultiMap(); + if (!prms.isEmpty()) { + for (Map.Entry> entry : prms.entrySet()) { + params.add(entry.getKey(), entry.getValue()); + } + } + } + return params; + } + + @Override + public String getParam(String paramName) { + return params.get(paramName); + } + @Override public X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException { return new X509Certificate[0]; } diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerRequest.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerRequest.java index 7dd4dda13..278614af6 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerRequest.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerRequest.java @@ -27,7 +27,7 @@ * methods you need to mock. * */ -public interface FastFailHttpServerRequest extends HttpServerRequestInternal { +public interface FastFailHttpServerRequest extends HttpServerRequest { String msg = "Mock: Override this method to mock your expected behaviour."; @@ -228,15 +228,4 @@ default Set cookies(String name) { default Set cookies() { throw new UnsupportedOperationException( msg ); } - - - @Override - default Context context() { - throw new UnsupportedOperationException( msg ); - } - - @Override - default Object metric() { - throw new UnsupportedOperationException( msg ); - } } diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerResponse.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerResponse.java index 81886bd55..89d2a7b32 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerResponse.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerResponse.java @@ -10,6 +10,7 @@ import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.HttpServerResponse; +import io.vertx.core.net.HostAndPort; import java.util.Set; @@ -256,4 +257,16 @@ default Set removeCookies(String name, boolean invalidate) { default @Nullable Cookie removeCookie(String name, String domain, String path, boolean invalidate) { throw new UnsupportedOperationException(); } + + default Future writeEarlyHints(MultiMap headers) { + throw new UnsupportedOperationException(); + } + + default void writeEarlyHints(MultiMap headers, Handler> handler) { + throw new UnsupportedOperationException(); + } + + default Future push(HttpMethod method, HostAndPort authority, String path, MultiMap headers) { + throw new UnsupportedOperationException(); + } } diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java index c4963a4fb..099abac50 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java @@ -8,6 +8,7 @@ import io.vertx.core.http.impl.headers.HeadersMultiMap; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; +import io.vertx.core.net.HostAndPort; import io.vertx.core.net.NetSocket; import io.vertx.core.net.SocketAddress; import io.vertx.core.net.impl.SocketAddressImpl; @@ -17,9 +18,12 @@ import javax.net.ssl.SSLSession; import javax.security.cert.X509Certificate; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; +import java.util.function.Function; /** * Bridges a HttpClientRequest to a HttpServerRequest sent to a request handler. @@ -28,6 +32,7 @@ */ public class LocalHttpClientRequest extends BufferBridge implements FastFailHttpClientRequest { private MultiMap headers = new HeadersMultiMap(); + private Charset paramsCharset = StandardCharsets.UTF_8; private MultiMap params; private HttpMethod method; private String uri; @@ -77,10 +82,15 @@ public String query() { return query; } + @Override + public @Nullable HostAndPort authority() { + return null; + } + @Override public MultiMap params() { if (params == null) { - QueryStringDecoder queryStringDecoder = new QueryStringDecoder(uri()); + QueryStringDecoder queryStringDecoder = new QueryStringDecoder(uri(), paramsCharset); Map> prms = queryStringDecoder.parameters(); params = new HeadersMultiMap(); if (!prms.isEmpty()) { @@ -112,6 +122,22 @@ public String getHeader(CharSequence headerName) { return headers().get(headerName); } + @Override + public HttpServerRequest setParamsCharset(String charset) { + Objects.requireNonNull(charset, "Charset must not be null"); + Charset current = paramsCharset; + paramsCharset = Charset.forName(charset); + if (!paramsCharset.equals(current)) { + params = null; + } + return this; + } + + @Override + public String getParamsCharset() { + return paramsCharset.name(); + } + @Override public SocketAddress remoteAddress() { return address; @@ -352,7 +378,17 @@ public Buffer getBody() { } @Override - public Set fileUploads() { + public RequestBody body() { + throw new UnsupportedOperationException(); + } + + @Override + public List fileUploads() { + throw new UnsupportedOperationException(); + } + + @Override + public void cancelAndCleanupFileUploads() { throw new UnsupportedOperationException(); } @@ -588,11 +624,26 @@ public int getPort() { throw new UnsupportedOperationException(); } + @Override + public boolean isFollowRedirects() { + throw new UnsupportedOperationException(); + } + @Override public HttpClientRequest setMaxRedirects(int maxRedirects) { throw new UnsupportedOperationException(); } + @Override + public int getMaxRedirects() { + throw new UnsupportedOperationException(); + } + + @Override + public int numberOfRedirections() { + throw new UnsupportedOperationException(); + } + @Override public MultiMap headers() { return headers; @@ -626,6 +677,16 @@ public HttpClientRequest putHeader(CharSequence name, Iterable val return this; } + @Override + public HttpClientRequest traceOperation(String op) { + throw new UnsupportedOperationException(); + } + + @Override + public String traceOperation() { + throw new UnsupportedOperationException(); + } + @Override public HttpVersion version() { throw new UnsupportedOperationException(); @@ -703,6 +764,16 @@ public void write(String chunk, String enc, Handler> handler) throw new UnsupportedOperationException(); } + @Override + public HttpClientRequest earlyHintsHandler(@Nullable Handler handler) { + throw new UnsupportedOperationException(); + } + + @Override + public HttpClientRequest redirectHandler(@Nullable Function> handler) { + throw new UnsupportedOperationException(); + } + @Override public Future end(String chunk) { return write(chunk).onComplete(event -> end()); @@ -779,6 +850,11 @@ public HttpClientRequest drainHandler(Handler handler) { return this; } + @Override + public HttpClientRequest authority(HostAndPort authority) { + throw new UnsupportedOperationException(); + } + @Override public HttpClientRequest exceptionHandler(Handler handler) { setExceptionHandler(handler); diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java index 3f9aeeccb..15297f23e 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java @@ -107,11 +107,21 @@ public SocketAddress remoteAddress() { throw new UnsupportedOperationException("LocalConnection don't support this"); } + @Override + public SocketAddress remoteAddress(boolean real) { + throw new UnsupportedOperationException("LocalConnection don't support this"); + } + @Override public SocketAddress localAddress() { throw new UnsupportedOperationException("LocalConnection don't support this"); } + @Override + public SocketAddress localAddress(boolean real) { + throw new UnsupportedOperationException("LocalConnection don't support this"); + } + @Override public boolean isSsl() { return false; diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java index 6ccfff0a2..6ff78e046 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java @@ -3,12 +3,15 @@ import com.jayway.awaitility.Duration; import io.vertx.core.Future; import io.vertx.core.Vertx; +import io.vertx.core.net.NetClientOptions; +import io.vertx.core.tracing.TracingPolicy; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.Timeout; import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.redis.client.PoolOptions; import io.vertx.redis.client.RedisAPI; -import io.vertx.redis.client.RedisOptions; +import io.vertx.redis.client.RedisStandaloneConnectOptions; import io.vertx.redis.client.impl.RedisClient; import org.junit.After; import org.junit.Before; @@ -42,7 +45,8 @@ public class RedisBasedLockTest { @BeforeClass public static void setupLock(){ vertx = Vertx.vertx(); - RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new NetClientOptions(), new PoolOptions(), + new RedisStandaloneConnectOptions(), TracingPolicy.IGNORE)); redisBasedLock = new RedisBasedLock(() -> Future.succeededFuture(redisAPI)); } diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java index 30bcf706f..eb522b61d 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java @@ -7,6 +7,7 @@ import io.vertx.core.http.*; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; +import io.vertx.core.net.HostAndPort; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; import io.vertx.ext.web.RoutingContext; @@ -737,6 +738,16 @@ public void write(String chunk, Handler> handler) { } + @Override + public Future writeEarlyHints(MultiMap headers) { + return null; + } + + @Override + public void writeEarlyHints(MultiMap headers, Handler> handler) { + + } + @Override public Future end(String chunk) {/* ignore */ return Future.succeededFuture(); @@ -772,6 +783,11 @@ public Future sendFile(String filename, long offset, long length) { return null; } + @Override + public Future push(HttpMethod method, HostAndPort authority, String path, MultiMap headers) { + return null; + } + @Override public Future push(HttpMethod method, String host, String path, MultiMap headers) { return null; @@ -808,11 +824,26 @@ public String uri() { return uri; } + @Override + public @Nullable HostAndPort authority() { + return null; + } + @Override public MultiMap headers() { return requestHeaders; } + @Override + public HttpServerRequest setParamsCharset(String charset) { + return null; + } + + @Override + public String getParamsCharset() { + return null; + } + @Override public HttpServerRequest handler(Handler handler) { handler.handle(requestBody); diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageAddQueueMultipleQueuesTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageAddQueueMultipleQueuesTest.java index d370c727a..c744e2a8e 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageAddQueueMultipleQueuesTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageAddQueueMultipleQueuesTest.java @@ -2,12 +2,15 @@ import io.vertx.core.Future; import io.vertx.core.Vertx; +import io.vertx.core.net.NetClientOptions; +import io.vertx.core.tracing.TracingPolicy; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.Timeout; import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.redis.client.PoolOptions; import io.vertx.redis.client.RedisAPI; -import io.vertx.redis.client.RedisOptions; +import io.vertx.redis.client.RedisStandaloneConnectOptions; import io.vertx.redis.client.impl.RedisClient; import org.junit.Before; import org.junit.BeforeClass; @@ -47,7 +50,7 @@ public class RedisReducedPropagationStorageAddQueueMultipleQueuesTest { public static void setupStorage() { vertx = Vertx.vertx(); - RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new NetClientOptions(), new PoolOptions(), new RedisStandaloneConnectOptions(), TracingPolicy.IGNORE)); storage = new RedisReducedPropagationStorage(() -> Future.succeededFuture(redisAPI)); } diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageRemoveExpiredQueuesEmptyTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageRemoveExpiredQueuesEmptyTest.java index bca92a8c1..2274cfee9 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageRemoveExpiredQueuesEmptyTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageRemoveExpiredQueuesEmptyTest.java @@ -2,12 +2,15 @@ import io.vertx.core.Future; import io.vertx.core.Vertx; +import io.vertx.core.net.NetClientOptions; +import io.vertx.core.tracing.TracingPolicy; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.Timeout; import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.redis.client.PoolOptions; import io.vertx.redis.client.RedisAPI; -import io.vertx.redis.client.RedisOptions; +import io.vertx.redis.client.RedisStandaloneConnectOptions; import io.vertx.redis.client.impl.RedisClient; import org.junit.Before; import org.junit.BeforeClass; @@ -45,7 +48,7 @@ public class RedisReducedPropagationStorageRemoveExpiredQueuesEmptyTest { public static void setupStorage() { vertx = Vertx.vertx(); - RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new NetClientOptions(), new PoolOptions(), new RedisStandaloneConnectOptions(), TracingPolicy.IGNORE)); storage = new RedisReducedPropagationStorage(() -> Future.succeededFuture(redisAPI)); } diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageTest.java index 9379e4f45..a4c42c5df 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/impl/RedisReducedPropagationStorageTest.java @@ -3,12 +3,15 @@ import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; +import io.vertx.core.net.NetClientOptions; +import io.vertx.core.tracing.TracingPolicy; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.Timeout; import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.redis.client.PoolOptions; import io.vertx.redis.client.RedisAPI; -import io.vertx.redis.client.RedisOptions; +import io.vertx.redis.client.RedisStandaloneConnectOptions; import io.vertx.redis.client.impl.RedisClient; import org.junit.Before; import org.junit.BeforeClass; @@ -47,7 +50,7 @@ public class RedisReducedPropagationStorageTest { public static void setupStorage() { vertx = Vertx.vertx(); - RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new NetClientOptions(), new PoolOptions(), new RedisStandaloneConnectOptions(), TracingPolicy.IGNORE)); storage = new RedisReducedPropagationStorage(() -> Future.succeededFuture(redisAPI)); } diff --git a/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageSenderTest.java b/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageSenderTest.java index 357d914aa..a4d1f1302 100644 --- a/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageSenderTest.java +++ b/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageSenderTest.java @@ -49,7 +49,7 @@ public void sendSingleMessage(TestContext context) throws ValidationException { final List> records = buildRecords(topic, Buffer.buffer(buildSingleRecordPayload("someKey").encode())); - when(producer.send(any())).thenReturn(Future.succeededFuture(new RecordMetadata(1,1,1,1, topic))); + when(producer.send(any())).thenReturn(Future.succeededFuture(new RecordMetadata(1,1,1, topic))); kafkaMessageSender.sendMessages(producer, records).onComplete(event -> { context.assertTrue(event.succeeded()); @@ -66,7 +66,7 @@ public void sendSingleMessageWithoutKey(TestContext context) throws ValidationEx final List> records = buildRecords(topic, Buffer.buffer(buildSingleRecordPayload(null).encode())); - when(producer.send(any())).thenReturn(Future.succeededFuture(new RecordMetadata(1,1,1,1, topic))); + when(producer.send(any())).thenReturn(Future.succeededFuture(new RecordMetadata(1,1,1, topic))); kafkaMessageSender.sendMessages(producer, records).onComplete(event -> { context.assertTrue(event.succeeded()); @@ -83,7 +83,7 @@ public void sendMultipleMessages(TestContext context) throws ValidationException final List> records = buildRecords(topic, Buffer.buffer(buildThreeRecordsPayload("key_1", "key_2", "key_3").encode())); - when(producer.send(any())).thenReturn(Future.succeededFuture(new RecordMetadata(1,1,1,1, topic))); + when(producer.send(any())).thenReturn(Future.succeededFuture(new RecordMetadata(1,1,1, topic))); kafkaMessageSender.sendMessages(producer, records).onComplete(event -> { context.assertTrue(event.succeeded()); @@ -107,7 +107,7 @@ public void sendMultipleMessagesWithFailingMessage(TestContext context) throws V final List> records = buildRecords(topic, Buffer.buffer(buildThreeRecordsPayload("key_1", "key_2", "key_3").encode())); - when(producer.send(any())).thenReturn(Future.succeededFuture(new RecordMetadata(1,1,1,1, topic))); + when(producer.send(any())).thenReturn(Future.succeededFuture(new RecordMetadata(1,1,1, topic))); when(producer.send(eq(records.get(1)))).thenReturn(Future.failedFuture("Message with key '" + records.get(1).key() + "' failed.")); kafkaMessageSender.sendMessages(producer, records).onComplete(event -> { diff --git a/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java b/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java index 70dad222d..fef85f11e 100755 --- a/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java +++ b/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java @@ -9,9 +9,12 @@ import io.vertx.core.http.HttpServer; import io.vertx.core.http.HttpServerOptions; import io.vertx.core.json.JsonObject; +import io.vertx.core.net.NetClientOptions; +import io.vertx.core.tracing.TracingPolicy; import io.vertx.ext.web.RoutingContext; +import io.vertx.redis.client.PoolOptions; import io.vertx.redis.client.RedisAPI; -import io.vertx.redis.client.RedisOptions; +import io.vertx.redis.client.RedisStandaloneConnectOptions; import io.vertx.redis.client.impl.RedisClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,7 +67,10 @@ import org.swisspush.gateleen.queue.queuing.circuitbreaker.impl.QueueCircuitBreakerImpl; import org.swisspush.gateleen.queue.queuing.circuitbreaker.impl.RedisQueueCircuitBreakerStorage; import org.swisspush.gateleen.queue.queuing.circuitbreaker.util.QueueCircuitBreakerRulePatternToCircuitMapping; -import org.swisspush.gateleen.routing.*; +import org.swisspush.gateleen.routing.CustomHttpResponseHandler; +import org.swisspush.gateleen.routing.DeferCloseHttpClient; +import org.swisspush.gateleen.routing.Router; +import org.swisspush.gateleen.routing.RuleProvider; import org.swisspush.gateleen.routing.auth.DefaultOAuthProvider; import org.swisspush.gateleen.runconfig.RunConfig; import org.swisspush.gateleen.scheduler.SchedulerResourceManager; @@ -192,7 +198,7 @@ public void start() { RunConfig.deployModules(vertx, Server.class, props, success -> { if (success) { String protocol = redisEnableTls ? "rediss://" : "redis://"; - redisClient = new RedisClient(vertx, new RedisOptions().setConnectionString(protocol + redisHost + ":" + redisPort)); + redisClient = new RedisClient(vertx, new NetClientOptions(), new PoolOptions(), new RedisStandaloneConnectOptions().setConnectionString(protocol + redisHost + ":" + redisPort), TracingPolicy.IGNORE); redisApi = RedisAPI.api(redisClient); RedisProvider redisProvider = () -> Future.succeededFuture(redisApi); diff --git a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java index 8af60224e..6f12c2860 100644 --- a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java +++ b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/RedisQueueCircuitBreakerStorageTest.java @@ -4,12 +4,15 @@ import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; +import io.vertx.core.net.NetClientOptions; +import io.vertx.core.tracing.TracingPolicy; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.Timeout; import io.vertx.ext.unit.junit.VertxUnitRunner; +import io.vertx.redis.client.PoolOptions; import io.vertx.redis.client.RedisAPI; -import io.vertx.redis.client.RedisOptions; +import io.vertx.redis.client.RedisStandaloneConnectOptions; import io.vertx.redis.client.impl.RedisClient; import org.junit.Before; import org.junit.BeforeClass; @@ -46,7 +49,7 @@ public class RedisQueueCircuitBreakerStorageTest { @BeforeClass public static void setupStorage(){ vertx = Vertx.vertx(); - RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new RedisOptions())); + RedisAPI redisAPI = RedisAPI.api(new RedisClient(vertx, new NetClientOptions(), new PoolOptions(), new RedisStandaloneConnectOptions(), TracingPolicy.IGNORE)); storage = new RedisQueueCircuitBreakerStorage(() -> Future.succeededFuture(redisAPI)); } @@ -736,10 +739,14 @@ public void testUnlockSampleQueues(TestContext context){ // second lua script execution storage.unlockSampleQueues().onComplete(event1 -> { + context.assertTrue(event1.succeeded()); - context.assertTrue(event1.result().get(0).toString().contains("c1_2")); - context.assertTrue(event1.result().get(1).toString().contains("c2_2")); - context.assertTrue(event1.result().get(2).toString().contains("c3_2")); + context.assertEquals(3, event1.result().size()); + Set results1 = new HashSet<>(); + results1.add(event1.result().get(0).toString()); + results1.add(event1.result().get(1).toString()); + results1.add(event1.result().get(2).toString()); + context.assertTrue(results1.containsAll(Arrays.asList("c1_2", "c2_2", "c3_2"))); context.assertEquals(3L, jedis.scard(STORAGE_ALL_CIRCUITS)); context.assertEquals(3L, jedis.scard(STORAGE_HALFOPEN_CIRCUITS)); @@ -749,10 +756,14 @@ public void testUnlockSampleQueues(TestContext context){ // third lua script execution storage.unlockSampleQueues().onComplete(event2 -> { + context.assertTrue(event2.succeeded()); - context.assertTrue(event2.result().get(0).toString().contains("c1_3")); - context.assertTrue(event2.result().get(1).toString().contains("c2_1")); - context.assertTrue(event2.result().get(2).toString().contains("c3_3")); + context.assertEquals(3, event2.result().size()); + Set results2 = new HashSet<>(); + results2.add(event2.result().get(0).toString()); + results2.add(event2.result().get(1).toString()); + results2.add(event2.result().get(2).toString()); + context.assertTrue(results2.containsAll(Arrays.asList("c1_3", "c2_1", "c3_3"))); context.assertEquals(3L, jedis.scard(STORAGE_ALL_CIRCUITS)); context.assertEquals(3L, jedis.scard(STORAGE_HALFOPEN_CIRCUITS)); diff --git a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/DeferCloseHttpClient.java b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/DeferCloseHttpClient.java index ebe68be9e..9cd5a16ae 100644 --- a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/DeferCloseHttpClient.java +++ b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/DeferCloseHttpClient.java @@ -2,6 +2,7 @@ import io.vertx.core.*; import io.vertx.core.http.*; +import io.vertx.core.net.SSLOptions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -251,6 +252,11 @@ public Future webSocketAbs(String url, MultiMap headers, WebsocketVer return delegate.webSocketAbs(url, headers, version, subProtocols); } + @Override + public Future updateSSLOptions(SSLOptions options, boolean force) { + return delegate.updateSSLOptions(options, force); + } + @Override public HttpClient connectionHandler(Handler handler) { return delegate.connectionHandler(handler); diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java index 334549dff..c06a011f4 100755 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java @@ -9,12 +9,15 @@ import io.vertx.core.Vertx; import io.vertx.core.http.HttpServer; import io.vertx.core.json.JsonObject; +import io.vertx.core.net.NetClientOptions; +import io.vertx.core.tracing.TracingPolicy; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; import io.vertx.ext.web.RoutingContext; +import io.vertx.redis.client.PoolOptions; import io.vertx.redis.client.RedisAPI; -import io.vertx.redis.client.RedisOptions; +import io.vertx.redis.client.RedisStandaloneConnectOptions; import io.vertx.redis.client.impl.RedisClient; import org.junit.After; import org.junit.AfterClass; @@ -145,7 +148,7 @@ public static void setupBeforeClass(TestContext context) { RunConfig.deployModules(vertx, AbstractTest.class, props, success -> { if (success) { String protocol = redisEnableTls ? "rediss://" : "redis://"; - RedisClient redisClient = new RedisClient(vertx, new RedisOptions().setConnectionString(protocol + redisHost + ":" + redisPort)); + RedisClient redisClient = new RedisClient(vertx, new NetClientOptions(), new PoolOptions(), new RedisStandaloneConnectOptions().setConnectionString(protocol + redisHost + ":" + redisPort), TracingPolicy.IGNORE); RedisAPI redisAPI = RedisAPI.api(redisClient); RedisProvider redisProvider = () -> Future.succeededFuture(redisAPI); diff --git a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerRequestMock.java b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerRequestMock.java index b8b2142c7..6d1e86e24 100755 --- a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerRequestMock.java +++ b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerRequestMock.java @@ -5,6 +5,7 @@ import io.vertx.core.MultiMap; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.*; +import io.vertx.core.net.HostAndPort; import io.vertx.core.net.NetSocket; import io.vertx.core.net.SocketAddress; import org.swisspush.gateleen.core.http.FastFailHttpServerRequest; @@ -65,6 +66,11 @@ public String query() { throw new UnsupportedOperationException(); } + @Override + public @Nullable HostAndPort authority() { + throw new UnsupportedOperationException(); + } + @Override public @Nullable String host() { throw new UnsupportedOperationException(); @@ -90,6 +96,16 @@ public String getHeader(CharSequence headerName) { throw new UnsupportedOperationException(); } + @Override + public HttpServerRequest setParamsCharset(String charset) { + throw new UnsupportedOperationException(); + } + + @Override + public String getParamsCharset() { + throw new UnsupportedOperationException(); + } + @Override public MultiMap params() { return MultiMap.caseInsensitiveMultiMap(); diff --git a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerResponseMock.java b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerResponseMock.java index 1c1776b3b..4ec906945 100755 --- a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerResponseMock.java +++ b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerResponseMock.java @@ -11,6 +11,7 @@ import io.vertx.core.http.HttpFrame; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServerResponse; +import io.vertx.core.net.HostAndPort; import java.util.Set; @@ -140,6 +141,16 @@ public HttpServerResponse writeContinue() { throw new UnsupportedOperationException(); } + @Override + public Future writeEarlyHints(MultiMap headers) { + throw new UnsupportedOperationException(); + } + + @Override + public void writeEarlyHints(MultiMap headers, Handler> handler) { + throw new UnsupportedOperationException(); + } + @Override public Future end(String chunk) { return Future.succeededFuture(); @@ -260,6 +271,11 @@ public HttpServerResponse push(HttpMethod method, String host, String path, Mult throw new UnsupportedOperationException(); } + @Override + public Future push(HttpMethod method, HostAndPort authority, String path, MultiMap headers) { + throw new UnsupportedOperationException(); + } + @Override public Future push(HttpMethod method, String host, String path, MultiMap headers) { throw new UnsupportedOperationException(); diff --git a/pom.xml b/pom.xml index 96b4ef206..a3caa0344 100644 --- a/pom.xml +++ b/pom.xml @@ -51,8 +51,8 @@ localhost 7012 /usr/local/bin/chromedriver - 4.2.1 - 4.3.3 + 4.5.1 + 4.5.1 2.15.0 5.3.27 @@ -325,12 +325,12 @@ org.swisspush redisques - 3.0.29 + 3.1.0-SNAPSHOT org.swisspush rest-storage - 3.0.15 + 3.1.0-SNAPSHOT org.quartz-scheduler From ab8b7499849f265ec39b9342321e85dd870b4e9b Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Mon, 15 Jan 2024 15:23:29 +0100 Subject: [PATCH 02/13] Update to Vert.x 4.5.1 also update dependencies --- .../cache/storage/RedisCacheStorageTest.java | 2 +- .../core/http/DummyHttpServerRequest.java | 2 +- .../core/http/FastFailHttpServerRequest.java | 106 +++++++------ .../core/http/LocalHttpClientRequest.java | 24 +-- .../ConfigurationResourceManagerTest.java | 2 +- .../core/lock/impl/RedisBasedLockTest.java | 7 +- .../lock/lua/ReleaseLockLuaScriptTests.java | 6 +- .../gateleen/hook/HookHandlerTest.java | 10 ++ .../ReducedPropagationManagerTest.java | 30 ++-- .../gateleen/kafka/KafkaHandlerTest.java | 2 +- .../DefaultLogAppenderRepositoryTest.java | 4 +- .../monitoring/MonitoringHandlerTest.java | 6 +- gateleen-player/pom.xml | 6 +- .../gateleen/player/player/Client.java | 9 +- .../gateleen/player/CollectorTest.java | 6 +- .../swisspush/gateleen/playground/Server.java | 5 +- .../impl/QueueCircuitBreakerImplTest.java | 2 +- .../gateleen/runconfig/RunConfig.java | 4 + gateleen-test/pom.xml | 2 +- .../org/swisspush/gateleen/TestUtils.java | 6 +- .../core/resource/CopyResourceTest.java | 6 +- .../gateleen/core/storage/ExpirationTest.java | 4 +- .../gateleen/expansion/ExpandDeltaTest.java | 4 +- .../gateleen/expansion/ExpandZipTest.java | 6 +- .../gateleen/hook/HookPersistenceTest.java | 6 +- .../hook/HookQueueingStrategiesTest.java | 6 +- .../swisspush/gateleen/hook/ListenerTest.java | 13 +- .../swisspush/gateleen/hook/RouteTest.java | 24 +-- .../gateleen/hookjs/HookJsSteps.java | 10 +- .../swisspush/gateleen/queue/QueueTest.java | 4 +- .../queue/expiry/ResourceQueueExpiryTest.java | 13 +- .../routing/RequestHopValidationTest.java | 16 +- .../gateleen/routing/RuleUpdateTest.java | 17 ++- .../gateleen/scheduler/SchedulerTest.java | 2 +- .../gateleen/user/RoleProfileTest.java | 12 +- .../gateleen/user/UserProfileTest.java | 6 +- gateleen-testhelper/pom.xml | 2 +- .../mocks/HttpServerRequestMock.java | 12 +- pom.xml | 143 +++++++++++------- 39 files changed, 308 insertions(+), 239 deletions(-) diff --git a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java index 14beb5e33..25bdb8919 100644 --- a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java +++ b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java @@ -30,7 +30,7 @@ import java.util.Set; import java.util.concurrent.TimeUnit; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static java.util.concurrent.TimeUnit.SECONDS; import static org.hamcrest.CoreMatchers.equalTo; import static org.mockito.Matchers.anyLong; diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/DummyHttpServerRequest.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/DummyHttpServerRequest.java index 10ddd7371..0f1343aa4 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/DummyHttpServerRequest.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/DummyHttpServerRequest.java @@ -21,7 +21,7 @@ * * @author https://github.com/mcweba [Marc-Andre Weber] */ -public class DummyHttpServerRequest implements FastFailHttpServerRequest { +public class DummyHttpServerRequest extends FastFailHttpServerRequest { private Charset paramsCharset = StandardCharsets.UTF_8; private MultiMap params; diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerRequest.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerRequest.java index 278614af6..cb86b8ae9 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerRequest.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/FastFailHttpServerRequest.java @@ -27,205 +27,215 @@ * methods you need to mock. * */ -public interface FastFailHttpServerRequest extends HttpServerRequest { +public abstract class FastFailHttpServerRequest extends HttpServerRequestInternal { String msg = "Mock: Override this method to mock your expected behaviour."; - default HttpServerRequest exceptionHandler(Handler handler) { + public HttpServerRequest exceptionHandler(Handler handler) { throw new UnsupportedOperationException( msg ); } - default HttpServerRequest handler(Handler handler) { + public HttpServerRequest handler(Handler handler) { throw new UnsupportedOperationException( msg ); } - default HttpServerRequest pause() { + public HttpServerRequest pause() { throw new UnsupportedOperationException( msg ); } - default HttpServerRequest resume() { + public HttpServerRequest resume() { throw new UnsupportedOperationException( msg ); } - default HttpServerRequest fetch(long amount) { + public HttpServerRequest fetch(long amount) { throw new UnsupportedOperationException( msg ); } - default HttpServerRequest endHandler(Handler endHandler) { + public HttpServerRequest endHandler(Handler endHandler) { throw new UnsupportedOperationException( msg ); } - default HttpVersion version() { + public HttpVersion version() { throw new UnsupportedOperationException( msg ); } - default HttpMethod method() { + public HttpMethod method() { throw new UnsupportedOperationException( msg ); } - default String rawMethod() { + public String rawMethod() { throw new UnsupportedOperationException( msg ); } - default boolean isSSL() { + public boolean isSSL() { throw new UnsupportedOperationException( msg ); } - default @Nullable String scheme() { + public @Nullable String scheme() { throw new UnsupportedOperationException( msg ); } - default String uri() { + public String uri() { throw new UnsupportedOperationException( msg ); } - default @Nullable String path() { + public @Nullable String path() { throw new UnsupportedOperationException( msg ); } - default @Nullable String query() { + public @Nullable String query() { throw new UnsupportedOperationException( msg ); } - default @Nullable String host() { + public @Nullable String host() { throw new UnsupportedOperationException( msg ); } - default long bytesRead() { + public long bytesRead() { throw new UnsupportedOperationException( msg ); } - default HttpServerResponse response() { + public HttpServerResponse response() { throw new UnsupportedOperationException( msg ); } - default MultiMap headers() { + public MultiMap headers() { throw new UnsupportedOperationException( msg ); } - default @Nullable String getHeader(String headerName) { + public @Nullable String getHeader(String headerName) { throw new UnsupportedOperationException( msg ); } - default String getHeader(CharSequence headerName) { + public String getHeader(CharSequence headerName) { throw new UnsupportedOperationException( msg ); } - default MultiMap params() { + public MultiMap params() { throw new UnsupportedOperationException( msg ); } - default @Nullable String getParam(String paramName) { + public @Nullable String getParam(String paramName) { throw new UnsupportedOperationException( msg ); } - default SocketAddress remoteAddress() { + public SocketAddress remoteAddress() { throw new UnsupportedOperationException( msg ); } - default SocketAddress localAddress() { + public SocketAddress localAddress() { throw new UnsupportedOperationException( msg ); } - default SSLSession sslSession() { + public SSLSession sslSession() { throw new UnsupportedOperationException( msg ); } - default X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException { + public X509Certificate[] peerCertificateChain() throws SSLPeerUnverifiedException { throw new UnsupportedOperationException( msg ); } - default String absoluteURI() { + public String absoluteURI() { throw new UnsupportedOperationException( msg ); } - default NetSocket netSocket() { + public NetSocket netSocket() { throw new UnsupportedOperationException( msg ); } - default HttpServerRequest setExpectMultipart(boolean expect) { + public HttpServerRequest setExpectMultipart(boolean expect) { throw new UnsupportedOperationException( msg ); } - default boolean isExpectMultipart() { + public boolean isExpectMultipart() { throw new UnsupportedOperationException( msg ); } - default HttpServerRequest uploadHandler(@Nullable Handler uploadHandler) { + public HttpServerRequest uploadHandler(@Nullable Handler uploadHandler) { throw new UnsupportedOperationException( msg ); } - default MultiMap formAttributes() { + public MultiMap formAttributes() { throw new UnsupportedOperationException( msg ); } - default @Nullable String getFormAttribute(String attributeName) { + public @Nullable String getFormAttribute(String attributeName) { throw new UnsupportedOperationException( msg ); } - default ServerWebSocket upgrade() { + public ServerWebSocket upgrade() { throw new UnsupportedOperationException( msg ); } - default boolean isEnded() { + public boolean isEnded() { throw new UnsupportedOperationException( msg ); } - default HttpServerRequest customFrameHandler(Handler handler) { + public HttpServerRequest customFrameHandler(Handler handler) { throw new UnsupportedOperationException( msg ); } - default HttpConnection connection() { + public HttpConnection connection() { throw new UnsupportedOperationException( msg ); } - default HttpServerRequest streamPriorityHandler(Handler handler) { + public HttpServerRequest streamPriorityHandler(Handler handler) { throw new UnsupportedOperationException( msg ); } - default Future body() { + public Future body() { throw new UnsupportedOperationException( msg ); } - default Future end() { + public Future end() { throw new UnsupportedOperationException( msg ); } - default Future toNetSocket() { + public Future toNetSocket() { throw new UnsupportedOperationException( msg ); } - default Future toWebSocket() { + public Future toWebSocket() { throw new UnsupportedOperationException( msg ); } - default DecoderResult decoderResult() { + public DecoderResult decoderResult() { throw new UnsupportedOperationException( msg ); } - default @Nullable Cookie getCookie(String name) { + public @Nullable Cookie getCookie(String name) { throw new UnsupportedOperationException( msg ); } - default @Nullable Cookie getCookie(String name, String domain, String path) { + public @Nullable Cookie getCookie(String name, String domain, String path) { throw new UnsupportedOperationException( msg ); } - default Set cookies(String name) { + public Set cookies(String name) { throw new UnsupportedOperationException( msg ); } - default Set cookies() { + public Set cookies() { + throw new UnsupportedOperationException( msg ); + } + + @Override + public Context context() { + throw new UnsupportedOperationException( msg ); + } + + @Override + public Object metric() { throw new UnsupportedOperationException( msg ); } } diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java index 3ae803547..4bc9060ca 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpClientRequest.java @@ -2,21 +2,9 @@ import io.netty.handler.codec.http.QueryStringDecoder; import io.vertx.codegen.annotations.Nullable; -import io.vertx.core.AsyncResult; -import io.vertx.core.Future; -import io.vertx.core.Handler; -import io.vertx.core.MultiMap; -import io.vertx.core.Promise; -import io.vertx.core.Vertx; +import io.vertx.core.*; import io.vertx.core.buffer.Buffer; -import io.vertx.core.http.Cookie; -import io.vertx.core.http.HttpClientRequest; -import io.vertx.core.http.HttpClientResponse; -import io.vertx.core.http.HttpConnection; -import io.vertx.core.http.HttpMethod; -import io.vertx.core.http.HttpServerRequest; -import io.vertx.core.http.HttpServerResponse; -import io.vertx.core.http.HttpVersion; +import io.vertx.core.http.*; import io.vertx.core.http.impl.headers.HeadersMultiMap; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; @@ -25,12 +13,7 @@ import io.vertx.core.net.SocketAddress; import io.vertx.core.net.impl.SocketAddressImpl; import io.vertx.ext.auth.User; -import io.vertx.ext.web.FileUpload; -import io.vertx.ext.web.LanguageHeader; -import io.vertx.ext.web.ParsedHeaderValues; -import io.vertx.ext.web.Route; -import io.vertx.ext.web.RoutingContext; -import io.vertx.ext.web.Session; +import io.vertx.ext.web.*; import org.slf4j.Logger; import javax.net.ssl.SSLSession; @@ -40,7 +23,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.Set; import java.util.function.Function; import static org.slf4j.LoggerFactory.getLogger; diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java index 24af3c429..64f041e07 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java @@ -13,7 +13,7 @@ import org.swisspush.gateleen.core.http.DummyHttpServerResponse; import org.swisspush.gateleen.core.storage.MockResourceStorage; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static java.util.concurrent.TimeUnit.SECONDS; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.equalTo; diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java index 6ff78e046..d0f0e2a32 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/impl/RedisBasedLockTest.java @@ -1,6 +1,5 @@ package org.swisspush.gateleen.core.lock.impl; -import com.jayway.awaitility.Duration; import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.net.NetClientOptions; @@ -21,7 +20,9 @@ import redis.clients.jedis.Jedis; import redis.clients.jedis.exceptions.JedisConnectionException; -import static com.jayway.awaitility.Awaitility.await; +import java.time.Duration; + +import static org.awaitility.Awaitility.await; import static java.util.concurrent.TimeUnit.MILLISECONDS; /** @@ -249,6 +250,6 @@ public void testReleaseLockRespectingOwnership(TestContext context){ } private void waitMaxUntilExpired(String key, long expireMs){ - await().pollInterval(50, MILLISECONDS).atMost(new Duration(expireMs, MILLISECONDS)).until(() -> !jedis.exists(key)); + await().pollInterval(50, MILLISECONDS).atMost(Duration.ofMillis(expireMs)).until(() -> !jedis.exists(key)); } } diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockLuaScriptTests.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockLuaScriptTests.java index 153f35385..a00dab468 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockLuaScriptTests.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockLuaScriptTests.java @@ -1,6 +1,6 @@ package org.swisspush.gateleen.core.lock.lua; -import com.jayway.awaitility.Duration; +import java.time.Duration; import io.vertx.ext.unit.junit.VertxUnitRunner; import org.junit.Test; import org.junit.runner.RunWith; @@ -10,7 +10,7 @@ import java.util.Collections; import java.util.List; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; @@ -201,6 +201,6 @@ private Object evalScriptReleaseLock(String lock, String token){ } private void waitMaxUntilExpired(String key, long expireMs){ - await().pollInterval(50, MILLISECONDS).atMost(new Duration(expireMs, MILLISECONDS)).until(() -> !jedis.exists(key)); + await().pollInterval(50, MILLISECONDS).atMost(Duration.ofMillis(expireMs)).until(() -> !jedis.exists(key)); } } diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java index eb522b61d..2b415844d 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java @@ -814,6 +814,16 @@ public Set removeCookies(String name, boolean invalidate) { } }; return new FastFailHttpServerRequest() { + @Override + public Context context() { + return null; + } + + @Override + public Object metric() { + return null; + } + @Override public HttpMethod method() { return method; diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java index 3eda4e42c..8ed123d14 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java @@ -62,7 +62,7 @@ public void setUp() { public void testStartExpiredQueueProcessingInitiallyDisabled(TestContext context) { Mockito.when(reducedPropagationStorage.removeExpiredQueues(anyLong())) .thenReturn(Future.succeededFuture(MultiType.EMPTY_MULTI)); - verify(reducedPropagationStorage, timeout(1000).never()).removeExpiredQueues(anyLong()); + verify(reducedPropagationStorage, after(1000).never()).removeExpiredQueues(anyLong()); } @Test @@ -72,7 +72,7 @@ public void testStartExpiredQueueProcessing(TestContext context) { Mockito.when(reducedPropagationStorage.removeExpiredQueues(anyLong())) .thenReturn(Future.succeededFuture(MultiType.EMPTY_MULTI)); manager.startExpiredQueueProcessing(10); - verify(reducedPropagationStorage, timeout(110).atLeast(10)).removeExpiredQueues(anyLong()); + verify(reducedPropagationStorage, timeout(150).atLeast(10)).removeExpiredQueues(anyLong()); } @Test @@ -82,7 +82,7 @@ public void testExpiredQueueProcessingNotExecutedWhenLocked(TestContext context) Mockito.when(reducedPropagationStorage.removeExpiredQueues(anyLong())) .thenReturn(Future.succeededFuture(MultiType.EMPTY_MULTI)); manager.startExpiredQueueProcessing(10); - verify(reducedPropagationStorage, timeout(110).never()).removeExpiredQueues(anyLong()); + verify(reducedPropagationStorage, after(110).never()).removeExpiredQueues(anyLong()); } @Test @@ -126,7 +126,7 @@ public void testProcessIncomingRequestWithAddQueueStorageError(TestContext conte context.assertEquals(queue, queuesCaptor.getValue()); //verify queue request has not been stored to storage - verify(reducedPropagationStorage, timeout(1000).never()).storeQueueRequest(anyString(), any(JsonObject.class)); + verify(reducedPropagationStorage, after(1000).never()).storeQueueRequest(anyString(), any(JsonObject.class)); }); } @@ -275,7 +275,7 @@ public void testProcessIncomingRequestStartingExistingTimer(TestContext context) context.assertEquals(queue, queuesCaptor.getValue()); //verify queue request has not been stored to storage - verify(reducedPropagationStorage, timeout(1000).never()).storeQueueRequest(anyString(), any(JsonObject.class)); + verify(reducedPropagationStorage, after(1000).never()).storeQueueRequest(anyString(), any(JsonObject.class)); }); } @@ -311,7 +311,7 @@ public void testExpiredQueueProcessingGetQueueRequestFailure(TestContext context context.assertEquals("boom: getQueueRequest failed", event.result().body().getString(MESSAGE)); verify(reducedPropagationStorage, timeout(1000).times(1)).getQueueRequest(eq(expiredQueue)); - verify(reducedPropagationStorage, timeout(1000).never()).removeQueueRequest(anyString()); + verify(reducedPropagationStorage, after(1000).never()).removeQueueRequest(anyString()); verifyZeroInteractions(requestQueue); async.complete(); @@ -330,7 +330,7 @@ public void testExpiredQueueProcessingGetQueueRequestReturnsNull(TestContext con context.assertEquals("stored queue request for queue 'myExpiredQueue' is null", event.result().body().getString(MESSAGE)); verify(reducedPropagationStorage, timeout(1000).times(1)).getQueueRequest(eq(expiredQueue)); - verify(reducedPropagationStorage, timeout(1000).never()).removeQueueRequest(anyString()); + verify(reducedPropagationStorage, after(1000).never()).removeQueueRequest(anyString()); verifyZeroInteractions(requestQueue); async.complete(); @@ -354,9 +354,9 @@ public void testExpiredQueueProcessingDeleteAllQueueItemsOfManagerQueueFailure(T verify(reducedPropagationStorage, timeout(1000).times(1)).getQueueRequest(eq(expiredQueue)); verify(requestQueue, timeout(1000).times(1)).deleteAllQueueItems(eq(managerQueue), eq(false)); - verify(requestQueue, timeout(1000).never()).enqueueFuture(any(), any()); - verify(reducedPropagationStorage, timeout(1000).never()).removeQueueRequest(anyString()); - verify(requestQueue, timeout(1000).never()).deleteAllQueueItems(eq(expiredQueue), eq(true)); + verify(requestQueue, after(1000).never()).enqueueFuture(any(), any()); + verify(reducedPropagationStorage, after(1000).never()).removeQueueRequest(anyString()); + verify(requestQueue, after(1000).never()).deleteAllQueueItems(eq(expiredQueue), eq(true)); async.complete(); }); @@ -379,9 +379,9 @@ public void testExpiredQueueProcessingInvalidStoredQueueRequest(TestContext cont verify(reducedPropagationStorage, timeout(1000).times(1)).getQueueRequest(eq(expiredQueue)); verify(requestQueue, timeout(1000).times(1)).deleteAllQueueItems(eq(managerQueue), eq(false)); - verify(requestQueue, timeout(1000).never()).enqueueFuture(any(), any()); - verify(reducedPropagationStorage, timeout(1000).never()).removeQueueRequest(anyString()); - verify(requestQueue, timeout(1000).never()).deleteAllQueueItems(eq(expiredQueue), eq(true)); + verify(requestQueue, after(1000).never()).enqueueFuture(any(), any()); + verify(reducedPropagationStorage, after(1000).never()).removeQueueRequest(anyString()); + verify(requestQueue, after(1000).never()).deleteAllQueueItems(eq(expiredQueue), eq(true)); async.complete(); }); @@ -409,8 +409,8 @@ public void testExpiredQueueProcessingEnqueueIntoManagerQueueFailure(TestContext verify(requestQueue, timeout(1000).times(1)).deleteAllQueueItems(eq(managerQueue), eq(false)); verify(requestQueue, timeout(1000).times(1)).enqueueFuture(any(), eq(managerQueue)); - verify(reducedPropagationStorage, timeout(1000).never()).removeQueueRequest(anyString()); - verify(requestQueue, timeout(1000).never()).deleteAllQueueItems(eq(expiredQueue), eq(true)); + verify(reducedPropagationStorage, after(1000).never()).removeQueueRequest(anyString()); + verify(requestQueue, after(1000).never()).deleteAllQueueItems(eq(expiredQueue), eq(true)); async.complete(); }); diff --git a/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaHandlerTest.java b/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaHandlerTest.java index b90f945b1..502367176 100644 --- a/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaHandlerTest.java +++ b/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaHandlerTest.java @@ -28,7 +28,7 @@ import java.util.Map; import java.util.regex.Pattern; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static java.util.concurrent.TimeUnit.SECONDS; import static org.hamcrest.Matchers.equalTo; import static org.mockito.Matchers.eq; diff --git a/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/DefaultLogAppenderRepositoryTest.java b/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/DefaultLogAppenderRepositoryTest.java index a6c30c0e8..52605e0f7 100644 --- a/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/DefaultLogAppenderRepositoryTest.java +++ b/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/DefaultLogAppenderRepositoryTest.java @@ -9,8 +9,8 @@ import org.junit.Test; import org.junit.runner.RunWith; -import static com.jayway.awaitility.Awaitility.await; -import static com.jayway.awaitility.Duration.TWO_SECONDS; +import static org.awaitility.Awaitility.await; +import static org.awaitility.Durations.TWO_SECONDS; import static org.hamcrest.CoreMatchers.equalTo; import static org.swisspush.gateleen.logging.LoggingResourceManager.UPDATE_ADDRESS; diff --git a/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/MonitoringHandlerTest.java b/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/MonitoringHandlerTest.java index 3790f0e88..41f6483d5 100644 --- a/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/MonitoringHandlerTest.java +++ b/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/MonitoringHandlerTest.java @@ -1,6 +1,5 @@ package org.swisspush.gateleen.monitoring; -import com.jayway.awaitility.Duration; import io.vertx.core.Handler; import io.vertx.core.MultiMap; import io.vertx.core.Vertx; @@ -22,7 +21,8 @@ import java.util.Map; import java.util.concurrent.Callable; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; +import static org.awaitility.Durations.TWO_SECONDS; /** @@ -127,7 +127,7 @@ public void testWriteRequestPerRuleMonitoringToStorage(){ request.addHeader(PROPERTY_NAME, "my_value_123"); mh.updateRequestPerRuleMonitoring(request, "a_fancy_rule"); - await().atMost(Duration.TWO_SECONDS).until(storageContainsData("my_value_123.a_fancy_rule")); + await().atMost(TWO_SECONDS).until(storageContainsData("my_value_123.a_fancy_rule")); } private Callable storageContainsData(String valueToLookFor) { diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index 465edb93f..59fd10873 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -25,6 +25,10 @@ com.google.guava guava + + commons-io + commons-io + com.jayway.jsonpath json-path @@ -36,7 +40,7 @@ - com.jayway.awaitility + org.awaitility awaitility test diff --git a/gateleen-player/src/main/java/org/swisspush/gateleen/player/player/Client.java b/gateleen-player/src/main/java/org/swisspush/gateleen/player/player/Client.java index ff1e32034..753f802d3 100644 --- a/gateleen-player/src/main/java/org/swisspush/gateleen/player/player/Client.java +++ b/gateleen-player/src/main/java/org/swisspush/gateleen/player/player/Client.java @@ -1,6 +1,8 @@ package org.swisspush.gateleen.player.player; +import org.json.JSONException; import org.json.JSONObject; +import org.apache.commons.io.IOUtils; import org.slf4j.LoggerFactory; import org.springframework.http.*; import org.springframework.http.client.ClientHttpResponse; @@ -12,6 +14,7 @@ import org.springframework.web.client.RestTemplate; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -38,7 +41,11 @@ protected boolean supports(Class aClass) { @Override protected JSONObject readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { - return new JSONObject(inputMessage.getBody()); + try { + return new JSONObject(IOUtils.toString(inputMessage.getBody(), StandardCharsets.UTF_8)); + } catch (JSONException e) { + throw new IOException(e); + } } @Override diff --git a/gateleen-player/src/test/java/org/swisspush/gateleen/player/CollectorTest.java b/gateleen-player/src/test/java/org/swisspush/gateleen/player/CollectorTest.java index f5698e471..b77459b5b 100644 --- a/gateleen-player/src/test/java/org/swisspush/gateleen/player/CollectorTest.java +++ b/gateleen-player/src/test/java/org/swisspush/gateleen/player/CollectorTest.java @@ -1,7 +1,6 @@ package org.swisspush.gateleen.player; import com.google.common.collect.FluentIterable; -import com.jayway.awaitility.Duration; import org.junit.Ignore; import org.junit.Test; import org.swisspush.gateleen.player.exchange.Exchange; @@ -15,7 +14,8 @@ import java.util.Iterator; import static com.google.common.base.Predicates.equalTo; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; +import static org.awaitility.Durations.FIVE_SECONDS; import static org.swisspush.gateleen.player.exchange.Exchange.*; /** @@ -35,7 +35,7 @@ public void testEventBusCollector() throws Exception { setExchangeHandler(new ExchangeHandler(){ @Override public boolean after(final Exchange exchange, final FluentIterable tailOutputLog) { - await().atMost(Duration.FIVE_SECONDS).until(() -> !tailOutputLog.filter(request(header("x-request-id", + await().atMost(FIVE_SECONDS).until(() -> !tailOutputLog.filter(request(header("x-request-id", equalTo(exchange.getRequest().getHeaders().get("x-request-id").get(0))))).isEmpty()); return true; } diff --git a/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java b/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java index fef85f11e..6decb174b 100755 --- a/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java +++ b/gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java @@ -1,9 +1,6 @@ package org.swisspush.gateleen.playground; -import io.vertx.core.AbstractVerticle; -import io.vertx.core.Future; -import io.vertx.core.Handler; -import io.vertx.core.Vertx; +import io.vertx.core.*; import io.vertx.core.http.HttpClient; import io.vertx.core.http.HttpClientOptions; import io.vertx.core.http.HttpServer; diff --git a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java index f9b95b308..2e8ac2c62 100644 --- a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java +++ b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java @@ -122,7 +122,7 @@ public void testLockingForPeriodicTimersSuccess(TestContext context) { ArgumentCaptor lockArguments = ArgumentCaptor.forClass(String.class); Mockito.verify(lock, timeout(1100).times(3)).acquireLock(lockArguments.capture(), Matchers.anyString(), Matchers.anyLong()); - Mockito.verify(lock, timeout(1100).never()).releaseLock(Matchers.anyString(), Matchers.anyString()); + Mockito.verify(lock, after(1100).never()).releaseLock(Matchers.anyString(), Matchers.anyString()); List lockValues = lockArguments.getAllValues(); context.assertTrue(lockValues.contains(QueueCircuitBreakerImpl.OPEN_TO_HALF_OPEN_TASK_LOCK)); diff --git a/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java b/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java index c5e9c593d..97f4a5766 100755 --- a/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java +++ b/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java @@ -434,6 +434,8 @@ public static JsonObject buildRedisquesConfig() { .processorAddress(Address.queueProcessorAddress()) .httpRequestHandlerEnabled(true) .httpRequestHandlerPort(7015) + .redisReconnectAttempts(-1) + .redisPoolRecycleTimeoutMs(-1) .build() .asJsonObject(); } @@ -445,6 +447,8 @@ public static JsonObject buildStorageConfig() { return new ModuleConfiguration() .storageType(ModuleConfiguration.StorageType.redis) .storageAddress(Address.storageAddress() + "-main") + .redisReconnectAttempts(-1) + .redisPoolRecycleTimeoutMs(-1) .asJsonObject(); } diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index 35d04a63f..586950500 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -156,7 +156,7 @@ - com.jayway.awaitility + org.awaitility awaitility diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java b/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java index efc604d82..5e71c2d76 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java @@ -1,7 +1,6 @@ package org.swisspush.gateleen; import com.google.common.collect.ImmutableMap; -import com.jayway.awaitility.Duration; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import org.slf4j.Logger; @@ -15,8 +14,9 @@ import java.util.Set; import java.util.regex.Pattern; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; +import static org.awaitility.Durations.FIVE_SECONDS; import static org.hamcrest.CoreMatchers.equalTo; public class TestUtils { @@ -197,7 +197,7 @@ public static JsonObject createRoutingRule(ImmutableMap String.valueOf(when().get(request).getStatusCode()), equalTo(String.valueOf(statusCode))); } diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/core/resource/CopyResourceTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/core/resource/CopyResourceTest.java index 4b1e9ad6f..51625d02c 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/core/resource/CopyResourceTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/core/resource/CopyResourceTest.java @@ -2,7 +2,6 @@ import org.swisspush.gateleen.AbstractTest; import org.swisspush.gateleen.TestUtils; -import com.jayway.awaitility.Duration; import io.restassured.RestAssured; import io.vertx.core.json.JsonObject; import io.vertx.ext.unit.Async; @@ -11,11 +10,12 @@ import org.junit.Test; import org.junit.runner.RunWith; +import java.time.Duration; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; import static org.hamcrest.CoreMatchers.equalTo; @@ -200,6 +200,6 @@ public String createCopyTaskBody(String source, String destination, Map when().get(requestUrl).getStatusCode(), equalTo(statusCode)); + await().atMost(Duration.ofSeconds(2)).until(() -> when().get(requestUrl).getStatusCode(), equalTo(statusCode)); } } diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/core/storage/ExpirationTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/core/storage/ExpirationTest.java index e59cb5174..9c80d3304 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/core/storage/ExpirationTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/core/storage/ExpirationTest.java @@ -11,9 +11,9 @@ import java.util.concurrent.TimeUnit; -import static com.jayway.awaitility.Awaitility.await; -import static com.jayway.awaitility.Duration.FIVE_SECONDS; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; +import static org.awaitility.Durations.FIVE_SECONDS; import static org.hamcrest.CoreMatchers.equalTo; @RunWith(VertxUnitRunner.class) diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandDeltaTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandDeltaTest.java index 87ef0e56a..5cead4ca3 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandDeltaTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandDeltaTest.java @@ -19,9 +19,9 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import static com.jayway.awaitility.Awaitility.await; -import static com.jayway.awaitility.Duration.TEN_SECONDS; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; +import static org.awaitility.Durations.TEN_SECONDS; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.Matchers.greaterThan; import static org.junit.Assert.assertNotNull; diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandZipTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandZipTest.java index f71e21d75..68c38e850 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandZipTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandZipTest.java @@ -2,7 +2,6 @@ import org.swisspush.gateleen.AbstractTest; import org.swisspush.gateleen.TestUtils; -import com.jayway.awaitility.Duration; import io.restassured.response.Response; import io.vertx.core.buffer.Buffer; import io.vertx.core.json.JsonObject; @@ -16,8 +15,9 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; +import static org.awaitility.Durations.FIVE_SECONDS; import static org.hamcrest.CoreMatchers.*; /** @@ -215,6 +215,6 @@ private void init() { * @param statusCode */ private void checkGETStatusCodeWithAwait(final String request, final Integer statusCode) { - await().atMost(Duration.FIVE_SECONDS).until(() -> String.valueOf(when().get(request).getStatusCode()), equalTo(String.valueOf(statusCode))); + await().atMost(FIVE_SECONDS).until(() -> String.valueOf(when().get(request).getStatusCode()), equalTo(String.valueOf(statusCode))); } } diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookPersistenceTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookPersistenceTest.java index 133465266..f8ec12bb0 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookPersistenceTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookPersistenceTest.java @@ -2,7 +2,6 @@ import org.swisspush.gateleen.AbstractTest; import org.swisspush.gateleen.TestUtils; -import com.jayway.awaitility.Duration; import io.restassured.RestAssured; import io.vertx.core.json.JsonObject; import io.vertx.ext.unit.Async; @@ -11,8 +10,9 @@ import org.junit.Test; import org.junit.runner.RunWith; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; +import static org.awaitility.Durations.FIVE_SECONDS; import static org.hamcrest.CoreMatchers.equalTo; /** @@ -380,7 +380,7 @@ public void testHookCleanupRoutes(TestContext context) { * @param statusCode */ private void checkGETStatusCodeWithAwait(final String request, final Integer statusCode) { - await().atMost(Duration.FIVE_SECONDS).until(() -> { + await().atMost(FIVE_SECONDS).until(() -> { System.out.println(request); return String.valueOf(RestAssured.get(request).getStatusCode()); }, equalTo(String.valueOf(statusCode))); diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookQueueingStrategiesTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookQueueingStrategiesTest.java index 96f30def3..c09efccce 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookQueueingStrategiesTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/HookQueueingStrategiesTest.java @@ -1,12 +1,12 @@ package org.swisspush.gateleen.hook; import com.google.common.collect.ImmutableMap; -import com.jayway.awaitility.Awaitility; import io.restassured.RestAssured; import io.vertx.core.json.JsonObject; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; +import org.awaitility.Awaitility; import org.junit.Test; import org.junit.runner.RunWith; import org.swisspush.gateleen.AbstractTest; @@ -157,7 +157,7 @@ public void testReducedPropagationQueueingStrategy(TestContext context) { // after 5s an unlocked manager queue with a single queue item should exist and the original queue should be empty // and its lock should have been deleted - Awaitility.await().until(() -> when().get("pushnotification/queuing/queues/").then().assertThat().body("queues", hasItem(managerQueue))); + Awaitility.await().untilAsserted(() -> when().get("pushnotification/queuing/queues/").then().assertThat().body("queues", hasItem(managerQueue))); given().urlEncodingEnabled(true).when().get("pushnotification/queuing/queues/" + managerQueue) .then().assertThat() .body(managerQueue, hasSize(1)); @@ -192,7 +192,7 @@ public void testReducedPropagationQueueingStrategy(TestContext context) { // after another 5s the unlocked manager queue with a single queue item should still exist and the original queue should be empty // and its lock should have been deleted TestUtils.waitSomeTime(5); - Awaitility.await().until(() -> when().get("pushnotification/queuing/queues/").then().assertThat().body("queues", hasItem(managerQueue))); + Awaitility.await().untilAsserted(() -> when().get("pushnotification/queuing/queues/").then().assertThat().body("queues", hasItem(managerQueue))); given().urlEncodingEnabled(true).when().get("pushnotification/queuing/queues/" + managerQueue) .then().assertThat() .body(managerQueue, hasSize(1)); diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java index 89a234233..2ef58ec1b 100755 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/ListenerTest.java @@ -3,8 +3,7 @@ import com.github.tomakehurst.wiremock.client.WireMock; import com.github.tomakehurst.wiremock.junit.WireMockRule; import com.google.common.collect.ImmutableMap; -import com.jayway.awaitility.Awaitility; -import com.jayway.awaitility.Duration; +import org.awaitility.Awaitility; import io.restassured.RestAssured; import io.restassured.http.Header; import io.restassured.http.Headers; @@ -24,8 +23,10 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.stubbing.Scenario.STARTED; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; +import static org.awaitility.Durations.FIVE_SECONDS; +import static org.awaitility.Durations.TEN_SECONDS; import static org.hamcrest.CoreMatchers.*; @@ -649,7 +650,7 @@ public void testDeadLock(TestContext context) { delete(url); given().body(body).put(url); System.out.println(index); - Awaitility.given().ignoreExceptions().await().atMost(Duration.FIVE_SECONDS).until( + Awaitility.given().ignoreExceptions().await().atMost(FIVE_SECONDS).until( () -> RestAssured.get(target + "/atest").then().extract().jsonPath().getString("name"), is("test")); } @@ -926,7 +927,7 @@ private void checkPUTStatusCode(String requestUrl, String body, int statusCode, * @param statusCode */ private void checkGETStatusCodeWithAwait(final String request, final Integer statusCode) { - await().atMost(Duration.FIVE_SECONDS).until(() -> String.valueOf(when().get(request).getStatusCode()), equalTo(String.valueOf(statusCode))); + await().atMost(FIVE_SECONDS).until(() -> String.valueOf(when().get(request).getStatusCode()), equalTo(String.valueOf(statusCode))); } /** @@ -937,6 +938,6 @@ private void checkGETStatusCodeWithAwait(final String request, final Integer sta * @param body */ private void checkGETBodyWithAwait(final String requestUrl, final String body) { - await().atMost(Duration.TEN_SECONDS).until(() -> when().get(requestUrl).then().extract().body().asString(), equalTo(body)); + await().atMost(TEN_SECONDS).until(() -> when().get(requestUrl).then().extract().body().asString(), equalTo(body)); } } diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteTest.java index 85bbf6aa8..14db93c52 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/hook/RouteTest.java @@ -1,8 +1,7 @@ package org.swisspush.gateleen.hook; import com.google.common.collect.ImmutableMap; -import com.jayway.awaitility.Awaitility; -import com.jayway.awaitility.Duration; +import org.awaitility.Awaitility; import io.restassured.RestAssured; import io.restassured.http.Header; import io.restassured.http.Headers; @@ -20,6 +19,8 @@ import java.util.regex.Pattern; import static io.restassured.RestAssured.*; +import static org.awaitility.Durations.TEN_SECONDS; +import static org.awaitility.Durations.TWO_SECONDS; import static org.hamcrest.CoreMatchers.containsString; /** @@ -108,8 +109,7 @@ public void testRouteWithStaticHeaders(TestContext context) { TestUtils.registerRoute(requestUrl, target, methods, staticHeaders); // - - Awaitility.given().await().atMost(Duration.TWO_SECONDS).until(() -> + Awaitility.given().await().atMost(TWO_SECONDS).untilAsserted(() -> when().get(routedResource).then().assertThat() .statusCode(200) .body(containsString("x-test1")) @@ -148,7 +148,7 @@ public void testRouteWithMatchingHeadersFilter(TestContext context) { String body2 = "{ \"name\" : \"routePathTest\"}"; given().headers(Headers.headers(new Header("x-foo", "A"))).body(body2).put(routedResource).then().assertThat().statusCode(200); - Awaitility.given().await().atMost(Duration.TEN_SECONDS).until(() -> { + Awaitility.given().await().atMost(TEN_SECONDS).untilAsserted(() -> { given().headers(Headers.headers(new Header("x-foo", "A"))).when().get(routedResource).then().assertThat().body(containsString(body2)); when().get(checkTarget).then().assertThat().body(containsString(body2)); }); @@ -183,7 +183,7 @@ public void testRouteWithValidPath(TestContext context) { String body2 = "{ \"name\" : \"routePathTest\"}"; given().body(body2).put(routedResource).then().assertThat().statusCode(200); - Awaitility.given().await().atMost(Duration.TWO_SECONDS).until(() -> { + Awaitility.given().await().atMost(TWO_SECONDS).untilAsserted(() -> { when().get(routedResource).then().assertThat().body(containsString(body2)); when().get(checkTarget).then().assertThat().body(containsString(body2)); }); @@ -224,7 +224,7 @@ public void testRoute(TestContext context) { */ String body1 = "{ \"name\" : \"routeTest 1\"}"; given().body(body1).put(routedResource).then().assertThat().statusCode(200); - Awaitility.given().await().atMost(Duration.TWO_SECONDS).until(() -> { + Awaitility.given().await().atMost(TWO_SECONDS).untilAsserted(() -> { when().get(routedResource).then().assertThat().body(containsString(body1)); when().get(checkTarget).then().assertThat().statusCode(404); }); @@ -246,7 +246,7 @@ public void testRoute(TestContext context) { */ String body2 = "{ \"name\" : \"routeTest 2\"}"; given().body(body2).put(routedResource).then().assertThat().statusCode(200); - Awaitility.given().await().atMost(Duration.TWO_SECONDS).until(() -> { + Awaitility.given().await().atMost(TWO_SECONDS).untilAsserted(() -> { when().get(routedResource).then().assertThat().body(containsString(body2)); when().get(checkTarget).then().assertThat().body(containsString(body2)); }); @@ -258,7 +258,7 @@ public void testRoute(TestContext context) { * ------- */ delete(routedResource).then().assertThat().statusCode(200); - Awaitility.given().await().atMost(Duration.TWO_SECONDS).until(() -> { + Awaitility.given().await().atMost(TWO_SECONDS).untilAsserted(() -> { when().get(routedResource).then().assertThat().statusCode(404); when().get(checkTarget).then().assertThat().statusCode(404); }); @@ -279,7 +279,7 @@ public void testRoute(TestContext context) { */ String body3 = "{ \"name\" : \"routeTest 3\"}"; given().body(body3).put(routedResource).then().assertThat().statusCode(200); - Awaitility.given().await().atMost(Duration.TWO_SECONDS).until(() -> { + Awaitility.given().await().atMost(TWO_SECONDS).untilAsserted(() -> { when().get(routedResource).then().assertThat().body(containsString(body3)); when().get(checkTarget).then().assertThat().statusCode(404); delete(routedResource); @@ -316,7 +316,7 @@ public void testRouteWithTranslateStatus(TestContext context) { TestUtils.registerRoute(requestUrl, target, methods); // since no translateStatus was defined, the resource should not be found and return a 404 - Awaitility.given().await().atMost(Duration.TWO_SECONDS).until(() -> + Awaitility.given().await().atMost(TWO_SECONDS).untilAsserted(() -> when().get(routedResource).then().assertThat() .statusCode(404) ); @@ -327,7 +327,7 @@ public void testRouteWithTranslateStatus(TestContext context) { TestUtils.registerRoute(requestUrl, target, methods, null, true, false, translateStatus); // with translateStatus defined, the response status code should have changed from 404 to 405 - Awaitility.given().await().atMost(Duration.TWO_SECONDS).until(() -> + Awaitility.given().await().atMost(TWO_SECONDS).untilAsserted(() -> when().get(routedResource).then().assertThat() .statusCode(405) ); diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/hookjs/HookJsSteps.java b/gateleen-test/src/test/java/org/swisspush/gateleen/hookjs/HookJsSteps.java index e7682c273..4f655fec2 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/hookjs/HookJsSteps.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/hookjs/HookJsSteps.java @@ -8,7 +8,6 @@ package org.swisspush.gateleen.hookjs; -import com.jayway.awaitility.Duration; import io.restassured.RestAssured; import io.restassured.http.ContentType; import cucumber.api.java.After; @@ -22,7 +21,8 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; -import static com.jayway.awaitility.Awaitility.given; +import static org.awaitility.Awaitility.given; +import static org.awaitility.Durations.TWO_SECONDS; import static org.hamcrest.core.IsEqual.equalTo; public class HookJsSteps { @@ -45,7 +45,7 @@ public void chromeHasBeenStarted() throws Throwable { @And("^the hook-js UI is displayed$") public void theHookJsUIIsDisplayed() throws Throwable { webDriver.get(PLAYGROUND_URL + "/hooktest.html"); - given().await().atMost(Duration.TWO_SECONDS).until(() -> + given().await().atMost(TWO_SECONDS).until(() -> webDriver.findElement(By.xpath("/html/body/div/div/div/div[1]")).getText(), equalTo("Hook JS Demo") ); @@ -59,7 +59,7 @@ public void weClickOnTheButton(String buttonId) throws Throwable { @Then("^we see the message \"([^\"]*)\" at position (\\d+)$") public void weSeeTheMessageAtPosition(String message, int indexOfMessage) throws Throwable { - given().await().atMost(Duration.TWO_SECONDS).until(() -> + given().await().atMost(TWO_SECONDS).until(() -> webDriver.findElement(By.xpath("//*[@id=\"hookjs messages\"]/li[" + indexOfMessage + "]")).getText(), equalTo(message)); @@ -67,7 +67,7 @@ public void weSeeTheMessageAtPosition(String message, int indexOfMessage) throws @Then("^we see no message at position (\\d+)$") public void weSeeNoMessageAtPosition(int indexOfMessage) throws Throwable { - given().await().atMost(Duration.TWO_SECONDS).until(() -> + given().await().atMost(TWO_SECONDS).until(() -> webDriver.findElements(By.xpath("//*[@id=\"hookjs messages\"]/li[" + indexOfMessage + "]")).size(), equalTo(0)); } diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/queue/QueueTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/queue/QueueTest.java index a5b0278de..de9f8007d 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/queue/QueueTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/queue/QueueTest.java @@ -12,11 +12,11 @@ import java.util.Set; -import static com.jayway.awaitility.Awaitility.await; -import static com.jayway.awaitility.Duration.*; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; +import static org.awaitility.Durations.*; import static org.hamcrest.CoreMatchers.*; @RunWith(VertxUnitRunner.class) diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/queue/expiry/ResourceQueueExpiryTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/queue/expiry/ResourceQueueExpiryTest.java index 87ac60615..06f3c173f 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/queue/expiry/ResourceQueueExpiryTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/queue/expiry/ResourceQueueExpiryTest.java @@ -1,6 +1,5 @@ package org.swisspush.gateleen.queue.expiry; -import com.jayway.awaitility.Duration; import io.restassured.RestAssured; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; @@ -13,9 +12,9 @@ import java.util.HashMap; import java.util.Map; -import static com.jayway.awaitility.Awaitility.await; -import static com.jayway.awaitility.Duration.TEN_SECONDS; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; +import static org.awaitility.Durations.*; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.hasItem; @@ -45,7 +44,7 @@ public void initRestAssured() { * @param body */ private void checkGETBodyWithAwait(final String requestUrl, final String body) { - await().atMost(Duration.FIVE_SECONDS).until(() -> when().get(requestUrl).then().extract().body().asString(), equalTo(body)); + await().atMost(FIVE_SECONDS).until(() -> when().get(requestUrl).then().extract().body().asString(), equalTo(body)); } /** @@ -127,7 +126,7 @@ public void testQueueExpiry(TestContext context) { // ---- // wait 2 seconds - await().timeout(Duration.TWO_SECONDS); + await().timeout(TWO_SECONDS); // check if the two items are in the queue when().get("queuing/queues/").then().assertThat().body("queues", hasItem("gateleen-queue-expiry-test-discard")); @@ -188,7 +187,7 @@ public void testQueueExpiryOverride_requestIsExpired_beforeRegularExpiryTime(Tes given().headers(headers).body(discardedBody).when().put(discardedRequestUrl); // wait 2 seconds - await().timeout(Duration.TWO_SECONDS); + await().timeout(TWO_SECONDS); // check if item is still in queue - yes when().get("queuing/queues/").then().assertThat().body("queues", hasItem(name)); @@ -236,7 +235,7 @@ public void testQueueExpiryOverride_requestIsNotExpired_regularResourceExpiry(Te given().headers(headers).body(discardedBody).when().put(discardedRequestUrl); // wait 2 seconds - await().timeout(Duration.TWO_SECONDS); + await().timeout(TWO_SECONDS); // check if item is still in queue - yes when().get("queuing/queues/").then().assertThat().body("queues", hasItem(name)); diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/routing/RequestHopValidationTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/routing/RequestHopValidationTest.java index 967e42935..daef24e78 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/routing/RequestHopValidationTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/routing/RequestHopValidationTest.java @@ -1,8 +1,7 @@ package org.swisspush.gateleen.routing; import com.google.common.collect.ImmutableMap; -import com.jayway.awaitility.Awaitility; -import com.jayway.awaitility.Duration; +import org.awaitility.Awaitility; import io.restassured.RestAssured; import io.vertx.core.json.JsonObject; import io.vertx.ext.unit.Async; @@ -14,6 +13,7 @@ import org.swisspush.gateleen.TestUtils; import static io.restassured.RestAssured.*; +import static org.awaitility.Durations.ONE_SECOND; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.core.IsEqual.equalTo; import static org.swisspush.gateleen.core.util.HttpRequestHeader.X_HOPS; @@ -81,19 +81,19 @@ public void testRequestHopValidationLimitExceeded(TestContext context) { when().get("/loop/4/resource").then().assertThat().statusCode(200); // get the test data via looping rules - Awaitility.given().await().atMost(Duration.ONE_SECOND).until(() -> + Awaitility.given().await().atMost(ONE_SECOND).untilAsserted(() -> when().get("/loop/1/resource").then().assertThat() .statusCode(500) .statusLine(containsString("Request hops limit exceeded")) .body(containsString(buildLimitExceededMessage(2))) ); - Awaitility.given().await().atMost(Duration.ONE_SECOND).until(() -> + Awaitility.given().await().atMost(ONE_SECOND).untilAsserted(() -> when().get("/loop/2/resource").then().assertThat() .statusCode(500) .statusLine(containsString("Request hops limit exceeded")) .body(containsString(buildLimitExceededMessage(2))) ); - Awaitility.given().await().atMost(Duration.ONE_SECOND).until(() -> + Awaitility.given().await().atMost(ONE_SECOND).untilAsserted(() -> when().get("/loop/3/resource").then().assertThat() .statusCode(200) .body(not(containsString(buildLimitExceededMessage(2)))) @@ -206,14 +206,14 @@ public void testRequestHopValidationWithLimitZero(TestContext context) { with().body("{\"request.hops.limit\":0}").put(ROUTING_CONFIG).then().assertThat().statusCode(200); // prepare test data - Awaitility.given().await().atMost(Duration.ONE_SECOND).until(() -> + Awaitility.given().await().atMost(ONE_SECOND).untilAsserted(() -> with().body("{\"someKey\":"+System.currentTimeMillis()+"}").put("/loop/4/resource").then().assertThat() .statusCode(500) .statusLine(containsString("Request hops limit exceeded")) .body(containsString(buildLimitExceededMessage(0))) ); - Awaitility.given().await().atMost(Duration.ONE_SECOND).until(() -> + Awaitility.given().await().atMost(ONE_SECOND).untilAsserted(() -> when().get("/loop/4/resource").then().assertThat() .statusCode(500) .statusLine(containsString("Request hops limit exceeded")) @@ -241,7 +241,7 @@ public void testRequestHopValidationManualHeaderValue(TestContext context) { TestUtils.putRoutingRules(rules); // configure request hops limit to 10 - Awaitility.given().await().atMost(Duration.ONE_SECOND).until(() -> + Awaitility.given().await().atMost(ONE_SECOND).untilAsserted(() -> with().body("{\"request.hops.limit\":10}").put(ROUTING_CONFIG).then().assertThat().statusCode(200) ); validateRoutingConfig(true, 10); diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/routing/RuleUpdateTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/routing/RuleUpdateTest.java index f87673fce..881f72464 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/routing/RuleUpdateTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/routing/RuleUpdateTest.java @@ -7,7 +7,11 @@ import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpServer; import io.vertx.core.http.HttpServerResponse; +import io.vertx.ext.unit.Async; +import io.vertx.ext.unit.TestContext; +import io.vertx.ext.unit.junit.VertxUnitRunner; import org.junit.*; +import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,6 +27,7 @@ import static java.nio.charset.StandardCharsets.ISO_8859_1; import static java.nio.charset.StandardCharsets.UTF_8; +@RunWith(VertxUnitRunner.class) public class RuleUpdateTest { private static final Logger logger = LoggerFactory.getLogger(RuleUpdateTest.class); @@ -56,7 +61,8 @@ public RuleUpdateTest() { } @BeforeClass - public static void mockServerIsRunning() throws IOException, InterruptedException { + public static void mockServerIsRunning(TestContext context) throws IOException, InterruptedException { + Async async = context.async(); RestAssured.port = port; RestAssured.registerParser("application/json; charset=utf-8", Parser.JSON); RestAssured.defaultParser = Parser.JSON; @@ -78,12 +84,19 @@ public static void mockServerIsRunning() throws IOException, InterruptedExceptio writeDataToResponse(rsp, largeResource, buf, vBuf); // write first part of data, and this will trigger the drainHandler rsp.drainHandler(event -> writeDataToResponse(rsp, largeResource, buf, vBuf)); }); - httpServer.listen(upstreamPort, upstreamHost); + httpServer.listen(upstreamPort, upstreamHost, event -> { + if (event.succeeded()) { + async.complete(); + } else { + context.fail("Server not listening on port " + upstreamPort); + } + }); logger.info("Mock httpServer.listen( {}, \"{}\")", upstreamPort, upstreamHost); // Then register that server as a static route. putCustomUpstreamRoute(); // Give it some time to properly initialize. Thread.sleep(42); + async.awaitSuccess(); } private static boolean writeDataToResponse(HttpServerResponse rsp, InputStream largeResource, byte[] buf, Buffer vBuf) { diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/scheduler/SchedulerTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/scheduler/SchedulerTest.java index 5d491b1db..6ebd3dbce 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/scheduler/SchedulerTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/scheduler/SchedulerTest.java @@ -12,7 +12,7 @@ import java.util.Calendar; import java.util.Date; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; import static java.util.concurrent.TimeUnit.SECONDS; import static org.hamcrest.Matchers.*; diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/user/RoleProfileTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/user/RoleProfileTest.java index 159ce462e..8e45c5298 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/user/RoleProfileTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/user/RoleProfileTest.java @@ -2,7 +2,6 @@ import org.swisspush.gateleen.AbstractTest; import org.swisspush.gateleen.TestUtils; -import com.jayway.awaitility.Duration; import io.restassured.RestAssured; import io.restassured.response.Response; import io.vertx.ext.unit.Async; @@ -11,10 +10,11 @@ import org.junit.Test; import org.junit.runner.RunWith; -import java.util.concurrent.TimeUnit; +import java.time.Duration; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; +import static org.awaitility.Durations.FIVE_SECONDS; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; @@ -90,7 +90,7 @@ public void testUpdateRoleProfileGetUserWithTheSameRole(TestContext context) thr // we have to wait here, cause the role profile needs to be published over the vert.x bus RestAssured.requestSpecification.basePath("/server/users/v1"); - await().atMost(new Duration(8, TimeUnit.SECONDS)).until(() -> given().header("x-rp-grp", "z-gateleen-known-role,z-gateleen-admin").when().get("known-user/profile").then().extract().body().jsonPath().getString("foo"), equalTo(roleProfilePropertyValue)); + await().atMost(Duration.ofSeconds(8)).until(() -> given().header("x-rp-grp", "z-gateleen-known-role,z-gateleen-admin").when().get("known-user/profile").then().extract().body().jsonPath().getString("foo"), equalTo(roleProfilePropertyValue)); async.complete(); } @@ -106,7 +106,7 @@ public void testUpdateRoleProfileGetUserWithAnotherRole(TestContext context) thr // we have to wait here, cause the role profile needs to be published over the vert.x bus RestAssured.requestSpecification.basePath("/server/users/v1"); - await().atMost(new Duration(5, TimeUnit.SECONDS)).until(() -> given().header("x-rp-grp", "z-gateleen-admin").when().get("known-user/profile").then().extract().body().jsonPath().getString("foo"), nullValue()); + await().atMost(FIVE_SECONDS).until(() -> given().header("x-rp-grp", "z-gateleen-admin").when().get("known-user/profile").then().extract().body().jsonPath().getString("foo"), nullValue()); async.complete(); } @@ -157,7 +157,7 @@ public void testAddRoleProfileGetUserProfileAndPutItThenDeleteRoleProfileAndGetT // we have to wait here, cause the role profile needs to be published over the vert.x bus System.out.println("get the known-user profile, after deletion of known-role profile"); RestAssured.requestSpecification.basePath("/server/users/v1"); - await().atMost(new Duration(5, TimeUnit.SECONDS)).until(() -> given().header("x-rp-grp", "z-gateleen-known-role,z-gateleen-admin").when().get("known-user/profile").then().extract().body().jsonPath().getString("foo"), nullValue()); + await().atMost(FIVE_SECONDS).until(() -> given().header("x-rp-grp", "z-gateleen-known-role,z-gateleen-admin").when().get("known-user/profile").then().extract().body().jsonPath().getString("foo"), nullValue()); async.complete(); } diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/user/UserProfileTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/user/UserProfileTest.java index a739bc34b..6fb577b3e 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/user/UserProfileTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/user/UserProfileTest.java @@ -1,7 +1,6 @@ package org.swisspush.gateleen.user; import org.swisspush.gateleen.AbstractTest; -import com.jayway.awaitility.Duration; import io.restassured.RestAssured; import io.restassured.response.Response; import io.vertx.core.json.JsonObject; @@ -13,8 +12,9 @@ import java.util.concurrent.TimeUnit; -import static com.jayway.awaitility.Awaitility.await; +import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; +import static org.awaitility.Durations.FIVE_SECONDS; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; @@ -118,7 +118,7 @@ public void testAddAllAllowedAttributesAndOneNotAllowedAttribute(TestContext con // we have to wait here, cause the role profile needs to be published over the vert.x bus System.out.println("get the known-user profile, after deletion of known-role profile"); RestAssured.requestSpecification.basePath("/server/users/v1"); - await().atMost(new Duration(5, TimeUnit.SECONDS)).until(() -> given().header("x-rp-grp", "z-gateleen-known-role,z-gateleen-admin").when().get("known-user/profile").then().extract().body().jsonPath().getString("attrSetByClient"), nullValue()); + await().atMost(FIVE_SECONDS).until(() -> given().header("x-rp-grp", "z-gateleen-known-role,z-gateleen-admin").when().get("known-user/profile").then().extract().body().jsonPath().getString("attrSetByClient"), nullValue()); given().header("x-rp-grp", "z-gateleen-known-role,z-gateleen-admin").when().get("known-user/profile").then().assertThat().body("username", equalTo("username")).body("personalNumber", equalTo(testPersonalNumber)).body("mail", equalTo("mail")).body("department", equalTo("department")).body("lang", equalTo("lang")).body("tour", equalTo("tour")).body("zip", equalTo("zip")) .body("context", equalTo("context")).body("contextIsDefault", equalTo("contextIsDefault")).body("passkeyChanged", equalTo("passkeyChanged")).body("volumeBeep", equalTo("volumeBeep")).body("torchMode", equalTo("torchMode")).body("spn", equalTo("spn")); diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index f97dfc63e..61a466534 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -26,7 +26,7 @@ vertx-unit - com.jayway.awaitility + org.awaitility awaitility diff --git a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerRequestMock.java b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerRequestMock.java index 6d1e86e24..b2ce1b07e 100755 --- a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerRequestMock.java +++ b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/mocks/HttpServerRequestMock.java @@ -1,6 +1,7 @@ package org.swisspush.gateleen.validation.mocks; import io.vertx.codegen.annotations.Nullable; +import io.vertx.core.Context; import io.vertx.core.Handler; import io.vertx.core.MultiMap; import io.vertx.core.buffer.Buffer; @@ -18,7 +19,7 @@ * * @author https://github.com/mcweba [Marc-Andre Weber] */ -public class HttpServerRequestMock implements FastFailHttpServerRequest { +public class HttpServerRequestMock extends FastFailHttpServerRequest { private String bodyContent; @@ -217,4 +218,13 @@ public HttpServerRequest exceptionHandler(Handler handler) { throw new UnsupportedOperationException(); } + @Override + public Context context() { + throw new UnsupportedOperationException(); + } + + @Override + public Object metric() { + throw new UnsupportedOperationException(); + } } diff --git a/pom.xml b/pom.xml index a3caa0344..38aef7661 100644 --- a/pom.xml +++ b/pom.xml @@ -51,10 +51,41 @@ localhost 7012 /usr/local/bin/chromedriver + 1.5.8 + 4.2.0 + 2.15.1 + 3.14.0 + 1.3.0 + 1.16.0 + 1.2.6 + 0.3 + 1.10 + 33.0.0-jre + 2.2 + 2.17.2 + 2.19.0 + 2.16.1 + 3.7.0 + 9.4.53.v20231009 + 7.0.2 + 0.1.1 + 4.13.2 + 20231013 + 2.4.10 + 2.12.6 + 2.6.0 + 1.10.19 + 3.0.0 + 0.1.15 + 4.4.0 + 3.1.0 + 3.1.1 + 5.3.27 + 2.0.10 + 2.3.2 4.5.1 4.5.1 - 2.15.0 - 5.3.27 + 1.58 @@ -285,57 +316,62 @@ org.slf4j slf4j-api - 2.0.1 + ${slf4j.version} com.google.guava guava - 32.0.0-jre + ${guava.version} com.networknt json-schema-validator - 0.1.15 + ${networknt.version} commons-codec commons-codec - 1.15 + ${commons-codec.version} + + + commons-io + commons-io + ${commons-io.version} com.floreysoft jmte - 7.0.0 + ${jmte.version} org.apache.logging.log4j log4j-api - 2.17.2 + ${log4j.version} org.apache.logging.log4j log4j-core - 2.17.2 + ${log4j.version} org.apache.logging.log4j log4j-slf4j2-impl - 2.19.0 + ${log4j-slf4j2.version} org.swisspush redisques - 3.1.0-SNAPSHOT + ${redisques.version} org.swisspush rest-storage - 3.1.0-SNAPSHOT + ${rest-storage.version} org.quartz-scheduler quartz - 2.3.2 + ${quartz.version} @@ -344,34 +380,29 @@ ${vertx.version} - com.jayway.awaitility + org.awaitility awaitility - 1.6.5 + ${awaitility.version} org.mockito mockito-core - 1.9.5 + ${mockito.version} junit junit - 4.13.1 + ${junit.version} redis.clients jedis - 3.7.0 + ${jedis.version} org.hamcrest - hamcrest-core - 1.3 - - - org.hamcrest - hamcrest-all - 1.3 + hamcrest + ${hamcrest.version} org.springframework @@ -398,39 +429,39 @@ org.json json - 20231013 + ${json.version} joda-time joda-time - 2.10.13 + ${joda.version} com.jayway.jsonpath json-path - 2.6.0 + ${jsonpath.version} io.rest-assured rest-assured - 4.4.0 - - - net.minidev - json-smart - 2.4.10 + ${rest-assured.version} + + + + + - - org.glassfish.tyrus.bundles - tyrus-standalone-client-jdk - 1.10 - + + + + + org.eclipse.jetty.websocket websocket-client - 9.3.0.M2 + ${jetty-websocket.version} @@ -452,67 +483,67 @@ uk.co.datumedge hamcrest-json - 0.2 + ${datumedge.version} commons-logging commons-logging - 1.2 + ${commons-logging.version} org.slf4j slf4j-simple - 2.0.1 + ${slf4j.version} org.swisspush mod-metrics - 3.0.0 + ${mod-metrics.version} org.apache.commons commons-lang3 - 3.12.0 - - - org.slf4j - slf4j-log4j - 2.0.1 + ${commons-lang3.version} + + + + + org.webjars angularjs - 1.5.8 + ${angularjs.version} com.github.tomakehurst wiremock - 1.56 + ${wiremock.version} info.cukes cucumber-java test - 1.2.6 + ${cucumber.version} info.cukes cucumber-junit test - 1.2.6 + ${cucumber.version} com.bazaarvoice.jolt jolt-core - 0.1.1 + ${jolt.version} com.bazaarvoice.jolt json-utils - 0.1.1 + ${jolt.version} From c7fef8527d647f7974d095e36a7c4a47648ec2bc Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Tue, 16 Jan 2024 17:26:54 +0100 Subject: [PATCH 03/13] Updated mockito dependency --- .../gateleen/cache/CacheHandlerTest.java | 2 +- .../cache/storage/RedisCacheStorageTest.java | 4 +- .../ConfigurationResourceManagerTest.java | 13 +- .../core/logging/RequestLoggerTest.java | 4 +- .../gateleen/core/util/LockUtilTest.java | 2 +- .../gateleen/delegate/DelegateTest.java | 2 +- .../gateleen/delta/DeltaHandlerTest.java | 15 +-- .../expansion/ExpansionHandlerTest.java | 4 +- .../gateleen/hook/HookHandlerTest.java | 92 ++++++-------- .../ReducedPropagationManagerTest.java | 4 +- .../gateleen/kafka/KafkaHandlerTest.java | 30 ++--- .../kafka/KafkaMessageSenderTest.java | 4 +- .../kafka/KafkaMessageValidatorTest.java | 8 +- .../gateleen/logging/LoggingHandlerTest.java | 4 +- .../gateleen/monitoring/RedisMonitorTest.java | 2 +- gateleen-player/pom.xml | 4 + .../queue/queuing/QueueClientTest.java | 6 +- ...eCircuitBreakerHttpRequestHandlerTest.java | 6 +- .../impl/QueueCircuitBreakerImplTest.java | 115 +++++++++--------- .../CustomHttpResponseHandlerTest.java | 2 +- .../SchedulerResourceManagerTest.java | 2 +- .../authorization/AuthorizerTest.java | 20 +-- .../ContentTypeConstraintHandlerTest.java | 14 +-- .../org/swisspush/gateleen/qos/QoSTest.java | 2 +- .../DefaultValidationSchemaProviderTest.java | 2 +- .../validation/ValidationHandlerTest.java | 8 +- .../gateleen/validation/ValidatorTest.java | 2 +- pom.xml | 23 +--- 28 files changed, 179 insertions(+), 217 deletions(-) diff --git a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/CacheHandlerTest.java b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/CacheHandlerTest.java index 3c68ffb5f..9494d93ed 100644 --- a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/CacheHandlerTest.java +++ b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/CacheHandlerTest.java @@ -100,7 +100,7 @@ public void testNotSupportedCacheControlHeadersAreNotHandled(TestContext context Request cacheControlMaxAgeZero = new Request(HttpMethod.GET, "/some/path", headers, response); context.assertFalse(cacheHandler.handle(cacheControlMaxAgeZero)); - Mockito.verifyZeroInteractions(response); + Mockito.verifyNoInteractions(response); } @Test diff --git a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java index 25bdb8919..04c160cf1 100644 --- a/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java +++ b/gateleen-cache/src/test/java/org/swisspush/gateleen/cache/storage/RedisCacheStorageTest.java @@ -33,8 +33,8 @@ import static org.awaitility.Awaitility.await; import static java.util.concurrent.TimeUnit.SECONDS; import static org.hamcrest.CoreMatchers.equalTo; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; import static org.swisspush.gateleen.cache.storage.RedisCacheStorage.CACHED_REQUESTS; import static org.swisspush.gateleen.cache.storage.RedisCacheStorage.CACHE_PREFIX; diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java index 64f041e07..fcdfe8a16 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java @@ -8,7 +8,7 @@ import io.vertx.ext.unit.junit.VertxUnitRunner; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.swisspush.gateleen.core.http.DummyHttpServerResponse; import org.swisspush.gateleen.core.storage.MockResourceStorage; @@ -18,8 +18,7 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; import static org.swisspush.gateleen.core.configuration.ConfigurationResourceManager.CONFIG_RESOURCE_CHANGED_ADDRESS; @@ -202,7 +201,7 @@ public void testRegistrationAndInvalidUpdateWithSchema(TestContext context) { // resource should still not be in storage after invalid update context.assertFalse(storage.getMockData().containsKey(resourceURI)); - verify(observer, Mockito.never()).resourceChanged(Matchers.anyString(), Matchers.any(Buffer.class)); + verify(observer, Mockito.never()).resourceChanged(anyString(), any(Buffer.class)); async.complete(); } @@ -241,7 +240,7 @@ public void testNoNotificationAfterUnsuccessfulStoragePut(TestContext context) t context.assertEquals(storagePutFailStatusCode, response.getStatusCode()); - verify(observer, Mockito.never()).resourceChanged(anyString(), Matchers.any(Buffer.class)); + verify(observer, Mockito.never()).resourceChanged(anyString(), any(Buffer.class)); async.complete(); } @@ -266,9 +265,9 @@ public void testNotSupportedConfigurationResourceChangeType(TestContext context) vertx.eventBus().publish(CONFIG_RESOURCE_CHANGED_ADDRESS, object); // only 1 occurence of Storage.get is allowed during registerObserver. The second call would have come after the publish - verify(storage, times(1)).get(Matchers.anyString(), Matchers.any()); + verify(storage, times(1)).get(anyString(), any()); - verify(observer, Mockito.never()).resourceChanged(Matchers.anyString(), Matchers.any(Buffer.class)); + verify(observer, Mockito.never()).resourceChanged(anyString(), any(Buffer.class)); async.complete(); } diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/logging/RequestLoggerTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/logging/RequestLoggerTest.java index 91621d0a4..65564ee1c 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/logging/RequestLoggerTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/logging/RequestLoggerTest.java @@ -18,8 +18,8 @@ import org.swisspush.gateleen.core.util.Address; import org.swisspush.gateleen.core.util.StatusCode; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.swisspush.gateleen.core.logging.RequestLogger.*; /** diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/LockUtilTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/LockUtilTest.java index f07ebe1b3..dafececb4 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/LockUtilTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/LockUtilTest.java @@ -11,7 +11,7 @@ import org.slf4j.Logger; import org.swisspush.gateleen.core.lock.Lock; -import static org.mockito.Matchers.*; +import static org.mockito.ArgumentMatchers.*; /** * Tests for the {@link LockUtil} class diff --git a/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java b/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java index 3ff128b4f..f00336499 100644 --- a/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java +++ b/gateleen-delegate/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java @@ -23,7 +23,7 @@ import java.util.HashMap; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; import static org.swisspush.gateleen.core.util.ResourcesUtils.loadResource; diff --git a/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java b/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java index b55049a9d..68f0d9eed 100644 --- a/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java +++ b/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java @@ -15,7 +15,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.swisspush.gateleen.core.http.DummyHttpServerRequest; import org.swisspush.gateleen.core.http.DummyHttpServerResponse; import org.swisspush.gateleen.core.redis.RedisProvider; @@ -27,7 +27,8 @@ import java.util.Arrays; import java.util.List; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; @RunWith(VertxUnitRunner.class) @@ -52,7 +53,7 @@ public void before() { Handler> handler = (Handler>) invocation.getArguments()[1]; handler.handle(Future.succeededFuture(555L)); return null; - }).when(redisAPI).incr(eq("delta:sequence"), Matchers.any()); + }).when(redisAPI).incr(eq("delta:sequence"), any()); requestHeaders = MultiMap.caseInsensitiveMultiMap(); requestHeaders.add("x-delta", "auto"); @@ -155,8 +156,8 @@ public void testDeltaNoExpiry() { DeltaHandler deltaHandler = new DeltaHandler(redisProvider, null, ruleProvider); deltaHandler.handle(request, router); - verify(redisAPI, times(1)).set(eq(Arrays.asList("delta:resources:a:b:c", "555")), Matchers.any()); - verify(redisAPI, never()).setex(Matchers.any(), Matchers.any(), Matchers.any(), Matchers.any()); + verify(redisAPI, times(1)).set(eq(Arrays.asList("delta:resources:a:b:c", "555")), any()); + verify(redisAPI, never()).setex(any(), any(), any(), any()); } @Test @@ -166,8 +167,8 @@ public void testDeltaWithExpiry() { DeltaHandler deltaHandler = new DeltaHandler(redisProvider, null, ruleProvider); deltaHandler.handle(request, router); - verify(redisAPI, times(1)).setex(eq("delta:resources:a:b:c"), eq("123"), eq("555"), Matchers.any()); - verify(redisAPI, never()).set(Matchers.any(), Matchers.any()); + verify(redisAPI, times(1)).setex(eq("delta:resources:a:b:c"), eq("123"), eq("555"), any()); + verify(redisAPI, never()).set(any(), any()); } @Test diff --git a/gateleen-expansion/src/test/java/org/swisspush/gateleen/expansion/ExpansionHandlerTest.java b/gateleen-expansion/src/test/java/org/swisspush/gateleen/expansion/ExpansionHandlerTest.java index b3c2a4e2d..daef5a283 100644 --- a/gateleen-expansion/src/test/java/org/swisspush/gateleen/expansion/ExpansionHandlerTest.java +++ b/gateleen-expansion/src/test/java/org/swisspush/gateleen/expansion/ExpansionHandlerTest.java @@ -251,7 +251,7 @@ public void testBadRequestResponseForInvalidExpandParameterRequests(TestContext verify(response, times(1)).setStatusMessage(StatusCode.BAD_REQUEST.getStatusMessage()); verify(response, times(1)).end("Expand parameter is not valid. Must be a positive number"); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } @Test @@ -271,7 +271,7 @@ public void testBadRequestResponseForExceedingMaxExpansionLevelHard(TestContext verify(response, times(1)).setStatusMessage(StatusCode.BAD_REQUEST.getStatusMessage()); verify(response, times(1)).end("Expand level '15' is greater than the maximum expand level '10'"); - verifyZeroInteractions(httpClient); + verifyNoInteractions(httpClient); } private static class Request extends DummyHttpServerRequest { diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java index 2b415844d..3d7dc82b2 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java @@ -34,7 +34,7 @@ import static io.vertx.core.http.HttpMethod.PUT; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.*; +import static org.mockito.ArgumentMatchers.*; import static org.swisspush.gateleen.core.util.HttpRequestHeader.*; /** @@ -133,15 +133,11 @@ public void testListenerEnqueueWithDefaultQueueingStrategy(TestContext context) hookHandler.handle(routingContext); // verify that enqueue has been called WITH the payload - Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(new ArgumentMatcher<>() { - @Override - public boolean matches(Object argument) { - HttpRequest req = (HttpRequest) argument; - return HttpMethod.PUT == req.getMethod() - && req.getUri().contains(uri) - && Integer.valueOf(99).equals(getInteger(req.getHeaders(), CONTENT_LENGTH)) // Content-Length header should not have changed - && Arrays.equals(req.getPayload(), Buffer.buffer(originalPayload).getBytes()); // payload should not have changed - } + Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(req -> { + return HttpMethod.PUT == req.getMethod() + && req.getUri().contains(uri) + && Integer.valueOf(99).equals(getInteger(req.getHeaders(), CONTENT_LENGTH)) // Content-Length header should not have changed + && Arrays.equals(req.getPayload(), Buffer.buffer(originalPayload).getBytes()); // payload should not have changed }), anyString(), any(Handler.class)); } @@ -163,15 +159,11 @@ public void testListenerEnqueueWithDefaultQueueingStrategyBecauseOfInvalidConfig hookHandler.handle(routingContext); // verify that enqueue has been called WITH the payload - Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(new ArgumentMatcher<>() { - @Override - public boolean matches(Object argument) { - HttpRequest req = (HttpRequest) argument; - return HttpMethod.PUT == req.getMethod() - && req.getUri().contains(uri) - && Integer.valueOf(99).equals(getInteger(req.getHeaders(), CONTENT_LENGTH)) // Content-Length header should not have changed - && Arrays.equals(req.getPayload(), Buffer.buffer(originalPayload).getBytes()); // payload should not have changed - } + Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(req -> { + return HttpMethod.PUT == req.getMethod() + && req.getUri().contains(uri) + && Integer.valueOf(99).equals(getInteger(req.getHeaders(), CONTENT_LENGTH)) // Content-Length header should not have changed + && Arrays.equals(req.getPayload(), Buffer.buffer(originalPayload).getBytes()); // payload should not have changed }), anyString(), any(Handler.class)); } @@ -192,15 +184,11 @@ public void testListenerEnqueueWithDiscardPayloadQueueingStrategy(TestContext co hookHandler.handle(routingContext); // verify that enqueue has been called WITHOUT the payload but with 'Content-Length : 0' header - Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(new ArgumentMatcher<>() { - @Override - public boolean matches(Object argument) { - HttpRequest req = (HttpRequest) argument; - return HttpMethod.PUT == req.getMethod() - && req.getUri().contains(uri) - && Integer.valueOf(0).equals(getInteger(req.getHeaders(), CONTENT_LENGTH)) - && Arrays.equals(req.getPayload(), new byte[0]); // should not be original payload anymore - } + Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(req -> { + return HttpMethod.PUT == req.getMethod() + && req.getUri().contains(uri) + && Integer.valueOf(0).equals(getInteger(req.getHeaders(), CONTENT_LENGTH)) + && Arrays.equals(req.getPayload(), new byte[0]); // should not be original payload anymore }), anyString(), any(Handler.class)); PUTRequest putRequestWithoutContentLengthHeader = new PUTRequest(uri, originalPayload); @@ -208,15 +196,11 @@ public boolean matches(Object argument) { hookHandler.handle(routingContext); // verify that enqueue has been called WITHOUT the payload and WITHOUT 'Content-Length' header - Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(new ArgumentMatcher<>() { - @Override - public boolean matches(Object argument) { - HttpRequest req = (HttpRequest) argument; - return HttpMethod.PUT == req.getMethod() - && req.getUri().contains(uri) - && !containsHeader(req.getHeaders(), CONTENT_LENGTH) - && Arrays.equals(req.getPayload(), new byte[0]); // should not be original payload anymore - } + Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(req -> { + return HttpMethod.PUT == req.getMethod() + && req.getUri().contains(uri) + && !containsHeader(req.getHeaders(), CONTENT_LENGTH) + && Arrays.equals(req.getPayload(), new byte[0]); // should not be original payload anymore }), anyString(), any(Handler.class)); } @@ -241,8 +225,8 @@ public void testListenerEnqueueWithReducedPropagationQueueingStrategyButNoManage hookHandler.handle(routingContext); // verify that no enqueue (or lockedEnqueue) has been called because no ReducedPropagationManager was configured - Mockito.verifyZeroInteractions(requestQueue); - Mockito.verifyZeroInteractions(reducedPropagationManager); + Mockito.verifyNoInteractions(requestQueue); + Mockito.verifyNoInteractions(reducedPropagationManager); } @Test @@ -289,15 +273,11 @@ public void testListenerEnqueueWithInvalidReducedPropagationQueueingStrategy(Tes hookHandler.handle(routingContext); // verify that enqueue has been called WITH the payload - Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(new ArgumentMatcher<>() { - @Override - public boolean matches(Object argument) { - HttpRequest req = (HttpRequest) argument; - return HttpMethod.PUT == req.getMethod() - && req.getUri().contains(uri) - && Integer.valueOf(99).equals(getInteger(req.getHeaders(), CONTENT_LENGTH)) // Content-Length header should not have changed - && Arrays.equals(req.getPayload(), Buffer.buffer(originalPayload).getBytes()); // payload should not have changed - } + Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(req -> { + return HttpMethod.PUT == req.getMethod() + && req.getUri().contains(uri) + && Integer.valueOf(99).equals(getInteger(req.getHeaders(), CONTENT_LENGTH)) // Content-Length header should not have changed + && Arrays.equals(req.getPayload(), Buffer.buffer(originalPayload).getBytes()); // payload should not have changed }), anyString(), any(Handler.class)); } @@ -320,15 +300,11 @@ public void testListenerEnqueueWithMatchingRequestsHeaderFilter(TestContext cont hookHandler.handle(routingContext); // verify that enqueue has been called WITH the payload - Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(new ArgumentMatcher<>() { - @Override - public boolean matches(Object argument) { - HttpRequest req = (HttpRequest) argument; - return HttpMethod.PUT == req.getMethod() - && req.getUri().contains(uri) - && Integer.valueOf(99).equals(getInteger(req.getHeaders(), CONTENT_LENGTH)) // Content-Length header should not have changed - && Arrays.equals(req.getPayload(), Buffer.buffer(originalPayload).getBytes()); // payload should not have changed - } + Mockito.verify(requestQueue, Mockito.timeout(2000).times(1)).enqueue(Mockito.argThat(req -> { + return HttpMethod.PUT == req.getMethod() + && req.getUri().contains(uri) + && Integer.valueOf(99).equals(getInteger(req.getHeaders(), CONTENT_LENGTH)) // Content-Length header should not have changed + && Arrays.equals(req.getPayload(), Buffer.buffer(originalPayload).getBytes()); // payload should not have changed }), anyString(), any(Handler.class)); } @@ -349,7 +325,7 @@ public void testListenerNoEnqueueWithoutMatchingRequestsHeaderFilter(TestContext hookHandler.handle(routingContext); // verify that no enqueue has been called since the header did not match - Mockito.verifyZeroInteractions(requestQueue); + Mockito.verifyNoInteractions(requestQueue); } @Test diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java index 8ed123d14..ca462832b 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java @@ -312,7 +312,7 @@ public void testExpiredQueueProcessingGetQueueRequestFailure(TestContext context verify(reducedPropagationStorage, timeout(1000).times(1)).getQueueRequest(eq(expiredQueue)); verify(reducedPropagationStorage, after(1000).never()).removeQueueRequest(anyString()); - verifyZeroInteractions(requestQueue); + verifyNoInteractions(requestQueue); async.complete(); }); @@ -331,7 +331,7 @@ public void testExpiredQueueProcessingGetQueueRequestReturnsNull(TestContext con verify(reducedPropagationStorage, timeout(1000).times(1)).getQueueRequest(eq(expiredQueue)); verify(reducedPropagationStorage, after(1000).never()).removeQueueRequest(anyString()); - verifyZeroInteractions(requestQueue); + verifyNoInteractions(requestQueue); async.complete(); }); diff --git a/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaHandlerTest.java b/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaHandlerTest.java index 502367176..054350367 100644 --- a/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaHandlerTest.java +++ b/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaHandlerTest.java @@ -31,7 +31,7 @@ import static org.awaitility.Awaitility.await; import static java.util.concurrent.TimeUnit.SECONDS; import static org.hamcrest.Matchers.equalTo; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; import static org.swisspush.gateleen.core.configuration.ConfigurationResourceManager.CONFIG_RESOURCE_CHANGED_ADDRESS; @@ -76,8 +76,8 @@ public void initWithMissingConfigResource(TestContext context) { Async async = context.async(); context.assertFalse(handler.isInitialized()); handler.initialize().onComplete(event -> { - verifyZeroInteractions(repository); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(repository); + verifyNoInteractions(kafkaMessageSender); context.assertFalse(handler.isInitialized()); async.complete(); }); @@ -105,7 +105,7 @@ public void initWithExistingConfigResource(TestContext context) { put("acks", "1"); }}; verify(repository, times(1)).addKafkaProducer(eq(new KafkaConfiguration(Pattern.compile("."), configs_2))); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); context.assertTrue(handler.isInitialized()); async.complete(); }); @@ -133,7 +133,7 @@ public void initWithWildcardConfigResource(TestContext context) { put("acks", "all"); }}; verify(repository, atLeastOnce()).addKafkaProducer(eq(new KafkaConfiguration(Pattern.compile("my.properties.topic.*"), configs_1))); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); context.assertTrue(handler.isInitialized()); async.complete(); }); @@ -151,7 +151,7 @@ public void initWithWildcardConfigResourceException(TestContext context) { handler.initialize().onComplete(event -> { verify(repository, never()).addKafkaProducer(any()); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); context.assertTrue(handler.isInitialized()); async.complete(); }); @@ -166,7 +166,7 @@ public void resourceRemovedTriggersCloseAllProducers(TestContext context){ object.put("type", "remove"); vertx.eventBus().publish(CONFIG_RESOURCE_CHANGED_ADDRESS, object); verify(repository, timeout(100).times(1)).closeAll(); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); async.complete(); }); } @@ -197,7 +197,7 @@ public void resourceChangedTriggersCloseAllAndReCreateOfProducers(TestContext co put("acks", "1"); }}; verify(repository, timeout(500).times(1)).addKafkaProducer(eq(new KafkaConfiguration(Pattern.compile("."), configs_2))); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); await().atMost(1, SECONDS).until( () -> handler.isInitialized(), equalTo(Boolean.TRUE)); async.complete(); } @@ -209,7 +209,7 @@ public void handleNotStreamingPath(TestContext context){ StreamingRequest request = new StreamingRequest(HttpMethod.POST, "/some/other/uri/path"); final boolean handled = handler.handle(request); context.assertFalse(handled); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); async.complete(); }); } @@ -224,7 +224,7 @@ public void handleNotPOSTRequest(TestContext context){ final boolean handled = handler.handle(request); context.assertTrue(handled); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); verify(response, times(1)).setStatusCode(eq(StatusCode.METHOD_NOT_ALLOWED.getStatusCode())); async.complete(); @@ -241,7 +241,7 @@ public void handleEmptyTopic(TestContext context){ final boolean handled = handler.handle(request); context.assertTrue(handled); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); verify(response, times(1)).setStatusCode(eq(StatusCode.BAD_REQUEST.getStatusCode())); async.complete(); @@ -258,7 +258,7 @@ public void handleNoMatchingProducer(TestContext context){ final boolean handled = handler.handle(request); context.assertTrue(handled); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); verify(response, times(1)).setStatusCode(eq(StatusCode.NOT_FOUND.getStatusCode())); async.complete(); @@ -277,7 +277,7 @@ public void handleInvalidPayload(TestContext context){ final boolean handled = handler.handle(request); context.assertTrue(handled); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); verify(response, times(1)).setStatusCode(eq(StatusCode.BAD_REQUEST.getStatusCode())); async.complete(); @@ -471,7 +471,7 @@ public void handlePayloadNotPassingValidation(TestContext context){ final boolean handled = handler.handle(request); context.assertTrue(handled); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); verify(response, times(1)).setStatusCode(eq(StatusCode.BAD_REQUEST.getStatusCode())); async.complete(); @@ -520,7 +520,7 @@ public void handleErrorWhileValidation(TestContext context){ final boolean handled = handler.handle(request); context.assertTrue(handled); - verifyZeroInteractions(kafkaMessageSender); + verifyNoInteractions(kafkaMessageSender); verify(response, times(1)).setStatusCode(eq(StatusCode.INTERNAL_SERVER_ERROR.getStatusCode())); async.complete(); diff --git a/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageSenderTest.java b/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageSenderTest.java index a4d1f1302..e2ba67511 100644 --- a/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageSenderTest.java +++ b/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageSenderTest.java @@ -19,8 +19,8 @@ import java.util.*; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; import static org.swisspush.gateleen.kafka.KafkaProducerRecordBuilder.buildRecords; diff --git a/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageValidatorTest.java b/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageValidatorTest.java index 7f327f978..46f45053e 100644 --- a/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageValidatorTest.java +++ b/gateleen-kafka/src/test/java/org/swisspush/gateleen/kafka/KafkaMessageValidatorTest.java @@ -60,8 +60,8 @@ public void testValidateMessagesWithEmptyRecordsList(TestContext context) { messageValidator.validateMessages(request, Collections.emptyList()).onComplete(event -> { context.assertTrue(event.succeeded()); context.assertEquals(ValidationStatus.VALIDATED_POSITIV, event.result().getValidationStatus()); - verifyZeroInteractions(validationResourceManager); - verifyZeroInteractions(validator); + verifyNoInteractions(validationResourceManager); + verifyNoInteractions(validator); async.complete(); }); @@ -83,7 +83,7 @@ public void testValidateMessagesNoMatchingValidationResourceEntry(TestContext co context.assertTrue(event.succeeded()); context.assertEquals(ValidationStatus.VALIDATED_POSITIV, event.result().getValidationStatus()); verify(validationResourceManager, times(1)).getValidationResource(); - verifyZeroInteractions(validator); + verifyNoInteractions(validator); async.complete(); }); @@ -108,7 +108,7 @@ public void testValidateMessagesMatchingValidationResourceEntryWithoutSchemaLoca context.assertTrue(event.succeeded()); context.assertEquals(ValidationStatus.COULD_NOT_VALIDATE, event.result().getValidationStatus()); verify(validationResourceManager, times(2)).getValidationResource(); - verifyZeroInteractions(validator); + verifyNoInteractions(validator); async.complete(); }); diff --git a/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingHandlerTest.java b/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingHandlerTest.java index d5e8b8603..5dc2b777a 100644 --- a/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingHandlerTest.java +++ b/gateleen-logging/src/test/java/org/swisspush/gateleen/logging/LoggingHandlerTest.java @@ -20,8 +20,8 @@ import java.util.List; import java.util.Map; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; /** * Tests for the {@link LoggingHandler} class diff --git a/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/RedisMonitorTest.java b/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/RedisMonitorTest.java index 1efe344ae..ac8be985d 100644 --- a/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/RedisMonitorTest.java +++ b/gateleen-monitoring/src/test/java/org/swisspush/gateleen/monitoring/RedisMonitorTest.java @@ -17,7 +17,7 @@ import java.util.List; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; /** diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index 59fd10873..6f50dc82b 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -17,6 +17,10 @@ org.springframework spring-websocket + + org.slf4j + slf4j-api + joda-time joda-time diff --git a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueClientTest.java b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueClientTest.java index f98289dab..feb879e1b 100644 --- a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueClientTest.java +++ b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/QueueClientTest.java @@ -21,7 +21,7 @@ import org.swisspush.gateleen.monitoring.MonitoringHandler; import org.swisspush.redisques.util.RedisquesAPI; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.swisspush.redisques.util.RedisquesAPI.*; /** @@ -90,7 +90,7 @@ public void testEnqueueFutureNotUpdatingMonitoringHandlerOnRedisquesFail(TestCon }); // since redisques answered with a 'failure', the monitoringHandler should not be called - Mockito.verifyZeroInteractions(monitoringHandler); + Mockito.verifyNoInteractions(monitoringHandler); } @Test @@ -252,7 +252,7 @@ public void testLockedEnqueueNotUpdatingMonitoringHandlerOnRedisquesFail(TestCon queueClient.lockedEnqueue(request, "myQueue", "LockRequester", event -> async.complete()); // since redisques answered with a 'failure', the monitoringHandler should not be called - Mockito.verifyZeroInteractions(monitoringHandler); + Mockito.verifyNoInteractions(monitoringHandler); } private void validateMessage(TestContext context, Message message, RedisquesAPI.QueueOperation expectedOperation, String queue){ diff --git a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/api/QueueCircuitBreakerHttpRequestHandlerTest.java b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/api/QueueCircuitBreakerHttpRequestHandlerTest.java index 58d05bbe4..a33336bb1 100644 --- a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/api/QueueCircuitBreakerHttpRequestHandlerTest.java +++ b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/api/QueueCircuitBreakerHttpRequestHandlerTest.java @@ -15,13 +15,11 @@ import org.junit.runner.RunWith; import org.mockito.Mockito; import org.swisspush.gateleen.queue.queuing.circuitbreaker.QueueCircuitBreakerStorage; -import org.swisspush.gateleen.queue.queuing.circuitbreaker.api.QueueCircuitBreakerAPI; -import org.swisspush.gateleen.queue.queuing.circuitbreaker.api.QueueCircuitBreakerHttpRequestHandler; import org.swisspush.gateleen.queue.queuing.circuitbreaker.util.PatternAndCircuitHash; import org.swisspush.gateleen.queue.queuing.circuitbreaker.util.QueueCircuitState; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.swisspush.gateleen.queue.queuing.circuitbreaker.api.QueueCircuitBreakerAPI.*; import static org.swisspush.gateleen.queue.queuing.circuitbreaker.api.QueueCircuitBreakerHttpRequestHandler.HTTP_REQUEST_API_ADDRESS; diff --git a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java index 2e8ac2c62..763511715 100644 --- a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java +++ b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java @@ -19,7 +19,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.swisspush.gateleen.core.http.HttpRequest; import org.swisspush.gateleen.core.lock.Lock; @@ -36,6 +36,7 @@ import java.util.Map; import java.util.regex.Pattern; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.*; import static org.swisspush.gateleen.queue.queuing.circuitbreaker.util.QueueResponseType.SUCCESS; @@ -65,8 +66,8 @@ public void setUp() { vertx = Vertx.vertx(); lock = Mockito.mock(Lock.class); - Mockito.when(lock.acquireLock(Matchers.anyString(), Matchers.anyString(), Matchers.anyLong())).thenReturn(Future.succeededFuture(Boolean.TRUE)); - Mockito.when(lock.releaseLock(Matchers.anyString(), Matchers.anyString())).thenReturn(Future.succeededFuture(Boolean.TRUE)); + Mockito.when(lock.acquireLock(anyString(), anyString(), anyLong())).thenReturn(Future.succeededFuture(Boolean.TRUE)); + Mockito.when(lock.releaseLock(anyString(), anyString())).thenReturn(Future.succeededFuture(Boolean.TRUE)); storage = Mockito.mock(ResourceStorage.class); @@ -106,7 +107,7 @@ public void cleanUp() { @Test public void testLockingForPeriodicTimersSuccess(TestContext context) { - Async async = context.async(2); + Async async = context.async(); Mockito.when(queueCircuitBreakerStorage.setOpenCircuitsToHalfOpen()).thenReturn(Future.succeededFuture(0L)); Mockito.when(queueCircuitBreakerStorage.popQueueToUnlock()).thenReturn(Future.succeededFuture("SomeQueue")); @@ -116,23 +117,23 @@ public void testLockingForPeriodicTimersSuccess(TestContext context) { context.assertEquals("deleteLock", event.body().getString("operation")); context.assertEquals("SomeQueue", event.body().getJsonObject("payload").getString("queuename")); event.reply(new JsonObject().put("status", "ok")); - async.countDown(); + + Mockito.verify(queueCircuitBreakerStorage, after(1200).atMost(1)).setOpenCircuitsToHalfOpen(); + Mockito.verify(queueCircuitBreakerStorage, after(1200).atMost(1)).popQueueToUnlock(); + Mockito.verify(queueCircuitBreakerStorage, after(1200).atMost(1)).unlockSampleQueues(); + async.complete(); }); ArgumentCaptor lockArguments = ArgumentCaptor.forClass(String.class); - Mockito.verify(lock, timeout(1100).times(3)).acquireLock(lockArguments.capture(), Matchers.anyString(), Matchers.anyLong()); - Mockito.verify(lock, after(1100).never()).releaseLock(Matchers.anyString(), Matchers.anyString()); + Mockito.verify(lock, timeout(1100).times(3)).acquireLock(lockArguments.capture(), anyString(), anyLong()); + Mockito.verify(lock, after(1100).never()).releaseLock(anyString(), anyString()); List lockValues = lockArguments.getAllValues(); context.assertTrue(lockValues.contains(QueueCircuitBreakerImpl.OPEN_TO_HALF_OPEN_TASK_LOCK)); context.assertTrue(lockValues.contains(QueueCircuitBreakerImpl.UNLOCK_QUEUES_TASK_LOCK)); context.assertTrue(lockValues.contains(QueueCircuitBreakerImpl.UNLOCK_SAMPLE_QUEUES_TASK_LOCK)); - Mockito.verify(queueCircuitBreakerStorage, timeout(1200).times(1)).setOpenCircuitsToHalfOpen(); - Mockito.verify(queueCircuitBreakerStorage, timeout(1200).times(1)).popQueueToUnlock(); - Mockito.verify(queueCircuitBreakerStorage, timeout(1200).times(1)).unlockSampleQueues(); - async.countDown(); async.awaitSuccess(); } @@ -147,8 +148,8 @@ public void testLockingForPeriodicTimersFail(TestContext context) { ArgumentCaptor lockArguments = ArgumentCaptor.forClass(String.class); ArgumentCaptor releaseArguments = ArgumentCaptor.forClass(String.class); - Mockito.verify(lock, timeout(1100).times(3)).acquireLock(lockArguments.capture(), Matchers.anyString(), Matchers.anyLong()); - Mockito.verify(lock, timeout(1100).times(3)).releaseLock(releaseArguments.capture(), Matchers.anyString()); + Mockito.verify(lock, timeout(1100).times(3)).acquireLock(lockArguments.capture(), anyString(), anyLong()); + Mockito.verify(lock, timeout(1100).times(3)).releaseLock(releaseArguments.capture(), anyString()); List lockValues = lockArguments.getAllValues(); context.assertTrue(lockValues.contains(QueueCircuitBreakerImpl.OPEN_TO_HALF_OPEN_TASK_LOCK)); @@ -173,20 +174,20 @@ public void testHandleQueuedRequest(TestContext context) { Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.getQueueCircuitState(Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.getQueueCircuitState(any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture(QueueCircuitState.CLOSED)); - Mockito.when(queueCircuitBreakerStorage.lockQueue(Matchers.anyString(), Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.lockQueue(anyString(), any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture()); queueCircuitBreaker.handleQueuedRequest("someQueue", req).onComplete(event -> { context.assertTrue(event.succeeded()); context.assertEquals(QueueCircuitState.CLOSED, event.result()); - Mockito.when(queueCircuitBreakerStorage.getQueueCircuitState(Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.getQueueCircuitState(any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture(QueueCircuitState.OPEN)); queueCircuitBreaker.handleQueuedRequest("someQueue", req).onComplete(event1 -> { @@ -203,13 +204,13 @@ public void testHandleQueuedRequestCallsLockQueueWhenCircuitIsOpen(TestContext c Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.getQueueCircuitState(Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.getQueueCircuitState(any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture(QueueCircuitState.OPEN)); - Mockito.when(queueCircuitBreakerStorage.lockQueue(Matchers.anyString(), Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.lockQueue(anyString(), any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture()); queueCircuitBreaker.handleQueuedRequest("someQueue", req).onComplete(event -> { @@ -226,24 +227,24 @@ public void testHandleQueuedRequestDoesNotCallLockQueueWhenCircuitIsNotOpen(Test Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.getQueueCircuitState(Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.getQueueCircuitState(any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture(QueueCircuitState.CLOSED)); queueCircuitBreaker.handleQueuedRequest("someQueue", req).onComplete(event -> { context.assertTrue(event.succeeded()); context.assertEquals(QueueCircuitState.CLOSED, event.result()); - verify(queueCircuitBreaker, never()).lockQueue(Matchers.anyString(), Matchers.any(HttpRequest.class)); + verify(queueCircuitBreaker, never()).lockQueue(anyString(), any(HttpRequest.class)); - Mockito.when(queueCircuitBreakerStorage.getQueueCircuitState(Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.getQueueCircuitState(any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture(QueueCircuitState.HALF_OPEN)); queueCircuitBreaker.handleQueuedRequest("someQueue", req).onComplete(event1 -> { context.assertTrue(event1.succeeded()); context.assertEquals(QueueCircuitState.HALF_OPEN, event1.result()); - verify(queueCircuitBreaker, never()).lockQueue(Matchers.anyString(), Matchers.any(HttpRequest.class)); + verify(queueCircuitBreaker, never()).lockQueue(anyString(), any(HttpRequest.class)); async.complete(); }); }); @@ -255,7 +256,7 @@ public void testHandleQueuedRequestNoCircuitMapping(TestContext context) { Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())).thenReturn(null); + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())).thenReturn(null); queueCircuitBreaker.handleQueuedRequest("someQueue", req).onComplete(event -> { context.assertTrue(event.failed()); @@ -271,16 +272,16 @@ public void testUpdateStatistics(TestContext context) { Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.updateStatistics(Matchers.any(PatternAndCircuitHash.class), - Matchers.anyString(), Matchers.anyLong(), Matchers.anyInt(), Matchers.anyLong(), Matchers.anyLong(), Matchers.anyLong(), Matchers.any(QueueResponseType.class))) + Mockito.when(queueCircuitBreakerStorage.updateStatistics(any(PatternAndCircuitHash.class), + anyString(), anyLong(), anyInt(), anyLong(), anyLong(), anyLong(), any(QueueResponseType.class))) .thenReturn(Future.succeededFuture(UpdateStatisticsResult.OK)); queueCircuitBreaker.updateStatistics("someQueue", req, SUCCESS).onComplete(event -> { context.assertTrue(event.succeeded()); - verify(queueCircuitBreaker, never()).lockQueue(Matchers.anyString(), Matchers.any(HttpRequest.class)); + verify(queueCircuitBreaker, never()).lockQueue(anyString(), any(HttpRequest.class)); async.complete(); }); async.awaitSuccess(); @@ -291,13 +292,13 @@ public void testUpdateStatisticsNoCircuitMapping(TestContext context) { Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())).thenReturn(null); + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())).thenReturn(null); queueCircuitBreaker.updateStatistics("someQueueName", req, SUCCESS).onComplete(event -> { context.assertTrue(event.failed()); context.assertNotNull(event.cause()); context.assertTrue(event.cause().getMessage().contains("no rule to circuit mapping found for queue")); - verify(queueCircuitBreaker, never()).lockQueue(Matchers.anyString(), Matchers.any(HttpRequest.class)); + verify(queueCircuitBreaker, never()).lockQueue(anyString(), any(HttpRequest.class)); async.complete(); }); async.awaitSuccess(); @@ -308,14 +309,14 @@ public void testUpdateStatisticsTriggersQueueLock(TestContext context) { Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.updateStatistics(Matchers.any(PatternAndCircuitHash.class), - Matchers.anyString(), Matchers.anyLong(), Matchers.anyInt(), Matchers.anyLong(), Matchers.anyLong(), Matchers.anyLong(), Matchers.any(QueueResponseType.class))) + Mockito.when(queueCircuitBreakerStorage.updateStatistics(any(PatternAndCircuitHash.class), + anyString(), anyLong(), anyInt(), anyLong(), anyLong(), anyLong(), any(QueueResponseType.class))) .thenReturn(Future.succeededFuture(UpdateStatisticsResult.OPENED)); - Mockito.when(queueCircuitBreakerStorage.lockQueue(Matchers.anyString(), Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.lockQueue(anyString(), any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture()); queueCircuitBreaker.updateStatistics("someQueue", req, SUCCESS).onComplete(event -> { @@ -331,10 +332,10 @@ public void testQueueLock(TestContext context) { Async async = context.async(2); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.lockQueue(Matchers.anyString(), Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.lockQueue(anyString(), any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture()); vertx.eventBus().consumer(Address.redisquesAddress(), (Message event) -> { @@ -345,7 +346,7 @@ public void testQueueLock(TestContext context) { queueCircuitBreaker.lockQueue("someQueue", req).onComplete(event -> { context.assertTrue(event.succeeded()); - verify(queueCircuitBreakerStorage, times(1)).lockQueue(Matchers.anyString(), Matchers.any(PatternAndCircuitHash.class)); + verify(queueCircuitBreakerStorage, times(1)).lockQueue(anyString(), any(PatternAndCircuitHash.class)); async.countDown(); }); @@ -357,10 +358,10 @@ public void testQueueLockFailingRedisques(TestContext context) { Async async = context.async(2); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.lockQueue(Matchers.anyString(), Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.lockQueue(anyString(), any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture()); vertx.eventBus().consumer(Address.redisquesAddress(), (Message event) -> { @@ -372,7 +373,7 @@ public void testQueueLockFailingRedisques(TestContext context) { queueCircuitBreaker.lockQueue("someQueue", req).onComplete(event -> { context.assertTrue(event.failed()); context.assertTrue(event.cause().getMessage().contains("failed to lock queue 'someQueue'")); - verify(queueCircuitBreakerStorage, times(1)).lockQueue(Matchers.anyString(), Matchers.any(PatternAndCircuitHash.class)); + verify(queueCircuitBreakerStorage, times(1)).lockQueue(anyString(), any(PatternAndCircuitHash.class)); async.countDown(); }); @@ -384,10 +385,10 @@ public void testQueueLockFailingStorage(TestContext context) { Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.lockQueue(Matchers.anyString(), Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.lockQueue(anyString(), any(PatternAndCircuitHash.class))) .thenReturn(Future.failedFuture("queue could not be locked")); vertx.eventBus().consumer(Address.redisquesAddress(), (Message event) -> context.fail("Redisques should not have been called when the storage failed")); @@ -395,7 +396,7 @@ public void testQueueLockFailingStorage(TestContext context) { queueCircuitBreaker.lockQueue("someQueue", req).onComplete(event -> { context.assertTrue(event.failed()); context.assertTrue(event.cause().getMessage().contains("queue could not be locked")); - verify(queueCircuitBreakerStorage, times(1)).lockQueue(Matchers.anyString(), Matchers.any(PatternAndCircuitHash.class)); + verify(queueCircuitBreakerStorage, times(1)).lockQueue(anyString(), any(PatternAndCircuitHash.class)); async.complete(); }); async.awaitSuccess(); @@ -541,15 +542,15 @@ public void testCloseCircuit(TestContext context) { Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.closeCircuit(Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.closeCircuit(any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture()); queueCircuitBreaker.closeCircuit(req).onComplete(event -> { context.assertTrue(event.succeeded()); - verify(queueCircuitBreakerStorage, times(1)).closeCircuit(Matchers.any(PatternAndCircuitHash.class)); + verify(queueCircuitBreakerStorage, times(1)).closeCircuit(any(PatternAndCircuitHash.class)); async.complete(); }); async.awaitSuccess(); @@ -560,16 +561,16 @@ public void testCloseCircuitFailingStorage(TestContext context) { Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.closeCircuit(Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.closeCircuit(any(PatternAndCircuitHash.class))) .thenReturn(Future.failedFuture("unable to close circuit")); queueCircuitBreaker.closeCircuit(req).onComplete(event -> { context.assertTrue(event.failed()); context.assertTrue(event.cause().getMessage().contains("unable to close circuit")); - verify(queueCircuitBreakerStorage, times(1)).closeCircuit(Matchers.any(PatternAndCircuitHash.class)); + verify(queueCircuitBreakerStorage, times(1)).closeCircuit(any(PatternAndCircuitHash.class)); async.complete(); }); async.awaitSuccess(); @@ -611,15 +612,15 @@ public void testReOpenCircuit(TestContext context) { Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.reOpenCircuit(Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.reOpenCircuit(any(PatternAndCircuitHash.class))) .thenReturn(Future.succeededFuture()); queueCircuitBreaker.reOpenCircuit(req).onComplete(event -> { context.assertTrue(event.succeeded()); - verify(queueCircuitBreakerStorage, times(1)).reOpenCircuit(Matchers.any(PatternAndCircuitHash.class)); + verify(queueCircuitBreakerStorage, times(1)).reOpenCircuit(any(PatternAndCircuitHash.class)); async.complete(); }); async.awaitSuccess(); @@ -630,16 +631,16 @@ public void testReOpenCircuitFailingStorage(TestContext context) { Async async = context.async(); HttpRequest req = new HttpRequest(HttpMethod.PUT, "/playground/circuitBreaker/test", MultiMap.caseInsensitiveMultiMap(), null); - Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(Matchers.anyString())) + Mockito.when(ruleToCircuitMapping.getCircuitFromRequestUri(anyString())) .thenReturn(new PatternAndCircuitHash(Pattern.compile("/someCircuit"), "someCircuitHash")); - Mockito.when(queueCircuitBreakerStorage.reOpenCircuit(Matchers.any(PatternAndCircuitHash.class))) + Mockito.when(queueCircuitBreakerStorage.reOpenCircuit(any(PatternAndCircuitHash.class))) .thenReturn(Future.failedFuture("unable to re-open circuit")); queueCircuitBreaker.reOpenCircuit(req).onComplete(event -> { context.assertTrue(event.failed()); context.assertTrue(event.cause().getMessage().contains("unable to re-open circuit")); - verify(queueCircuitBreakerStorage, times(1)).reOpenCircuit(Matchers.any(PatternAndCircuitHash.class)); + verify(queueCircuitBreakerStorage, times(1)).reOpenCircuit(any(PatternAndCircuitHash.class)); async.complete(); }); async.awaitSuccess(); diff --git a/gateleen-routing/src/test/java/org/swisspush/gateleen/routing/CustomHttpResponseHandlerTest.java b/gateleen-routing/src/test/java/org/swisspush/gateleen/routing/CustomHttpResponseHandlerTest.java index 3156b7901..6eb5a602e 100644 --- a/gateleen-routing/src/test/java/org/swisspush/gateleen/routing/CustomHttpResponseHandlerTest.java +++ b/gateleen-routing/src/test/java/org/swisspush/gateleen/routing/CustomHttpResponseHandlerTest.java @@ -11,7 +11,7 @@ import org.swisspush.gateleen.core.http.DummyHttpServerResponse; import org.swisspush.gateleen.core.util.StatusCode; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; import static org.mockito.Mockito.times; diff --git a/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java b/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java index 547ac14d7..eee9df49f 100644 --- a/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java +++ b/gateleen-scheduler/src/test/java/org/swisspush/gateleen/scheduler/SchedulerResourceManagerTest.java @@ -26,7 +26,7 @@ import java.util.Collections; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; /** diff --git a/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/AuthorizerTest.java b/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/AuthorizerTest.java index 2f59186e4..db9f2181a 100644 --- a/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/AuthorizerTest.java +++ b/gateleen-security/src/test/java/org/swisspush/gateleen/security/authorization/AuthorizerTest.java @@ -30,7 +30,7 @@ import java.util.Map; import java.util.Set; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.timeout; /** @@ -158,7 +158,7 @@ public void testAuthorizeAclUriGETRequest(TestContext context) { context.assertTrue(event.result()); }); - Mockito.verifyZeroInteractions(response); + Mockito.verifyNoInteractions(response); } @Test @@ -224,7 +224,7 @@ public void testHandleIsAuthorizedWithRolesWithDefaultBehaviour(TestContext cont context.assertTrue(event.result()); }); - Mockito.verifyZeroInteractions(response); + Mockito.verifyNoInteractions(response); } @Test @@ -239,7 +239,7 @@ public void testHandleIsAuthorizedWithoutRolesWithDefaultBehaviour(TestContext c context.assertTrue(event.result()); }); - Mockito.verifyZeroInteractions(response); + Mockito.verifyNoInteractions(response); } @Test @@ -296,7 +296,7 @@ public void testHandleIsAuthorizedWithRolesWithOverriddenBehaviour(TestContext c context.assertTrue(event.result()); }); - Mockito.verifyZeroInteractions(response); + Mockito.verifyNoInteractions(response); } @Test @@ -320,7 +320,7 @@ public void testHandleAclRoleMapper(TestContext context) { context.assertTrue(roles.contains("z-gateleen-everyone")); }); - Mockito.verifyZeroInteractions(response); + Mockito.verifyNoInteractions(response); } @@ -338,7 +338,7 @@ public void adminIsAuthorizedToReadAllUserspecificResourcesWithoutUserHeader(Tes context.assertTrue(event.result()); }); - Mockito.verifyZeroInteractions(response); + Mockito.verifyNoInteractions(response); } @Test @@ -356,7 +356,7 @@ public void adminIsAuthorizedToReadAllUserspecificResourcesWithUserHeader(TestCo context.assertTrue(event.result()); }); - Mockito.verifyZeroInteractions(response); + Mockito.verifyNoInteractions(response); } @Test @@ -374,7 +374,7 @@ public void userIsAuthorizedToReadItsOwnResources(TestContext context) { context.assertTrue(event.result()); }); - Mockito.verifyZeroInteractions(response); + Mockito.verifyNoInteractions(response); } @Test @@ -426,7 +426,7 @@ public void userIsAuthorizedToReadItsOwnResourcesAdditionalRegexGroups(TestConte context.assertTrue(event.result()); }); - Mockito.verifyZeroInteractions(response); + Mockito.verifyNoInteractions(response); } @Test diff --git a/gateleen-security/src/test/java/org/swisspush/gateleen/security/content/ContentTypeConstraintHandlerTest.java b/gateleen-security/src/test/java/org/swisspush/gateleen/security/content/ContentTypeConstraintHandlerTest.java index e42c0ace1..3648b5b50 100644 --- a/gateleen-security/src/test/java/org/swisspush/gateleen/security/content/ContentTypeConstraintHandlerTest.java +++ b/gateleen-security/src/test/java/org/swisspush/gateleen/security/content/ContentTypeConstraintHandlerTest.java @@ -25,7 +25,7 @@ import java.util.Collections; import java.util.List; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; /** @@ -59,7 +59,7 @@ public void initWithMissingConfigResource(TestContext context) { Async async = context.async(); context.assertFalse(handler.isInitialized()); handler.initialize().onComplete(event -> { - verifyZeroInteractions(repository); + verifyNoInteractions(repository); context.assertFalse(handler.isInitialized()); async.complete(); }); @@ -92,7 +92,7 @@ public void handleWithNoConfigNoHeaderNoDefaults(TestContext context) { final boolean handled = handler.handle(request); context.assertFalse(handled); - verifyZeroInteractions(repository); + verifyNoInteractions(repository); async.complete(); }); @@ -113,7 +113,7 @@ public void handleWithNoConfigNoHeaderWithDefaults(TestContext context) { final boolean handled = handler.handle(request); context.assertFalse(handled); - verifyZeroInteractions(repository); + verifyNoInteractions(repository); async.complete(); }); } @@ -132,7 +132,7 @@ public void handleWithNoConfigWithHeaderMatchingDefaults(TestContext context) { final boolean handled = handler.handle(request); context.assertFalse(handled); - verifyZeroInteractions(repository); + verifyNoInteractions(repository); async.complete(); }); } @@ -259,7 +259,7 @@ public void resourceRemovedNotMatchingUri(TestContext context){ context.assertTrue(handler.isInitialized()); handler.resourceRemoved("/some/other/uri"); - verifyZeroInteractions(repository); + verifyNoInteractions(repository); context.assertTrue(handler.isInitialized()); async.complete(); }); @@ -275,7 +275,7 @@ public void resourceChangedNotMatchingUri(TestContext context){ context.assertTrue(handler.isInitialized()); handler.resourceChanged("/some/other/uri", Buffer.buffer(VALID_CONFIG2)); - verifyZeroInteractions(repository); + verifyNoInteractions(repository); context.assertTrue(handler.isInitialized()); async.complete(); }); diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/qos/QoSTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/qos/QoSTest.java index fb3284dbd..7567f76f8 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/qos/QoSTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/qos/QoSTest.java @@ -15,7 +15,7 @@ import javax.management.*; import static io.restassured.RestAssured.*; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; /** diff --git a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/DefaultValidationSchemaProviderTest.java b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/DefaultValidationSchemaProviderTest.java index 7a31ddcd3..8a22a201a 100644 --- a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/DefaultValidationSchemaProviderTest.java +++ b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/DefaultValidationSchemaProviderTest.java @@ -18,7 +18,7 @@ import java.time.Duration; import java.util.Map; -import static org.mockito.Matchers.*; +import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/ValidationHandlerTest.java b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/ValidationHandlerTest.java index 32f6354c2..535e573c8 100755 --- a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/ValidationHandlerTest.java +++ b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/ValidationHandlerTest.java @@ -13,14 +13,14 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; +import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.swisspush.gateleen.core.storage.MockResourceStorage; import org.swisspush.gateleen.core.util.StatusCode; import java.util.Optional; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; /** @@ -105,7 +105,7 @@ public void setUp() { httpClient = Mockito.mock(HttpClient.class); clientRequest = Mockito.mock(HttpClientRequest.class); Mockito.when(clientRequest.headers()).thenReturn(new HeadersMultiMap()); - Mockito.when(httpClient.request(any(HttpMethod.class), Matchers.anyString())) + Mockito.when(httpClient.request(any(HttpMethod.class), ArgumentMatchers.anyString())) .thenReturn(Future.succeededFuture(clientRequest)); storage = new MockResourceStorage(); @@ -253,7 +253,7 @@ public void testValidateSchemaLocationWithValidPayload(TestContext context) { validationHandler.handle(request); - verifyZeroInteractions(response); + verifyNoInteractions(response); } @Test diff --git a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/ValidatorTest.java b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/ValidatorTest.java index 1393e2c94..291b59533 100755 --- a/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/ValidatorTest.java +++ b/gateleen-validation/src/test/java/org/swisspush/gateleen/validation/ValidatorTest.java @@ -17,7 +17,7 @@ import java.util.Optional; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; @RunWith(VertxUnitRunner.class) diff --git a/pom.xml b/pom.xml index 38aef7661..b4156c9ad 100644 --- a/pom.xml +++ b/pom.xml @@ -73,8 +73,8 @@ 20231013 2.4.10 2.12.6 - 2.6.0 - 1.10.19 + 2.8.0 + 5.8.0 3.0.0 0.1.15 4.4.0 @@ -446,18 +446,6 @@ rest-assured ${rest-assured.version} - - - - - - - - - - - - org.eclipse.jetty.websocket websocket-client @@ -494,7 +482,7 @@ org.slf4j - slf4j-simple + slf4j-api ${slf4j.version} @@ -507,11 +495,6 @@ commons-lang3 ${commons-lang3.version} - - - - - org.webjars From a01e8827ba65d0e845e1439fee6ee385f71b5302 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Wed, 17 Jan 2024 08:18:12 +0100 Subject: [PATCH 04/13] Fixed ReducedPropagationManagerTest --- .../reducedpropagation/ReducedPropagationManagerTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java index ca462832b..57acaf179 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/reducedpropagation/ReducedPropagationManagerTest.java @@ -114,7 +114,7 @@ public void testProcessIncomingRequestWithAddQueueStorageError(TestContext conte ArgumentCaptor queuesCaptor = ArgumentCaptor.forClass(String.class); verify(requestQueue, timeout(1000).times(1)).lockedEnqueue(requestCaptor.capture(), - queuesCaptor.capture(), eq(LOCK_REQUESTER), any(Handler.class)); + queuesCaptor.capture(), eq(LOCK_REQUESTER), isNull()); // verify that request has been locked-enqueued in original queue HttpRequest originalEnqueue = requestCaptor.getValue(); @@ -159,7 +159,7 @@ public void testProcessIncomingRequestStartingNewTimerAndSuccessfulStoreQueueReq ArgumentCaptor queuesCaptor = ArgumentCaptor.forClass(String.class); verify(requestQueue, timeout(1000).times(1)).lockedEnqueue(requestCaptor.capture(), - queuesCaptor.capture(), eq(LOCK_REQUESTER), any(Handler.class)); + queuesCaptor.capture(), eq(LOCK_REQUESTER), isNull()); List requests = requestCaptor.getAllValues(); List queues = queuesCaptor.getAllValues(); @@ -212,7 +212,7 @@ public void testProcessIncomingRequestStartingNewTimerAndFailingStoreQueueReques ArgumentCaptor queuesCaptor = ArgumentCaptor.forClass(String.class); verify(requestQueue, timeout(1000).times(1)).lockedEnqueue(requestCaptor.capture(), - queuesCaptor.capture(), eq(LOCK_REQUESTER), any(Handler.class)); + queuesCaptor.capture(), eq(LOCK_REQUESTER), isNull()); List requests = requestCaptor.getAllValues(); List queues = queuesCaptor.getAllValues(); @@ -262,7 +262,7 @@ public void testProcessIncomingRequestStartingExistingTimer(TestContext context) ArgumentCaptor queuesCaptor = ArgumentCaptor.forClass(String.class); verify(requestQueue, timeout(1000).times(1)).lockedEnqueue(requestCaptor.capture(), - queuesCaptor.capture(), eq(LOCK_REQUESTER), any(Handler.class)); + queuesCaptor.capture(), eq(LOCK_REQUESTER), isNull()); // verify that request has been locked-enqueued in original queue HttpRequest originalEnqueue = requestCaptor.getValue(); From 3885f7c888c9c2839e80491ddeaf1b3ada37e7ac Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Wed, 17 Jan 2024 12:35:31 +0100 Subject: [PATCH 05/13] Some cleanup --- .../cache/fetch/DefaultCacheDataFetcher.java | 2 +- .../gateleen/core/http/ClientRequestCreator.java | 2 +- .../gateleen/core/http/LocalHttpConnection.java | 1 - .../core/http/LocalHttpServerResponse.java | 4 ---- .../swisspush/gateleen/core/json/JsonMultiMap.java | 5 ++--- .../gateleen/core/property/PropertyHandler.java | 2 +- .../core/resource/CopyResourceHandler.java | 4 ++-- .../gateleen/core/storage/HttpResourceStorage.java | 8 +++----- .../org/swisspush/gateleen/delta/DeltaHandler.java | 4 ++-- .../gateleen/expansion/ExpansionHandler.java | 6 +++--- .../gateleen/expansion/ZipExtractHandler.java | 2 +- .../org/swisspush/gateleen/hook/HookHandler.java | 8 ++++---- .../org/swisspush/gateleen/merge/MergeHandler.java | 14 +++++++------- .../gateleen/queue/queuing/QueueProcessor.java | 2 +- .../routing/CustomHttpResponseHandler.java | 2 +- .../org/swisspush/gateleen/routing/Forwarder.java | 4 ++-- .../scheduler/SchedulerResourceManager.java | 4 ++-- .../gateleen/validation/ValidationException.java | 2 +- .../gateleen/validation/ValidationHandler.java | 2 +- .../validation/ValidationResourceManager.java | 2 +- .../swisspush/gateleen/validation/Validator.java | 8 ++++---- 21 files changed, 40 insertions(+), 48 deletions(-) diff --git a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/fetch/DefaultCacheDataFetcher.java b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/fetch/DefaultCacheDataFetcher.java index 9b5909398..d090c9b21 100644 --- a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/fetch/DefaultCacheDataFetcher.java +++ b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/fetch/DefaultCacheDataFetcher.java @@ -62,7 +62,7 @@ public Future> fetchData(final String requestUri, Hea return; } HttpClientRequest cReq = event.result(); - cReq.setTimeout(requestTimeoutMs); + cReq.idleTimeout(requestTimeoutMs); cReq.headers().setAll(requestHeaders); cReq.headers().set("Accept", "application/json"); cReq.headers().set(SELF_REQUEST_HEADER, "true"); diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/ClientRequestCreator.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/ClientRequestCreator.java index 916f7650b..3d0e91da0 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/ClientRequestCreator.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/ClientRequestCreator.java @@ -32,7 +32,7 @@ public Future createClientRequest(HttpMethod method, String r } delegateRequest.headers().setAll(headers); delegateRequest.exceptionHandler(exceptionHandler); - delegateRequest.setTimeout(timeoutMs); // avoids blocking other requests + delegateRequest.idleTimeout(timeoutMs); // avoids blocking other requests promise.complete(delegateRequest); }); return promise.future(); diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java index 91d72f38e..2d5b8e13e 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java @@ -10,7 +10,6 @@ import io.vertx.core.http.HttpConnection; import io.vertx.core.net.SocketAddress; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java index 0637e9870..d6ad0845c 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpServerResponse.java @@ -1,17 +1,13 @@ package org.swisspush.gateleen.core.http; -import io.vertx.codegen.annotations.Nullable; import io.vertx.core.*; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.*; - import io.vertx.core.http.impl.headers.HeadersMultiMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.swisspush.gateleen.core.util.StatusCode; -import java.util.Set; - /** * Bridges the reponses of a LocalHttpClientRequest. * diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/json/JsonMultiMap.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/json/JsonMultiMap.java index bbfb5aff3..e6d508b3d 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/json/JsonMultiMap.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/json/JsonMultiMap.java @@ -1,11 +1,10 @@ package org.swisspush.gateleen.core.json; -import java.util.Iterator; -import java.util.Map; - import io.vertx.core.MultiMap; import io.vertx.core.json.JsonArray; +import java.util.Map; + public final class JsonMultiMap { private JsonMultiMap(){} diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/property/PropertyHandler.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/property/PropertyHandler.java index 7e7c4d673..e1f1e01dc 100755 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/property/PropertyHandler.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/property/PropertyHandler.java @@ -141,7 +141,7 @@ public boolean handle(final HttpServerRequest request) { } if (!found) { - log.warn("id for the request PUT {} could not be found: {}", request.uri(), body.toString()); + log.warn("id for the request PUT {} could not be found: {}", request.uri(), body); } // everythin is fine diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/resource/CopyResourceHandler.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/resource/CopyResourceHandler.java index 889703486..b6a9aabad 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/resource/CopyResourceHandler.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/resource/CopyResourceHandler.java @@ -102,7 +102,7 @@ protected void performGETRequest(final HttpServerRequest request, final CopyTask selfRequest.headers().setAll(task.getHeaders()); // avoids blocking other requests - selfRequest.setTimeout(DEFAULT_TIMEOUT); + selfRequest.idleTimeout(DEFAULT_TIMEOUT); // add exception handler selfRequest.exceptionHandler( ex -> { @@ -152,7 +152,7 @@ protected void performPUTRequest(final HttpServerRequest request, final HttpClie selfRequest.write(data); // avoids blocking other requests - selfRequest.setTimeout(DEFAULT_TIMEOUT); + selfRequest.idleTimeout(DEFAULT_TIMEOUT); // fire selfRequest.send(asyncResult -> { diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/storage/HttpResourceStorage.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/storage/HttpResourceStorage.java index 2d9464604..3a5ba74af 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/storage/HttpResourceStorage.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/storage/HttpResourceStorage.java @@ -10,8 +10,6 @@ import org.swisspush.gateleen.core.util.HttpHeaderUtil; import org.swisspush.gateleen.core.util.StatusCode; -import static org.swisspush.gateleen.core.util.StatusCode.INTERNAL_SERVER_ERROR; - /** * Gives programmatic access to the resource storage. * @@ -57,7 +55,7 @@ public void get(final String path, final Handler bodyHandler) { log.error("Storage request error", new Exception("stacktrace", e)); bodyHandler.handle(null); }); - request.setTimeout(TIMEOUT); + request.idleTimeout(TIMEOUT); request.send(event -> { HttpClientResponse response = event.result(); response.exceptionHandler(exception -> { @@ -102,7 +100,7 @@ public void put(final String uri, MultiMap headers, Buffer buffer, final Handler HttpHeaderUtil.mergeHeaders(request.headers(), headers, uri); } - request.setTimeout(TIMEOUT); + request.idleTimeout(TIMEOUT); request.putHeader("Content-Length", "" + buffer.length()); request.write(buffer); request.send(asyncRespnose -> { @@ -138,7 +136,7 @@ public void delete(final String uri, final Handler doneHandler) { log.warn("Deleting {} failed", uri, new Exception("stacktrace", ex)); doneHandler.handle(StatusCode.INTERNAL_SERVER_ERROR.getStatusCode()); }); - request.setTimeout(TIMEOUT); + request.idleTimeout(TIMEOUT); request.send(asyncRespnose -> { if( asyncRespnose.failed() ){ log.error("TODO error handling", new Exception(request.getURI(), asyncRespnose.cause())); diff --git a/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java b/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java index 352dfa7a9..fa37b8cb2 100755 --- a/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java +++ b/gateleen-delta/src/main/java/org/swisspush/gateleen/delta/DeltaHandler.java @@ -295,7 +295,7 @@ private void handleCollectionGET(final HttpServerRequest request, final String u } HttpClientRequest cReq = asyncResult.result(); - cReq.setTimeout(TIMEOUT); + cReq.idleTimeout(TIMEOUT); cReq.headers().setAll(request.headers()); // add a marker header to signalize, that in the next loop of the mainverticle we should pass the deltahandler cReq.headers().set(DELTA_BACKEND_HEADER, ""); @@ -324,7 +324,7 @@ private void handleCollectionGET(final HttpServerRequest request, final String u final long updateIdNumber = extractNumberDeltaParameter(updateId, request, log); if (log.isTraceEnabled()) { - log.trace("DeltaHandler: deltaResourceKeys for targetUri ({}): {}", targetUri, deltaResourceKeys.toString()); + log.trace("DeltaHandler: deltaResourceKeys for targetUri ({}): {}", targetUri, deltaResourceKeys); } if (deltaResourceKeys.size() > 0) { diff --git a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java index d0dd971bd..15fb35a74 100755 --- a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java +++ b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java @@ -404,7 +404,7 @@ private void handleExpansionRequest(final HttpServerRequest req, final Recursive if (log.isTraceEnabled()) { log.trace("set cReq headers"); } - cReq.setTimeout(TIMEOUT); + cReq.idleTimeout(TIMEOUT); cReq.headers().setAll(req.headers()); cReq.headers().set("Accept", "application/json"); cReq.headers().set(SELF_REQUEST_HEADER, "true"); @@ -514,7 +514,7 @@ private void makeStorageExpandRequest(final String targetUri, final List subReso requestPayload.put("subResources", new JsonArray(subResourceNames)); Buffer payload = Buffer.buffer(requestPayload.encodePrettily()); - cReq.setTimeout(TIMEOUT); + cReq.idleTimeout(TIMEOUT); cReq.headers().setAll(req.headers()); cReq.headers().set(SELF_REQUEST_HEADER, "true"); cReq.headers().set("Content-Type", "application/json; charset=utf-8"); @@ -591,7 +591,7 @@ private void makeResourceSubRequest(final String targetUri, final HttpServerRequ if (log.isTraceEnabled()) { log.trace("set the cReq headers for the subRequest"); } - cReq.setTimeout(TIMEOUT); + cReq.idleTimeout(TIMEOUT); cReq.headers().setAll(req.headers()); cReq.headers().set("Accept", "application/json"); cReq.headers().set(SELF_REQUEST_HEADER, "true"); diff --git a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ZipExtractHandler.java b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ZipExtractHandler.java index fadca6f06..8c953da54 100644 --- a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ZipExtractHandler.java +++ b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ZipExtractHandler.java @@ -85,7 +85,7 @@ protected void performGETRequest(final HttpServerRequest req, final String zipUr selfRequest.headers().setAll(req.headers()); // avoids blocking other requests - selfRequest.setTimeout(DEFAULT_TIMEOUT); + selfRequest.idleTimeout(DEFAULT_TIMEOUT); // fire selfRequest.send(event -> { diff --git a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java index f0ec0542e..adb320f67 100755 --- a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java +++ b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/HookHandler.java @@ -598,7 +598,7 @@ private boolean createListingIfRequested(final HttpServerRequest request) { selfRequest.headers().add(HOOK_ROUTES_LISTED, "true"); selfRequest.exceptionHandler(exception -> log.warn("HookHandler: listing of collections (routes) failed: {}: {}", request.uri(), exception.getMessage())); - selfRequest.setTimeout(120000); // avoids blocking other requests + selfRequest.idleTimeout(120000); // avoids blocking other requests selfRequest.send(asyncResult -> { HttpClientResponse response = asyncResult.result(); HttpServerRequestUtil.prepareResponse(request, response); @@ -623,7 +623,7 @@ private boolean createListingIfRequested(final HttpServerRequest request) { } if (log.isTraceEnabled()) { - log.trace("createListingIfRequested > response: {}", responseObject.toString()); + log.trace("createListingIfRequested > response: {}", responseObject); } // write the response @@ -649,7 +649,7 @@ else if (response.statusCode() == StatusCode.NOT_FOUND.getStatusCode()) { collections.forEach(parentCollectionArray::add); if (log.isTraceEnabled()) { - log.trace("createListingIfRequested > response: {}", responseObject.toString()); + log.trace("createListingIfRequested > response: {}", responseObject); } // write the response @@ -1199,7 +1199,7 @@ private void createSelfRequest(final HttpServerRequest request, final Buffer req selfRequest.exceptionHandler(exception -> log.warn("HookHandler HOOK_ERROR: Failed self request to {}: {}", request.uri(), exception.getMessage())); - selfRequest.setTimeout(120000); // avoids blocking other requests + selfRequest.idleTimeout(120000); // avoids blocking other requests Handler> asyncResultHandler = asyncResult -> { HttpClientResponse response = asyncResult.result(); diff --git a/gateleen-merge/src/main/java/org/swisspush/gateleen/merge/MergeHandler.java b/gateleen-merge/src/main/java/org/swisspush/gateleen/merge/MergeHandler.java index 6e6a20ffe..e39bda658 100644 --- a/gateleen-merge/src/main/java/org/swisspush/gateleen/merge/MergeHandler.java +++ b/gateleen-merge/src/main/java/org/swisspush/gateleen/merge/MergeHandler.java @@ -80,7 +80,7 @@ public boolean handle(final HttpServerRequest request) { HttpClientRequest cReq = asyncReqResult.result(); - cReq.setTimeout(TIMEOUT); + cReq.idleTimeout(TIMEOUT); cReq.headers().set("Accept", "application/json"); cReq.headers().set(SELF_REQUEST_HEADER, "true"); cReq.setChunked(true); @@ -101,7 +101,7 @@ public boolean handle(final HttpServerRequest request) { JsonObject dataObject = new JsonObject(data.toString()); if (log.isTraceEnabled()) { - log.trace(" >> body is \"{}\"", dataObject.toString()); + log.trace(" >> body is \"{}\"", dataObject); } // we get an array back @@ -210,7 +210,7 @@ private void requestCollection(final HttpServerRequest request, HttpClientRequest collectionRequest = asyncReqResult.result(); - collectionRequest.setTimeout(TIMEOUT); + collectionRequest.idleTimeout(TIMEOUT); collectionRequest.headers().set("Accept", "application/json"); collectionRequest.headers().set(SELF_REQUEST_HEADER, "true"); collectionRequest.setChunked(true); @@ -259,7 +259,7 @@ In this case there may only exists (always) one Element if (log.isTraceEnabled()) { - log.trace("requestCollection >> uri is: {}, body is: {}", parentUrl, data.toString()); + log.trace("requestCollection >> uri is: {}, body is: {}", parentUrl, data); } @@ -505,7 +505,7 @@ private void performMergeRequest(final HttpServerRequest request, final MergeDat } HttpClientRequest mergeRequest = asyncReqResult.result(); - mergeRequest.setTimeout(TIMEOUT); + mergeRequest.idleTimeout(TIMEOUT); HttpHeaderUtil.mergeHeaders(mergeRequest.headers(), request.headers(), request.uri()); mergeRequest.headers().set(SELF_REQUEST_HEADER, "true"); mergeRequest.headers().remove(MERGE_HEADER); @@ -608,7 +608,7 @@ private void createMergedResponse(final HttpServerRequest request, final String for (final MergeData data : collectionData) { final JsonObject dataObject = new JsonObject(data.getContent().toString()); if (log.isTraceEnabled()) { - log.trace("createMergedResponse > loop - {}", dataObject.toString()); + log.trace("createMergedResponse > loop - {}", dataObject); } if (dataObject.getValue(collectionName) instanceof JsonArray) { @@ -659,7 +659,7 @@ private void performDirectRequest(final HttpServerRequest request, final MergeDa } HttpClientRequest directRequest = asyncReqResult.result(); - directRequest.setTimeout(TIMEOUT); + directRequest.idleTimeout(TIMEOUT); HttpHeaderUtil.mergeHeaders(directRequest.headers(), request.headers(), request.uri()); directRequest.headers().set(SELF_REQUEST_HEADER, "true"); directRequest.headers().remove(MERGE_HEADER); diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueueProcessor.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueueProcessor.java index 657cfe2ec..d8f496ddb 100755 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueueProcessor.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueueProcessor.java @@ -273,7 +273,7 @@ private void executeQueuedRequest(Message message, Logger logger, Ht performCircuitBreakerActions(queueName, queuedRequest, FAILURE, state); }); }; - request1.setTimeout(120000); // avoids blocking other requests + request1.idleTimeout(120000); // avoids blocking other requests if (queuedRequest.getPayload() != null) { request1.send(Buffer.buffer(queuedRequest.getPayload()), httpAsyncHandler); } else { diff --git a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/CustomHttpResponseHandler.java b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/CustomHttpResponseHandler.java index bfa217155..c43cde14b 100644 --- a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/CustomHttpResponseHandler.java +++ b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/CustomHttpResponseHandler.java @@ -49,7 +49,7 @@ public boolean handle(HttpServerRequest request) { rs = HttpResponseStatus.BAD_REQUEST; info = ": missing, wrong or non-numeric status-code in request URL"; } - request.response().setStatusCode(rs.code()).setStatusMessage(rs.reasonPhrase()).end(rs.toString() + info); + request.response().setStatusCode(rs.code()).setStatusMessage(rs.reasonPhrase()).end(rs + info); return true; } } diff --git a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java index ad38f4a4e..649edcedb 100755 --- a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java +++ b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java @@ -260,9 +260,9 @@ public void handle(AsyncResult event) { cReq.response(cResHandler); if (timeout != null) { - cReq.setTimeout(Long.parseLong(timeout)); + cReq.idleTimeout(Long.parseLong(timeout)); } else { - cReq.setTimeout(rule.getTimeout()); + cReq.idleTimeout(rule.getTimeout()); } // per https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.10 diff --git a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java index b52559b5c..59b6d1eb6 100755 --- a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java +++ b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/SchedulerResourceManager.java @@ -89,7 +89,7 @@ private void updateSchedulers(Buffer buffer) { try { schedulers = schedulerFactory.parseSchedulers(buffer); } catch(ValidationException validationException) { - log.error("Could not parse schedulers: " + validationException.toString()); + log.error("Could not parse schedulers: " + validationException); } finally { vertx.setTimer(2000, aLong -> startSchedulers()); } @@ -101,7 +101,7 @@ public boolean handleSchedulerResource(final HttpServerRequest request) { try { schedulerFactory.parseSchedulers(buffer); } catch (ValidationException validationException) { - log.warn("Could not parse schedulers: " + validationException.toString()); + log.warn("Could not parse schedulers: " + validationException); ResponseStatusCodeLogUtil.info(request, StatusCode.BAD_REQUEST, SchedulerResourceManager.class); request.response().setStatusCode(StatusCode.BAD_REQUEST.getStatusCode()); request.response().setStatusMessage(StatusCode.BAD_REQUEST.getStatusMessage() + " " + validationException.getMessage()); diff --git a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationException.java b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationException.java index cc6d66fc3..fe0b1861c 100755 --- a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationException.java +++ b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationException.java @@ -33,7 +33,7 @@ public JsonArray getValidationDetails() { public String toString() { StringBuilder stringBuilder = new StringBuilder("ValidationException: ").append(getMessage()); if(validationDetails != null){ - stringBuilder.append(" Details: ").append(validationDetails.toString()); + stringBuilder.append(" Details: ").append(validationDetails); } return stringBuilder.toString(); } diff --git a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationHandler.java b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationHandler.java index ddea2be71..dbb9b3043 100755 --- a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationHandler.java +++ b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationHandler.java @@ -104,7 +104,7 @@ private void handleValidation(final HttpServerRequest req) { HttpClientRequest cReq = asyncReqResult.result(); - cReq.setTimeout(TIMEOUT); + cReq.idleTimeout(TIMEOUT); cReq.headers().setAll(req.headers()); cReq.headers().set(VALID_HEADER, "0"); Handler> resultHandler = asyncResult -> { diff --git a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationResourceManager.java b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationResourceManager.java index 02452dd93..37221ea8e 100755 --- a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationResourceManager.java +++ b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationResourceManager.java @@ -90,7 +90,7 @@ public boolean handleValidationResource(final HttpServerRequest request) { extractValidationValues(validationResourceBuffer); } catch (ValidationException validationException) { updateValidationResource(); - log.error("Could not parse validation resource: " + validationException.toString()); + log.error("Could not parse validation resource: " + validationException); ResponseStatusCodeLogUtil.info(request, StatusCode.BAD_REQUEST, ValidationResourceManager.class); request.response().setStatusCode(StatusCode.BAD_REQUEST.getStatusCode()); request.response().setStatusMessage(StatusCode.BAD_REQUEST.getStatusMessage()); diff --git a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/Validator.java b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/Validator.java index a0f2d01cc..5d15b45b2 100755 --- a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/Validator.java +++ b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/Validator.java @@ -195,7 +195,7 @@ private static Future performValidation(JsonSchema schema, Sch JsonNode jsonNode = new ObjectMapper().readTree(jsonBuffer.getBytes()); if (jsonNode == null) { promise.complete(new ValidationResult(ValidationStatus.VALIDATED_NEGATIV, - "no valid JSON object: " + jsonBuffer.toString())); + "no valid JSON object: " + jsonBuffer)); return promise.future(); } final Set valMsgs = schema.validate(jsonNode); @@ -212,7 +212,7 @@ private static Future performValidation(JsonSchema schema, Sch .append(" | Report: ").append(getReportAsString(valMsgs)); if (log.isDebugEnabled()) { - msgBuilder.append(" | Validated JSON: ").append(jsonBuffer.toString()); + msgBuilder.append(" | Validated JSON: ").append(jsonBuffer); } log.warn(msgBuilder.toString()); @@ -234,7 +234,7 @@ private static void performValidation(JsonSchema schema, Logger log, String base try { JsonNode jsonNode = new ObjectMapper().readTree(jsonBuffer.getBytes()); if (jsonNode == null) { - throw new IOException("no valid JSON object: " + jsonBuffer.toString()); + throw new IOException("no valid JSON object: " + jsonBuffer); } final Set valMsgs = schema.validate(jsonNode); if (valMsgs.isEmpty()) { @@ -252,7 +252,7 @@ private static void performValidation(JsonSchema schema, Logger log, String base .append(" | Report: ").append(getReportAsString(valMsgs)); if (log.isDebugEnabled()) { - msgBuilder.append(" | Validated JSON: ").append(jsonBuffer.toString()); + msgBuilder.append(" | Validated JSON: ").append(jsonBuffer); } log.warn(msgBuilder.toString()); From a2c9e50ec17bb3f6130b23edae20267387861d43 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Wed, 17 Jan 2024 15:05:33 +0100 Subject: [PATCH 06/13] Updated versioning --- gateleen-cache/pom.xml | 2 +- gateleen-core/pom.xml | 2 +- gateleen-delegate/pom.xml | 2 +- gateleen-delta/pom.xml | 2 +- gateleen-expansion/pom.xml | 2 +- gateleen-hook-js/pom.xml | 2 +- gateleen-hook/pom.xml | 2 +- gateleen-kafka/pom.xml | 2 +- gateleen-logging/pom.xml | 2 +- gateleen-merge/pom.xml | 2 +- gateleen-monitoring/pom.xml | 2 +- gateleen-packing/pom.xml | 2 +- gateleen-player/pom.xml | 2 +- gateleen-playground/pom.xml | 2 +- gateleen-qos/pom.xml | 2 +- gateleen-queue/pom.xml | 2 +- gateleen-routing/pom.xml | 2 +- gateleen-runconfig/pom.xml | 2 +- gateleen-scheduler/pom.xml | 2 +- gateleen-security/pom.xml | 2 +- gateleen-test/pom.xml | 2 +- gateleen-testhelper/pom.xml | 2 +- gateleen-user/pom.xml | 2 +- gateleen-validation/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml index 1e20966c0..01a8e09e8 100644 --- a/gateleen-cache/pom.xml +++ b/gateleen-cache/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-cache diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml index 5a0081187..5c4b682a4 100644 --- a/gateleen-core/pom.xml +++ b/gateleen-core/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-core diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml index e6a38b8ee..788485c10 100644 --- a/gateleen-delegate/pom.xml +++ b/gateleen-delegate/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-delegate diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml index 3de846c29..6722df20f 100644 --- a/gateleen-delta/pom.xml +++ b/gateleen-delta/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-delta diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml index e1f420fd1..6ecac6e56 100644 --- a/gateleen-expansion/pom.xml +++ b/gateleen-expansion/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-expansion diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index cba835ea7..d636303c2 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -4,7 +4,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-hook-js jar diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml index 0d64e87b3..e2cebf493 100644 --- a/gateleen-hook/pom.xml +++ b/gateleen-hook/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-hook diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml index f73df06a9..23320422c 100644 --- a/gateleen-kafka/pom.xml +++ b/gateleen-kafka/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-kafka diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml index 1235e7e45..b0d42a915 100644 --- a/gateleen-logging/pom.xml +++ b/gateleen-logging/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-logging diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml index 960de8e9f..2648da41d 100644 --- a/gateleen-merge/pom.xml +++ b/gateleen-merge/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-merge diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml index 19a811cb6..2a93bd4d0 100644 --- a/gateleen-monitoring/pom.xml +++ b/gateleen-monitoring/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-monitoring diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml index 488b506fe..034b1d921 100644 --- a/gateleen-packing/pom.xml +++ b/gateleen-packing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-packing diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index 6f50dc82b..a537b1620 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-player diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml index feafee495..c3dee126d 100644 --- a/gateleen-playground/pom.xml +++ b/gateleen-playground/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-playground diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml index 23968f1c7..d1821f0a3 100644 --- a/gateleen-qos/pom.xml +++ b/gateleen-qos/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-qos diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml index d5d75d8f4..3a1df6173 100644 --- a/gateleen-queue/pom.xml +++ b/gateleen-queue/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-queue diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml index e63b2c22f..064c6c1b2 100644 --- a/gateleen-routing/pom.xml +++ b/gateleen-routing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-routing diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml index ed9c1a6f9..7bc4ea141 100644 --- a/gateleen-runconfig/pom.xml +++ b/gateleen-runconfig/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-runconfig diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml index 21125ee44..c5a7977dd 100644 --- a/gateleen-scheduler/pom.xml +++ b/gateleen-scheduler/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-scheduler diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml index 756cfc885..ae8596eae 100644 --- a/gateleen-security/pom.xml +++ b/gateleen-security/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-security diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index 586950500..fef26f7fa 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-test jar diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index 61a466534..41df882a0 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-testhelper diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml index 92ab72cff..87c670ad2 100644 --- a/gateleen-user/pom.xml +++ b/gateleen-user/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-user diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml index 79b601a72..5a83a32fe 100644 --- a/gateleen-validation/pom.xml +++ b/gateleen-validation/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT gateleen-validation diff --git a/pom.xml b/pom.xml index b4156c9ad..04bbfa7d3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.0.4-SNAPSHOT + 2.1.0-SNAPSHOT pom gateleen Middleware library based on Vert.x to build advanced JSON/REST communication servers From 96b9caba9750cd0724fc85fe9c3d4016486457b9 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Thu, 18 Jan 2024 16:37:55 +0100 Subject: [PATCH 07/13] Removed noisy log --- .../org/swisspush/gateleen/core/http/LocalHttpConnection.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java index 2d5b8e13e..f40606d03 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/http/LocalHttpConnection.java @@ -54,8 +54,6 @@ public Future shutdown(long timeoutMs) { @Override public HttpConnection closeHandler(Handler handler) { - log.warn("Happy debugging, as this impl is going to ignore your closeHandler anyway", - new Exception("may this stacktrace help you")); return this; } From 1fa0a8f1431b5febe614b896812d11ce9efdf884 Mon Sep 17 00:00:00 2001 From: Marc-Andre Weber Date: Fri, 19 Jan 2024 17:26:51 +0100 Subject: [PATCH 08/13] Some code cleanup --- .../cache/fetch/DefaultCacheDataFetcher.java | 2 +- .../storage/CacheRequestRedisCommand.java | 2 +- .../cache/storage/ClearCacheRedisCommand.java | 2 +- .../ConfigurationResourceManager.java | 2 +- .../lock/lua/ReleaseLockRedisCommand.java | 2 +- .../core/resource/CopyResourceHandler.java | 4 +-- .../ConfigurationResourceManagerTest.java | 3 +- .../core/util/HttpHeaderUtilTest.java | 2 -- .../gateleen/delta/DeltaHandlerTest.java | 1 - .../gateleen/expansion/ExpansionHandler.java | 2 +- .../expansion/RecursiveZipRootHandler.java | 4 +-- .../gateleen/hook/RouteRepositoryBase.java | 2 +- .../lua/RemoveExpiredQueuesRedisCommand.java | 2 +- .../lua/StartQueueTimerRedisCommand.java | 2 +- .../gateleen/hook/HookHandlerTest.java | 11 ++++-- .../gateleen/kafka/KafkaTopicExtractor.java | 2 +- .../gateleen/merge/MergeHandler.java | 2 +- .../gateleen/monitoring/ResetMetrics.java | 2 +- .../monitoring/ResetMetricsController.java | 2 +- .../swisspush/gateleen/qos/QoSHandler.java | 10 +++--- .../gateleen/queue/queuing/QueueBrowser.java | 4 +-- .../impl/QueueCircuitBreakerImpl.java | 14 ++++---- .../lua/CloseCircuitRedisCommand.java | 2 +- .../lua/HalfOpenCircuitRedisCommand.java | 2 +- .../lua/ReOpenCircuitRedisCommand.java | 2 +- .../lua/UnlockSampleQueuesRedisCommand.java | 2 +- .../lua/UpdateStatsRedisCommand.java | 4 +-- ...uitBreakerRulePatternToCircuitMapping.java | 4 +-- .../impl/QueueCircuitBreakerImplTest.java | 1 - .../swisspush/gateleen/routing/Forwarder.java | 20 +++++------ .../gateleen/routing/RuleFactory.java | 6 ++-- .../routing/RuleFeaturesProvider.java | 2 +- .../gateleen/runconfig/RunConfig.java | 4 +-- .../gateleen/scheduler/Scheduler.java | 8 ++--- .../security/authorization/Authorizer.java | 22 ++++++------ .../authorization/RoleAuthorizer.java | 24 ++++++------- .../org/swisspush/gateleen/TestUtils.java | 10 +++--- .../gateleen/delegate/DelegateTest.java | 34 +++++++++---------- .../expansion/ExpandByBackendTest.java | 4 +-- .../gateleen/user/UserProfileTest.java | 6 ++-- .../user/UserProfileConfiguration.java | 20 +++++------ .../validation/ValidationResourceManager.java | 2 +- .../gateleen/validation/ValidationUtil.java | 2 +- 43 files changed, 128 insertions(+), 132 deletions(-) diff --git a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/fetch/DefaultCacheDataFetcher.java b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/fetch/DefaultCacheDataFetcher.java index d090c9b21..ad3deecf8 100644 --- a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/fetch/DefaultCacheDataFetcher.java +++ b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/fetch/DefaultCacheDataFetcher.java @@ -58,7 +58,7 @@ public Future> fetchData(final String requestUri, Hea promise.complete(Result.err(StatusCode.INTERNAL_SERVER_ERROR)); }).onComplete(event -> { if (event.failed()) { - log.warn("Failed request to {}: {}", requestUri, event.cause()); + log.warn("Failed request to {}", requestUri, event.cause()); return; } HttpClientRequest cReq = event.result(); diff --git a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/CacheRequestRedisCommand.java b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/CacheRequestRedisCommand.java index edb8283fd..cd1240938 100644 --- a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/CacheRequestRedisCommand.java +++ b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/CacheRequestRedisCommand.java @@ -46,7 +46,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("CacheRequestRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + executionCounter); + log.warn("amount the script got loaded: {}", executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/ClearCacheRedisCommand.java b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/ClearCacheRedisCommand.java index d31d7d167..5dd745841 100644 --- a/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/ClearCacheRedisCommand.java +++ b/gateleen-cache/src/main/java/org/swisspush/gateleen/cache/storage/ClearCacheRedisCommand.java @@ -42,7 +42,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("ClearCacheRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + executionCounter); + log.warn("amount the script got loaded: {}", executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManager.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManager.java index cf3861892..2a087ce38 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManager.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManager.java @@ -114,7 +114,7 @@ public boolean handleConfigurationResource(final HttpServerRequest request) { requestLog.info("Refresh resource {}", resourceUri); request.bodyHandler(buffer -> configurationResourceValidator.validateConfigurationResource(buffer, resourceSchema, event -> { if (event.failed() || (event.succeeded() && !event.result().isSuccess())) { - requestLog.error("Could not parse configuration resource for uri '" + resourceUri + "' message: " + event.result().getMessage()); + requestLog.error("Could not parse configuration resource for uri '{}' message: {}", resourceUri, event.result().getMessage()); request.response().setStatusCode(StatusCode.BAD_REQUEST.getStatusCode()); request.response().setStatusMessage(StatusCode.BAD_REQUEST.getStatusMessage() + " " + event.result().getMessage()); ResponseStatusCodeLogUtil.info(request, StatusCode.BAD_REQUEST, ConfigurationResourceManager.class); diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockRedisCommand.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockRedisCommand.java index eece7fed4..2a90e8484 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockRedisCommand.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/lock/lua/ReleaseLockRedisCommand.java @@ -47,7 +47,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("ReleaseLockRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + executionCounter); + log.warn("amount the script got loaded: {}", executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-core/src/main/java/org/swisspush/gateleen/core/resource/CopyResourceHandler.java b/gateleen-core/src/main/java/org/swisspush/gateleen/core/resource/CopyResourceHandler.java index b6a9aabad..f0913a6e7 100644 --- a/gateleen-core/src/main/java/org/swisspush/gateleen/core/resource/CopyResourceHandler.java +++ b/gateleen-core/src/main/java/org/swisspush/gateleen/core/resource/CopyResourceHandler.java @@ -105,9 +105,7 @@ protected void performGETRequest(final HttpServerRequest request, final CopyTask selfRequest.idleTimeout(DEFAULT_TIMEOUT); // add exception handler - selfRequest.exceptionHandler( ex -> { - log.warn("CopyResourceHandler: GET request failed: {}", request.uri(), new Exception("stacktrace", ex)); - }); + selfRequest.exceptionHandler( ex -> log.warn("CopyResourceHandler: GET request failed: {}", request.uri(), new Exception("stacktrace", ex))); // fire selfRequest.send(asyncResult -> { diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java index fcdfe8a16..57edbccab 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/configuration/ConfigurationResourceManagerTest.java @@ -8,13 +8,12 @@ import io.vertx.ext.unit.junit.VertxUnitRunner; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.swisspush.gateleen.core.http.DummyHttpServerResponse; import org.swisspush.gateleen.core.storage.MockResourceStorage; -import static org.awaitility.Awaitility.await; import static java.util.concurrent.TimeUnit.SECONDS; +import static org.awaitility.Awaitility.await; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.nullValue; diff --git a/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/HttpHeaderUtilTest.java b/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/HttpHeaderUtilTest.java index 16f6367fc..1cbaae41c 100644 --- a/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/HttpHeaderUtilTest.java +++ b/gateleen-core/src/test/java/org/swisspush/gateleen/core/util/HttpHeaderUtilTest.java @@ -7,8 +7,6 @@ import org.junit.Test; import org.junit.runner.RunWith; -import java.util.Map; -import java.util.function.Consumer; import java.util.regex.Pattern; diff --git a/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java b/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java index 68f0d9eed..d9cdddfd4 100644 --- a/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java +++ b/gateleen-delta/src/test/java/org/swisspush/gateleen/delta/DeltaHandlerTest.java @@ -15,7 +15,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.ArgumentMatchers; import org.swisspush.gateleen.core.http.DummyHttpServerRequest; import org.swisspush.gateleen.core.http.DummyHttpServerResponse; import org.swisspush.gateleen.core.redis.RedisProvider; diff --git a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java index 15fb35a74..c8be4176f 100755 --- a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java +++ b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/ExpansionHandler.java @@ -438,7 +438,7 @@ private void handleExpansionRequest(final HttpServerRequest req, final Recursive private Integer extractExpandParamValue(final HttpServerRequest request, final Logger log) { String expandValue = request.params().get(EXPAND_PARAM); - log.debug("got expand parameter value " + expandValue); + log.debug("got expand parameter value {}", expandValue); try { int value = Integer.parseInt(expandValue); diff --git a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/RecursiveZipRootHandler.java b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/RecursiveZipRootHandler.java index c935ac4b4..49fba6693 100755 --- a/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/RecursiveZipRootHandler.java +++ b/gateleen-expansion/src/main/java/org/swisspush/gateleen/expansion/RecursiveZipRootHandler.java @@ -103,7 +103,7 @@ public void handle(ResourceNode node) { ResponseStatusCodeLogUtil.debug(req, StatusCode.OK, RecursiveExpansionRootHandler.class); req.response().end(Buffer.buffer(outputStream.toByteArray())); } catch (Exception e) { - log.error("Error while writing zip: " + e.getMessage(), e); + log.error("Error while writing zip: {}", e.getMessage(), e); createErrorResponse(e); } } catch (ResourceCollectionException exception) { @@ -133,7 +133,7 @@ private void zipEntry(ZipOutputStream zipOutputStream, ResourceNode resourceNode zipOutputStream.closeEntry(); inputStream.close(); } catch (Exception e) { - log.error("Error while writing zip entry '" + resourceNode.getNodeName() + "'.", e); + log.error("Error while writing zip entry '{}'.", resourceNode.getNodeName(), e); } } diff --git a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/RouteRepositoryBase.java b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/RouteRepositoryBase.java index 4e51454f5..2c565f685 100644 --- a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/RouteRepositoryBase.java +++ b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/RouteRepositoryBase.java @@ -46,7 +46,7 @@ String findFirstMatchingKey(T container, String url) { * @param route */ void cleanupRoute(Route route) { - LOG.debug("Route for cleanup available? " + (route != null)); + LOG.debug("Route for cleanup available? {}", (route != null)); if (route != null) { route.cleanup(); diff --git a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java index 6ee17cdbb..da5ea7348 100644 --- a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java +++ b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/RemoveExpiredQueuesRedisCommand.java @@ -48,7 +48,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("RemoveExpiredQueuesRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + executionCounter); + log.warn("amount the script got loaded: {}", executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java index 629d7f8fe..cc44b6e28 100644 --- a/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java +++ b/gateleen-hook/src/main/java/org/swisspush/gateleen/hook/reducedpropagation/lua/StartQueueTimerRedisCommand.java @@ -43,7 +43,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("StartQueueTimerRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + executionCounter); + log.warn("amount the script got loaded: {}", executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java index 3d7dc82b2..0dbef201d 100644 --- a/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java +++ b/gateleen-hook/src/test/java/org/swisspush/gateleen/hook/HookHandlerTest.java @@ -15,11 +15,13 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.ArgumentMatcher; import org.mockito.Mockito; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.swisspush.gateleen.core.http.*; +import org.swisspush.gateleen.core.http.DummyHttpServerRequest; +import org.swisspush.gateleen.core.http.DummyHttpServerResponse; +import org.swisspush.gateleen.core.http.FastFailHttpServerRequest; +import org.swisspush.gateleen.core.http.FastFailHttpServerResponse; import org.swisspush.gateleen.core.storage.MockResourceStorage; import org.swisspush.gateleen.hook.reducedpropagation.ReducedPropagationManager; import org.swisspush.gateleen.logging.LogAppenderRepository; @@ -29,7 +31,10 @@ import org.swisspush.gateleen.queue.queuing.RequestQueue; import org.swisspush.gateleen.routing.Router; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; import java.util.concurrent.CountDownLatch; import static io.vertx.core.http.HttpMethod.PUT; diff --git a/gateleen-kafka/src/main/java/org/swisspush/gateleen/kafka/KafkaTopicExtractor.java b/gateleen-kafka/src/main/java/org/swisspush/gateleen/kafka/KafkaTopicExtractor.java index 4930be75d..b8c689b10 100644 --- a/gateleen-kafka/src/main/java/org/swisspush/gateleen/kafka/KafkaTopicExtractor.java +++ b/gateleen-kafka/src/main/java/org/swisspush/gateleen/kafka/KafkaTopicExtractor.java @@ -33,7 +33,7 @@ Optional extractTopic(HttpServerRequest request) { if (StringUtils.isNotEmptyTrimmed(topic)) { return Optional.of(topic); } - requestLog.warn("Extracted an empty string as topic from uri " + request.uri()); + requestLog.warn("Extracted an empty string as topic from uri {}", request.uri()); return Optional.empty(); } } diff --git a/gateleen-merge/src/main/java/org/swisspush/gateleen/merge/MergeHandler.java b/gateleen-merge/src/main/java/org/swisspush/gateleen/merge/MergeHandler.java index e39bda658..d06be4663 100644 --- a/gateleen-merge/src/main/java/org/swisspush/gateleen/merge/MergeHandler.java +++ b/gateleen-merge/src/main/java/org/swisspush/gateleen/merge/MergeHandler.java @@ -199,7 +199,7 @@ private void requestCollection(final HttpServerRequest request, final String targetUrlPart = getTargetUrlPart(requestUrl); if (log.isTraceEnabled()) { - log.trace("requestCollection > (requestUrl)" + requestUrl + " (parentUrl) " + parentUrl + " (targetUrlPart) " + targetUrlPart); + log.trace("requestCollection > (requestUrl) {} (parentUrl) {} (targetUrlPart) {}", requestUrl, parentUrl, targetUrlPart); } httpClient.request(HttpMethod.GET, parentUrl).onComplete(asyncReqResult -> { diff --git a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/ResetMetrics.java b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/ResetMetrics.java index 33c92f810..3ba4430db 100644 --- a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/ResetMetrics.java +++ b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/ResetMetrics.java @@ -51,7 +51,7 @@ private void removeMetric(final String metric){ log.debug("About to reset '{}' (triggered by an operation from MBean) by sending message to monitoring address '{}'", metric, monitoringAddress); vertx.eventBus().request(monitoringAddress, new JsonObject().put("name", metric).put("action", "remove"), (Handler>>) reply -> { if(reply.failed()){ - log.error("Failed to remove value for metric '"+metric+"'. Cause: " + reply.cause().getMessage(), reply.cause()); + log.error("Failed to remove value for metric '{}'. Cause: {}", metric, reply.cause().getMessage(), reply.cause()); } else { if (!RedisUtils.STATUS_OK.equals(reply.result().body().getString(RedisUtils.REPLY_STATUS))) { log.error("Removing value for metric '{}' resulted in status '{}'. Message: {}", metric, diff --git a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/ResetMetricsController.java b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/ResetMetricsController.java index a769a14f3..dcd0561a1 100644 --- a/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/ResetMetricsController.java +++ b/gateleen-monitoring/src/main/java/org/swisspush/gateleen/monitoring/ResetMetricsController.java @@ -31,7 +31,7 @@ public ResetMetricsController(Vertx vertx, String monitoringAddress){ } public void registerResetMetricsControlMBean(String domain, String prefix) { - log.debug("About to register ResetMetricsControlMBean with domain '"+domain+"', prefix '"+prefix+"' and monitoring address '"+monitoringAddress+"'"); + log.debug("About to register ResetMetricsControlMBean with domain '{}', prefix '{}' and monitoring address '{}'", domain, prefix, monitoringAddress); MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ResetMetrics resetMetrics = new ResetMetrics(vertx, prefix, monitoringAddress); ObjectName name; diff --git a/gateleen-qos/src/main/java/org/swisspush/gateleen/qos/QoSHandler.java b/gateleen-qos/src/main/java/org/swisspush/gateleen/qos/QoSHandler.java index aab9f3899..82f681b29 100644 --- a/gateleen-qos/src/main/java/org/swisspush/gateleen/qos/QoSHandler.java +++ b/gateleen-qos/src/main/java/org/swisspush/gateleen/qos/QoSHandler.java @@ -650,8 +650,8 @@ protected void evaluateQoSActions() { Set instances = mbeanServer.queryMBeans(null, null); for (ObjectInstance instance : instances) { log.trace("MBean Found:"); - log.trace("Class Name:t" + instance.getClassName()); - log.trace("Object Name:t" + instance.getObjectName()); + log.trace("Class Name:t{}", instance.getClassName()); + log.trace("Object Name:t{}", instance.getObjectName()); log.trace("****************************************"); } } @@ -723,13 +723,13 @@ protected void evaluateQoSActions() { log.warn("MBean {} for sentinel {} is not ready yet ...", name, sentinel.getName()); } } catch (MalformedObjectNameException e) { - log.error("Could not load MBean for metric name '" + sentinel.getName() + "'.", e); + log.error("Could not load MBean for metric name '{}'.", sentinel.getName(), e); } catch (AttributeNotFoundException e) { // ups ... should not be possible, we check if the bean is registered } catch (InstanceNotFoundException e) { - log.error("Could not find attribute " + sentinel.getPercentile() + PERCENTILE_SUFFIX + " for the MBean of the metric '" + sentinel.getName() + "'.", e); + log.error("Could not find attribute {} for the MBean of the metric '{}'.", sentinel.getPercentile() + PERCENTILE_SUFFIX, sentinel.getName(), e); } catch (MBeanException | ReflectionException e) { - log.error("Could not load value of attribute " + sentinel.getPercentile() + PERCENTILE_SUFFIX + " for the MBean of the metric '" + sentinel.getName() + "'.", e); + log.error("Could not load value of attribute {} for the MBean of the metric '{}'.", sentinel.getPercentile() + PERCENTILE_SUFFIX, sentinel.getName(), e); } } diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueueBrowser.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueueBrowser.java index b09a7c52b..3bc4ce1af 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueueBrowser.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/QueueBrowser.java @@ -264,7 +264,7 @@ private int getMaxQueueItemCountIndex(HttpServerRequest request) { defaultMaxIndex = maxIndex; } } catch (NumberFormatException ex) { - log.warn("Invalid limit parameter '" + limitParam + "' configured for max queue item count. Using default " + DEFAULT_MAX_QUEUEITEM_COUNT); + log.warn("Invalid limit parameter '{}' configured for max queue item count. Using default {}", limitParam, DEFAULT_MAX_QUEUEITEM_COUNT); } } return defaultMaxIndex; @@ -277,7 +277,7 @@ private int extractNumOfQueuesValue(String source, String separator) { numQueues = Integer.parseInt(numberOfQueuesStr); } catch (Exception e) { numQueues = DEFAULT_QUEUE_NUM; - log.warn("Queue size monitoring url was used with wrong or without number of queues param. Using default " + DEFAULT_QUEUE_NUM); + log.warn("Queue size monitoring url was used with wrong or without number of queues param. Using default {}", DEFAULT_QUEUE_NUM); } return numQueues; diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImpl.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImpl.java index 3c817be45..eb26a211c 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImpl.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImpl.java @@ -35,20 +35,20 @@ */ public class QueueCircuitBreakerImpl implements QueueCircuitBreaker, RuleChangesObserver, Refreshable { - private Logger log = LoggerFactory.getLogger(QueueCircuitBreakerImpl.class); + private final Logger log = LoggerFactory.getLogger(QueueCircuitBreakerImpl.class); - private Vertx vertx; - private QueueCircuitBreakerStorage queueCircuitBreakerStorage; - private QueueCircuitBreakerRulePatternToCircuitMapping ruleToCircuitMapping; - private QueueCircuitBreakerConfigurationResourceManager configResourceManager; + private final Vertx vertx; + private final QueueCircuitBreakerStorage queueCircuitBreakerStorage; + private final QueueCircuitBreakerRulePatternToCircuitMapping ruleToCircuitMapping; + private final QueueCircuitBreakerConfigurationResourceManager configResourceManager; - private Lock lock; + private final Lock lock; public static final String OPEN_TO_HALF_OPEN_TASK_LOCK = "openToHalfOpenTask"; public static final String UNLOCK_QUEUES_TASK_LOCK = "unlockQueuesTask"; public static final String UNLOCK_SAMPLE_QUEUES_TASK_LOCK = "unlockSampleQueuesTask"; - private String redisquesAddress; + private final String redisquesAddress; private long openToHalfOpenTimerId = -1; private long unlockQueuesTimerId = -1; diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/CloseCircuitRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/CloseCircuitRedisCommand.java index 4d9d5f813..3d6d91808 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/CloseCircuitRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/CloseCircuitRedisCommand.java @@ -41,7 +41,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("CloseCircuitRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + executionCounter); + log.warn("amount the script got loaded: {}", executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/HalfOpenCircuitRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/HalfOpenCircuitRedisCommand.java index 011218b71..635c98c2a 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/HalfOpenCircuitRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/HalfOpenCircuitRedisCommand.java @@ -41,7 +41,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("HalfOpenCircuitRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + executionCounter); + log.warn("amount the script got loaded: {}", executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/ReOpenCircuitRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/ReOpenCircuitRedisCommand.java index 3758b314e..65fef20d9 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/ReOpenCircuitRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/ReOpenCircuitRedisCommand.java @@ -41,7 +41,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("ReOpenCircuitRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + executionCounter); + log.warn("amount the script got loaded: {}", executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UnlockSampleQueuesRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UnlockSampleQueuesRedisCommand.java index 6c2751bf7..b5e084888 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UnlockSampleQueuesRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UnlockSampleQueuesRedisCommand.java @@ -43,7 +43,7 @@ public void exec(int executionCounter) { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("UnlockSampleQueuesRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + executionCounter); + log.warn("amount the script got loaded: {}", executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java index 8481e33be..86d6624fe 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/lua/UpdateStatsRedisCommand.java @@ -39,14 +39,14 @@ public void exec(int executionCounter) { if (event.succeeded()) { String value = event.result().toString(); if (log.isTraceEnabled()) { - log.trace("UpdateStatsRedisCommand lua script got result: " + value); + log.trace("UpdateStatsRedisCommand lua script got result: {}", value); } promise.complete(UpdateStatisticsResult.fromString(value, UpdateStatisticsResult.ERROR)); } else { String message = event.cause().getMessage(); if (message != null && message.startsWith("NOSCRIPT")) { log.warn("UpdateStatsRedisCommand script couldn't be found, reload it"); - log.warn("amount the script got loaded: " + executionCounter); + log.warn("amount the script got loaded: {}", executionCounter); if (executionCounter > 10) { promise.fail("amount the script got loaded is higher than 10, we abort"); } else { diff --git a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/util/QueueCircuitBreakerRulePatternToCircuitMapping.java b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/util/QueueCircuitBreakerRulePatternToCircuitMapping.java index b91809754..9ac19f372 100644 --- a/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/util/QueueCircuitBreakerRulePatternToCircuitMapping.java +++ b/gateleen-queue/src/main/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/util/QueueCircuitBreakerRulePatternToCircuitMapping.java @@ -41,7 +41,7 @@ public List updateRulePatternToCircuitMapping(List log.debug(patternAndCircuitHash.toString()); rulePatternToCircuitMapping.add(patternAndCircuitHash); } else { - log.error("rule pattern and circuitHash could not be retrieved from rule " + rule.getUrlPattern()); + log.error("rule pattern and circuitHash could not be retrieved from rule {}", rule.getUrlPattern()); } } return getRemovedPatternAndCircuitHashes(originalPatternAndCircuitHashes, rulePatternToCircuitMapping); @@ -68,7 +68,7 @@ private PatternAndCircuitHash getPatternAndCircuitHashFromRule(Rule rule){ String circuitHash = HashCodeGenerator.createHashCode(rule.getUrlPattern()); return new PatternAndCircuitHash(pattern, circuitHash); } catch (Exception e) { - log.error("Could not compile the regex:" + rule.getUrlPattern() + " to a pattern."); + log.error("Could not compile the regex:{} to a pattern.", rule.getUrlPattern()); return null; } } diff --git a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java index 763511715..21a31c522 100644 --- a/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java +++ b/gateleen-queue/src/test/java/org/swisspush/gateleen/queue/queuing/circuitbreaker/impl/QueueCircuitBreakerImplTest.java @@ -19,7 +19,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; -import org.mockito.ArgumentMatchers; import org.mockito.Mockito; import org.swisspush.gateleen.core.http.HttpRequest; import org.swisspush.gateleen.core.lock.Lock; diff --git a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java index 649edcedb..17114f6dc 100755 --- a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java +++ b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java @@ -40,19 +40,19 @@ */ public class Forwarder extends AbstractForwarder { - private String userProfilePath; - private HttpClient client; - private Pattern urlPattern; + private final String userProfilePath; + private final HttpClient client; + private final Pattern urlPattern; private String target; private int port; - private Rule rule; - private LoggingResourceManager loggingResourceManager; - private LogAppenderRepository logAppenderRepository; - private MonitoringHandler monitoringHandler; - private ResourceStorage storage; + private final Rule rule; + private final LoggingResourceManager loggingResourceManager; + private final LogAppenderRepository logAppenderRepository; + private final MonitoringHandler monitoringHandler; + private final ResourceStorage storage; @Nullable - private AuthStrategy authStrategy; - private Vertx vertx; + private final AuthStrategy authStrategy; + private final Vertx vertx; private static final String ON_BEHALF_OF_HEADER = "x-on-behalf-of"; private static final String USER_HEADER = "x-rp-usr"; diff --git a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/RuleFactory.java b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/RuleFactory.java index 981a39d76..3acf61117 100755 --- a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/RuleFactory.java +++ b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/RuleFactory.java @@ -53,7 +53,7 @@ public List createRules(JsonObject rules, int routeMultiplier) throws Vali Set metricNames = new HashSet<>(); List result = new ArrayList<>(); for (String urlPattern : rules.fieldNames()) { - log.debug("Creating a new rule-object for URL pattern " + urlPattern); + log.debug("Creating a new rule-object for URL pattern {}", urlPattern); Rule ruleObj = new Rule(); ruleObj.setUrlPattern(urlPattern); @@ -113,7 +113,7 @@ public List createRules(JsonObject rules, int routeMultiplier) throws Vali profileArray[i] = profile.getString(i); } ruleObj.setProfile(profileArray); - log.debug("The profile-array is set. Those profile-information will be sent: " + Arrays.toString(ruleObj.getProfile())); + log.debug("The profile-array is set. Those profile-information will be sent: {}", Arrays.toString(ruleObj.getProfile())); } else { log.debug("The profile-array is not set. So won't send any profile-information when using this rule."); } @@ -195,7 +195,7 @@ private void setStaticHeaders(Rule ruleObj, JsonObject rule) { // For backward compatibility we still parse the old "staticHeaders" - but now create a manipulator chain accordingly JsonObject staticHeaders = rule.getJsonObject("staticHeaders"); if (staticHeaders != null) { - log.warn("you use the deprecated \"staticHeaders\" syntax in your routing rule JSON (" + rule + "). Please migrate to the more flexible \"headers\" syntax"); + log.warn("you use the deprecated \"staticHeaders\" syntax in your routing rule JSON ({}). Please migrate to the more flexible \"headers\" syntax", rule); ruleObj.setHeaderFunction(HeaderFunctions.parseStaticHeadersFromJson(staticHeaders)); } } diff --git a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/RuleFeaturesProvider.java b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/RuleFeaturesProvider.java index d4175c7c5..26219004b 100755 --- a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/RuleFeaturesProvider.java +++ b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/RuleFeaturesProvider.java @@ -63,7 +63,7 @@ private List collectRuleFeatures(List rules) { RuleFeatures.Feature.DELTA_ON_BACKEND, isDeltaOnBackend))); log.info(String.format("Collected features for rule url pattern %s storageExpand:%s expandOnBackend:%s deltaOnBackend:%s", rule.getUrlPattern(), isStorageExpand, isExpandOnBackend, isDeltaOnBackend)); } catch (Exception e) { - log.error("Could not compile the regex:" + rule.getUrlPattern() + " to a pattern. Cannot collect feature information of this rule"); + log.error("Could not compile the regex:{} to a pattern. Cannot collect feature information of this rule", rule.getUrlPattern()); } } return featuresList; diff --git a/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java b/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java index 97f4a5766..f2cedae8a 100755 --- a/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java +++ b/gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java @@ -201,7 +201,7 @@ private void init() { conf = "classpath:" + SERVER_NAME + "/config/logging/log4j2.xml"; } - log.info(SERVER_NAME + " starting with log configuration " + conf); + log.info("{} starting with log configuration {}", SERVER_NAME, conf); Configurator.initialize("", conf); } @@ -790,7 +790,7 @@ private void localizeTimestamp(HttpServerRequest request, String header) { DateTime dt = isoDateTimeParser.parseDateTime(timestamp); request.headers().set(header, dfISO8601.print(dt)); } catch (IllegalArgumentException e) { - log.warn("Could not parse " + header + " : " + timestamp); + log.warn("Could not parse {} : {}", header, timestamp); } } } diff --git a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java index 2ef8da95a..277e9aaca 100755 --- a/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java +++ b/gateleen-scheduler/src/main/java/org/swisspush/gateleen/scheduler/Scheduler.java @@ -78,7 +78,7 @@ private void calcRandomOffset(int maxRandomOffset) { } public void start() { - log.info("Starting scheduler [ " + cronExpression.getCronExpression() + " ]"); + log.info("Starting scheduler [ {} ]", cronExpression.getCronExpression()); timer = vertx.setPeriodic(5000, timer -> redisProvider.redis() .onSuccess(redisAPI -> redisAPI.get("schedulers:" + name, reply -> { @@ -113,14 +113,14 @@ public void start() { } public void stop() { - log.info("Stopping scheduler [ " + cronExpression.getCronExpression() + " ] "); + log.info("Stopping scheduler [ {} ] ", cronExpression.getCronExpression()); vertx.cancelTimer(timer); String key = "schedulers:" + name; redisProvider.redis().onSuccess(redisAPI -> redisAPI.del(Collections.singletonList(key), reply -> { if (reply.failed()) { log.error("Could not reset scheduler '" + key + "'"); } - })).onFailure(throwable -> log.error("Redis: Could not reset scheduler '" + key + "'")); + })).onFailure(throwable -> log.error("Redis: Could not reset scheduler '{}'", key)); } private void trigger() { @@ -140,7 +140,7 @@ private void trigger() { vertx.eventBus().request(redisquesAddress, buildEnqueueOperation("scheduler-" + name, request.toJsonObject().put(QueueClient.QUEUE_TIMESTAMP, System.currentTimeMillis()).encode()), (Handler>>) event -> { if (!OK.equals(event.result().body().getString(STATUS))) { - log.error("Could not enqueue request " + request.toJsonObject().encodePrettily()); + log.error("Could not enqueue request {}", request.toJsonObject().encodePrettily()); } }); } diff --git a/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/Authorizer.java b/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/Authorizer.java index fee533be9..4bbff2963 100755 --- a/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/Authorizer.java +++ b/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/Authorizer.java @@ -33,24 +33,24 @@ public class Authorizer implements LoggableResource { private static final String UPDATE_ADDRESS = "gateleen.authorization-updated"; - private Pattern userUriPattern; + private final Pattern userUriPattern; - private String aclKey = "acls"; + private final String aclKey = "acls"; - private String anonymousRole = "everyone"; + private final String anonymousRole = "everyone"; - private RoleMapper roleMapper; - private RoleAuthorizer roleAuthorizer; + private final RoleMapper roleMapper; + private final RoleAuthorizer roleAuthorizer; - private PatternHolder aclUriPattern; - private PatternHolder roleMapperUriPattern; + private final PatternHolder aclUriPattern; + private final PatternHolder roleMapperUriPattern; - private Vertx vertx; - private EventBus eb; + private final Vertx vertx; + private final EventBus eb; private boolean logACLChanges = false; - private ResourceStorage storage; - private RoleExtractor roleExtractor; + private final ResourceStorage storage; + private final RoleExtractor roleExtractor; public static final Logger log = LoggerFactory.getLogger(Authorizer.class); diff --git a/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/RoleAuthorizer.java b/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/RoleAuthorizer.java index 4ff607df1..3b5f08596 100644 --- a/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/RoleAuthorizer.java +++ b/gateleen-security/src/main/java/org/swisspush/gateleen/security/authorization/RoleAuthorizer.java @@ -21,24 +21,24 @@ public class RoleAuthorizer implements ConfigurationResource { - private String aclRoot; - private String aclKey = "acls"; + private final String aclRoot; + private final String aclKey = "acls"; - private String adminRole = "admin"; - private String anonymousRole = "everyone"; - private String deviceHeader = "x-rp-deviceid"; - private String userHeader = "x-rp-usr"; + private final String adminRole = "admin"; + private final String anonymousRole = "everyone"; + private final String deviceHeader = "x-rp-deviceid"; + private final String userHeader = "x-rp-usr"; private final String rolePrefix; - private AclFactory aclFactory; - private RoleMapper roleMapper; + private final AclFactory aclFactory; + private final RoleMapper roleMapper; - private PatternHolder aclUriPattern; + private final PatternHolder aclUriPattern; - private ResourceStorage storage; - private RoleExtractor roleExtractor; - private Map>> initialGrantedRoles; + private final ResourceStorage storage; + private final RoleExtractor roleExtractor; + private final Map>> initialGrantedRoles; private final boolean grantAccessWithoutRoles; // URI -> Method -> Roles diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java b/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java index 5e71c2d76..0100ae71b 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/TestUtils.java @@ -172,17 +172,17 @@ public static JsonObject createRoutingRule(ImmutableMap entry : map.entrySet()) { if (entry.getValue() instanceof String) { - newRule.put(entry.getKey(), (String) entry.getValue()); + newRule.put(entry.getKey(), entry.getValue()); } else if (entry.getValue() instanceof Number) { newRule.put(entry.getKey(), entry.getValue()); } else if (entry.getValue() instanceof Boolean) { - newRule.put(entry.getKey(), (Boolean)entry.getValue()); + newRule.put(entry.getKey(), entry.getValue()); } else if (entry.getValue() instanceof JsonObject) { - newRule.put(entry.getKey(), (JsonObject) entry.getValue()); + newRule.put(entry.getKey(), entry.getValue()); } else if (entry.getValue() instanceof JsonArray) { - newRule.put(entry.getKey(), (JsonArray) entry.getValue()); + newRule.put(entry.getKey(), entry.getValue()); } else { - LOG.error("not handled data type for rule " + entry.getKey()); + LOG.error("not handled data type for rule {}", entry.getKey()); } } return newRule; diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java index 1d9584577..b12113c84 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/delegate/DelegateTest.java @@ -71,7 +71,7 @@ public void testDelegateExecution_OneRequest(TestContext context) { methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -132,7 +132,7 @@ public void testDelegateExecution_MultipleRequest_WithQueue(TestContext context) methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -183,7 +183,7 @@ public void testDelegateExecution_MultipleRequest(TestContext context) { methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -227,7 +227,7 @@ public void testDelegateExecution_MultipleMatchingGroups(TestContext context) { methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/execution/([^/?]+)/([^/?]+)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -272,7 +272,7 @@ public void testDelegateExecution_NoMatchingDelegate(TestContext context) { methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -314,7 +314,7 @@ public void testDelegateUnregistration_NoMatchingDelegate(TestContext context) { methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -380,7 +380,7 @@ public void testDelegateExecution_OneRequestTransformation(TestContext context) methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -465,7 +465,7 @@ public void testDelegateExecution_MultipleRequestsTransformation(TestContext con methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -557,7 +557,7 @@ public void testDelegateExecution_MultipleRequestsMixedTransformationAndPayload( methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -637,7 +637,7 @@ public void testDelegateRegistration_InvalidTransformationSpec(TestContext conte methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -678,7 +678,7 @@ public void testDelegateRegistration_InvalidPayloadDefinition(TestContext contex methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -727,7 +727,7 @@ public void testDelegateRegistration_InvalidTransformationSpecMultipleRequests(T methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -764,7 +764,7 @@ public void testDelegateExecution_NoTransformationNoRequestPayload(TestContext c methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -820,7 +820,7 @@ public void testDelegateExecution_NoTransformationInvalidRequestPayload(TestCont methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -885,7 +885,7 @@ public void testDelegateExecution_TransformationNoRequestPayload(TestContext con methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -941,7 +941,7 @@ public void testDelegateExecution_TransformationInvalidRequestPayload(TestContex methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration @@ -1000,7 +1000,7 @@ public void testDelegateExecution_MultipleRequestsIncludingTransformationNoReque methods.add(HttpMethod.PUT); JsonObject delegate = createDelegate(methods, ".*/([^/]+.*)", requests); - System.out.println(delegate.toString()); + System.out.println(delegate); // ----- // Registration diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandByBackendTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandByBackendTest.java index 6656132bc..e0ae68d5d 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandByBackendTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/expansion/ExpandByBackendTest.java @@ -97,7 +97,7 @@ private void createRemoteRoutingRule() { private void createBackend() { HttpServer httpServer = vertx.createHttpServer().requestHandler(req -> { - log.info("got request in backend: " + req.path()); + log.info("got request in backend: {}", req.path()); req.response().headers().set("Content-Type", "application/json"); if(req.uri().indexOf("expand") > 1) { req.response().end("{\"expandonbackend\": \"success\"}"); @@ -106,6 +106,6 @@ private void createBackend() { } }); - httpServer.listen(9999, event -> log.info("created http server on port 9999, " + event.result())); + httpServer.listen(9999, event -> log.info("created http server on port 9999, {}", event.result())); } } diff --git a/gateleen-test/src/test/java/org/swisspush/gateleen/user/UserProfileTest.java b/gateleen-test/src/test/java/org/swisspush/gateleen/user/UserProfileTest.java index 6fb577b3e..5c9b2e4bc 100644 --- a/gateleen-test/src/test/java/org/swisspush/gateleen/user/UserProfileTest.java +++ b/gateleen-test/src/test/java/org/swisspush/gateleen/user/UserProfileTest.java @@ -1,6 +1,5 @@ package org.swisspush.gateleen.user; -import org.swisspush.gateleen.AbstractTest; import io.restassured.RestAssured; import io.restassured.response.Response; import io.vertx.core.json.JsonObject; @@ -9,11 +8,10 @@ import io.vertx.ext.unit.junit.VertxUnitRunner; import org.junit.Test; import org.junit.runner.RunWith; +import org.swisspush.gateleen.AbstractTest; -import java.util.concurrent.TimeUnit; - -import static org.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; +import static org.awaitility.Awaitility.await; import static org.awaitility.Durations.FIVE_SECONDS; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; diff --git a/gateleen-user/src/main/java/org/swisspush/gateleen/user/UserProfileConfiguration.java b/gateleen-user/src/main/java/org/swisspush/gateleen/user/UserProfileConfiguration.java index 206a8c8ab..387c18cef 100755 --- a/gateleen-user/src/main/java/org/swisspush/gateleen/user/UserProfileConfiguration.java +++ b/gateleen-user/src/main/java/org/swisspush/gateleen/user/UserProfileConfiguration.java @@ -16,8 +16,8 @@ public class UserProfileConfiguration { private Map profileProperties = new HashMap<>(); private List allowedProfileProperties = new ArrayList<>(); private Pattern userProfileUriPattern; - private String roleProfilesRoot; - private String rolePattern; + private final String roleProfilesRoot; + private final String rolePattern; private UserProfileConfiguration(UserProfileConfigurationBuilder arguments) { this.allowedProfileProperties = arguments.allowedProfileProperties; @@ -77,13 +77,13 @@ public enum UpdateStrategy { } public static class ProfileProperty { - private String headerName; - private String profileName; - private String validationRegex; + private final String headerName; + private final String profileName; + private final String validationRegex; private Pattern validationRegexPattern; - private boolean optional; - private UpdateStrategy updateStrategy; - private String valueToUseIfNoOtherValidValue; + private final boolean optional; + private final UpdateStrategy updateStrategy; + private final String valueToUseIfNoOtherValidValue; private ProfileProperty(ProfilePropertyBuilder arguments) { this.headerName = arguments.headerName; @@ -156,8 +156,8 @@ public static class ProfilePropertyBuilder { public boolean optional; public UpdateStrategy updateStrategy = UpdateStrategy.UPDATE_ALWAYS; public String valueToUseIfNoOtherValidValue; - private String headerName; - private String profileName; + private final String headerName; + private final String profileName; private String validationRegex; protected ProfilePropertyBuilder(String headerName, String profileName) { diff --git a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationResourceManager.java b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationResourceManager.java index 37221ea8e..6123ca522 100755 --- a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationResourceManager.java +++ b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationResourceManager.java @@ -76,7 +76,7 @@ private void updateValidationResource() { private void updateValidationResource(Buffer buffer) throws ValidationException { extractValidationValues(buffer); for (Map resourceToValidate : getValidationResource().getResources()) { - log.info("Applying validation for resource: " + resourceToValidate); + log.info("Applying validation for resource: {}", resourceToValidate); } if(getValidationResource().getResources().isEmpty()){ log.info("No validation rules to apply!"); diff --git a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationUtil.java b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationUtil.java index 3ab43634b..dd3e54816 100644 --- a/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationUtil.java +++ b/gateleen-validation/src/main/java/org/swisspush/gateleen/validation/ValidationUtil.java @@ -37,7 +37,7 @@ && doesRequestValueMatch(request.uri(), entry.get(ValidationResource.URL_PROPERT } } } catch (PatternSyntaxException patternException) { - log.error(patternException.getMessage() + " " + patternException.getPattern()); + log.error("{} {}", patternException.getMessage(), patternException.getPattern()); } return null; From b3f80b3128d9c82fa6e3e67e02782a722d568bca Mon Sep 17 00:00:00 2001 From: runner Date: Sat, 20 Jan 2024 20:53:23 +0000 Subject: [PATCH 09/13] updating poms for 2.1.0 branch with snapshot versions From b3278dd586641cb374e74fcfabdea95e36ffad1a Mon Sep 17 00:00:00 2001 From: runner Date: Sat, 20 Jan 2024 20:53:25 +0000 Subject: [PATCH 10/13] updating poms for 2.1.1-SNAPSHOT development --- gateleen-cache/pom.xml | 2 +- gateleen-core/pom.xml | 2 +- gateleen-delegate/pom.xml | 2 +- gateleen-delta/pom.xml | 2 +- gateleen-expansion/pom.xml | 2 +- gateleen-hook-js/pom.xml | 2 +- gateleen-hook/pom.xml | 2 +- gateleen-kafka/pom.xml | 2 +- gateleen-logging/pom.xml | 2 +- gateleen-merge/pom.xml | 2 +- gateleen-monitoring/pom.xml | 2 +- gateleen-packing/pom.xml | 2 +- gateleen-player/pom.xml | 2 +- gateleen-playground/pom.xml | 2 +- gateleen-qos/pom.xml | 2 +- gateleen-queue/pom.xml | 2 +- gateleen-routing/pom.xml | 2 +- gateleen-runconfig/pom.xml | 2 +- gateleen-scheduler/pom.xml | 2 +- gateleen-security/pom.xml | 2 +- gateleen-test/pom.xml | 2 +- gateleen-testhelper/pom.xml | 2 +- gateleen-user/pom.xml | 2 +- gateleen-validation/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml index 01a8e09e8..ebda035a8 100644 --- a/gateleen-cache/pom.xml +++ b/gateleen-cache/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-cache diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml index 5c4b682a4..756d75e82 100644 --- a/gateleen-core/pom.xml +++ b/gateleen-core/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-core diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml index 788485c10..527d4d6c9 100644 --- a/gateleen-delegate/pom.xml +++ b/gateleen-delegate/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-delegate diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml index 6722df20f..be65c9f4e 100644 --- a/gateleen-delta/pom.xml +++ b/gateleen-delta/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-delta diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml index 6ecac6e56..68d792cab 100644 --- a/gateleen-expansion/pom.xml +++ b/gateleen-expansion/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-expansion diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index d636303c2..bdf82d25d 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -4,7 +4,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-hook-js jar diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml index e2cebf493..acc1263ab 100644 --- a/gateleen-hook/pom.xml +++ b/gateleen-hook/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-hook diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml index 23320422c..5679c5250 100644 --- a/gateleen-kafka/pom.xml +++ b/gateleen-kafka/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-kafka diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml index b0d42a915..86cad9aeb 100644 --- a/gateleen-logging/pom.xml +++ b/gateleen-logging/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-logging diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml index 2648da41d..46bf01cce 100644 --- a/gateleen-merge/pom.xml +++ b/gateleen-merge/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-merge diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml index 2a93bd4d0..b2c4173db 100644 --- a/gateleen-monitoring/pom.xml +++ b/gateleen-monitoring/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-monitoring diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml index 034b1d921..364068b26 100644 --- a/gateleen-packing/pom.xml +++ b/gateleen-packing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-packing diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index a537b1620..36125f623 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-player diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml index c3dee126d..dd449743c 100644 --- a/gateleen-playground/pom.xml +++ b/gateleen-playground/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-playground diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml index d1821f0a3..c0aeb6dc9 100644 --- a/gateleen-qos/pom.xml +++ b/gateleen-qos/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-qos diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml index 3a1df6173..84da6dd88 100644 --- a/gateleen-queue/pom.xml +++ b/gateleen-queue/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-queue diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml index 064c6c1b2..b066c304a 100644 --- a/gateleen-routing/pom.xml +++ b/gateleen-routing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-routing diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml index 7bc4ea141..2479d513e 100644 --- a/gateleen-runconfig/pom.xml +++ b/gateleen-runconfig/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-runconfig diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml index c5a7977dd..b3e867532 100644 --- a/gateleen-scheduler/pom.xml +++ b/gateleen-scheduler/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-scheduler diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml index ae8596eae..58051f94e 100644 --- a/gateleen-security/pom.xml +++ b/gateleen-security/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-security diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index fef26f7fa..357631cef 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-test jar diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index 41df882a0..92ef0f9bb 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-testhelper diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml index 87c670ad2..0f890f00d 100644 --- a/gateleen-user/pom.xml +++ b/gateleen-user/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-user diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml index 5a83a32fe..1492169cf 100644 --- a/gateleen-validation/pom.xml +++ b/gateleen-validation/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT gateleen-validation diff --git a/pom.xml b/pom.xml index 04bbfa7d3..e7156769f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.1-SNAPSHOT pom gateleen Middleware library based on Vert.x to build advanced JSON/REST communication servers From d963c83b28ef192c7be9221de3d4f80009b3b30b Mon Sep 17 00:00:00 2001 From: runner Date: Sat, 20 Jan 2024 20:53:27 +0000 Subject: [PATCH 11/13] updating poms for branch'release-2.1.0' with non-snapshot versions --- gateleen-cache/pom.xml | 2 +- gateleen-core/pom.xml | 2 +- gateleen-delegate/pom.xml | 2 +- gateleen-delta/pom.xml | 2 +- gateleen-expansion/pom.xml | 2 +- gateleen-hook-js/pom.xml | 2 +- gateleen-hook/pom.xml | 2 +- gateleen-kafka/pom.xml | 2 +- gateleen-logging/pom.xml | 2 +- gateleen-merge/pom.xml | 2 +- gateleen-monitoring/pom.xml | 2 +- gateleen-packing/pom.xml | 2 +- gateleen-player/pom.xml | 2 +- gateleen-playground/pom.xml | 2 +- gateleen-qos/pom.xml | 2 +- gateleen-queue/pom.xml | 2 +- gateleen-routing/pom.xml | 2 +- gateleen-runconfig/pom.xml | 2 +- gateleen-scheduler/pom.xml | 2 +- gateleen-security/pom.xml | 2 +- gateleen-test/pom.xml | 2 +- gateleen-testhelper/pom.xml | 2 +- gateleen-user/pom.xml | 2 +- gateleen-validation/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml index 01a8e09e8..3d49b5f18 100644 --- a/gateleen-cache/pom.xml +++ b/gateleen-cache/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-cache diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml index 5c4b682a4..4e0265cf4 100644 --- a/gateleen-core/pom.xml +++ b/gateleen-core/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-core diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml index 788485c10..8391bacb1 100644 --- a/gateleen-delegate/pom.xml +++ b/gateleen-delegate/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-delegate diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml index 6722df20f..fcf65fdfa 100644 --- a/gateleen-delta/pom.xml +++ b/gateleen-delta/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-delta diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml index 6ecac6e56..593be454f 100644 --- a/gateleen-expansion/pom.xml +++ b/gateleen-expansion/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-expansion diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index d636303c2..dc15c3232 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -4,7 +4,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-hook-js jar diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml index e2cebf493..be8c63733 100644 --- a/gateleen-hook/pom.xml +++ b/gateleen-hook/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-hook diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml index 23320422c..edbff7900 100644 --- a/gateleen-kafka/pom.xml +++ b/gateleen-kafka/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-kafka diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml index b0d42a915..e002942e2 100644 --- a/gateleen-logging/pom.xml +++ b/gateleen-logging/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-logging diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml index 2648da41d..a50e8c393 100644 --- a/gateleen-merge/pom.xml +++ b/gateleen-merge/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-merge diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml index 2a93bd4d0..def5f28ca 100644 --- a/gateleen-monitoring/pom.xml +++ b/gateleen-monitoring/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-monitoring diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml index 034b1d921..2ab0814b0 100644 --- a/gateleen-packing/pom.xml +++ b/gateleen-packing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-packing diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index a537b1620..8d92f343a 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-player diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml index c3dee126d..6b63e6d34 100644 --- a/gateleen-playground/pom.xml +++ b/gateleen-playground/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-playground diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml index d1821f0a3..b41f1ab8e 100644 --- a/gateleen-qos/pom.xml +++ b/gateleen-qos/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-qos diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml index 3a1df6173..2e224fd0a 100644 --- a/gateleen-queue/pom.xml +++ b/gateleen-queue/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-queue diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml index 064c6c1b2..d4baaa9c0 100644 --- a/gateleen-routing/pom.xml +++ b/gateleen-routing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-routing diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml index 7bc4ea141..43f33f592 100644 --- a/gateleen-runconfig/pom.xml +++ b/gateleen-runconfig/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-runconfig diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml index c5a7977dd..1a4fb3a3f 100644 --- a/gateleen-scheduler/pom.xml +++ b/gateleen-scheduler/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-scheduler diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml index ae8596eae..3f8ce5423 100644 --- a/gateleen-security/pom.xml +++ b/gateleen-security/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-security diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index fef26f7fa..c14c4df39 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-test jar diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index 41df882a0..3b8b9b022 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-testhelper diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml index 87c670ad2..e33569900 100644 --- a/gateleen-user/pom.xml +++ b/gateleen-user/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-user diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml index 5a83a32fe..ee9047d6e 100644 --- a/gateleen-validation/pom.xml +++ b/gateleen-validation/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 gateleen-validation diff --git a/pom.xml b/pom.xml index 04bbfa7d3..804face43 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0-SNAPSHOT + 2.1.0 pom gateleen Middleware library based on Vert.x to build advanced JSON/REST communication servers From 6f6587063486b384798921e0e71030057256d017 Mon Sep 17 00:00:00 2001 From: runner Date: Sat, 20 Jan 2024 20:57:39 +0000 Subject: [PATCH 12/13] updating develop poms to master versions to avoid merge conflicts --- gateleen-cache/pom.xml | 2 +- gateleen-core/pom.xml | 2 +- gateleen-delegate/pom.xml | 2 +- gateleen-delta/pom.xml | 2 +- gateleen-expansion/pom.xml | 2 +- gateleen-hook-js/pom.xml | 2 +- gateleen-hook/pom.xml | 2 +- gateleen-kafka/pom.xml | 2 +- gateleen-logging/pom.xml | 2 +- gateleen-merge/pom.xml | 2 +- gateleen-monitoring/pom.xml | 2 +- gateleen-packing/pom.xml | 2 +- gateleen-player/pom.xml | 2 +- gateleen-playground/pom.xml | 2 +- gateleen-qos/pom.xml | 2 +- gateleen-queue/pom.xml | 2 +- gateleen-routing/pom.xml | 2 +- gateleen-runconfig/pom.xml | 2 +- gateleen-scheduler/pom.xml | 2 +- gateleen-security/pom.xml | 2 +- gateleen-test/pom.xml | 2 +- gateleen-testhelper/pom.xml | 2 +- gateleen-user/pom.xml | 2 +- gateleen-validation/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml index ebda035a8..3d49b5f18 100644 --- a/gateleen-cache/pom.xml +++ b/gateleen-cache/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-cache diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml index 756d75e82..4e0265cf4 100644 --- a/gateleen-core/pom.xml +++ b/gateleen-core/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-core diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml index 527d4d6c9..8391bacb1 100644 --- a/gateleen-delegate/pom.xml +++ b/gateleen-delegate/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-delegate diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml index be65c9f4e..fcf65fdfa 100644 --- a/gateleen-delta/pom.xml +++ b/gateleen-delta/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-delta diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml index 68d792cab..593be454f 100644 --- a/gateleen-expansion/pom.xml +++ b/gateleen-expansion/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-expansion diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index bdf82d25d..dc15c3232 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -4,7 +4,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-hook-js jar diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml index acc1263ab..be8c63733 100644 --- a/gateleen-hook/pom.xml +++ b/gateleen-hook/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-hook diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml index 5679c5250..edbff7900 100644 --- a/gateleen-kafka/pom.xml +++ b/gateleen-kafka/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-kafka diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml index 86cad9aeb..e002942e2 100644 --- a/gateleen-logging/pom.xml +++ b/gateleen-logging/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-logging diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml index 46bf01cce..a50e8c393 100644 --- a/gateleen-merge/pom.xml +++ b/gateleen-merge/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-merge diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml index b2c4173db..def5f28ca 100644 --- a/gateleen-monitoring/pom.xml +++ b/gateleen-monitoring/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-monitoring diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml index 364068b26..2ab0814b0 100644 --- a/gateleen-packing/pom.xml +++ b/gateleen-packing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-packing diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index 36125f623..8d92f343a 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-player diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml index dd449743c..6b63e6d34 100644 --- a/gateleen-playground/pom.xml +++ b/gateleen-playground/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-playground diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml index c0aeb6dc9..b41f1ab8e 100644 --- a/gateleen-qos/pom.xml +++ b/gateleen-qos/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-qos diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml index 84da6dd88..2e224fd0a 100644 --- a/gateleen-queue/pom.xml +++ b/gateleen-queue/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-queue diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml index b066c304a..d4baaa9c0 100644 --- a/gateleen-routing/pom.xml +++ b/gateleen-routing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-routing diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml index 2479d513e..43f33f592 100644 --- a/gateleen-runconfig/pom.xml +++ b/gateleen-runconfig/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-runconfig diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml index b3e867532..1a4fb3a3f 100644 --- a/gateleen-scheduler/pom.xml +++ b/gateleen-scheduler/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-scheduler diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml index 58051f94e..3f8ce5423 100644 --- a/gateleen-security/pom.xml +++ b/gateleen-security/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-security diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index 357631cef..c14c4df39 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-test jar diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index 92ef0f9bb..3b8b9b022 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-testhelper diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml index 0f890f00d..e33569900 100644 --- a/gateleen-user/pom.xml +++ b/gateleen-user/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-user diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml index 1492169cf..ee9047d6e 100644 --- a/gateleen-validation/pom.xml +++ b/gateleen-validation/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 gateleen-validation diff --git a/pom.xml b/pom.xml index e7156769f..804face43 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.1-SNAPSHOT + 2.1.0 pom gateleen Middleware library based on Vert.x to build advanced JSON/REST communication servers From 7a1d526c9468faef64cdefb5c8c71685e2501bb5 Mon Sep 17 00:00:00 2001 From: runner Date: Sat, 20 Jan 2024 20:57:41 +0000 Subject: [PATCH 13/13] Updating develop poms back to pre merge state --- gateleen-cache/pom.xml | 2 +- gateleen-core/pom.xml | 2 +- gateleen-delegate/pom.xml | 2 +- gateleen-delta/pom.xml | 2 +- gateleen-expansion/pom.xml | 2 +- gateleen-hook-js/pom.xml | 2 +- gateleen-hook/pom.xml | 2 +- gateleen-kafka/pom.xml | 2 +- gateleen-logging/pom.xml | 2 +- gateleen-merge/pom.xml | 2 +- gateleen-monitoring/pom.xml | 2 +- gateleen-packing/pom.xml | 2 +- gateleen-player/pom.xml | 2 +- gateleen-playground/pom.xml | 2 +- gateleen-qos/pom.xml | 2 +- gateleen-queue/pom.xml | 2 +- gateleen-routing/pom.xml | 2 +- gateleen-runconfig/pom.xml | 2 +- gateleen-scheduler/pom.xml | 2 +- gateleen-security/pom.xml | 2 +- gateleen-test/pom.xml | 2 +- gateleen-testhelper/pom.xml | 2 +- gateleen-user/pom.xml | 2 +- gateleen-validation/pom.xml | 2 +- pom.xml | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gateleen-cache/pom.xml b/gateleen-cache/pom.xml index 3d49b5f18..ebda035a8 100644 --- a/gateleen-cache/pom.xml +++ b/gateleen-cache/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-cache diff --git a/gateleen-core/pom.xml b/gateleen-core/pom.xml index 4e0265cf4..756d75e82 100644 --- a/gateleen-core/pom.xml +++ b/gateleen-core/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-core diff --git a/gateleen-delegate/pom.xml b/gateleen-delegate/pom.xml index 8391bacb1..527d4d6c9 100644 --- a/gateleen-delegate/pom.xml +++ b/gateleen-delegate/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-delegate diff --git a/gateleen-delta/pom.xml b/gateleen-delta/pom.xml index fcf65fdfa..be65c9f4e 100644 --- a/gateleen-delta/pom.xml +++ b/gateleen-delta/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-delta diff --git a/gateleen-expansion/pom.xml b/gateleen-expansion/pom.xml index 593be454f..68d792cab 100644 --- a/gateleen-expansion/pom.xml +++ b/gateleen-expansion/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-expansion diff --git a/gateleen-hook-js/pom.xml b/gateleen-hook-js/pom.xml index dc15c3232..bdf82d25d 100644 --- a/gateleen-hook-js/pom.xml +++ b/gateleen-hook-js/pom.xml @@ -4,7 +4,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-hook-js jar diff --git a/gateleen-hook/pom.xml b/gateleen-hook/pom.xml index be8c63733..acc1263ab 100644 --- a/gateleen-hook/pom.xml +++ b/gateleen-hook/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-hook diff --git a/gateleen-kafka/pom.xml b/gateleen-kafka/pom.xml index edbff7900..5679c5250 100644 --- a/gateleen-kafka/pom.xml +++ b/gateleen-kafka/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-kafka diff --git a/gateleen-logging/pom.xml b/gateleen-logging/pom.xml index e002942e2..86cad9aeb 100644 --- a/gateleen-logging/pom.xml +++ b/gateleen-logging/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-logging diff --git a/gateleen-merge/pom.xml b/gateleen-merge/pom.xml index a50e8c393..46bf01cce 100644 --- a/gateleen-merge/pom.xml +++ b/gateleen-merge/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-merge diff --git a/gateleen-monitoring/pom.xml b/gateleen-monitoring/pom.xml index def5f28ca..b2c4173db 100644 --- a/gateleen-monitoring/pom.xml +++ b/gateleen-monitoring/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-monitoring diff --git a/gateleen-packing/pom.xml b/gateleen-packing/pom.xml index 2ab0814b0..364068b26 100644 --- a/gateleen-packing/pom.xml +++ b/gateleen-packing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-packing diff --git a/gateleen-player/pom.xml b/gateleen-player/pom.xml index 8d92f343a..36125f623 100644 --- a/gateleen-player/pom.xml +++ b/gateleen-player/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-player diff --git a/gateleen-playground/pom.xml b/gateleen-playground/pom.xml index 6b63e6d34..dd449743c 100644 --- a/gateleen-playground/pom.xml +++ b/gateleen-playground/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-playground diff --git a/gateleen-qos/pom.xml b/gateleen-qos/pom.xml index b41f1ab8e..c0aeb6dc9 100644 --- a/gateleen-qos/pom.xml +++ b/gateleen-qos/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-qos diff --git a/gateleen-queue/pom.xml b/gateleen-queue/pom.xml index 2e224fd0a..84da6dd88 100644 --- a/gateleen-queue/pom.xml +++ b/gateleen-queue/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-queue diff --git a/gateleen-routing/pom.xml b/gateleen-routing/pom.xml index d4baaa9c0..b066c304a 100644 --- a/gateleen-routing/pom.xml +++ b/gateleen-routing/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-routing diff --git a/gateleen-runconfig/pom.xml b/gateleen-runconfig/pom.xml index 43f33f592..2479d513e 100644 --- a/gateleen-runconfig/pom.xml +++ b/gateleen-runconfig/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-runconfig diff --git a/gateleen-scheduler/pom.xml b/gateleen-scheduler/pom.xml index 1a4fb3a3f..b3e867532 100644 --- a/gateleen-scheduler/pom.xml +++ b/gateleen-scheduler/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-scheduler diff --git a/gateleen-security/pom.xml b/gateleen-security/pom.xml index 3f8ce5423..58051f94e 100644 --- a/gateleen-security/pom.xml +++ b/gateleen-security/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-security diff --git a/gateleen-test/pom.xml b/gateleen-test/pom.xml index c14c4df39..357631cef 100644 --- a/gateleen-test/pom.xml +++ b/gateleen-test/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-test jar diff --git a/gateleen-testhelper/pom.xml b/gateleen-testhelper/pom.xml index 3b8b9b022..92ef0f9bb 100644 --- a/gateleen-testhelper/pom.xml +++ b/gateleen-testhelper/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-testhelper diff --git a/gateleen-user/pom.xml b/gateleen-user/pom.xml index e33569900..0f890f00d 100644 --- a/gateleen-user/pom.xml +++ b/gateleen-user/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-user diff --git a/gateleen-validation/pom.xml b/gateleen-validation/pom.xml index ee9047d6e..1492169cf 100644 --- a/gateleen-validation/pom.xml +++ b/gateleen-validation/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT gateleen-validation diff --git a/pom.xml b/pom.xml index 804face43..e7156769f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.swisspush.gateleen gateleen - 2.1.0 + 2.1.1-SNAPSHOT pom gateleen Middleware library based on Vert.x to build advanced JSON/REST communication servers