From 8dc9e14133e0fa9b79637d5fdb9512091969b2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Weber?= Date: Thu, 4 Jan 2024 09:16:31 +0100 Subject: [PATCH 1/4] Update to Vert.x 4.5.1 --- pom.xml | 4 +- .../reststorage/EventBusAdapter.java | 45 ++++++++++++++++++- .../reststorage/RestStorageHandlerTest.java | 1 + .../lock/impl/RedisBasedLockTest.java | 7 +-- .../reststorage/mocks/FailFastVertx.java | 35 +++++++++++++-- .../mocks/FailFastVertxAsyncFile.java | 31 +++++++++++++ .../mocks/FailFastVertxHttpServerRequest.java | 18 +++++++- .../FailFastVertxHttpServerResponse.java | 16 +++++++ .../mocks/FailFastVertxWebRoutingContext.java | 12 ++++- 9 files changed, 156 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 656447f..3a321a5 100644 --- a/pom.xml +++ b/pom.xml @@ -403,8 +403,8 @@ - 4.2.1 - 4.3.3 + 4.5.1 + 4.5.1 1.7.32 4.13.1 2.16.0 diff --git a/src/main/java/org/swisspush/reststorage/EventBusAdapter.java b/src/main/java/org/swisspush/reststorage/EventBusAdapter.java index fdc2993..3d44639 100644 --- a/src/main/java/org/swisspush/reststorage/EventBusAdapter.java +++ b/src/main/java/org/swisspush/reststorage/EventBusAdapter.java @@ -10,13 +10,17 @@ 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 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; /** @@ -30,7 +34,7 @@ public void init(final Vertx vertx, String address, final Handler>) message -> requestHandler.handle(new MappedHttpServerRequest(vertx, message))); } - private static class MappedHttpServerRequest implements HttpServerRequestInternal { + private static class MappedHttpServerRequest extends HttpServerRequestInternal { private final Vertx vertx; private final Buffer requestPayload; private final HttpMethod method; @@ -40,6 +44,7 @@ private static class MappedHttpServerRequest implements HttpServerRequestInterna private String path; private String query; private MultiMap params; + private Charset paramsCharset = StandardCharsets.UTF_8; private Handler dataHandler; private Handler endHandler; private HttpServerResponse response; @@ -112,6 +117,11 @@ public String query() { return query; } + @Override + public HostAndPort authority() { + return null; + } + @Override public String host() { throw new UnsupportedOperationException(); @@ -272,6 +282,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) { write(Buffer.buffer(chunk)); @@ -410,6 +430,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(); @@ -484,10 +509,26 @@ public String getHeader(CharSequence headerName) { return requestHeaders.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 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()) { diff --git a/src/test/java/org/swisspush/reststorage/RestStorageHandlerTest.java b/src/test/java/org/swisspush/reststorage/RestStorageHandlerTest.java index ec88407..42d56fe 100644 --- a/src/test/java/org/swisspush/reststorage/RestStorageHandlerTest.java +++ b/src/test/java/org/swisspush/reststorage/RestStorageHandlerTest.java @@ -65,6 +65,7 @@ public void setUp(TestContext context) { when(request.resume()).thenReturn(request); when(request.response()).thenReturn(response); when(request.headers()).thenReturn(new HeadersMultiMap()); + when(response.headers()).thenReturn(new HeadersMultiMap()); } @Test diff --git a/src/test/java/org/swisspush/reststorage/lock/impl/RedisBasedLockTest.java b/src/test/java/org/swisspush/reststorage/lock/impl/RedisBasedLockTest.java index be839d9..3010d35 100644 --- a/src/test/java/org/swisspush/reststorage/lock/impl/RedisBasedLockTest.java +++ b/src/test/java/org/swisspush/reststorage/lock/impl/RedisBasedLockTest.java @@ -3,12 +3,13 @@ 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.RedisAPI; -import io.vertx.redis.client.RedisOptions; +import io.vertx.redis.client.*; import io.vertx.redis.client.impl.RedisClient; import org.junit.After; import org.junit.Before; @@ -42,7 +43,7 @@ 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/src/test/java/org/swisspush/reststorage/mocks/FailFastVertx.java b/src/test/java/org/swisspush/reststorage/mocks/FailFastVertx.java index 5d8ee12..da3eaa6 100644 --- a/src/test/java/org/swisspush/reststorage/mocks/FailFastVertx.java +++ b/src/test/java/org/swisspush/reststorage/mocks/FailFastVertx.java @@ -8,10 +8,7 @@ import io.vertx.core.dns.DnsClientOptions; import io.vertx.core.eventbus.EventBus; import io.vertx.core.file.FileSystem; -import io.vertx.core.http.HttpClient; -import io.vertx.core.http.HttpClientOptions; -import io.vertx.core.http.HttpServer; -import io.vertx.core.http.HttpServerOptions; +import io.vertx.core.http.*; import io.vertx.core.net.NetClient; import io.vertx.core.net.NetClientOptions; import io.vertx.core.net.NetServer; @@ -71,6 +68,16 @@ public HttpServer createHttpServer() { throw new UnsupportedOperationException(msg); } + @Override + public WebSocketClient createWebSocketClient(WebSocketClientOptions options) { + throw new UnsupportedOperationException(msg); + } + + @Override + public HttpClientBuilder httpClientBuilder() { + throw new UnsupportedOperationException(msg); + } + @Override public HttpClient createHttpClient(HttpClientOptions httpClientOptions) { throw new UnsupportedOperationException(msg); @@ -121,6 +128,11 @@ public SharedData sharedData() { throw new UnsupportedOperationException(msg); } + @Override + public Timer timer(long delay, TimeUnit unit) { + throw new UnsupportedOperationException(msg); + } + @Override public long setTimer(long l, Handler handler) { throw new UnsupportedOperationException(msg); @@ -136,11 +148,21 @@ public long setPeriodic(long l, Handler handler) { throw new UnsupportedOperationException(msg); } + @Override + public long setPeriodic(long initialDelay, long delay, Handler handler) { + throw new UnsupportedOperationException(msg); + } + @Override public TimeoutStream periodicStream(long l) { throw new UnsupportedOperationException(msg); } + @Override + public TimeoutStream periodicStream(long initialDelay, long delay) { + throw new UnsupportedOperationException(msg); + } + @Override public boolean cancelTimer(long l) { throw new UnsupportedOperationException(msg); @@ -311,6 +333,11 @@ public boolean isNativeTransportEnabled() { throw new UnsupportedOperationException(msg); } + @Override + public Throwable unavailableNativeTransportCause() { + throw new UnsupportedOperationException(msg); + } + @Override public Vertx exceptionHandler(Handler handler) { throw new UnsupportedOperationException(msg); diff --git a/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxAsyncFile.java b/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxAsyncFile.java index 13b670e..3533313 100644 --- a/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxAsyncFile.java +++ b/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxAsyncFile.java @@ -5,6 +5,7 @@ import io.vertx.core.Handler; import io.vertx.core.buffer.Buffer; import io.vertx.core.file.AsyncFile; +import io.vertx.core.file.AsyncFileLock; public class FailFastVertxAsyncFile implements AsyncFile { @@ -162,4 +163,34 @@ public long sizeBlocking() { public Future size() { throw new UnsupportedOperationException(msg); } + + @Override + public AsyncFileLock tryLock() { + throw new UnsupportedOperationException(msg); + } + + @Override + public AsyncFileLock tryLock(long position, long size, boolean shared) { + throw new UnsupportedOperationException(msg); + } + + @Override + public Future lock() { + throw new UnsupportedOperationException(msg); + } + + @Override + public void lock(Handler> handler) { + throw new UnsupportedOperationException(msg); + } + + @Override + public Future lock(long position, long size, boolean shared) { + throw new UnsupportedOperationException(msg); + } + + @Override + public void lock(long position, long size, boolean shared, Handler> handler) { + throw new UnsupportedOperationException(msg); + } } diff --git a/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxHttpServerRequest.java b/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxHttpServerRequest.java index 263edaa..5b9d918 100644 --- a/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxHttpServerRequest.java +++ b/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxHttpServerRequest.java @@ -8,6 +8,7 @@ import io.vertx.core.buffer.Buffer; import io.vertx.core.http.*; import io.vertx.core.http.impl.HttpServerRequestInternal; +import io.vertx.core.net.HostAndPort; import io.vertx.core.net.NetSocket; import io.vertx.core.net.SocketAddress; @@ -19,7 +20,7 @@ /** * Simple base class for mocking. */ -public class FailFastVertxHttpServerRequest implements HttpServerRequestInternal { +public class FailFastVertxHttpServerRequest extends HttpServerRequestInternal { protected final String msg; @@ -96,6 +97,11 @@ public String query() { throw new UnsupportedOperationException(msg); } + @Override + public HostAndPort authority() { + throw new UnsupportedOperationException(msg); + } + @Override public String host() { throw new UnsupportedOperationException(msg); @@ -126,6 +132,16 @@ public String getHeader(CharSequence headerName) { throw new UnsupportedOperationException(msg); } + @Override + public HttpServerRequest setParamsCharset(String charset) { + throw new UnsupportedOperationException(msg); + } + + @Override + public String getParamsCharset() { + throw new UnsupportedOperationException(msg); + } + @Override public MultiMap params() { throw new UnsupportedOperationException(msg); diff --git a/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxHttpServerResponse.java b/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxHttpServerResponse.java index df67dd0..f718392 100644 --- a/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxHttpServerResponse.java +++ b/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxHttpServerResponse.java @@ -8,6 +8,7 @@ import io.vertx.core.http.Cookie; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServerResponse; +import io.vertx.core.net.HostAndPort; import java.util.Set; @@ -172,6 +173,16 @@ public HttpServerResponse writeContinue() { throw new UnsupportedOperationException(msg); } + @Override + public Future writeEarlyHints(MultiMap headers) { + throw new UnsupportedOperationException(msg); + } + + @Override + public void writeEarlyHints(MultiMap headers, Handler> handler) { + throw new UnsupportedOperationException(msg); + } + @Override public Future end(String chunk) { throw new UnsupportedOperationException(msg); @@ -282,6 +293,11 @@ public HttpServerResponse push(HttpMethod method, String host, String path, Mult throw new UnsupportedOperationException(msg); } + @Override + public Future push(HttpMethod method, HostAndPort authority, String path, MultiMap headers) { + throw new UnsupportedOperationException(msg); + } + @Override public Future push(HttpMethod method, String host, String path, MultiMap headers) { throw new UnsupportedOperationException(msg); diff --git a/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxWebRoutingContext.java b/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxWebRoutingContext.java index b5f0b5f..d454f4e 100644 --- a/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxWebRoutingContext.java +++ b/src/test/java/org/swisspush/reststorage/mocks/FailFastVertxWebRoutingContext.java @@ -173,7 +173,17 @@ public Buffer getBody() { } @Override - public Set fileUploads() { + public RequestBody body() { + throw new UnsupportedOperationException(msg); + } + + @Override + public List fileUploads() { + throw new UnsupportedOperationException(msg); + } + + @Override + public void cancelAndCleanupFileUploads() { throw new UnsupportedOperationException(msg); } From b50ff2767809d0d9a5716dcf4a5a6d997b526d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Weber?= Date: Thu, 4 Jan 2024 09:23:22 +0100 Subject: [PATCH 2/4] Changed version because of Vert.x update --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3a321a5..9aaf29e 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 org.swisspush rest-storage - 3.0.20-SNAPSHOT + 3.1.0-SNAPSHOT rest-storage Persistence for REST resources in the filesystem or a redis database From bed8df93378b6cd7bf346b40455db4317d44a3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Weber?= Date: Thu, 4 Jan 2024 12:55:24 +0100 Subject: [PATCH 3/4] Updated some dependecies --- pom.xml | 20 +++++++++---------- .../reststorage/EventBusAdapter.java | 1 - .../reststorage/CleanupIntegrationTest.java | 2 +- .../reststorage/CrudIntegrationTest.java | 8 ++++---- .../ExpirationIntegrationTest.java | 4 ++-- .../reststorage/LockIntegrationTest.java | 2 +- .../lock/impl/RedisBasedLockTest.java | 7 ++++--- .../lua/RedisDelLuaScriptTests.java | 2 +- .../lua/RedisPutLuaScriptTests.java | 2 +- .../lua/ReleaseLockLuaScriptTests.java | 6 +++--- 10 files changed, 27 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 9aaf29e..4f86517 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ org.slf4j - slf4j-log4j12 + slf4j-reload4j ${slf4j.version} @@ -100,7 +100,7 @@ test - com.jayway.awaitility + org.awaitility awaitility ${awaitility.version} test @@ -405,16 +405,16 @@ 4.5.1 4.5.1 - 1.7.32 - 4.13.1 + 2.0.10 + 4.13.2 2.16.0 - 1.3 - 1.9 - 2.4 - 2.7 + 2.2 + 1.16.0 + 2.6 + 2.15.1 1.10.19 - 4.3.0 - 1.6.5 + 5.4.0 + 4.2.0 3.7.0 UTF8 diff --git a/src/main/java/org/swisspush/reststorage/EventBusAdapter.java b/src/main/java/org/swisspush/reststorage/EventBusAdapter.java index 83f9ff4..ad2dc7f 100644 --- a/src/main/java/org/swisspush/reststorage/EventBusAdapter.java +++ b/src/main/java/org/swisspush/reststorage/EventBusAdapter.java @@ -14,7 +14,6 @@ import io.vertx.core.net.NetSocket; import io.vertx.core.net.SocketAddress; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import javax.net.ssl.SSLSession; import javax.security.cert.X509Certificate; diff --git a/src/test/java/org/swisspush/reststorage/CleanupIntegrationTest.java b/src/test/java/org/swisspush/reststorage/CleanupIntegrationTest.java index 2a193de..2844f37 100644 --- a/src/test/java/org/swisspush/reststorage/CleanupIntegrationTest.java +++ b/src/test/java/org/swisspush/reststorage/CleanupIntegrationTest.java @@ -10,9 +10,9 @@ import java.util.concurrent.TimeUnit; -import static com.jayway.awaitility.Awaitility.await; import static io.restassured.RestAssured.get; import static io.restassured.RestAssured.given; +import static org.awaitility.Awaitility.await; import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.core.IsEqual.equalTo; diff --git a/src/test/java/org/swisspush/reststorage/CrudIntegrationTest.java b/src/test/java/org/swisspush/reststorage/CrudIntegrationTest.java index b082fed..b5e9675 100644 --- a/src/test/java/org/swisspush/reststorage/CrudIntegrationTest.java +++ b/src/test/java/org/swisspush/reststorage/CrudIntegrationTest.java @@ -1,7 +1,6 @@ package org.swisspush.reststorage; -import com.jayway.awaitility.Duration; import io.restassured.RestAssured; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; @@ -10,10 +9,11 @@ import org.junit.runner.RunWith; import org.swisspush.reststorage.redis.RedisStorageIntegrationTestCase; +import java.time.Duration; import java.util.List; -import static com.jayway.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; +import static org.awaitility.Awaitility.await; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.hasItems; @@ -564,10 +564,10 @@ public void testGetHTMLCollectionHavingResourcesWithColonsAndSemiColonsInTheName } private void checkGETStatusCodeWithAwait5sec(final String request, final Integer statusCode) { - await().atMost(Duration.FIVE_SECONDS).until(() -> String.valueOf(when().get(request).getStatusCode()), equalTo(String.valueOf(statusCode))); + await().atMost(Duration.ofSeconds(5)).until(() -> String.valueOf(when().get(request).getStatusCode()), equalTo(String.valueOf(statusCode))); } private void checkGETStatusCodeWithAwait5secNoUrlEncoding(final String request, final Integer statusCode) { - await().atMost(Duration.FIVE_SECONDS).until(() -> String.valueOf(given().urlEncodingEnabled(false).when().get(request).getStatusCode()), equalTo(String.valueOf(statusCode))); + await().atMost(Duration.ofSeconds(5)).until(() -> String.valueOf(given().urlEncodingEnabled(false).when().get(request).getStatusCode()), equalTo(String.valueOf(statusCode))); } } diff --git a/src/test/java/org/swisspush/reststorage/ExpirationIntegrationTest.java b/src/test/java/org/swisspush/reststorage/ExpirationIntegrationTest.java index 4fd68fb..d75ea8a 100644 --- a/src/test/java/org/swisspush/reststorage/ExpirationIntegrationTest.java +++ b/src/test/java/org/swisspush/reststorage/ExpirationIntegrationTest.java @@ -9,9 +9,9 @@ import java.util.concurrent.TimeUnit; -import static com.jayway.awaitility.Awaitility.await; -import static com.jayway.awaitility.Duration.TWO_SECONDS; import static io.restassured.RestAssured.*; +import static org.awaitility.Awaitility.await; +import static org.awaitility.Durations.TWO_SECONDS; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.core.IsEqual.equalTo; diff --git a/src/test/java/org/swisspush/reststorage/LockIntegrationTest.java b/src/test/java/org/swisspush/reststorage/LockIntegrationTest.java index 1513958..1921ca5 100644 --- a/src/test/java/org/swisspush/reststorage/LockIntegrationTest.java +++ b/src/test/java/org/swisspush/reststorage/LockIntegrationTest.java @@ -12,9 +12,9 @@ import java.util.HashMap; import java.util.Map; -import static com.jayway.awaitility.Awaitility.await; import static io.restassured.RestAssured.*; import static java.util.concurrent.TimeUnit.SECONDS; +import static org.awaitility.Awaitility.await; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.core.Is.is; diff --git a/src/test/java/org/swisspush/reststorage/lock/impl/RedisBasedLockTest.java b/src/test/java/org/swisspush/reststorage/lock/impl/RedisBasedLockTest.java index 3010d35..44c2b63 100644 --- a/src/test/java/org/swisspush/reststorage/lock/impl/RedisBasedLockTest.java +++ b/src/test/java/org/swisspush/reststorage/lock/impl/RedisBasedLockTest.java @@ -1,6 +1,5 @@ package org.swisspush.reststorage.lock.impl; -import com.jayway.awaitility.Duration; import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.net.NetClientOptions; @@ -19,8 +18,10 @@ import redis.clients.jedis.Jedis; import redis.clients.jedis.exceptions.JedisConnectionException; -import static com.jayway.awaitility.Awaitility.await; +import java.time.Duration; + import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static org.awaitility.Awaitility.await; /** * Tests for the {@link RedisBasedLock} class @@ -246,6 +247,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/src/test/java/org/swisspush/reststorage/lua/RedisDelLuaScriptTests.java b/src/test/java/org/swisspush/reststorage/lua/RedisDelLuaScriptTests.java index f04c5af..5fae971 100644 --- a/src/test/java/org/swisspush/reststorage/lua/RedisDelLuaScriptTests.java +++ b/src/test/java/org/swisspush/reststorage/lua/RedisDelLuaScriptTests.java @@ -5,8 +5,8 @@ import java.util.ArrayList; -import static com.jayway.awaitility.Awaitility.await; import static java.util.concurrent.TimeUnit.SECONDS; +import static org.awaitility.Awaitility.await; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; diff --git a/src/test/java/org/swisspush/reststorage/lua/RedisPutLuaScriptTests.java b/src/test/java/org/swisspush/reststorage/lua/RedisPutLuaScriptTests.java index 9ea6209..625492a 100644 --- a/src/test/java/org/swisspush/reststorage/lua/RedisPutLuaScriptTests.java +++ b/src/test/java/org/swisspush/reststorage/lua/RedisPutLuaScriptTests.java @@ -8,8 +8,8 @@ import java.util.List; import java.util.UUID; -import static com.jayway.awaitility.Awaitility.await; import static java.util.concurrent.TimeUnit.SECONDS; +import static org.awaitility.Awaitility.await; import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.assertThat; diff --git a/src/test/java/org/swisspush/reststorage/lua/ReleaseLockLuaScriptTests.java b/src/test/java/org/swisspush/reststorage/lua/ReleaseLockLuaScriptTests.java index d5ac075..b584937 100644 --- a/src/test/java/org/swisspush/reststorage/lua/ReleaseLockLuaScriptTests.java +++ b/src/test/java/org/swisspush/reststorage/lua/ReleaseLockLuaScriptTests.java @@ -1,17 +1,17 @@ package org.swisspush.reststorage.lua; -import com.jayway.awaitility.Duration; import io.vertx.ext.unit.junit.VertxUnitRunner; import org.junit.Test; import org.junit.runner.RunWith; import org.swisspush.reststorage.lock.lua.LockLuaScripts; import redis.clients.jedis.params.SetParams; +import java.time.Duration; import java.util.Collections; import java.util.List; -import static com.jayway.awaitility.Awaitility.await; import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static org.awaitility.Awaitility.await; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -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)); } } From 6fe3a65935bf0c722b39fe5a6a90ee983652b5d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Weber?= Date: Thu, 4 Jan 2024 15:25:47 +0100 Subject: [PATCH 4/4] Updated some dependecies --- pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4f86517..1062c3f 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,7 @@ io.vertx vertx-redis-client - ${vertx-redis-client.version} + ${vertx.version} io.vertx @@ -404,7 +404,6 @@ 4.5.1 - 4.5.1 2.0.10 4.13.2 2.16.0